@sovereignfs/ui 0.33.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/CheckableListRow.module.css +95 -0
- package/dist/Dialog.module.css +12 -12
- package/dist/IconPicker.module.css +63 -0
- package/dist/QuantityStepper.module.css +67 -0
- package/dist/SuggestionInput.module.css +103 -0
- package/dist/index.d.ts +128 -2
- package/dist/index.js +1007 -169
- package/package.json +1 -1
- package/src/components/CheckableListRow/CheckableListRow.module.css +95 -0
- package/src/components/CheckableListRow/CheckableListRow.stories.tsx +99 -0
- package/src/components/CheckableListRow/CheckableListRow.tsx +89 -0
- package/src/components/Dialog/Dialog.module.css +12 -12
- package/src/components/Icon/icons/apple.tsx +21 -0
- package/src/components/Icon/icons/banana.tsx +21 -0
- package/src/components/Icon/icons/beef.tsx +22 -0
- package/src/components/Icon/icons/beer.tsx +24 -0
- package/src/components/Icon/icons/candy.tsx +24 -0
- package/src/components/Icon/icons/carrot.tsx +22 -0
- package/src/components/Icon/icons/coffee.tsx +23 -0
- package/src/components/Icon/icons/cookie.tsx +25 -0
- package/src/components/Icon/icons/croissant.tsx +24 -0
- package/src/components/Icon/icons/cup-soda.tsx +23 -0
- package/src/components/Icon/icons/drumstick.tsx +21 -0
- package/src/components/Icon/icons/egg.tsx +20 -0
- package/src/components/Icon/icons/fish.tsx +25 -0
- package/src/components/Icon/icons/index.ts +81 -1
- package/src/components/Icon/icons/milk.tsx +22 -0
- package/src/components/Icon/icons/pizza.tsx +24 -0
- package/src/components/Icon/icons/salad.tsx +24 -0
- package/src/components/Icon/icons/shopping-basket.tsx +26 -0
- package/src/components/Icon/icons/snowflake.tsx +31 -0
- package/src/components/Icon/icons/spray-can.tsx +29 -0
- package/src/components/Icon/icons/wine.tsx +23 -0
- package/src/components/IconPicker/IconPicker.module.css +63 -0
- package/src/components/IconPicker/IconPicker.stories.tsx +84 -0
- package/src/components/IconPicker/IconPicker.tsx +90 -0
- package/src/components/QuantityStepper/QuantityStepper.module.css +67 -0
- package/src/components/QuantityStepper/QuantityStepper.stories.tsx +79 -0
- package/src/components/QuantityStepper/QuantityStepper.tsx +107 -0
- package/src/components/SuggestionInput/SuggestionInput.module.css +103 -0
- package/src/components/SuggestionInput/SuggestionInput.stories.tsx +144 -0
- package/src/components/SuggestionInput/SuggestionInput.tsx +207 -0
- package/src/index.ts +11 -0
- package/src/stories/DesignSystemOverview.stories.tsx +107 -0
|
@@ -10,12 +10,17 @@ import { Drawer } from '../components/Drawer/Drawer';
|
|
|
10
10
|
import { EmptyState } from '../components/EmptyState/EmptyState';
|
|
11
11
|
import { FormField } from '../components/FormField/FormField';
|
|
12
12
|
import { Icon } from '../components/Icon/Icon';
|
|
13
|
+
import type { IconName } from '../components/Icon/Icon';
|
|
14
|
+
import { IconPicker } from '../components/IconPicker/IconPicker';
|
|
15
|
+
import { QuantityStepper } from '../components/QuantityStepper/QuantityStepper';
|
|
16
|
+
import { CheckableListRow } from '../components/CheckableListRow/CheckableListRow';
|
|
13
17
|
import { Input } from '../components/Input/Input';
|
|
14
18
|
import { CodeTextarea } from '../components/CodeTextarea/CodeTextarea';
|
|
15
19
|
import { Textarea } from '../components/Textarea/Textarea';
|
|
16
20
|
import { StatusBadge } from '../components/StatusBadge/StatusBadge';
|
|
17
21
|
import { SplitPane } from '../components/SplitPane/SplitPane';
|
|
18
22
|
import { TagInput } from '../components/TagInput/TagInput';
|
|
23
|
+
import { SuggestionInput } from '../components/SuggestionInput/SuggestionInput';
|
|
19
24
|
import { NavTabs } from '../components/NavTabs/NavTabs';
|
|
20
25
|
import { PageHeader } from '../components/PageHeader/PageHeader';
|
|
21
26
|
import { Popover } from '../components/Popover/Popover';
|
|
@@ -730,6 +735,70 @@ function TagInputDemo() {
|
|
|
730
735
|
return <TagInput value={tags} onChange={setTags} aria-label="Tags" />;
|
|
731
736
|
}
|
|
732
737
|
|
|
738
|
+
function QuantityStepperDemo() {
|
|
739
|
+
const [value, setValue] = useState(6);
|
|
740
|
+
return <QuantityStepper value={value} onChange={setValue} unit="pcs" aria-label="Quantity" />;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function CheckableListRowDemo() {
|
|
744
|
+
const [checked, setChecked] = useState(false);
|
|
745
|
+
return (
|
|
746
|
+
<div style={{ width: '100%' }}>
|
|
747
|
+
<CheckableListRow
|
|
748
|
+
checked={checked}
|
|
749
|
+
onCheckedChange={setChecked}
|
|
750
|
+
label="Bananas"
|
|
751
|
+
icon={<Icon name="banana" size="md" aria-hidden />}
|
|
752
|
+
trailing={<span style={{ fontSize: 13, color: 'var(--sv-color-text-muted)' }}>6 pcs</span>}
|
|
753
|
+
/>
|
|
754
|
+
</div>
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function IconPickerDemo() {
|
|
759
|
+
const [value, setValue] = useState<IconName | null>('banana');
|
|
760
|
+
const options: IconName[] = [
|
|
761
|
+
'banana',
|
|
762
|
+
'apple',
|
|
763
|
+
'carrot',
|
|
764
|
+
'egg',
|
|
765
|
+
'milk',
|
|
766
|
+
'beef',
|
|
767
|
+
'drumstick',
|
|
768
|
+
'fish',
|
|
769
|
+
'croissant',
|
|
770
|
+
'cookie',
|
|
771
|
+
];
|
|
772
|
+
return (
|
|
773
|
+
<IconPicker
|
|
774
|
+
value={value}
|
|
775
|
+
onChange={setValue}
|
|
776
|
+
options={options}
|
|
777
|
+
aria-label="Item icon"
|
|
778
|
+
triggerLabel={value ?? 'Choose icon'}
|
|
779
|
+
/>
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function SuggestionInputDemo() {
|
|
784
|
+
const [value, setValue] = useState('ban');
|
|
785
|
+
const options = ['Bananas', 'Banana bread mix']
|
|
786
|
+
.filter((label) => label.toLowerCase().includes(value.trim().toLowerCase()))
|
|
787
|
+
.map((label, i) => ({ id: String(i), label }));
|
|
788
|
+
return (
|
|
789
|
+
<SuggestionInput
|
|
790
|
+
value={value}
|
|
791
|
+
onChange={setValue}
|
|
792
|
+
options={value.trim() ? options : []}
|
|
793
|
+
onSelect={(o) => setValue(o.label)}
|
|
794
|
+
placeholder="Add an item…"
|
|
795
|
+
aria-label="Add an item"
|
|
796
|
+
createLabel={(v) => `Add "${v}" as a new item`}
|
|
797
|
+
onCreate={setValue}
|
|
798
|
+
/>
|
|
799
|
+
);
|
|
800
|
+
}
|
|
801
|
+
|
|
733
802
|
// ---------------------------------------------------------------------------
|
|
734
803
|
// Main component
|
|
735
804
|
// ---------------------------------------------------------------------------
|
|
@@ -1429,6 +1498,35 @@ font-weight: var(--sv-font-weight-bold); /* 700 */`}</Code>
|
|
|
1429
1498
|
<TagInputDemo />
|
|
1430
1499
|
</ComponentCard>
|
|
1431
1500
|
|
|
1501
|
+
{/* SuggestionInput */}
|
|
1502
|
+
<ComponentCard
|
|
1503
|
+
name="SuggestionInput"
|
|
1504
|
+
importLine="import { SuggestionInput } from '@sovereignfs/ui';"
|
|
1505
|
+
usage="Text field with an anchored, keyboard-navigable async suggestion list, plus an optional trailing 'create new' row. Built on Popover."
|
|
1506
|
+
>
|
|
1507
|
+
<div style={{ width: '100%' }}>
|
|
1508
|
+
<SuggestionInputDemo />
|
|
1509
|
+
</div>
|
|
1510
|
+
</ComponentCard>
|
|
1511
|
+
|
|
1512
|
+
{/* IconPicker */}
|
|
1513
|
+
<ComponentCard
|
|
1514
|
+
name="IconPicker"
|
|
1515
|
+
importLine="import { IconPicker } from '@sovereignfs/ui';"
|
|
1516
|
+
usage="Trigger button + Popover grid for a curated, bounded icon set (e.g. a plugin's category icons) — not the full icon library."
|
|
1517
|
+
>
|
|
1518
|
+
<IconPickerDemo />
|
|
1519
|
+
</ComponentCard>
|
|
1520
|
+
|
|
1521
|
+
{/* QuantityStepper */}
|
|
1522
|
+
<ComponentCard
|
|
1523
|
+
name="QuantityStepper"
|
|
1524
|
+
importLine="import { QuantityStepper } from '@sovereignfs/ui';"
|
|
1525
|
+
usage="Numeric input with +/- buttons and an optional read-only unit suffix. Supports fractional step values (e.g. 0.5 kg)."
|
|
1526
|
+
>
|
|
1527
|
+
<QuantityStepperDemo />
|
|
1528
|
+
</ComponentCard>
|
|
1529
|
+
|
|
1432
1530
|
{/* Select */}
|
|
1433
1531
|
<ComponentCard
|
|
1434
1532
|
name="Select"
|
|
@@ -1798,6 +1896,15 @@ font-weight: var(--sv-font-weight-bold); /* 700 */`}</Code>
|
|
|
1798
1896
|
</div>
|
|
1799
1897
|
</ComponentCard>
|
|
1800
1898
|
|
|
1899
|
+
{/* CheckableListRow */}
|
|
1900
|
+
<ComponentCard
|
|
1901
|
+
name="CheckableListRow"
|
|
1902
|
+
importLine="import { CheckableListRow } from '@sovereignfs/ui';"
|
|
1903
|
+
usage="Whole-row tap target that toggles a checked state, with strike-through on the label — for 'tap the row to mark it done' lists (not a form checkbox)."
|
|
1904
|
+
>
|
|
1905
|
+
<CheckableListRowDemo />
|
|
1906
|
+
</ComponentCard>
|
|
1907
|
+
|
|
1801
1908
|
{/* Checkbox */}
|
|
1802
1909
|
<ComponentCard
|
|
1803
1910
|
name="Checkbox"
|