@devslab/dds-solid 0.23.0 → 0.25.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.
Files changed (92) hide show
  1. package/README.ko.md +15 -3
  2. package/README.md +15 -3
  3. package/dist/assets/{calendar-view-1RO2mtf1.js → calendar-view-BBQGmkJ7.js} +181 -145
  4. package/dist/assets/calendar-view-BBQGmkJ7.js.map +1 -0
  5. package/dist/assets/{choice-DoXiK8nc.js → choice-DPmk9AHn.js} +41 -29
  6. package/dist/assets/choice-DPmk9AHn.js.map +1 -0
  7. package/dist/assets/choice-types-h4YVL8xH.js +24 -0
  8. package/dist/assets/choice-types-h4YVL8xH.js.map +1 -0
  9. package/dist/assets/date-only-0Ldsjp43.js +174 -0
  10. package/dist/assets/date-only-0Ldsjp43.js.map +1 -0
  11. package/dist/assets/direction-BpTqmXs-.js +24 -0
  12. package/dist/assets/direction-BpTqmXs-.js.map +1 -0
  13. package/dist/calendar-view-CZLsC57_.js +481 -0
  14. package/dist/calendar-view-CZLsC57_.js.map +1 -0
  15. package/dist/calendar-view.d.ts +10 -0
  16. package/dist/calendar-view.d.ts.map +1 -1
  17. package/dist/calendar.js +7 -6
  18. package/dist/calendar.js.map +1 -1
  19. package/dist/calendar.server.js +2 -1
  20. package/dist/calendar.server.js.map +1 -1
  21. package/dist/choice-CTNeFOVo.js +403 -0
  22. package/dist/choice-CTNeFOVo.js.map +1 -0
  23. package/dist/choice-types-kSaEnZPr.js +23 -0
  24. package/dist/choice-types-kSaEnZPr.js.map +1 -0
  25. package/dist/combobox.js +1 -1
  26. package/dist/combobox.server.js +1 -1
  27. package/dist/date-only-Bu4UmsTP.js +151 -0
  28. package/dist/date-only-Bu4UmsTP.js.map +1 -0
  29. package/dist/date-only.d.ts +92 -0
  30. package/dist/date-only.d.ts.map +1 -1
  31. package/dist/date-picker.js +51 -50
  32. package/dist/date-picker.js.map +1 -1
  33. package/dist/date-picker.server.js +2 -1
  34. package/dist/date-picker.server.js.map +1 -1
  35. package/dist/date-range-picker.d.ts +41 -0
  36. package/dist/date-range-picker.d.ts.map +1 -0
  37. package/dist/date-range-picker.js +368 -0
  38. package/dist/date-range-picker.js.map +1 -0
  39. package/dist/date-range-picker.server.js +347 -0
  40. package/dist/date-range-picker.server.js.map +1 -0
  41. package/dist/direction-CS85IDNU.js +21 -0
  42. package/dist/direction-CS85IDNU.js.map +1 -0
  43. package/dist/index.d.ts +5 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +168 -179
  46. package/dist/index.js.map +1 -1
  47. package/dist/input.d.ts.map +1 -1
  48. package/dist/input.js +1 -1
  49. package/dist/input.js.map +1 -1
  50. package/dist/input.server.js +1 -1
  51. package/dist/input.server.js.map +1 -1
  52. package/dist/internal/choice.d.ts +25 -3
  53. package/dist/internal/choice.d.ts.map +1 -1
  54. package/dist/month-picker.d.ts +33 -0
  55. package/dist/month-picker.d.ts.map +1 -0
  56. package/dist/month-picker.js +287 -0
  57. package/dist/month-picker.js.map +1 -0
  58. package/dist/month-picker.server.js +282 -0
  59. package/dist/month-picker.server.js.map +1 -0
  60. package/dist/number-input.d.ts +53 -0
  61. package/dist/number-input.d.ts.map +1 -0
  62. package/dist/number-input.js +267 -0
  63. package/dist/number-input.js.map +1 -0
  64. package/dist/number-input.server.js +237 -0
  65. package/dist/number-input.server.js.map +1 -0
  66. package/dist/segmented-control.d.ts +40 -0
  67. package/dist/segmented-control.d.ts.map +1 -0
  68. package/dist/segmented-control.js +133 -0
  69. package/dist/segmented-control.js.map +1 -0
  70. package/dist/segmented-control.server.js +138 -0
  71. package/dist/segmented-control.server.js.map +1 -0
  72. package/dist/select-picker.js +1 -1
  73. package/dist/select-picker.server.js +1 -1
  74. package/dist/server.js +8 -22
  75. package/dist/server.js.map +1 -1
  76. package/dist/time-only.d.ts +32 -0
  77. package/dist/time-only.d.ts.map +1 -0
  78. package/dist/time-picker-BlMWCQwk.js +113 -0
  79. package/dist/time-picker-BlMWCQwk.js.map +1 -0
  80. package/dist/time-picker.d.ts +34 -0
  81. package/dist/time-picker.d.ts.map +1 -0
  82. package/dist/time-picker.js +2 -0
  83. package/dist/time-picker.server.js +152 -0
  84. package/dist/time-picker.server.js.map +1 -0
  85. package/package.json +44 -4
  86. package/styles.css +31 -1
  87. package/dist/assets/calendar-view-1RO2mtf1.js.map +0 -1
  88. package/dist/assets/choice-DoXiK8nc.js.map +0 -1
  89. package/dist/calendar-view-CTBTPB4T.js +0 -444
  90. package/dist/calendar-view-CTBTPB4T.js.map +0 -1
  91. package/dist/choice-BPMiJlPJ.js +0 -395
  92. package/dist/choice-BPMiJlPJ.js.map +0 -1
