feat: knobs
This commit is contained in:
@@ -15,15 +15,22 @@ const meta = {
|
|||||||
},
|
},
|
||||||
args: { defaultValue: 62, min: 0, max: 100, step: 0, accent: 'lime' },
|
args: { defaultValue: 62, min: 0, max: 100, step: 0, accent: 'lime' },
|
||||||
argTypes: {
|
argTypes: {
|
||||||
defaultValue: { control: 'number', description: 'Uncontrolled starting value.' },
|
defaultValue: {
|
||||||
|
control: 'number',
|
||||||
|
description: 'Uncontrolled starting value.',
|
||||||
|
},
|
||||||
min: { control: 'number' },
|
min: { control: 'number' },
|
||||||
max: { control: 'number' },
|
max: { control: 'number' },
|
||||||
step: { control: 'number', description: '`0` = continuous; `> 0` adds detents + ticks.' },
|
step: {
|
||||||
|
control: 'number',
|
||||||
|
description: '`0` = continuous; `> 0` adds detents + ticks.',
|
||||||
|
},
|
||||||
accent: { control: 'inline-radio', options: ['lime', 'ember'] },
|
accent: { control: 'inline-radio', options: ['lime', 'ember'] },
|
||||||
size: { control: 'number', description: 'Diameter in px (default 108).' },
|
size: { control: 'number', description: 'Diameter in px (default 108).' },
|
||||||
animated: {
|
animated: {
|
||||||
control: 'boolean',
|
control: 'boolean',
|
||||||
description: 'Glide the fill/value between detents. Defaults to `true` when `step > 0`.',
|
description:
|
||||||
|
'Glide the fill/value between detents. Defaults to `true` when `step > 0`.',
|
||||||
},
|
},
|
||||||
disabled: { control: 'boolean' },
|
disabled: { control: 'boolean' },
|
||||||
className: { control: 'text' },
|
className: { control: 'text' },
|
||||||
@@ -57,7 +64,14 @@ export const Disabled: Story = {
|
|||||||
const Readout = (args: React.ComponentProps<typeof Knob>) => {
|
const Readout = (args: React.ComponentProps<typeof Knob>) => {
|
||||||
const [v, setV] = useState(62);
|
const [v, setV] = useState(62);
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 14 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 14,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Knob {...args} value={v} onValueChange={setV} aria-label="Volume" />
|
<Knob {...args} value={v} onValueChange={setV} aria-label="Volume" />
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
@@ -67,8 +81,10 @@ const Readout = (args: React.ComponentProps<typeof Knob>) => {
|
|||||||
fontVariantNumeric: 'tabular-nums',
|
fontVariantNumeric: 'tabular-nums',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{v}
|
{v.toFixed(2)}
|
||||||
<span style={{ fontSize: 12, color: 'var(--fg-3)', marginLeft: 2 }}>%</span>
|
<span style={{ fontSize: 12, color: 'var(--fg-3)', marginLeft: 2 }}>
|
||||||
|
%
|
||||||
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ textarea.modern-sk-field {
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 200px;
|
width: 100%;
|
||||||
height: var(--ms-thumb);
|
height: var(--ms-thumb);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user