@happyvertical/smrt-ui 0.38.26 → 0.39.1
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/AGENTS.md +23 -7
- package/README.md +132 -0
- package/dist/components/data/CollectionList.svelte +106 -0
- package/dist/components/data/CollectionList.svelte.d.ts +49 -0
- package/dist/components/data/CollectionList.svelte.d.ts.map +1 -0
- package/dist/components/data/CollectionToolbar.svelte +72 -0
- package/dist/components/data/CollectionToolbar.svelte.d.ts +20 -0
- package/dist/components/data/CollectionToolbar.svelte.d.ts.map +1 -0
- package/dist/components/data/DataTable.svelte +107 -17
- package/dist/components/data/DataTable.svelte.d.ts +2 -2
- package/dist/components/data/DataTable.svelte.d.ts.map +1 -1
- package/dist/components/data/__tests__/DataTable.test.js +61 -1
- package/dist/components/data/index.d.ts +2 -0
- package/dist/components/data/index.d.ts.map +1 -1
- package/dist/components/data/index.js +2 -0
- package/dist/components/data/types.d.ts +33 -0
- package/dist/components/data/types.d.ts.map +1 -1
- package/dist/components/feedback/Alert.svelte +53 -0
- package/dist/components/feedback/Alert.svelte.d.ts +14 -0
- package/dist/components/feedback/Alert.svelte.d.ts.map +1 -0
- package/dist/components/feedback/Drawer.svelte +34 -0
- package/dist/components/feedback/Drawer.svelte.d.ts +18 -0
- package/dist/components/feedback/Drawer.svelte.d.ts.map +1 -0
- package/dist/components/feedback/Meter.svelte +33 -0
- package/dist/components/feedback/Meter.svelte.d.ts +16 -0
- package/dist/components/feedback/Meter.svelte.d.ts.map +1 -0
- package/dist/components/feedback/Modal.svelte +9 -5
- package/dist/components/feedback/Modal.svelte.d.ts +2 -2
- package/dist/components/feedback/Modal.svelte.d.ts.map +1 -1
- package/dist/components/feedback/Progress.svelte +61 -0
- package/dist/components/feedback/Progress.svelte.d.ts +14 -0
- package/dist/components/feedback/Progress.svelte.d.ts.map +1 -0
- package/dist/components/feedback/Spinner.svelte +17 -0
- package/dist/components/feedback/Spinner.svelte.d.ts +9 -0
- package/dist/components/feedback/Spinner.svelte.d.ts.map +1 -0
- package/dist/components/feedback/ToastViewport.svelte +48 -0
- package/dist/components/feedback/ToastViewport.svelte.d.ts +10 -0
- package/dist/components/feedback/ToastViewport.svelte.d.ts.map +1 -0
- package/dist/components/feedback/__tests__/toast.test.js +49 -0
- package/dist/components/feedback/index.d.ts +8 -0
- package/dist/components/feedback/index.d.ts.map +1 -1
- package/dist/components/feedback/index.js +10 -3
- package/dist/components/feedback/toast.d.ts +28 -0
- package/dist/components/feedback/toast.d.ts.map +1 -0
- package/dist/components/feedback/toast.js +58 -0
- package/dist/components/forms/Checkbox.svelte +149 -0
- package/dist/components/forms/Checkbox.svelte.d.ts +13 -0
- package/dist/components/forms/Checkbox.svelte.d.ts.map +1 -0
- package/dist/components/forms/Combobox.svelte +172 -0
- package/dist/components/forms/Combobox.svelte.d.ts +18 -0
- package/dist/components/forms/Combobox.svelte.d.ts.map +1 -0
- package/dist/components/forms/DatePicker.svelte +25 -0
- package/dist/components/forms/DatePicker.svelte.d.ts +12 -0
- package/dist/components/forms/DatePicker.svelte.d.ts.map +1 -0
- package/dist/components/forms/ErrorSummary.svelte +32 -0
- package/dist/components/forms/ErrorSummary.svelte.d.ts +11 -0
- package/dist/components/forms/ErrorSummary.svelte.d.ts.map +1 -0
- package/dist/components/forms/Fieldset.svelte +32 -0
- package/dist/components/forms/Fieldset.svelte.d.ts +13 -0
- package/dist/components/forms/Fieldset.svelte.d.ts.map +1 -0
- package/dist/components/forms/FilePicker.svelte +116 -0
- package/dist/components/forms/FilePicker.svelte.d.ts +19 -0
- package/dist/components/forms/FilePicker.svelte.d.ts.map +1 -0
- package/dist/components/forms/Form.svelte +55 -2
- package/dist/components/forms/Form.svelte.d.ts +11 -1
- package/dist/components/forms/Form.svelte.d.ts.map +1 -1
- package/dist/components/forms/FormGroup.svelte +19 -2
- package/dist/components/forms/FormGroup.svelte.d.ts +3 -0
- package/dist/components/forms/FormGroup.svelte.d.ts.map +1 -1
- package/dist/components/forms/Input.svelte +127 -0
- package/dist/components/forms/Input.svelte.d.ts +9 -1
- package/dist/components/forms/Input.svelte.d.ts.map +1 -1
- package/dist/components/forms/InputGroup.svelte +17 -0
- package/dist/components/forms/InputGroup.svelte.d.ts +11 -0
- package/dist/components/forms/InputGroup.svelte.d.ts.map +1 -0
- package/dist/components/forms/Listbox.svelte +97 -0
- package/dist/components/forms/Listbox.svelte.d.ts +15 -0
- package/dist/components/forms/Listbox.svelte.d.ts.map +1 -0
- package/dist/components/forms/MultiSelect.svelte +159 -0
- package/dist/components/forms/MultiSelect.svelte.d.ts +16 -0
- package/dist/components/forms/MultiSelect.svelte.d.ts.map +1 -0
- package/dist/components/forms/Radio.svelte +34 -0
- package/dist/components/forms/Radio.svelte.d.ts +10 -0
- package/dist/components/forms/Radio.svelte.d.ts.map +1 -0
- package/dist/components/forms/RadioGroup.svelte +130 -0
- package/dist/components/forms/RadioGroup.svelte.d.ts +19 -0
- package/dist/components/forms/RadioGroup.svelte.d.ts.map +1 -0
- package/dist/components/forms/RangeSlider.svelte +137 -0
- package/dist/components/forms/RangeSlider.svelte.d.ts +21 -0
- package/dist/components/forms/RangeSlider.svelte.d.ts.map +1 -0
- package/dist/components/forms/SegmentedControl.svelte +87 -0
- package/dist/components/forms/SegmentedControl.svelte.d.ts +17 -0
- package/dist/components/forms/SegmentedControl.svelte.d.ts.map +1 -0
- package/dist/components/forms/Select.svelte +84 -3
- package/dist/components/forms/Select.svelte.d.ts +6 -1
- package/dist/components/forms/Select.svelte.d.ts.map +1 -1
- package/dist/components/forms/Slider.svelte +131 -0
- package/dist/components/forms/Slider.svelte.d.ts +18 -0
- package/dist/components/forms/Slider.svelte.d.ts.map +1 -0
- package/dist/components/forms/Switch.svelte +128 -0
- package/dist/components/forms/Switch.svelte.d.ts +14 -0
- package/dist/components/forms/Switch.svelte.d.ts.map +1 -0
- package/dist/components/forms/TagsInput.svelte +106 -0
- package/dist/components/forms/TagsInput.svelte.d.ts +17 -0
- package/dist/components/forms/TagsInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/Textarea.svelte +84 -3
- package/dist/components/forms/Textarea.svelte.d.ts +6 -1
- package/dist/components/forms/Textarea.svelte.d.ts.map +1 -1
- package/dist/components/forms/TimePicker.svelte +25 -0
- package/dist/components/forms/TimePicker.svelte.d.ts +12 -0
- package/dist/components/forms/TimePicker.svelte.d.ts.map +1 -0
- package/dist/components/forms/ToggleButton.svelte +79 -0
- package/dist/components/forms/ToggleButton.svelte.d.ts +13 -0
- package/dist/components/forms/ToggleButton.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte +29 -0
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte.d.ts +8 -0
- package/dist/components/forms/__tests__/composite-controls.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/composite-controls.test.js +33 -0
- package/dist/components/forms/__tests__/control-interaction.test.js +95 -0
- package/dist/components/forms/__tests__/core-controls.fixture.svelte +39 -0
- package/dist/components/forms/__tests__/core-controls.fixture.svelte.d.ts +8 -0
- package/dist/components/forms/__tests__/core-controls.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/core-controls.test.js +90 -0
- package/dist/components/forms/control-dom.d.ts +6 -0
- package/dist/components/forms/control-dom.d.ts.map +1 -0
- package/dist/components/forms/control-dom.js +38 -0
- package/dist/components/forms/control-interaction-context.d.ts +9 -0
- package/dist/components/forms/control-interaction-context.d.ts.map +1 -0
- package/dist/components/forms/control-interaction-context.js +15 -0
- package/dist/components/forms/control-interaction.d.ts +147 -0
- package/dist/components/forms/control-interaction.d.ts.map +1 -0
- package/dist/components/forms/control-interaction.js +265 -0
- package/dist/components/forms/form-group-context.d.ts +7 -0
- package/dist/components/forms/form-group-context.d.ts.map +1 -1
- package/dist/components/forms/index.d.ts +22 -1
- package/dist/components/forms/index.d.ts.map +1 -1
- package/dist/components/forms/index.js +21 -1
- package/dist/components/forms/radio-group-context.d.ts +12 -0
- package/dist/components/forms/radio-group-context.d.ts.map +1 -0
- package/dist/components/forms/radio-group-context.js +11 -0
- package/dist/components/forms/types.d.ts +14 -0
- package/dist/components/forms/types.d.ts.map +1 -0
- package/dist/components/forms/types.js +1 -0
- package/dist/components/forms/use-control-registration.svelte.d.ts +8 -0
- package/dist/components/forms/use-control-registration.svelte.d.ts.map +1 -0
- package/dist/components/forms/use-control-registration.svelte.js +15 -0
- package/dist/components/ui/Accordion.svelte +44 -0
- package/dist/components/ui/Accordion.svelte.d.ts +12 -0
- package/dist/components/ui/Accordion.svelte.d.ts.map +1 -0
- package/dist/components/ui/AccordionItem.svelte +42 -0
- package/dist/components/ui/AccordionItem.svelte.d.ts +11 -0
- package/dist/components/ui/AccordionItem.svelte.d.ts.map +1 -0
- package/dist/components/ui/Disclosure.svelte +50 -0
- package/dist/components/ui/Disclosure.svelte.d.ts +13 -0
- package/dist/components/ui/Disclosure.svelte.d.ts.map +1 -0
- package/dist/components/ui/Dropdown.svelte +5 -7
- package/dist/components/ui/Dropdown.svelte.d.ts +9 -0
- package/dist/components/ui/Dropdown.svelte.d.ts.map +1 -1
- package/dist/components/ui/Popover.svelte +102 -0
- package/dist/components/ui/Popover.svelte.d.ts +16 -0
- package/dist/components/ui/Popover.svelte.d.ts.map +1 -0
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte +13 -0
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte.d.ts +19 -0
- package/dist/components/ui/__tests__/interaction-primitives.fixture.svelte.d.ts.map +1 -0
- package/dist/components/ui/__tests__/interaction-primitives.test.js +31 -0
- package/dist/components/ui/accordion-context.d.ts +7 -0
- package/dist/components/ui/accordion-context.d.ts.map +1 -0
- package/dist/components/ui/accordion-context.js +11 -0
- package/dist/components/ui/index.d.ts +5 -1
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +1 -0
- package/dist/svelte/__tests__/playground.test.js +18 -0
- package/dist/svelte/playground/BaseControlsPreview.svelte +233 -0
- package/dist/svelte/playground/BaseControlsPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/BaseControlsPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/CollectionsPreview.svelte +59 -0
- package/dist/svelte/playground/CollectionsPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/CollectionsPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/DataTablePreview.svelte +247 -0
- package/dist/svelte/playground/DataTablePreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/DataTablePreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/FeedbackPreview.svelte +51 -0
- package/dist/svelte/playground/FeedbackPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/FeedbackPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/InteractiveControlsPreview.svelte +109 -0
- package/dist/svelte/playground/InteractiveControlsPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/InteractiveControlsPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground.d.ts +20 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +65 -0
- package/dist/theme/index.d.ts +6 -4
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +6 -7
- package/dist/themes/context.svelte.js +1 -1
- package/dist/themes/index.d.ts +1 -1
- package/dist/themes/index.js +1 -1
- package/dist/themes/smrt/index.js +1 -1
- package/dist/types-generic.d.ts +7 -1
- package/dist/types-generic.d.ts.map +1 -1
- package/package.json +12 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control-interaction.d.ts","sourceRoot":"","sources":["../../../src/components/forms/control-interaction.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,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AQ,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS,CAAC;IAC5D,OAAO,CACL,OAAO,EAAE,cAAc,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC3E;AAED,MAAM,WAAW,uCAAuC;IACtD,MAAM,CAAC,EAAE,wBAAwB,CAAC;CACnC;AA6ED,4EAA4E;AAC5E,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,uCAA4C,GACpD,0BAA0B,CAwN5B"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transport-neutral interaction model for addressable form controls.
|
|
3
|
+
*
|
|
4
|
+
* The registry deliberately knows nothing about chat, agents, WebMCP, or the
|
|
5
|
+
* DOM. Controls register serializable metadata plus small imperative handles;
|
|
6
|
+
* adapters translate voice/chat/tutorial requests into commands.
|
|
7
|
+
*/
|
|
8
|
+
function identityKey(identity) {
|
|
9
|
+
const subject = identity.subject
|
|
10
|
+
? `${identity.subject.type}:${identity.subject.id}`
|
|
11
|
+
: '';
|
|
12
|
+
return `${identity.formId}\u0000${identity.controlId}\u0000${subject}`;
|
|
13
|
+
}
|
|
14
|
+
function isMutation(action) {
|
|
15
|
+
return ['stage', 'apply', 'clear', 'undo'].includes(action);
|
|
16
|
+
}
|
|
17
|
+
function isSecret(registration) {
|
|
18
|
+
return registration.metadata.sensitivity === 'secret';
|
|
19
|
+
}
|
|
20
|
+
function capabilitiesOf(registration) {
|
|
21
|
+
const declared = registration.metadata.capabilities;
|
|
22
|
+
const capabilities = declared ? [...declared] : [];
|
|
23
|
+
if (!declared) {
|
|
24
|
+
capabilities.push('explain');
|
|
25
|
+
if (registration.getValue && registration.metadata.readable !== false) {
|
|
26
|
+
capabilities.push('read');
|
|
27
|
+
}
|
|
28
|
+
if (registration.focus)
|
|
29
|
+
capabilities.push('focus');
|
|
30
|
+
if (registration.reveal)
|
|
31
|
+
capabilities.push('reveal');
|
|
32
|
+
if (registration.highlight)
|
|
33
|
+
capabilities.push('highlight');
|
|
34
|
+
if (registration.validate)
|
|
35
|
+
capabilities.push('validate');
|
|
36
|
+
if (registration.setValue && registration.metadata.writable !== false) {
|
|
37
|
+
capabilities.push('stage', 'apply', 'undo');
|
|
38
|
+
}
|
|
39
|
+
if ((registration.clear || registration.setValue) &&
|
|
40
|
+
registration.metadata.writable !== false) {
|
|
41
|
+
capabilities.push('clear');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return capabilities.filter((capability) => {
|
|
45
|
+
if (capability === 'read')
|
|
46
|
+
return !isSecret(registration);
|
|
47
|
+
if (isMutation(capability))
|
|
48
|
+
return !isSecret(registration);
|
|
49
|
+
return true;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function redactsValue(registration) {
|
|
53
|
+
return isSecret(registration) || registration.metadata.readable === false;
|
|
54
|
+
}
|
|
55
|
+
function defaultPolicy(command, context, snapshot) {
|
|
56
|
+
if (!isMutation(command.action))
|
|
57
|
+
return { allowed: true };
|
|
58
|
+
if (snapshot.metadata.sensitivity === 'secret') {
|
|
59
|
+
return { allowed: false, reason: 'sensitive_control' };
|
|
60
|
+
}
|
|
61
|
+
if (snapshot.metadata.writable === false) {
|
|
62
|
+
return { allowed: false, reason: 'control_not_writable' };
|
|
63
|
+
}
|
|
64
|
+
if (snapshot.state.disabled || snapshot.state.readonly) {
|
|
65
|
+
return { allowed: false, reason: 'control_not_editable' };
|
|
66
|
+
}
|
|
67
|
+
if (context.source === 'agent' &&
|
|
68
|
+
command.action !== 'stage' &&
|
|
69
|
+
!context.confirmed) {
|
|
70
|
+
return { allowed: false, reason: 'consent_required' };
|
|
71
|
+
}
|
|
72
|
+
return { allowed: true };
|
|
73
|
+
}
|
|
74
|
+
/** Create an isolated registry; apps choose where and how it is exposed. */
|
|
75
|
+
export function createControlInteractionRegistry(options = {}) {
|
|
76
|
+
const registrations = new Map();
|
|
77
|
+
const staged = new Map();
|
|
78
|
+
const undo = new Map();
|
|
79
|
+
const listeners = new Set();
|
|
80
|
+
const emit = (event) => {
|
|
81
|
+
const next = { ...event, timestamp: Date.now() };
|
|
82
|
+
for (const listener of listeners)
|
|
83
|
+
listener(next);
|
|
84
|
+
};
|
|
85
|
+
const snapshotOf = (registration) => {
|
|
86
|
+
const key = identityKey(registration.identity);
|
|
87
|
+
const redacted = redactsValue(registration);
|
|
88
|
+
const hasStaged = staged.has(key);
|
|
89
|
+
return {
|
|
90
|
+
identity: { ...registration.identity },
|
|
91
|
+
metadata: {
|
|
92
|
+
...registration.metadata,
|
|
93
|
+
capabilities: capabilitiesOf(registration),
|
|
94
|
+
constraints: registration.metadata.constraints
|
|
95
|
+
? { ...registration.metadata.constraints }
|
|
96
|
+
: undefined,
|
|
97
|
+
options: registration.metadata.options?.map((option) => ({
|
|
98
|
+
...option,
|
|
99
|
+
})),
|
|
100
|
+
},
|
|
101
|
+
state: {
|
|
102
|
+
...registration.getState?.(),
|
|
103
|
+
value: redacted ? undefined : registration.getValue?.(),
|
|
104
|
+
valueRedacted: redacted,
|
|
105
|
+
stagedValue: hasStaged && !redacted ? staged.get(key) : undefined,
|
|
106
|
+
stagedValueRedacted: hasStaged ? redacted : undefined,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const result = (command, ok, registration, reason) => ({
|
|
111
|
+
ok,
|
|
112
|
+
action: command.action,
|
|
113
|
+
identity: { ...command.identity },
|
|
114
|
+
snapshot: registration ? snapshotOf(registration) : undefined,
|
|
115
|
+
reason,
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
register(registration) {
|
|
119
|
+
const key = identityKey(registration.identity);
|
|
120
|
+
registrations.set(key, registration);
|
|
121
|
+
emit({ type: 'registered', identity: registration.identity });
|
|
122
|
+
return () => {
|
|
123
|
+
if (registrations.get(key) !== registration)
|
|
124
|
+
return;
|
|
125
|
+
registrations.delete(key);
|
|
126
|
+
staged.delete(key);
|
|
127
|
+
undo.delete(key);
|
|
128
|
+
emit({ type: 'unregistered', identity: registration.identity });
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
unregister(identity) {
|
|
132
|
+
const key = identityKey(identity);
|
|
133
|
+
if (!registrations.delete(key))
|
|
134
|
+
return;
|
|
135
|
+
staged.delete(key);
|
|
136
|
+
undo.delete(key);
|
|
137
|
+
emit({ type: 'unregistered', identity });
|
|
138
|
+
},
|
|
139
|
+
list(formId) {
|
|
140
|
+
return [...registrations.values()]
|
|
141
|
+
.filter((registration) => formId ? registration.identity.formId === formId : true)
|
|
142
|
+
.map(snapshotOf);
|
|
143
|
+
},
|
|
144
|
+
get(identity) {
|
|
145
|
+
const registration = registrations.get(identityKey(identity));
|
|
146
|
+
return registration ? snapshotOf(registration) : undefined;
|
|
147
|
+
},
|
|
148
|
+
async execute(command, context = { source: 'user', confirmed: true }) {
|
|
149
|
+
const key = identityKey(command.identity);
|
|
150
|
+
const registration = registrations.get(key);
|
|
151
|
+
if (!registration)
|
|
152
|
+
return result(command, false, undefined, 'not_found');
|
|
153
|
+
const snapshot = snapshotOf(registration);
|
|
154
|
+
const policyDecision = await (options.policy ?? defaultPolicy)(command, context, snapshot);
|
|
155
|
+
if (!policyDecision.allowed) {
|
|
156
|
+
const denied = result(command, false, registration, policyDecision.reason ?? 'denied');
|
|
157
|
+
emit({
|
|
158
|
+
type: 'command',
|
|
159
|
+
identity: command.identity,
|
|
160
|
+
command,
|
|
161
|
+
context,
|
|
162
|
+
result: denied,
|
|
163
|
+
});
|
|
164
|
+
return denied;
|
|
165
|
+
}
|
|
166
|
+
const capabilities = capabilitiesOf(registration);
|
|
167
|
+
if (!capabilities.includes(command.action)) {
|
|
168
|
+
const unsupported = result(command, false, registration, 'unsupported');
|
|
169
|
+
emit({
|
|
170
|
+
type: 'command',
|
|
171
|
+
identity: command.identity,
|
|
172
|
+
command,
|
|
173
|
+
context,
|
|
174
|
+
result: unsupported,
|
|
175
|
+
});
|
|
176
|
+
return unsupported;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
switch (command.action) {
|
|
180
|
+
case 'focus':
|
|
181
|
+
await registration.focus?.();
|
|
182
|
+
break;
|
|
183
|
+
case 'reveal':
|
|
184
|
+
await registration.reveal?.();
|
|
185
|
+
break;
|
|
186
|
+
case 'highlight':
|
|
187
|
+
await registration.highlight?.(command.durationMs);
|
|
188
|
+
break;
|
|
189
|
+
case 'explain':
|
|
190
|
+
break;
|
|
191
|
+
case 'validate':
|
|
192
|
+
await registration.validate?.();
|
|
193
|
+
break;
|
|
194
|
+
case 'stage':
|
|
195
|
+
staged.set(key, command.value);
|
|
196
|
+
emit({
|
|
197
|
+
type: 'staged',
|
|
198
|
+
identity: command.identity,
|
|
199
|
+
command,
|
|
200
|
+
context,
|
|
201
|
+
});
|
|
202
|
+
break;
|
|
203
|
+
case 'apply': {
|
|
204
|
+
const nextValue = 'value' in command && command.value !== undefined
|
|
205
|
+
? command.value
|
|
206
|
+
: staged.get(key);
|
|
207
|
+
if (nextValue === undefined && !staged.has(key)) {
|
|
208
|
+
throw new Error('no_staged_value');
|
|
209
|
+
}
|
|
210
|
+
const history = undo.get(key) ?? [];
|
|
211
|
+
history.push(registration.getValue?.());
|
|
212
|
+
undo.set(key, history);
|
|
213
|
+
await registration.setValue?.(nextValue);
|
|
214
|
+
staged.delete(key);
|
|
215
|
+
await registration.validate?.();
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case 'clear': {
|
|
219
|
+
const history = undo.get(key) ?? [];
|
|
220
|
+
history.push(registration.getValue?.());
|
|
221
|
+
undo.set(key, history);
|
|
222
|
+
if (registration.clear)
|
|
223
|
+
await registration.clear();
|
|
224
|
+
else
|
|
225
|
+
await registration.setValue?.('');
|
|
226
|
+
staged.delete(key);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case 'undo': {
|
|
230
|
+
const history = undo.get(key) ?? [];
|
|
231
|
+
if (history.length === 0)
|
|
232
|
+
throw new Error('nothing_to_undo');
|
|
233
|
+
await registration.setValue?.(history.pop());
|
|
234
|
+
undo.set(key, history);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const completed = result(command, true, registration);
|
|
239
|
+
emit({
|
|
240
|
+
type: 'command',
|
|
241
|
+
identity: command.identity,
|
|
242
|
+
command,
|
|
243
|
+
context,
|
|
244
|
+
result: completed,
|
|
245
|
+
});
|
|
246
|
+
return completed;
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
const failed = result(command, false, registration, error instanceof Error ? error.message : 'command_failed');
|
|
250
|
+
emit({
|
|
251
|
+
type: 'command',
|
|
252
|
+
identity: command.identity,
|
|
253
|
+
command,
|
|
254
|
+
context,
|
|
255
|
+
result: failed,
|
|
256
|
+
});
|
|
257
|
+
return failed;
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
subscribe(listener) {
|
|
261
|
+
listeners.add(listener);
|
|
262
|
+
return () => listeners.delete(listener);
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ControlInteractionOptions } from './control-interaction.js';
|
|
1
2
|
export interface FormGroupContextValue {
|
|
2
3
|
/** Stable id for the field control; matches the FormGroup label's `for`. */
|
|
3
4
|
inputId: string;
|
|
@@ -5,6 +6,12 @@ export interface FormGroupContextValue {
|
|
|
5
6
|
describedBy: string | undefined;
|
|
6
7
|
/** Whether the field is currently showing an error. */
|
|
7
8
|
invalid: boolean;
|
|
9
|
+
/** Human-readable label and description for interaction adapters. */
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
required: boolean;
|
|
13
|
+
error?: string;
|
|
14
|
+
interaction?: ControlInteractionOptions | false;
|
|
8
15
|
}
|
|
9
16
|
export declare function setFormGroupContext(get: () => FormGroupContextValue): void;
|
|
10
17
|
export declare function tryGetFormGroupContext(): (() => FormGroupContextValue) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-group-context.d.ts","sourceRoot":"","sources":["../../../src/components/forms/form-group-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-group-context.d.ts","sourceRoot":"","sources":["../../../src/components/forms/form-group-context.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,yBAAyB,GAAG,KAAK,CAAC;CACjD;AAID,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,qBAAqB,GAAG,IAAI,CAE1E;AAED,wBAAgB,sBAAsB,IAClC,CAAC,MAAM,qBAAqB,CAAC,GAC7B,SAAS,CAEZ;AAID,mFAAmF;AACnF,wBAAgB,WAAW,IAAI,MAAM,CAGpC"}
|
|
@@ -11,11 +11,32 @@
|
|
|
11
11
|
* dependency. The Provider-REQUIRED inputs (`CheckboxInput`, `TextInput`,
|
|
12
12
|
* `MoneyInput`, the rich `Form`, …) stay in `@happyvertical/smrt-svelte/forms`.
|
|
13
13
|
*/
|
|
14
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
15
|
+
export { default as Combobox } from './Combobox.svelte';
|
|
16
|
+
export { type ControlCapability, type ControlCommand, type ControlCommandAction, type ControlCommandContext, type ControlCommandResult, type ControlCommandSource, type ControlConstraints, type ControlIdentity, type ControlInteractionEvent, type ControlInteractionOptions, type ControlInteractionPolicy, type ControlInteractionRegistry, type ControlKind, type ControlMetadata, type ControlOption, type ControlRegistration, type ControlRuntimeState, type ControlSensitivity, type ControlSnapshot, type ControlSubject, createControlInteractionRegistry, } from './control-interaction.js';
|
|
17
|
+
export { type ControlInteractionContextValue, getControlInteractionContext, setControlInteractionContext, tryGetControlInteractionContext, } from './control-interaction-context.js';
|
|
18
|
+
export { default as DatePicker } from './DatePicker.svelte';
|
|
19
|
+
export { default as ErrorSummary } from './ErrorSummary.svelte';
|
|
20
|
+
export { default as Fieldset } from './Fieldset.svelte';
|
|
21
|
+
export { default as FilePicker } from './FilePicker.svelte';
|
|
14
22
|
export { default as Form } from './Form.svelte';
|
|
15
|
-
export { default as FormGroup } from './FormGroup.svelte';
|
|
23
|
+
export { default as Field, default as FormGroup } from './FormGroup.svelte';
|
|
16
24
|
export { type FormGroupContextValue, nextFieldId, setFormGroupContext, tryGetFormGroupContext, } from './form-group-context.js';
|
|
17
25
|
export { default as Input } from './Input.svelte';
|
|
26
|
+
export { default as InputGroup } from './InputGroup.svelte';
|
|
27
|
+
export { default as Listbox } from './Listbox.svelte';
|
|
28
|
+
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
29
|
+
export { default as Radio } from './Radio.svelte';
|
|
30
|
+
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
31
|
+
export { default as RangeSlider } from './RangeSlider.svelte';
|
|
32
|
+
export { default as SegmentedControl } from './SegmentedControl.svelte';
|
|
18
33
|
export { default as Select } from './Select.svelte';
|
|
34
|
+
export { default as Slider } from './Slider.svelte';
|
|
35
|
+
export { default as Switch } from './Switch.svelte';
|
|
36
|
+
export { default as TagsInput } from './TagsInput.svelte';
|
|
19
37
|
export { default as Textarea } from './Textarea.svelte';
|
|
38
|
+
export { default as TimePicker } from './TimePicker.svelte';
|
|
20
39
|
export { default as Toggle } from './Toggle.svelte';
|
|
40
|
+
export { default as ToggleButton } from './ToggleButton.svelte';
|
|
41
|
+
export type { FormError, RangeSliderValue, SegmentedControlOption, } from './types.js';
|
|
21
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/forms/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,8BAA8B,EACnC,4BAA4B,EAC5B,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,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iB,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
@@ -11,10 +11,30 @@
|
|
|
11
11
|
* dependency. The Provider-REQUIRED inputs (`CheckboxInput`, `TextInput`,
|
|
12
12
|
* `MoneyInput`, the rich `Form`, …) stay in `@happyvertical/smrt-svelte/forms`.
|
|
13
13
|
*/
|
|
14
|
+
export { default as Checkbox } from './Checkbox.svelte';
|
|
15
|
+
export { default as Combobox } from './Combobox.svelte';
|
|
16
|
+
export { createControlInteractionRegistry, } from './control-interaction.js';
|
|
17
|
+
export { getControlInteractionContext, setControlInteractionContext, tryGetControlInteractionContext, } from './control-interaction-context.js';
|
|
18
|
+
export { default as DatePicker } from './DatePicker.svelte';
|
|
19
|
+
export { default as ErrorSummary } from './ErrorSummary.svelte';
|
|
20
|
+
export { default as Fieldset } from './Fieldset.svelte';
|
|
21
|
+
export { default as FilePicker } from './FilePicker.svelte';
|
|
14
22
|
export { default as Form } from './Form.svelte';
|
|
15
|
-
export { default as FormGroup } from './FormGroup.svelte';
|
|
23
|
+
export { default as Field, default as FormGroup } from './FormGroup.svelte';
|
|
16
24
|
export { nextFieldId, setFormGroupContext, tryGetFormGroupContext, } from './form-group-context.js';
|
|
17
25
|
export { default as Input } from './Input.svelte';
|
|
26
|
+
export { default as InputGroup } from './InputGroup.svelte';
|
|
27
|
+
export { default as Listbox } from './Listbox.svelte';
|
|
28
|
+
export { default as MultiSelect } from './MultiSelect.svelte';
|
|
29
|
+
export { default as Radio } from './Radio.svelte';
|
|
30
|
+
export { default as RadioGroup } from './RadioGroup.svelte';
|
|
31
|
+
export { default as RangeSlider } from './RangeSlider.svelte';
|
|
32
|
+
export { default as SegmentedControl } from './SegmentedControl.svelte';
|
|
18
33
|
export { default as Select } from './Select.svelte';
|
|
34
|
+
export { default as Slider } from './Slider.svelte';
|
|
35
|
+
export { default as Switch } from './Switch.svelte';
|
|
36
|
+
export { default as TagsInput } from './TagsInput.svelte';
|
|
19
37
|
export { default as Textarea } from './Textarea.svelte';
|
|
38
|
+
export { default as TimePicker } from './TimePicker.svelte';
|
|
20
39
|
export { default as Toggle } from './Toggle.svelte';
|
|
40
|
+
export { default as ToggleButton } from './ToggleButton.svelte';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ControlOption } from './control-interaction.js';
|
|
2
|
+
export interface RadioGroupContextValue {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly value: string;
|
|
5
|
+
readonly disabled: boolean;
|
|
6
|
+
readonly required: boolean;
|
|
7
|
+
setValue(value: string): void;
|
|
8
|
+
registerOption(option: ControlOption): () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function setRadioGroupContext(value: RadioGroupContextValue): void;
|
|
11
|
+
export declare function getRadioGroupContext(): RadioGroupContextValue;
|
|
12
|
+
//# sourceMappingURL=radio-group-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio-group-context.d.ts","sourceRoot":"","sources":["../../../src/components/forms/radio-group-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,IAAI,CAAC;CACnD;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAExE;AACD,wBAAgB,oBAAoB,IAAI,sBAAsB,CAI7D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const RADIO_GROUP_KEY = Symbol('smrt-radio-group');
|
|
3
|
+
export function setRadioGroupContext(value) {
|
|
4
|
+
setContext(RADIO_GROUP_KEY, value);
|
|
5
|
+
}
|
|
6
|
+
export function getRadioGroupContext() {
|
|
7
|
+
const value = getContext(RADIO_GROUP_KEY);
|
|
8
|
+
if (!value)
|
|
9
|
+
throw new Error('<Radio> must be rendered inside <RadioGroup>.');
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ControlOption } from './control-interaction.js';
|
|
2
|
+
export interface FormError {
|
|
3
|
+
controlId: string;
|
|
4
|
+
message: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RangeSliderValue {
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SegmentedControlOption extends ControlOption {
|
|
12
|
+
icon?: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/forms/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ControlRegistration, ControlSubject } from './control-interaction.js';
|
|
2
|
+
export interface ControlRegistrationDescriptor extends Omit<ControlRegistration, 'identity'> {
|
|
3
|
+
controlId: string | undefined;
|
|
4
|
+
subject?: ControlSubject;
|
|
5
|
+
}
|
|
6
|
+
/** Register a reactive control descriptor with the nearest Form registry. */
|
|
7
|
+
export declare function useControlRegistration(getDescriptor: () => ControlRegistrationDescriptor | false): void;
|
|
8
|
+
//# sourceMappingURL=use-control-registration.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-control-registration.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/forms/use-control-registration.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAGlC,MAAM,WAAW,6BACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC;IAC7C,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,6EAA6E;AAC7E,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,6BAA6B,GAAG,KAAK,GACzD,IAAI,CAWN"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { tryGetControlInteractionContext } from './control-interaction-context.js';
|
|
2
|
+
/** Register a reactive control descriptor with the nearest Form registry. */
|
|
3
|
+
export function useControlRegistration(getDescriptor) {
|
|
4
|
+
const context = tryGetControlInteractionContext();
|
|
5
|
+
$effect(() => {
|
|
6
|
+
const descriptor = getDescriptor();
|
|
7
|
+
if (!context || descriptor === false || !descriptor.controlId)
|
|
8
|
+
return;
|
|
9
|
+
const { controlId, subject, ...registration } = descriptor;
|
|
10
|
+
return context.registry.register({
|
|
11
|
+
...registration,
|
|
12
|
+
identity: { formId: context.formId, controlId, subject },
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { setAccordionContext } from './accordion-context.js';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
value?: string | string[];
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
onvaluechange?: (value: string | string[]) => void;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
value = $bindable(''),
|
|
15
|
+
multiple = false,
|
|
16
|
+
children,
|
|
17
|
+
onvaluechange,
|
|
18
|
+
class: className = '',
|
|
19
|
+
}: Props = $props();
|
|
20
|
+
|
|
21
|
+
function isOpen(item: string) {
|
|
22
|
+
return Array.isArray(value) ? value.includes(item) : value === item;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function toggle(item: string) {
|
|
26
|
+
if (multiple) {
|
|
27
|
+
const current = Array.isArray(value) ? value : value ? [value] : [];
|
|
28
|
+
value = current.includes(item)
|
|
29
|
+
? current.filter((entry) => entry !== item)
|
|
30
|
+
: [...current, item];
|
|
31
|
+
} else {
|
|
32
|
+
value = value === item ? '' : item;
|
|
33
|
+
}
|
|
34
|
+
onvaluechange?.(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
setAccordionContext({ isOpen, toggle });
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div class="accordion {className}">{#if children}{@render children()}{/if}</div>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
.accordion { overflow: hidden; border: 1px solid var(--smrt-color-outline-variant); border-radius: var(--smrt-radius-large); background: var(--smrt-color-surface); }
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface Props {
|
|
3
|
+
value?: string | string[];
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
onvaluechange?: (value: string | string[]) => void;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Accordion: import("svelte").Component<Props, {}, "value">;
|
|
10
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
11
|
+
export default Accordion;
|
|
12
|
+
//# sourceMappingURL=Accordion.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accordion.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Accordion.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,WAAW,KAAK;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAuCD,QAAA,MAAM,SAAS,gDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { getAccordionContext } from './accordion-context.js';
|
|
4
|
+
|
|
5
|
+
export interface Props {
|
|
6
|
+
value: string;
|
|
7
|
+
title: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
let { value, title, disabled = false, children }: Props = $props();
|
|
12
|
+
const instanceId = $props.id();
|
|
13
|
+
const triggerId = `accordion-trigger-${instanceId}`;
|
|
14
|
+
const panelId = `accordion-panel-${instanceId}`;
|
|
15
|
+
const context = getAccordionContext();
|
|
16
|
+
const open = $derived(context.isOpen(value));
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<section class="item">
|
|
20
|
+
<h3>
|
|
21
|
+
<button id={triggerId} type="button" aria-expanded={open} aria-controls={panelId} {disabled} onclick={() => context.toggle(value)}>
|
|
22
|
+
<span>{title}</span><span class="chevron" aria-hidden="true">⌄</span>
|
|
23
|
+
</button>
|
|
24
|
+
</h3>
|
|
25
|
+
{#if open}
|
|
26
|
+
<div id={panelId} role="region" aria-labelledby={triggerId} class="panel">{#if children}{@render children()}{/if}</div>
|
|
27
|
+
{/if}
|
|
28
|
+
</section>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
.item { border-bottom: 1px solid var(--smrt-color-outline-variant); }
|
|
32
|
+
.item:last-child { border-bottom: 0; }
|
|
33
|
+
h3 { margin: 0; }
|
|
34
|
+
button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: var(--smrt-spacing-3); padding: var(--smrt-spacing-4); border: 0; background: transparent; color: var(--smrt-color-on-surface); font: var(--smrt-typography-title-small-font); text-align: left; cursor: pointer; }
|
|
35
|
+
button:hover:not(:disabled) { background: var(--smrt-color-surface-container-low); }
|
|
36
|
+
button:focus-visible { outline: 2px solid var(--smrt-color-primary); outline-offset: -2px; }
|
|
37
|
+
button:disabled { opacity: .5; cursor: not-allowed; }
|
|
38
|
+
.chevron { transition: transform var(--smrt-duration-short4) var(--smrt-easing-standard); }
|
|
39
|
+
button[aria-expanded='true'] .chevron { transform: rotate(180deg); }
|
|
40
|
+
.panel { padding: 0 var(--smrt-spacing-4) var(--smrt-spacing-4); color: var(--smrt-color-on-surface-variant); }
|
|
41
|
+
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface Props {
|
|
3
|
+
value: string;
|
|
4
|
+
title: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
}
|
|
8
|
+
declare const AccordionItem: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type AccordionItem = ReturnType<typeof AccordionItem>;
|
|
10
|
+
export default AccordionItem;
|
|
11
|
+
//# sourceMappingURL=AccordionItem.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccordionItem.svelte.d.ts","sourceRoot":"","sources":["../../../src/components/ui/AccordionItem.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAItC,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA4BD,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
open?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
onopenchange?: (open: boolean) => void;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
title,
|
|
15
|
+
open = $bindable(false),
|
|
16
|
+
disabled = false,
|
|
17
|
+
children,
|
|
18
|
+
onopenchange,
|
|
19
|
+
class: className = '',
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
function handleToggle(event: Event) {
|
|
23
|
+
const next = (event.currentTarget as HTMLDetailsElement).open;
|
|
24
|
+
if (disabled && next) {
|
|
25
|
+
open = false;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
open = next;
|
|
29
|
+
onopenchange?.(next);
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<details class="disclosure {className}" bind:open ontoggle={handleToggle}>
|
|
34
|
+
<summary aria-disabled={disabled} onclick={(event) => disabled && event.preventDefault()}>
|
|
35
|
+
<span>{title}</span><span class="chevron" aria-hidden="true">⌄</span>
|
|
36
|
+
</summary>
|
|
37
|
+
<div class="content">{#if children}{@render children()}{/if}</div>
|
|
38
|
+
</details>
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
.disclosure { border-bottom: 1px solid var(--smrt-color-outline-variant); color: var(--smrt-color-on-surface); }
|
|
42
|
+
summary { display: flex; justify-content: space-between; gap: var(--smrt-spacing-3); padding: var(--smrt-spacing-3) 0; font: var(--smrt-typography-title-small-font); cursor: pointer; list-style: none; }
|
|
43
|
+
summary::-webkit-details-marker { display: none; }
|
|
44
|
+
summary:focus-visible { outline: 2px solid var(--smrt-color-primary); outline-offset: 2px; }
|
|
45
|
+
summary[aria-disabled='true'] { opacity: .5; cursor: not-allowed; }
|
|
46
|
+
.chevron { transition: transform var(--smrt-duration-short4) var(--smrt-easing-standard); }
|
|
47
|
+
details[open] .chevron { transform: rotate(180deg); }
|
|
48
|
+
.content { padding: 0 0 var(--smrt-spacing-4); color: var(--smrt-color-on-surface-variant); }
|
|
49
|
+
@media (prefers-reduced-motion: reduce) { .chevron { transition: none; } }
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
open?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
onopenchange?: (open: boolean) => void;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Disclosure: import("svelte").Component<Props, {}, "open">;
|
|
11
|
+
type Disclosure = ReturnType<typeof Disclosure>;
|
|
12
|
+
export default Disclosure;
|
|
13
|
+
//# sourceMappingURL=Disclosure.svelte.d.ts.map
|