@@ -0,0 +1,237 @@
1
+ import { n as describedBy, t as classes } from "./assets/utils-Ou0UJRlO.js";
2
+ import { t as useDirection } from "./assets/direction-BpTqmXs-.js";
3
+ import { c as isKorean } from "./assets/date-only-0Ldsjp43.js";
4
+ import { Show, createEffect, createMemo, createSignal, createUniqueId, mergeProps, on } from "solid-js";
5
+ import { createComponent, escape, mergeProps as mergeProps$1, ssr, ssrAttribute, ssrElement, ssrHydrationKey } from "solid-js/web";
6
+ import { NumberInput as NumberInput$1, useNumberInput } from "@ark-ui/solid/number-input";
7
+ //#region src/number-input.tsx
8
+ var _tmpl$ = [
9
+ "<svg",
10
+ " width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">",
11
+ "</svg>"
12
+ ];
13
+ var _tmpl$2 = ["<path", "></path>"];
14
+ var _tmpl$3 = [
15
+ "<span",
16
+ " class=\"dds-number-input__suffix\">",
17
+ "</span>"
18
+ ];
19
+ var _tmpl$4 = [
20
+ "<span",
21
+ " class=\"dds-number-input__steppers\"><!--$-->",
22
+ "<!--/--><!--$-->",
23
+ "<!--/--></span>"
24
+ ];
25
+ var _tmpl$5 = [
26
+ "<input",
27
+ " type=\"hidden\"",
28
+ "",
29
+ ">"
30
+ ];
31
+ function numberInputMessages(locale, messages = {}) {
32
+ const ko = isKorean(locale);
33
+ return {
34
+ decrease: ko ? "값 줄이기" : "Decrease",
35
+ increase: ko ? "값 늘리기" : "Increase",
36
+ ...messages
37
+ };
38
+ }
39
+ var MINUS = ["M5 12h14"];
40
+ var PLUS = ["M12 5v14", "M5 12h14"];
41
+ function StepIcon(props) {
42
+ return ssr(_tmpl$, ssrHydrationKey(), escape(props.path.map((d) => ssr(_tmpl$2, ssrHydrationKey() + ssrAttribute("d", escape(d, true), false)))));
43
+ }
44
+ var FULL_WIDTH = {
45
+ ",": ",",
46
+ ".": ".",
47
+ "-": "-",
48
+ "−": "-"
49
+ };
50
+ /** Full-width digits from Japanese/Chinese IMEs become ASCII; other text is left for validation. */
51
+ function normalizeNumberText(text) {
52
+ return text.replace(/[0-9,.-−]/g, (char) => char >= "0" && char <= "9" ? String.fromCharCode(char.charCodeAt(0) - 65296 + 48) : FULL_WIDTH[char]);
53
+ }
54
+ function separators(formatter) {
55
+ const parts = [...formatter.formatToParts(-1234567.5), ...formatter.formatToParts(1234567.5)];
56
+ const find = (type) => parts.find((part) => part.type === type)?.value;
57
+ const affixes = /* @__PURE__ */ new Set();
58
+ for (const part of parts) if (![
59
+ "integer",
60
+ "group",
61
+ "decimal",
62
+ "fraction",
63
+ "minusSign"
64
+ ].includes(part.type)) for (const char of part.value) affixes.add(char);
65
+ return {
66
+ group: find("group") ?? "",
67
+ decimal: find("decimal") ?? ".",
68
+ minus: find("minusSign") ?? "-",
69
+ affixes
70
+ };
71
+ }
72
+ /**
73
+ * A localized number field. Values are numbers (or null for empty); display
74
+ * text is formatted with Intl and never leaves the component.
75
+ */
76
+ function NumberInput(props) {
77
+ const generated = createUniqueId();
78
+ const id = () => props.id ?? `dds-number-input-${generated}`;
79
+ const suffixId = () => `${id()}-suffix`;
80
+ const locale = () => props.locale ?? "ko-KR";
81
+ const messages = () => numberInputMessages(locale(), props.messages);
82
+ const formatOptions = createMemo(() => props.formatOptions ?? { maximumFractionDigits: 0 });
83
+ const formatter = createMemo(() => new Intl.NumberFormat(locale(), formatOptions()));
84
+ createMemo(() => separators(formatter()));
85
+ const fractions = () => (formatter().resolvedOptions().maximumFractionDigits ?? 0) > 0;
86
+ const format = (next) => next === null || !Number.isFinite(next) ? "" : formatter().format(next);
87
+ const controlled = () => props.value !== void 0;
88
+ const [internal, setInternal] = createSignal(props.defaultValue ?? null);
89
+ const current = () => controlled() ? props.value ?? null : internal();
90
+ const [draft, setDraft] = createSignal(format(current()));
91
+ const [draftNumber, setDraftNumber] = createSignal(current());
92
+ const outOfRange = () => {
93
+ const next = draftNumber();
94
+ return next !== null && (props.min !== void 0 && next < props.min || props.max !== void 0 && next > props.max);
95
+ };
96
+ const invalid = () => !!props.invalid || outOfRange();
97
+ let root;
98
+ const direction = useDirection(() => root, () => props.dir);
99
+ const commit = (next) => {
100
+ if (next === current()) return;
101
+ if (!controlled()) setInternal(next);
102
+ props.onValueChange?.(next);
103
+ };
104
+ const api = useNumberInput(() => ({
105
+ id: `${id()}-root`,
106
+ ids: {
107
+ root: `${id()}-root`,
108
+ input: id()
109
+ },
110
+ dir: direction(),
111
+ locale: locale(),
112
+ formatOptions: formatOptions(),
113
+ value: draft(),
114
+ step: props.step ?? 1,
115
+ ...props.min !== void 0 ? { min: props.min } : {},
116
+ ...props.max !== void 0 ? { max: props.max } : {},
117
+ allowMouseWheel: false,
118
+ clampValueOnBlur: true,
119
+ spinOnPress: true,
120
+ inputMode: fractions() ? "decimal" : "numeric",
121
+ disabled: props.disabled,
122
+ readOnly: props.readOnly,
123
+ required: props.required,
124
+ invalid: invalid(),
125
+ translations: {
126
+ decrementLabel: messages().decrease,
127
+ incrementLabel: messages().increase,
128
+ valueText: (text) => text && props.suffix ? `${text} ${props.suffix}` : text
129
+ },
130
+ onValueChange: (details) => {
131
+ const next = Number.isNaN(details.valueAsNumber) ? null : details.valueAsNumber;
132
+ setDraft(details.value);
133
+ setDraftNumber(next);
134
+ commit(next);
135
+ }
136
+ }));
137
+ createEffect(on(current, (next) => {
138
+ if (next === draftNumber()) return;
139
+ setDraft(format(next));
140
+ setDraftNumber(next);
141
+ }, { defer: true }));
142
+ createEffect(() => {
143
+ props.form;
144
+ });
145
+ const inputAttributes = mergeProps(() => {
146
+ const { onKeyDown: _keyDown, onBeforeInput: _beforeInput, onInput: _input, onFocusOut: _focusOut, value: _value, ...attributes } = api().getInputProps();
147
+ return attributes;
148
+ });
149
+ return createComponent(NumberInput$1.RootProvider, {
150
+ value: api,
151
+ get ["class"]() {
152
+ return classes("dds-number-input", props.class);
153
+ },
154
+ get ["data-label-placement"]() {
155
+ return props.labelPlacement ?? "outside";
156
+ },
157
+ get ["data-readonly"]() {
158
+ return props.readOnly ? "" : void 0;
159
+ },
160
+ get ["data-stepper"]() {
161
+ return props.stepper === false ? void 0 : "";
162
+ },
163
+ get children() {
164
+ return [
165
+ createComponent(Show, {
166
+ get when() {
167
+ return props.label;
168
+ },
169
+ get children() {
170
+ return createComponent(NumberInput$1.Label, {
171
+ "class": "dds-number-input__label",
172
+ get children() {
173
+ return props.label;
174
+ }
175
+ });
176
+ }
177
+ }),
178
+ createComponent(NumberInput$1.Control, {
179
+ "class": "dds-number-input__control",
180
+ get children() {
181
+ return [
182
+ ssrElement("input", mergeProps$1(inputAttributes, {
183
+ "class": "dds-number-input__field",
184
+ get value() {
185
+ return draft();
186
+ },
187
+ get placeholder() {
188
+ return props.placeholder;
189
+ },
190
+ get ["aria-label"]() {
191
+ return props.label ? void 0 : props["aria-label"];
192
+ },
193
+ get ["aria-labelledby"]() {
194
+ return props.label ? void 0 : props["aria-labelledby"];
195
+ },
196
+ get ["aria-describedby"]() {
197
+ return describedBy(props.suffix ? suffixId() : void 0, props["aria-describedby"]);
198
+ }
199
+ }), void 0, true),
200
+ createComponent(Show, {
201
+ get when() {
202
+ return props.suffix;
203
+ },
204
+ get children() {
205
+ return ssr(_tmpl$3, ssrHydrationKey() + ssrAttribute("id", escape(suffixId(), true), false), escape(props.suffix));
206
+ }
207
+ }),
208
+ createComponent(Show, {
209
+ get when() {
210
+ return props.stepper !== false;
211
+ },
212
+ get children() {
213
+ return ssr(_tmpl$4, ssrHydrationKey(), escape(createComponent(NumberInput$1.DecrementTrigger, {
214
+ "class": "dds-number-input__step",
215
+ get children() {
216
+ return createComponent(StepIcon, { path: MINUS });
217
+ }
218
+ })), escape(createComponent(NumberInput$1.IncrementTrigger, {
219
+ "class": "dds-number-input__step",
220
+ get children() {
221
+ return createComponent(StepIcon, { path: PLUS });
222
+ }
223
+ })));
224
+ }
225
+ })
226
+ ];
227
+ }
228
+ }),
229
+ ssr(_tmpl$5, ssrHydrationKey(), ssrAttribute("name", escape(props.name, true), false) + ssrAttribute("form", escape(props.form, true), false) + ssrAttribute("value", draftNumber() === null ? "" : escape(String(draftNumber()), true), false), ssrAttribute("disabled", props.disabled, true))
230
+ ];
231
+ }
232
+ });
233
+ }
234
+ //#endregion
235
+ export { NumberInput, normalizeNumberText, numberInputMessages };
236
+
237
+ //# sourceMappingURL=number-input.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-input.server.js","names":["NumberInput","ArkNumberInput","useNumberInput","createEffect","createMemo","createSignal","createUniqueId","mergeProps","on","onCleanup","Show","isKorean","useDirection","Direction","classes","describedBy","NumberInputMessages","decrease","increase","numberInputMessages","locale","messages","Required","ko","NumberInputProps","value","defaultValue","onValueChange","next","min","max","step","formatOptions","Intl","NumberFormatOptions","stepper","suffix","label","labelPlacement","id","name","form","required","disabled","readOnly","invalid","placeholder","dir","class","MINUS","PLUS","StepIcon","props","path","_$ssr","_tmpl$","_$ssrHydrationKey","_$escape","map","d","_tmpl$2","_$ssrAttribute","FULL_WIDTH","Record","normalizeNumberText","text","replace","char","String","fromCharCode","charCodeAt","separators","formatter","NumberFormat","parts","formatToParts","find","type","part","affixes","Set","includes","add","group","decimal","minus","generated","suffixId","maximumFractionDigits","syntax","fractions","resolvedOptions","format","Number","isFinite","controlled","undefined","internal","setInternal","current","draft","setDraft","draftNumber","setDraftNumber","outOfRange","root","HTMLDivElement","input","HTMLInputElement","composing","resetting","direction","commit","api","ids","allowMouseWheel","clampValueOnBlur","spinOnPress","inputMode","const","translations","decrementLabel","incrementLabel","valueText","details","isNaN","valueAsNumber","defer","reset","event","Event","setTimeout","defaultPrevented","addEventListener","capture","removeEventListener","inputAttributes","onKeyDown","_keyDown","onBeforeInput","_beforeInput","onInput","_input","onFocusOut","_focusOut","_value","attributes","getInputProps","zag","acceptable","decimals","trim","has","stepBy","delta","Math","setValue","_$createComponent","RootProvider","data-label-placement","data-readonly","data-stepper","children","when","Label","Control","_$ssrElement","_$mergeProps","aria-label","aria-labelledby","aria-describedby","_tmpl$3","_tmpl$4","DecrementTrigger","IncrementTrigger","_tmpl$5"],"sources":["../src/number-input.tsx"],"sourcesContent":["import {\n NumberInput as ArkNumberInput,\n useNumberInput,\n} from \"@ark-ui/solid/number-input\";\nimport {\n createEffect,\n createMemo,\n createSignal,\n createUniqueId,\n mergeProps,\n on,\n onCleanup,\n Show,\n} from \"solid-js\";\nimport { isKorean } from \"./date-only\";\nimport { useDirection, type Direction } from \"./direction\";\nimport { classes, describedBy } from \"./utils\";\n\nexport interface NumberInputMessages {\n /** Accessible name of the − button. */\n decrease?: string;\n /** Accessible name of the + button. */\n increase?: string;\n}\n\nexport function numberInputMessages(\n locale: string,\n messages: NumberInputMessages = {},\n): Required<NumberInputMessages> {\n const ko = isKorean(locale);\n return {\n decrease: ko ? \"값 줄이기\" : \"Decrease\",\n increase: ko ? \"값 늘리기\" : \"Increase\",\n ...messages,\n };\n}\n\nexport interface NumberInputProps {\n /** null means empty. Controlled when not undefined. */\n value?: number | null;\n defaultValue?: number | null;\n /** Called with the new number, or null when emptied, only after a user change. */\n onValueChange?: (next: number | null) => void;\n min?: number;\n max?: number;\n /** Arrow keys and the stepper buttons move by step; PageUp/PageDown by ten steps. */\n step?: number;\n /** Formatting and parsing locale. Defaults to ko-KR. */\n locale?: string;\n /** Defaults to whole numbers with thousands separators. */\n formatOptions?: Intl.NumberFormatOptions;\n /** Show the − / + buttons. Defaults to true. */\n stepper?: boolean;\n /** Unit shown after the digits, for example 원, 개 or 분. */\n suffix?: string;\n label?: string;\n labelPlacement?: \"outside\" | \"hidden\";\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n /** Submits the plain number (1234.5), never the formatted text. */\n name?: string;\n form?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n /** Also invalid on its own while the number is outside min/max. */\n invalid?: boolean;\n placeholder?: string;\n messages?: NumberInputMessages;\n dir?: Direction;\n class?: string;\n}\n\n// Inlined from @devslab/dds-icons (minus/plus): importing the shared Icon here\n// would move the whole icon set into a chunk shared with the root entry.\nconst MINUS = [\"M5 12h14\"];\nconst PLUS = [\"M12 5v14\", \"M5 12h14\"];\nfunction StepIcon(props: { path: string[] }) {\n return (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n {props.path.map((d) => <path d={d} />)}\n </svg>\n );\n}\n\nconst FULL_WIDTH: Record<string, string> = {\n \",\": \",\",\n \".\": \".\",\n \"-\": \"-\",\n \"−\": \"-\",\n};\n/** Full-width digits from Japanese/Chinese IMEs become ASCII; other text is left for validation. */\nexport function normalizeNumberText(text: string) {\n return text.replace(/[0-9,.-−]/g, (char) =>\n char >= \"0\" && char <= \"9\"\n ? String.fromCharCode(char.charCodeAt(0) - 0xff10 + 48)\n : FULL_WIDTH[char]!,\n );\n}\n\nfunction separators(formatter: Intl.NumberFormat) {\n const parts = [\n ...formatter.formatToParts(-1234567.5),\n ...formatter.formatToParts(1234567.5),\n ];\n const find = (type: string) => parts.find((part) => part.type === type)?.value;\n const affixes = new Set<string>();\n for (const part of parts)\n if (![\"integer\", \"group\", \"decimal\", \"fraction\", \"minusSign\"].includes(part.type))\n for (const char of part.value) affixes.add(char);\n return {\n group: find(\"group\") ?? \"\",\n decimal: find(\"decimal\") ?? \".\",\n minus: find(\"minusSign\") ?? \"-\",\n affixes,\n };\n}\n\n/**\n * A localized number field. Values are numbers (or null for empty); display\n * text is formatted with Intl and never leaves the component.\n */\nexport function NumberInput(props: NumberInputProps) {\n const generated = createUniqueId();\n const id = () => props.id ?? `dds-number-input-${generated}`;\n const suffixId = () => `${id()}-suffix`;\n const locale = () => props.locale ?? \"ko-KR\";\n const messages = () => numberInputMessages(locale(), props.messages);\n const formatOptions = createMemo<Intl.NumberFormatOptions>(\n () => props.formatOptions ?? { maximumFractionDigits: 0 },\n );\n const formatter = createMemo(\n () => new Intl.NumberFormat(locale(), formatOptions()),\n );\n const syntax = createMemo(() => separators(formatter()));\n const fractions = () =>\n (formatter().resolvedOptions().maximumFractionDigits ?? 0) > 0;\n const format = (next: number | null) =>\n next === null || !Number.isFinite(next) ? \"\" : formatter().format(next);\n\n const controlled = () => props.value !== undefined;\n const [internal, setInternal] = createSignal<number | null>(\n props.defaultValue ?? null,\n );\n const current = () => (controlled() ? (props.value ?? null) : internal());\n // draft is the text in the field; draftNumber is what that text means.\n const [draft, setDraft] = createSignal(format(current()));\n const [draftNumber, setDraftNumber] = createSignal(current());\n const outOfRange = () => {\n const next = draftNumber();\n return (\n next !== null &&\n ((props.min !== undefined && next < props.min) ||\n (props.max !== undefined && next > props.max))\n );\n };\n const invalid = () => !!props.invalid || outOfRange();\n\n let root: HTMLDivElement | undefined;\n let input: HTMLInputElement | undefined;\n let composing = false;\n let resetting = false;\n const direction = useDirection(() => root, () => props.dir);\n\n const commit = (next: number | null) => {\n if (next === current()) return;\n if (!controlled()) setInternal(next);\n props.onValueChange?.(next);\n };\n\n const api = useNumberInput(() => ({\n id: `${id()}-root`,\n // Zag prefixes part IDs with \"number-input:\"; pin the two DDS documents.\n ids: { root: `${id()}-root`, input: id() },\n dir: direction(),\n locale: locale(),\n formatOptions: formatOptions(),\n value: draft(),\n step: props.step ?? 1,\n // Unset bounds stay absent: Zag's defaults are the safe-integer limits.\n ...(props.min !== undefined ? { min: props.min } : {}),\n ...(props.max !== undefined ? { max: props.max } : {}),\n allowMouseWheel: false,\n clampValueOnBlur: true,\n spinOnPress: true,\n inputMode: fractions() ? (\"decimal\" as const) : (\"numeric\" as const),\n disabled: props.disabled,\n readOnly: props.readOnly,\n required: props.required,\n invalid: invalid(),\n translations: {\n decrementLabel: messages().decrease,\n incrementLabel: messages().increase,\n valueText: (text: string) =>\n text && props.suffix ? `${text} ${props.suffix}` : text,\n },\n onValueChange: (details) => {\n if (resetting) return;\n const next = Number.isNaN(details.valueAsNumber)\n ? null\n : details.valueAsNumber;\n setDraft(details.value);\n setDraftNumber(next);\n commit(next);\n },\n }));\n\n // A parent-owned value that changes from outside replaces the field text.\n createEffect(\n on(\n current,\n (next) => {\n if (next === draftNumber()) return;\n setDraft(format(next));\n setDraftNumber(next);\n },\n { defer: true },\n ),\n );\n\n createEffect(() => {\n void props.form;\n const form = input?.form;\n if (!form) return;\n const reset = (event: Event) => {\n resetting = true;\n // A task, not a microtask: after a reset-button click, microtasks run\n // before the browser resets the controls and would be overwritten.\n setTimeout(() => {\n resetting = false;\n if (event.defaultPrevented) return;\n if (!controlled()) setInternal(props.defaultValue ?? null);\n setDraft(format(current()));\n setDraftNumber(current());\n if (input) input.value = draft();\n });\n };\n // Capture runs before Zag's own reset listener, which would emit a change.\n form.addEventListener(\"reset\", reset, { capture: true });\n onCleanup(() => form.removeEventListener(\"reset\", reset, { capture: true }));\n });\n\n // Keep everything from Zag except the handlers DDS composes below.\n const inputAttributes = mergeProps(() => {\n const {\n onKeyDown: _keyDown,\n onBeforeInput: _beforeInput,\n onInput: _input,\n onFocusOut: _focusOut,\n value: _value,\n ...attributes\n } = api().getInputProps() as Record<string, unknown>;\n return attributes;\n });\n const zag = () =>\n api().getInputProps() as Record<string, ((event: Event) => void) | undefined>;\n\n const acceptable = (text: string) => {\n const { group, decimal, minus, affixes } = syntax();\n let decimals = 0;\n for (const char of text) {\n if (char >= \"0\" && char <= \"9\") continue;\n if (char === group || (group.trim() === \"\" && char === \" \")) continue;\n if (char === decimal) {\n decimals += 1;\n if (!fractions() || decimals > 1) return false;\n continue;\n }\n if (char === minus || char === \"-\") {\n if (props.min !== undefined && props.min >= 0) return false;\n continue;\n }\n if (affixes.has(char)) continue;\n return false;\n }\n return true;\n };\n\n const stepBy = (delta: number) => {\n let next = (draftNumber() ?? 0) + delta;\n if (props.min !== undefined) next = Math.max(props.min, next);\n if (props.max !== undefined) next = Math.min(props.max, next);\n api().setValue(next);\n };\n\n return (\n <ArkNumberInput.RootProvider\n ref={root}\n value={api}\n class={classes(\"dds-number-input\", props.class)}\n data-label-placement={props.labelPlacement ?? \"outside\"}\n data-readonly={props.readOnly ? \"\" : undefined}\n data-stepper={props.stepper === false ? undefined : \"\"}\n >\n <Show when={props.label}>\n <ArkNumberInput.Label class=\"dds-number-input__label\">\n {props.label}\n </ArkNumberInput.Label>\n </Show>\n <ArkNumberInput.Control class=\"dds-number-input__control\">\n <input\n {...inputAttributes}\n ref={input}\n class=\"dds-number-input__field\"\n value={draft()}\n placeholder={props.placeholder}\n aria-label={props.label ? undefined : props[\"aria-label\"]}\n aria-labelledby={props.label ? undefined : props[\"aria-labelledby\"]}\n aria-describedby={describedBy(\n props.suffix ? suffixId() : undefined,\n props[\"aria-describedby\"],\n )}\n onCompositionStart={() => {\n composing = true;\n }}\n onCompositionEnd={(event) => {\n composing = false;\n // Hand the finished composition to the normal input path.\n event.currentTarget.dispatchEvent(\n new InputEvent(\"input\", { bubbles: true }),\n );\n }}\n onBeforeInput={(event) => {\n if (composing || event.isComposing) return;\n const target = event.currentTarget;\n const data = normalizeNumberText(event.data ?? \"\");\n const next =\n target.value.slice(0, target.selectionStart ?? target.value.length) +\n data +\n target.value.slice(target.selectionEnd ?? target.value.length);\n if (!acceptable(normalizeNumberText(next))) event.preventDefault();\n }}\n onInput={(event) => {\n if (composing) return;\n const target = event.currentTarget;\n const normalized = normalizeNumberText(target.value);\n if (!acceptable(normalized)) {\n // Letters, pasted units and the like are refused, not guessed at.\n target.value = draft();\n return;\n }\n if (normalized !== target.value) {\n const start = target.selectionStart;\n const end = target.selectionEnd;\n target.value = normalized;\n target.setSelectionRange(start, end);\n }\n zag().onInput?.(event);\n }}\n onKeyDown={(event) => {\n if (props.readOnly || props.disabled) return;\n if (event.isComposing || event.keyCode === 229) return;\n const step = props.step ?? 1;\n if (event.key === \"PageUp\" || event.key === \"PageDown\") {\n event.preventDefault();\n stepBy((event.key === \"PageUp\" ? 10 : -10) * step);\n return;\n }\n // Home/End jump to a bound only when that bound exists;\n // otherwise they keep moving the caret.\n if (event.key === \"Home\" && props.min === undefined) return;\n if (event.key === \"End\" && props.max === undefined) return;\n zag().onKeyDown?.(event);\n }}\n onFocusOut={(event) => {\n zag().onFocusOut?.(event);\n // A parent that declined the typed number gets its own value back.\n if (controlled() && draftNumber() !== current()) {\n setDraft(format(current()));\n setDraftNumber(current());\n }\n }}\n />\n <Show when={props.suffix}>\n <span id={suffixId()} class=\"dds-number-input__suffix\">\n {props.suffix}\n </span>\n </Show>\n <Show when={props.stepper !== false}>\n <span class=\"dds-number-input__steppers\">\n <ArkNumberInput.DecrementTrigger class=\"dds-number-input__step\">\n <StepIcon path={MINUS} />\n </ArkNumberInput.DecrementTrigger>\n <ArkNumberInput.IncrementTrigger class=\"dds-number-input__step\">\n <StepIcon path={PLUS} />\n </ArkNumberInput.IncrementTrigger>\n </span>\n </Show>\n </ArkNumberInput.Control>\n <input\n type=\"hidden\"\n name={props.name}\n form={props.form}\n value={draftNumber() === null ? \"\" : String(draftNumber())}\n disabled={props.disabled}\n />\n </ArkNumberInput.RootProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgBmB,oBACdC,QACAC,WAAgC,CAAC,GACF;CAC/B,MAAME,KAAKZ,SAASS,MAAM;C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"./direction";
2
+ export interface SegmentedControlItem {
3
+ /** Nonempty ID, unique within the control. This is what callbacks and forms receive. */
4
+ value: string;
5
+ label: string;
6
+ disabled?: boolean;
7
+ }
8
+ export interface SegmentedControlProps {
9
+ items: readonly SegmentedControlItem[];
10
+ value?: string;
11
+ defaultValue?: string;
12
+ /** Called with the chosen item ID, only after a user choice. */
13
+ onValueChange?: (value: string) => void;
14
+ /** Visible group label. Without it, supply aria-label or aria-labelledby. */
15
+ label?: string;
16
+ "aria-label"?: string;
17
+ "aria-labelledby"?: string;
18
+ "aria-describedby"?: string;
19
+ id?: string;
20
+ name?: string;
21
+ form?: string;
22
+ required?: boolean;
23
+ disabled?: boolean;
24
+ readOnly?: boolean;
25
+ invalid?: boolean;
26
+ /** md is 40px tall like other DDS controls, sm is 32px. */
27
+ size?: "md" | "sm";
28
+ /** Segments share the available width equally instead of sizing to their labels. */
29
+ fullWidth?: boolean;
30
+ dir?: Direction;
31
+ class?: string;
32
+ }
33
+ export declare function validateSegmentedItems(items: readonly SegmentedControlItem[]): void;
34
+ /**
35
+ * Single choice among a few visible options (view switch, filter).
36
+ * Radio-group semantics come from Ark: one tab stop, arrow keys move and select,
37
+ * and each segment submits through a native radio input.
38
+ */
39
+ export declare function SegmentedControl(props: SegmentedControlProps): import("solid-js").JSX.Element;
40
+ //# sourceMappingURL=segmented-control.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../src/segmented-control.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAI3D,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,6EAA6E;IAC7E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,oBAAoB,EAAE,QAW5E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,kCAoF5D"}
@@ -0,0 +1,133 @@
1
+ import { t as e } from "./utils-oKxhg9RG.js";
2
+ import { t } from "./direction-CS85IDNU.js";
3
+ import { n } from "./choice-types-kSaEnZPr.js";
4
+ import { For as r, Show as i, createEffect as a, createUniqueId as o } from "solid-js";
5
+ import { createComponent as s, getNextElement as c, insert as l, memo as u, template as d } from "solid-js/web";
6
+ import { SegmentGroup as f } from "@ark-ui/solid/segment-group";
7
+ //#region src/segmented-control.tsx
8
+ var p = /*#__PURE__*/ d("<div class=dds-segmented__track>");
9
+ function m(e) {
10
+ if (e.length === 0) throw Error("DDS SegmentedControl: items must not be empty");
11
+ let t = /* @__PURE__ */ new Set();
12
+ for (let n of e) {
13
+ if (!n.value || t.has(n.value)) throw Error(`DDS SegmentedControl: item values must be nonempty and unique (${JSON.stringify(n.value)})`);
14
+ t.add(n.value);
15
+ }
16
+ }
17
+ function h(d) {
18
+ let h = o(), g, _ = t(() => g, () => d.dir), v = d.value ?? d.defaultValue;
19
+ return a(() => m(d.items)), a(() => {
20
+ n() && !d.label && !d["aria-label"] && !d["aria-labelledby"] && console.warn("DDS SegmentedControl: supply label, aria-label or aria-labelledby.");
21
+ }), s(f.Root, {
22
+ ref(e) {
23
+ var t = g;
24
+ typeof t == "function" ? t(e) : g = e;
25
+ },
26
+ get id() {
27
+ return d.id ?? `dds-segmented-${h}`;
28
+ },
29
+ get ids() {
30
+ return u(() => !!d.id)() ? { root: d.id } : void 0;
31
+ },
32
+ get dir() {
33
+ return _();
34
+ },
35
+ orientation: "horizontal",
36
+ get value() {
37
+ return d.value;
38
+ },
39
+ get defaultValue() {
40
+ return d.defaultValue;
41
+ },
42
+ get name() {
43
+ return d.name;
44
+ },
45
+ get form() {
46
+ return d.form;
47
+ },
48
+ get required() {
49
+ return d.required;
50
+ },
51
+ get disabled() {
52
+ return d.disabled;
53
+ },
54
+ get readOnly() {
55
+ return d.readOnly;
56
+ },
57
+ get invalid() {
58
+ return d.invalid;
59
+ },
60
+ onValueChange: (e) => {
61
+ e.value !== null && d.onValueChange?.(e.value);
62
+ },
63
+ get "aria-label"() {
64
+ return u(() => !!d.label)() ? void 0 : d["aria-label"];
65
+ },
66
+ get "aria-labelledby"() {
67
+ return u(() => !!d.label)() ? void 0 : d["aria-labelledby"] ?? null;
68
+ },
69
+ get "aria-describedby"() {
70
+ return d["aria-describedby"];
71
+ },
72
+ get class() {
73
+ return e("dds-segmented", d.class);
74
+ },
75
+ get "data-size"() {
76
+ return d.size ?? "md";
77
+ },
78
+ get "data-full-width"() {
79
+ return d.fullWidth ? "" : void 0;
80
+ },
81
+ get children() {
82
+ return [s(i, {
83
+ get when() {
84
+ return d.label;
85
+ },
86
+ get children() {
87
+ return s(f.Label, {
88
+ class: "dds-segmented__label",
89
+ get children() {
90
+ return d.label;
91
+ }
92
+ });
93
+ }
94
+ }), (() => {
95
+ var e = c(p);
96
+ return l(e, s(r, {
97
+ get each() {
98
+ return d.items;
99
+ },
100
+ children: (e) => s(f.Item, {
101
+ get value() {
102
+ return e.value;
103
+ },
104
+ get disabled() {
105
+ return e.disabled;
106
+ },
107
+ class: "dds-segmented__item",
108
+ get title() {
109
+ return u(() => !!d.fullWidth)() ? e.label : void 0;
110
+ },
111
+ get children() {
112
+ return [s(f.ItemText, {
113
+ class: "dds-segmented__text",
114
+ get "data-text"() {
115
+ return e.label;
116
+ },
117
+ get children() {
118
+ return e.label;
119
+ }
120
+ }), s(f.ItemHiddenInput, { ref: (t) => {
121
+ t.defaultChecked = v === e.value;
122
+ } })];
123
+ }
124
+ })
125
+ })), e;
126
+ })()];
127
+ }
128
+ });
129
+ }
130
+ //#endregion
131
+ export { h as SegmentedControl, m as validateSegmentedItems };
132
+
133
+ //# sourceMappingURL=segmented-control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.js","names":["SegmentGroup","createEffect","createUniqueId","For","Show","useDirection","Direction","choiceWarningsEnabled","classes","SegmentedControlItem","value","label","disabled","SegmentedControlProps","items","defaultValue","onValueChange","id","name","form","required","readOnly","invalid","size","fullWidth","dir","class","validateSegmentedItems","length","Error","ids","Set","item","has","JSON","stringify","add","SegmentedControl","props","generated","root","HTMLDivElement","direction","initialValue","console","warn","_$createComponent","Root","ref","r$","_ref$","_$memo","undefined","orientation","details","aria-label","aria-labelledby","aria-describedby","data-size","data-full-width","children","when","Label","_el$","_$getNextElement","_tmpl$","_$insert","each","Item","title","ItemText","data-text","ItemHiddenInput","input","defaultChecked"],"sources":["../src/segmented-control.tsx"],"sourcesContent":["import { SegmentGroup } from \"@ark-ui/solid/segment-group\";\nimport { createEffect, createUniqueId, For, Show } from \"solid-js\";\nimport { useDirection, type Direction } from \"./direction\";\nimport { choiceWarningsEnabled } from \"./choice-types\";\nimport { classes } from \"./utils\";\n\nexport interface SegmentedControlItem {\n /** Nonempty ID, unique within the control. This is what callbacks and forms receive. */\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n items: readonly SegmentedControlItem[];\n value?: string;\n defaultValue?: string;\n /** Called with the chosen item ID, only after a user choice. */\n onValueChange?: (value: string) => void;\n /** Visible group label. Without it, supply aria-label or aria-labelledby. */\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n name?: string;\n form?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n /** md is 40px tall like other DDS controls, sm is 32px. */\n size?: \"md\" | \"sm\";\n /** Segments share the available width equally instead of sizing to their labels. */\n fullWidth?: boolean;\n dir?: Direction;\n class?: string;\n}\n\nexport function validateSegmentedItems(items: readonly SegmentedControlItem[]) {\n if (items.length === 0)\n throw new Error(\"DDS SegmentedControl: items must not be empty\");\n const ids = new Set<string>();\n for (const item of items) {\n if (!item.value || ids.has(item.value))\n throw new Error(\n `DDS SegmentedControl: item values must be nonempty and unique (${JSON.stringify(item.value)})`,\n );\n ids.add(item.value);\n }\n}\n\n/**\n * Single choice among a few visible options (view switch, filter).\n * Radio-group semantics come from Ark: one tab stop, arrow keys move and select,\n * and each segment submits through a native radio input.\n */\nexport function SegmentedControl(props: SegmentedControlProps) {\n // Ark derives every part ID (label, radios) from the root ID; an undefined\n // id prop would override its generated one and collide across instances.\n const generated = createUniqueId();\n let root: HTMLDivElement | undefined;\n const direction = useDirection(() => root, () => props.dir);\n const initialValue = props.value ?? props.defaultValue;\n createEffect(() => validateSegmentedItems(props.items));\n createEffect(() => {\n if (\n choiceWarningsEnabled() &&\n !props.label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n )\n console.warn(\n \"DDS SegmentedControl: supply label, aria-label or aria-labelledby.\",\n );\n });\n return (\n <SegmentGroup.Root\n ref={root}\n id={props.id ?? `dds-segmented-${generated}`}\n // A consumer id lands on the group element itself, not on Zag's prefixed root ID.\n ids={props.id ? { root: props.id } : undefined}\n dir={direction()}\n orientation=\"horizontal\"\n value={props.value}\n defaultValue={props.defaultValue}\n name={props.name}\n form={props.form}\n required={props.required}\n disabled={props.disabled}\n readOnly={props.readOnly}\n invalid={props.invalid}\n onValueChange={(details) => {\n if (details.value !== null) props.onValueChange?.(details.value);\n }}\n // Without a visible label the group is named by the consumer's attributes;\n // Ark's own aria-labelledby would otherwise point at a label that is not rendered.\n aria-label={props.label ? undefined : props[\"aria-label\"]}\n // (null removes Ark's attribute; undefined would let it through the merge.)\n aria-labelledby={\n props.label\n ? undefined\n : ((props[\"aria-labelledby\"] ?? null) as unknown as string)\n }\n aria-describedby={props[\"aria-describedby\"]}\n class={classes(\"dds-segmented\", props.class)}\n data-size={props.size ?? \"md\"}\n data-full-width={props.fullWidth ? \"\" : undefined}\n >\n <Show when={props.label}>\n <SegmentGroup.Label class=\"dds-segmented__label\">\n {props.label}\n </SegmentGroup.Label>\n </Show>\n <div class=\"dds-segmented__track\">\n <For each={props.items}>\n {(item) => (\n <SegmentGroup.Item\n value={item.value}\n disabled={item.disabled}\n class=\"dds-segmented__item\"\n title={props.fullWidth ? item.label : undefined}\n >\n <SegmentGroup.ItemText\n class=\"dds-segmented__text\"\n data-text={item.label}\n >\n {item.label}\n </SegmentGroup.ItemText>\n <SegmentGroup.ItemHiddenInput\n ref={(input) => {\n // Native form reset returns to the first rendered choice.\n input.defaultChecked = initialValue === item.value;\n }}\n />\n </SegmentGroup.Item>\n )}\n </For>\n </div>\n </SegmentGroup.Root>\n );\n}\n"],"mappings":";;;;;;;;AAuCA,SAAgB2B,EAAuBb,GAAwC;CAC7E,IAAIA,EAAMc,WAAW,GACnB,MAAUC,MAAM,+CAA+C;CACjE,IAAMC,oBAAM,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AAA;MAAA,IAEvByD,QAAK;OAAA,OAAElB,QAAA,CAAA,CAAAb,EAAMd,SAAS,CAAA,CAAA,IAAGQ,EAAKrB,QAAQyC,KAAAA;MAAS;MAAA,IAAAQ,WAAA;OAAA,OAAA,CAAAd,EAE9C9C,EAAasE,UAAQ;QAAA,OAAA;QAAA,IAAA,cAAA;SAAA,OAETtC,EAAKrB;QAAK;QAAA,IAAAiD,WAAA;SAAA,OAEpB5B,EAAKrB;QAAK;OAAA,CAAA,GAAAmC,EAEZ9C,EAAawE,iBAAe,EAAAxB,MACrByB,MAAU;QAEdA,EAAMC,iBAAiB/B,MAAiBX,EAAKtB;OAC/C,EAAC,CAAA,CAAA;MAAA;KAAA,CAAA;IAGN,CAAA,CAAA,GAAAqD;GAAA,EAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
@@ -0,0 +1,138 @@
1
+ import { t as classes } from "./assets/utils-Ou0UJRlO.js";
2
+ import { t as useDirection } from "./assets/direction-BpTqmXs-.js";
3
+ import { n as choiceWarningsEnabled } from "./assets/choice-types-h4YVL8xH.js";
4
+ import { For, Show, createEffect, createUniqueId } from "solid-js";
5
+ import { createComponent, escape, memo, ssr, ssrHydrationKey } from "solid-js/web";
6
+ import { SegmentGroup } from "@ark-ui/solid/segment-group";
7
+ //#region src/segmented-control.tsx
8
+ var _tmpl$ = [
9
+ "<div",
10
+ " class=\"dds-segmented__track\">",
11
+ "</div>"
12
+ ];
13
+ function validateSegmentedItems(items) {
14
+ if (items.length === 0) throw new Error("DDS SegmentedControl: items must not be empty");
15
+ const ids = /* @__PURE__ */ new Set();
16
+ for (const item of items) {
17
+ if (!item.value || ids.has(item.value)) throw new Error(`DDS SegmentedControl: item values must be nonempty and unique (${JSON.stringify(item.value)})`);
18
+ ids.add(item.value);
19
+ }
20
+ }
21
+ /**
22
+ * Single choice among a few visible options (view switch, filter).
23
+ * Radio-group semantics come from Ark: one tab stop, arrow keys move and select,
24
+ * and each segment submits through a native radio input.
25
+ */
26
+ function SegmentedControl(props) {
27
+ const generated = createUniqueId();
28
+ let root;
29
+ const direction = useDirection(() => root, () => props.dir);
30
+ props.value ?? props.defaultValue;
31
+ createEffect(() => validateSegmentedItems(props.items));
32
+ createEffect(() => {
33
+ if (choiceWarningsEnabled() && !props.label && !props["aria-label"] && !props["aria-labelledby"]) console.warn("DDS SegmentedControl: supply label, aria-label or aria-labelledby.");
34
+ });
35
+ return createComponent(SegmentGroup.Root, {
36
+ get id() {
37
+ return props.id ?? `dds-segmented-${generated}`;
38
+ },
39
+ get ids() {
40
+ return memo(() => !!props.id)() ? { root: props.id } : void 0;
41
+ },
42
+ get dir() {
43
+ return direction();
44
+ },
45
+ orientation: "horizontal",
46
+ get value() {
47
+ return props.value;
48
+ },
49
+ get defaultValue() {
50
+ return props.defaultValue;
51
+ },
52
+ get name() {
53
+ return props.name;
54
+ },
55
+ get form() {
56
+ return props.form;
57
+ },
58
+ get required() {
59
+ return props.required;
60
+ },
61
+ get disabled() {
62
+ return props.disabled;
63
+ },
64
+ get readOnly() {
65
+ return props.readOnly;
66
+ },
67
+ get invalid() {
68
+ return props.invalid;
69
+ },
70
+ onValueChange: (details) => {
71
+ if (details.value !== null) props.onValueChange?.(details.value);
72
+ },
73
+ get ["aria-label"]() {
74
+ return memo(() => !!props.label)() ? void 0 : props["aria-label"];
75
+ },
76
+ get ["aria-labelledby"]() {
77
+ return memo(() => !!props.label)() ? void 0 : props["aria-labelledby"] ?? null;
78
+ },
79
+ get ["aria-describedby"]() {
80
+ return props["aria-describedby"];
81
+ },
82
+ get ["class"]() {
83
+ return classes("dds-segmented", props.class);
84
+ },
85
+ get ["data-size"]() {
86
+ return props.size ?? "md";
87
+ },
88
+ get ["data-full-width"]() {
89
+ return props.fullWidth ? "" : void 0;
90
+ },
91
+ get children() {
92
+ return [createComponent(Show, {
93
+ get when() {
94
+ return props.label;
95
+ },
96
+ get children() {
97
+ return createComponent(SegmentGroup.Label, {
98
+ "class": "dds-segmented__label",
99
+ get children() {
100
+ return props.label;
101
+ }
102
+ });
103
+ }
104
+ }), ssr(_tmpl$, ssrHydrationKey(), escape(createComponent(For, {
105
+ get each() {
106
+ return props.items;
107
+ },
108
+ children: (item) => createComponent(SegmentGroup.Item, {
109
+ get value() {
110
+ return item.value;
111
+ },
112
+ get disabled() {
113
+ return item.disabled;
114
+ },
115
+ "class": "dds-segmented__item",
116
+ get title() {
117
+ return memo(() => !!props.fullWidth)() ? item.label : void 0;
118
+ },
119
+ get children() {
120
+ return [createComponent(SegmentGroup.ItemText, {
121
+ "class": "dds-segmented__text",
122
+ get ["data-text"]() {
123
+ return item.label;
124
+ },
125
+ get children() {
126
+ return item.label;
127
+ }
128
+ }), createComponent(SegmentGroup.ItemHiddenInput, {})];
129
+ }
130
+ })
131
+ })))];
132
+ }
133
+ });
134
+ }
135
+ //#endregion
136
+ export { SegmentedControl, validateSegmentedItems };
137
+
138
+ //# sourceMappingURL=segmented-control.server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"segmented-control.server.js","names":["SegmentGroup","createEffect","createUniqueId","For","Show","useDirection","Direction","choiceWarningsEnabled","classes","SegmentedControlItem","value","label","disabled","SegmentedControlProps","items","defaultValue","onValueChange","id","name","form","required","readOnly","invalid","size","fullWidth","dir","class","validateSegmentedItems","length","Error","ids","Set","item","has","JSON","stringify","add","SegmentedControl","props","generated","root","HTMLDivElement","direction","initialValue","console","warn","_$createComponent","Root","_$memo","undefined","orientation","details","aria-label","aria-labelledby","aria-describedby","data-size","data-full-width","children","when","Label","_$ssr","_tmpl$","_$ssrHydrationKey","_$escape","each","Item","title","ItemText","data-text","ItemHiddenInput"],"sources":["../src/segmented-control.tsx"],"sourcesContent":["import { SegmentGroup } from \"@ark-ui/solid/segment-group\";\nimport { createEffect, createUniqueId, For, Show } from \"solid-js\";\nimport { useDirection, type Direction } from \"./direction\";\nimport { choiceWarningsEnabled } from \"./choice-types\";\nimport { classes } from \"./utils\";\n\nexport interface SegmentedControlItem {\n /** Nonempty ID, unique within the control. This is what callbacks and forms receive. */\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps {\n items: readonly SegmentedControlItem[];\n value?: string;\n defaultValue?: string;\n /** Called with the chosen item ID, only after a user choice. */\n onValueChange?: (value: string) => void;\n /** Visible group label. Without it, supply aria-label or aria-labelledby. */\n label?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n \"aria-describedby\"?: string;\n id?: string;\n name?: string;\n form?: string;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n /** md is 40px tall like other DDS controls, sm is 32px. */\n size?: \"md\" | \"sm\";\n /** Segments share the available width equally instead of sizing to their labels. */\n fullWidth?: boolean;\n dir?: Direction;\n class?: string;\n}\n\nexport function validateSegmentedItems(items: readonly SegmentedControlItem[]) {\n if (items.length === 0)\n throw new Error(\"DDS SegmentedControl: items must not be empty\");\n const ids = new Set<string>();\n for (const item of items) {\n if (!item.value || ids.has(item.value))\n throw new Error(\n `DDS SegmentedControl: item values must be nonempty and unique (${JSON.stringify(item.value)})`,\n );\n ids.add(item.value);\n }\n}\n\n/**\n * Single choice among a few visible options (view switch, filter).\n * Radio-group semantics come from Ark: one tab stop, arrow keys move and select,\n * and each segment submits through a native radio input.\n */\nexport function SegmentedControl(props: SegmentedControlProps) {\n // Ark derives every part ID (label, radios) from the root ID; an undefined\n // id prop would override its generated one and collide across instances.\n const generated = createUniqueId();\n let root: HTMLDivElement | undefined;\n const direction = useDirection(() => root, () => props.dir);\n const initialValue = props.value ?? props.defaultValue;\n createEffect(() => validateSegmentedItems(props.items));\n createEffect(() => {\n if (\n choiceWarningsEnabled() &&\n !props.label &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n )\n console.warn(\n \"DDS SegmentedControl: supply label, aria-label or aria-labelledby.\",\n );\n });\n return (\n <SegmentGroup.Root\n ref={root}\n id={props.id ?? `dds-segmented-${generated}`}\n // A consumer id lands on the group element itself, not on Zag's prefixed root ID.\n ids={props.id ? { root: props.id } : undefined}\n dir={direction()}\n orientation=\"horizontal\"\n value={props.value}\n defaultValue={props.defaultValue}\n name={props.name}\n form={props.form}\n required={props.required}\n disabled={props.disabled}\n readOnly={props.readOnly}\n invalid={props.invalid}\n onValueChange={(details) => {\n if (details.value !== null) props.onValueChange?.(details.value);\n }}\n // Without a visible label the group is named by the consumer's attributes;\n // Ark's own aria-labelledby would otherwise point at a label that is not rendered.\n aria-label={props.label ? undefined : props[\"aria-label\"]}\n // (null removes Ark's attribute; undefined would let it through the merge.)\n aria-labelledby={\n props.label\n ? undefined\n : ((props[\"aria-labelledby\"] ?? null) as unknown as string)\n }\n aria-describedby={props[\"aria-describedby\"]}\n class={classes(\"dds-segmented\", props.class)}\n data-size={props.size ?? \"md\"}\n data-full-width={props.fullWidth ? \"\" : undefined}\n >\n <Show when={props.label}>\n <SegmentGroup.Label class=\"dds-segmented__label\">\n {props.label}\n </SegmentGroup.Label>\n </Show>\n <div class=\"dds-segmented__track\">\n <For each={props.items}>\n {(item) => (\n <SegmentGroup.Item\n value={item.value}\n disabled={item.disabled}\n class=\"dds-segmented__item\"\n title={props.fullWidth ? item.label : undefined}\n >\n <SegmentGroup.ItemText\n class=\"dds-segmented__text\"\n data-text={item.label}\n >\n {item.label}\n </SegmentGroup.ItemText>\n <SegmentGroup.ItemHiddenInput\n ref={(input) => {\n // Native form reset returns to the first rendered choice.\n input.defaultChecked = initialValue === item.value;\n }}\n />\n </SegmentGroup.Item>\n )}\n </For>\n </div>\n </SegmentGroup.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAuCA,SAAgB2B,uBAAuBb,OAAwC;CAC7E,IAAIA,MAAMc,WAAW,GACnB,MAAM,IAAIC,MAAM,+CAA+C;CACjE,MAAMC,sBAAM,IAAIC,IAAY;CAC5B,KAAK,MAAMC,QAAQlB,OAAO;EACxB,IAAI,CAACkB,KAAKtB,SAASoB,IAAIG,IAAID,KAAKtB,KAAK,GACnC,MAAM,IAAImB,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,OAETnC,KAAKrB;OAAK;OAAA,IAAA8C,WAAA;QAAA,OAEpBzB,KAAKrB;OAAK;MAAA,CAAA,GAAAmC,gBAEZ9C,aAAaqE,iBAAe,CAAA,CAAA,CAAA;KAAA;IAAA,CAAA;GAOhC,CAAA,CAAA,CAAA,CAAA;EAAA;CAAA,CAAA;AAKX"}
@@ -1,4 +1,4 @@
1
- import { t as e } from "./choice-BPMiJlPJ.js";
1
+ import { t as e } from "./choice-CTNeFOVo.js";
2
2
  import { createComponent as t, mergeProps as n } from "solid-js/web";
3
3
  //#region src/select-picker.tsx
4
4
  function r(r) {