@ttoss/fsl-ui 0.2.4

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 (174) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +30 -0
  4. package/dist/components/Breadcrumbs/Breadcrumbs.cjs +129 -0
  5. package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +61 -0
  6. package/dist/components/Breadcrumbs/Breadcrumbs.d.mts +61 -0
  7. package/dist/components/Breadcrumbs/Breadcrumbs.mjs +126 -0
  8. package/dist/components/Button/Button.cjs +80 -0
  9. package/dist/components/Button/Button.d.cts +68 -0
  10. package/dist/components/Button/Button.d.mts +68 -0
  11. package/dist/components/Button/Button.mjs +79 -0
  12. package/dist/components/Checkbox/Checkbox.cjs +183 -0
  13. package/dist/components/Checkbox/Checkbox.d.cts +45 -0
  14. package/dist/components/Checkbox/Checkbox.d.mts +45 -0
  15. package/dist/components/Checkbox/Checkbox.mjs +182 -0
  16. package/dist/components/CheckboxGroup/CheckboxGroup.cjs +97 -0
  17. package/dist/components/CheckboxGroup/CheckboxGroup.d.cts +56 -0
  18. package/dist/components/CheckboxGroup/CheckboxGroup.d.mts +56 -0
  19. package/dist/components/CheckboxGroup/CheckboxGroup.mjs +96 -0
  20. package/dist/components/FileTrigger/FileTrigger.cjs +51 -0
  21. package/dist/components/FileTrigger/FileTrigger.d.cts +52 -0
  22. package/dist/components/FileTrigger/FileTrigger.d.mts +52 -0
  23. package/dist/components/FileTrigger/FileTrigger.mjs +50 -0
  24. package/dist/components/GridList/GridList.cjs +220 -0
  25. package/dist/components/GridList/GridList.d.cts +72 -0
  26. package/dist/components/GridList/GridList.d.mts +72 -0
  27. package/dist/components/GridList/GridList.mjs +217 -0
  28. package/dist/components/Group/Group.cjs +77 -0
  29. package/dist/components/Group/Group.d.cts +61 -0
  30. package/dist/components/Group/Group.d.mts +61 -0
  31. package/dist/components/Group/Group.mjs +74 -0
  32. package/dist/components/Icon/Icon.cjs +52 -0
  33. package/dist/components/Icon/Icon.mjs +52 -0
  34. package/dist/components/Icon/glyphs.cjs +72 -0
  35. package/dist/components/Icon/glyphs.mjs +63 -0
  36. package/dist/components/Link/Link.cjs +62 -0
  37. package/dist/components/Link/Link.d.cts +38 -0
  38. package/dist/components/Link/Link.d.mts +38 -0
  39. package/dist/components/Link/Link.mjs +61 -0
  40. package/dist/components/ListBox/ListBox.cjs +126 -0
  41. package/dist/components/ListBox/ListBox.d.cts +63 -0
  42. package/dist/components/ListBox/ListBox.d.mts +63 -0
  43. package/dist/components/ListBox/ListBox.mjs +123 -0
  44. package/dist/components/Meter/Meter.cjs +126 -0
  45. package/dist/components/Meter/Meter.d.cts +63 -0
  46. package/dist/components/Meter/Meter.d.mts +63 -0
  47. package/dist/components/Meter/Meter.mjs +125 -0
  48. package/dist/components/NumberField/NumberField.cjs +221 -0
  49. package/dist/components/NumberField/NumberField.d.cts +68 -0
  50. package/dist/components/NumberField/NumberField.d.mts +68 -0
  51. package/dist/components/NumberField/NumberField.mjs +220 -0
  52. package/dist/components/ProgressBar/ProgressBar.cjs +132 -0
  53. package/dist/components/ProgressBar/ProgressBar.d.cts +56 -0
  54. package/dist/components/ProgressBar/ProgressBar.d.mts +56 -0
  55. package/dist/components/ProgressBar/ProgressBar.mjs +129 -0
  56. package/dist/components/RadioGroup/RadioGroup.cjs +218 -0
  57. package/dist/components/RadioGroup/RadioGroup.d.cts +82 -0
  58. package/dist/components/RadioGroup/RadioGroup.d.mts +82 -0
  59. package/dist/components/RadioGroup/RadioGroup.mjs +215 -0
  60. package/dist/components/Select/Select.cjs +253 -0
  61. package/dist/components/Select/Select.d.cts +86 -0
  62. package/dist/components/Select/Select.d.mts +86 -0
  63. package/dist/components/Select/Select.mjs +250 -0
  64. package/dist/components/Separator/Separator.cjs +64 -0
  65. package/dist/components/Separator/Separator.d.cts +44 -0
  66. package/dist/components/Separator/Separator.d.mts +44 -0
  67. package/dist/components/Separator/Separator.mjs +63 -0
  68. package/dist/components/Slider/Slider.cjs +160 -0
  69. package/dist/components/Slider/Slider.d.cts +45 -0
  70. package/dist/components/Slider/Slider.d.mts +45 -0
  71. package/dist/components/Slider/Slider.mjs +159 -0
  72. package/dist/components/Switch/Switch.cjs +176 -0
  73. package/dist/components/Switch/Switch.d.cts +43 -0
  74. package/dist/components/Switch/Switch.d.mts +43 -0
  75. package/dist/components/Switch/Switch.mjs +175 -0
  76. package/dist/components/Tabs/Tabs.cjs +180 -0
  77. package/dist/components/Tabs/Tabs.d.cts +85 -0
  78. package/dist/components/Tabs/Tabs.d.mts +85 -0
  79. package/dist/components/Tabs/Tabs.mjs +173 -0
  80. package/dist/components/Toast/Toast.cjs +218 -0
  81. package/dist/components/Toast/Toast.d.cts +96 -0
  82. package/dist/components/Toast/Toast.d.mts +96 -0
  83. package/dist/components/Toast/Toast.mjs +214 -0
  84. package/dist/components/ToggleButton/ToggleButton.cjs +125 -0
  85. package/dist/components/ToggleButton/ToggleButton.d.cts +43 -0
  86. package/dist/components/ToggleButton/ToggleButton.d.mts +43 -0
  87. package/dist/components/ToggleButton/ToggleButton.mjs +124 -0
  88. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.cjs +48 -0
  89. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.cts +41 -0
  90. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.d.mts +41 -0
  91. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.mjs +47 -0
  92. package/dist/components/Toolbar/Toolbar.cjs +67 -0
  93. package/dist/components/Toolbar/Toolbar.d.cts +60 -0
  94. package/dist/components/Toolbar/Toolbar.d.mts +60 -0
  95. package/dist/components/Toolbar/Toolbar.mjs +66 -0
  96. package/dist/composites/Accordion/Accordion.cjs +279 -0
  97. package/dist/composites/Accordion/Accordion.d.cts +176 -0
  98. package/dist/composites/Accordion/Accordion.d.mts +176 -0
  99. package/dist/composites/Accordion/Accordion.mjs +270 -0
  100. package/dist/composites/ConfirmationDialog/ConfirmationDialog.cjs +206 -0
  101. package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.cts +166 -0
  102. package/dist/composites/ConfirmationDialog/ConfirmationDialog.d.mts +166 -0
  103. package/dist/composites/ConfirmationDialog/ConfirmationDialog.mjs +203 -0
  104. package/dist/composites/Dialog/Dialog.cjs +372 -0
  105. package/dist/composites/Dialog/Dialog.d.cts +234 -0
  106. package/dist/composites/Dialog/Dialog.d.mts +234 -0
  107. package/dist/composites/Dialog/Dialog.mjs +360 -0
  108. package/dist/composites/Disclosure/Disclosure.cjs +214 -0
  109. package/dist/composites/Disclosure/Disclosure.d.cts +118 -0
  110. package/dist/composites/Disclosure/Disclosure.d.mts +118 -0
  111. package/dist/composites/Disclosure/Disclosure.mjs +207 -0
  112. package/dist/composites/Form/Form.cjs +161 -0
  113. package/dist/composites/Form/Form.d.cts +176 -0
  114. package/dist/composites/Form/Form.d.mts +176 -0
  115. package/dist/composites/Form/Form.mjs +156 -0
  116. package/dist/composites/Menu/Menu.cjs +190 -0
  117. package/dist/composites/Menu/Menu.d.cts +158 -0
  118. package/dist/composites/Menu/Menu.d.mts +158 -0
  119. package/dist/composites/Menu/Menu.mjs +186 -0
  120. package/dist/composites/Popover/Popover.cjs +80 -0
  121. package/dist/composites/Popover/Popover.d.cts +56 -0
  122. package/dist/composites/Popover/Popover.d.mts +56 -0
  123. package/dist/composites/Popover/Popover.mjs +78 -0
  124. package/dist/composites/SearchField/SearchField.cjs +194 -0
  125. package/dist/composites/SearchField/SearchField.d.cts +81 -0
  126. package/dist/composites/SearchField/SearchField.d.mts +81 -0
  127. package/dist/composites/SearchField/SearchField.mjs +189 -0
  128. package/dist/composites/TagGroup/TagGroup.cjs +212 -0
  129. package/dist/composites/TagGroup/TagGroup.d.cts +84 -0
  130. package/dist/composites/TagGroup/TagGroup.d.mts +84 -0
  131. package/dist/composites/TagGroup/TagGroup.mjs +209 -0
  132. package/dist/composites/TextArea/TextArea.cjs +190 -0
  133. package/dist/composites/TextArea/TextArea.d.cts +95 -0
  134. package/dist/composites/TextArea/TextArea.d.mts +95 -0
  135. package/dist/composites/TextArea/TextArea.mjs +181 -0
  136. package/dist/composites/TextField/TextField.cjs +200 -0
  137. package/dist/composites/TextField/TextField.d.cts +111 -0
  138. package/dist/composites/TextField/TextField.d.mts +111 -0
  139. package/dist/composites/TextField/TextField.mjs +191 -0
  140. package/dist/composites/Tooltip/Tooltip.cjs +79 -0
  141. package/dist/composites/Tooltip/Tooltip.d.cts +53 -0
  142. package/dist/composites/Tooltip/Tooltip.d.mts +53 -0
  143. package/dist/composites/Tooltip/Tooltip.mjs +77 -0
  144. package/dist/composites/Wizard/Wizard.cjs +333 -0
  145. package/dist/composites/Wizard/Wizard.d.cts +206 -0
  146. package/dist/composites/Wizard/Wizard.d.mts +206 -0
  147. package/dist/composites/Wizard/Wizard.mjs +324 -0
  148. package/dist/composites/scope.cjs +124 -0
  149. package/dist/composites/scope.mjs +121 -0
  150. package/dist/index.cjs +186 -0
  151. package/dist/index.d.cts +37 -0
  152. package/dist/index.d.mts +37 -0
  153. package/dist/index.mjs +39 -0
  154. package/dist/semantics/componentMeta.d.cts +37 -0
  155. package/dist/semantics/componentMeta.d.mts +37 -0
  156. package/dist/semantics/index.cjs +16 -0
  157. package/dist/semantics/index.d.cts +4 -0
  158. package/dist/semantics/index.d.mts +4 -0
  159. package/dist/semantics/index.mjs +3 -0
  160. package/dist/semantics/taxonomy.cjs +150 -0
  161. package/dist/semantics/taxonomy.d.cts +153 -0
  162. package/dist/semantics/taxonomy.d.mts +153 -0
  163. package/dist/semantics/taxonomy.mjs +140 -0
  164. package/dist/tokens/escapeHatch.cjs +13 -0
  165. package/dist/tokens/escapeHatch.mjs +13 -0
  166. package/dist/tokens/focusRing.cjs +28 -0
  167. package/dist/tokens/focusRing.mjs +28 -0
  168. package/dist/tokens/keyframes.cjs +76 -0
  169. package/dist/tokens/keyframes.mjs +75 -0
  170. package/dist/tokens/resolveInteractiveStyle.cjs +41 -0
  171. package/dist/tokens/resolveInteractiveStyle.mjs +41 -0
  172. package/llms.txt +142 -0
  173. package/package.json +70 -0
  174. package/src/tokens/CONTRACT.md +505 -0
@@ -0,0 +1,160 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ const require_focusRing = require('../../tokens/focusRing.cjs');
3
+ let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
4
+ let react_aria_components = require("react-aria-components");
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+
7
+ //#region src/components/Slider/Slider.tsx
8
+ /** Formal semantic identity — Slider root (Input entity). */
9
+ var sliderMeta = {
10
+ displayName: "Slider",
11
+ entity: "Input",
12
+ structure: "root"
13
+ };
14
+ var TRACK_THICKNESS = "0.375rem";
15
+ var THUMB_SIZE = "1.125rem";
16
+ /** The rail the thumb travels along. */
17
+ var buildTrackStyle = c => {
18
+ return {
19
+ boxSizing: "border-box",
20
+ position: "relative",
21
+ inlineSize: "100%",
22
+ blockSize: TRACK_THICKNESS,
23
+ borderRadius: _ttoss_fsl_theme_vars.vars.radii.round,
24
+ backgroundColor: c?.background?.disabled ?? c?.background?.default
25
+ };
26
+ };
27
+ /** The filled portion (from the first thumb — or 0 — to the last thumb). */
28
+ var buildFillStyle = ({
29
+ c,
30
+ state
31
+ }) => {
32
+ const lastIndex = state.values.length - 1;
33
+ const start = state.values.length > 1 ? state.getThumbPercent(0) : 0;
34
+ const end = state.getThumbPercent(lastIndex);
35
+ return {
36
+ position: "absolute",
37
+ blockSize: "100%",
38
+ insetInlineStart: `${start * 100}%`,
39
+ inlineSize: `${(end - start) * 100}%`,
40
+ borderRadius: "inherit",
41
+ backgroundColor: c?.border?.checked ?? c?.border?.default
42
+ };
43
+ };
44
+ /** The grabbable handle. */
45
+ var buildThumbStyle = ({
46
+ c,
47
+ isFocusVisible,
48
+ isDisabled
49
+ }) => {
50
+ const border = c?.border;
51
+ const background = c?.background;
52
+ const key = isDisabled ? "disabled" : "default";
53
+ return {
54
+ boxSizing: "border-box",
55
+ inlineSize: THUMB_SIZE,
56
+ blockSize: THUMB_SIZE,
57
+ borderRadius: _ttoss_fsl_theme_vars.vars.radii.round,
58
+ borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.control.width,
59
+ borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.control.style,
60
+ borderColor: border?.[key],
61
+ backgroundColor: background?.[key],
62
+ outline: require_focusRing.focusRingOutline(isFocusVisible)
63
+ };
64
+ };
65
+ /**
66
+ * A semantic slider built on React Aria's `Slider` — select one value (or a
67
+ * range) along a track. Entity = Input → reads `vars.colors.input.primary.*`.
68
+ * Supports `minValue`/`maxValue`/`step`, `orientation`, locale-aware
69
+ * `formatOptions`, and multiple thumbs (pass an array value for a range).
70
+ * Keyboard + RTL handling come from React Aria.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * <Slider label="Volume" defaultValue={50} />
75
+ * <Slider label="Price" defaultValue={[20, 80]} formatOptions={{ style: 'currency', currency: 'USD' }} />
76
+ * ```
77
+ */
78
+ var Slider = ({
79
+ label,
80
+ showOutput = true,
81
+ ...props
82
+ }) => {
83
+ const c = _ttoss_fsl_theme_vars.vars.colors.input.primary;
84
+ return /* @__PURE__ */(0, react_jsx_runtime.jsxs)(react_aria_components.Slider, {
85
+ ...props,
86
+ "data-scope": "slider",
87
+ "data-part": "root",
88
+ style: {
89
+ boxSizing: "border-box",
90
+ display: "flex",
91
+ flexDirection: "column",
92
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.xs
93
+ },
94
+ children: [(label != null || showOutput) && /* @__PURE__ */(0, react_jsx_runtime.jsxs)("div", {
95
+ "data-scope": "slider",
96
+ "data-part": "labelRow",
97
+ style: {
98
+ display: "flex",
99
+ justifyContent: "space-between",
100
+ alignItems: "baseline",
101
+ color: c?.text?.default,
102
+ ..._ttoss_fsl_theme_vars.vars.text.label.md
103
+ },
104
+ children: [label != null && /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Label, {
105
+ "data-scope": "slider",
106
+ "data-part": "label",
107
+ children: label
108
+ }), showOutput && /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.SliderOutput, {
109
+ "data-scope": "slider",
110
+ "data-part": "status"
111
+ })]
112
+ }), /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.SliderTrack, {
113
+ "data-scope": "slider",
114
+ "data-part": "track",
115
+ style: {
116
+ boxSizing: "border-box",
117
+ display: "flex",
118
+ alignItems: "center",
119
+ blockSize: THUMB_SIZE,
120
+ inlineSize: "100%"
121
+ },
122
+ children: ({
123
+ state
124
+ }) => {
125
+ return /* @__PURE__ */(0, react_jsx_runtime.jsxs)("div", {
126
+ style: buildTrackStyle(c),
127
+ children: [/* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
128
+ "data-scope": "slider",
129
+ "data-part": "fill",
130
+ style: buildFillStyle({
131
+ c,
132
+ state
133
+ })
134
+ }), state.values.map((_, index) => {
135
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.SliderThumb, {
136
+ index,
137
+ "data-scope": "slider",
138
+ "data-part": "control",
139
+ style: ({
140
+ isFocusVisible,
141
+ isDisabled
142
+ }) => {
143
+ return buildThumbStyle({
144
+ c,
145
+ isFocusVisible,
146
+ isDisabled
147
+ });
148
+ }
149
+ }, index);
150
+ })]
151
+ });
152
+ }
153
+ })]
154
+ });
155
+ };
156
+ Slider.displayName = sliderMeta.displayName;
157
+
158
+ //#endregion
159
+ exports.Slider = Slider;
160
+ exports.sliderMeta = sliderMeta;
@@ -0,0 +1,45 @@
1
+
2
+ import * as React from "react";
3
+ import { SliderProps } from "react-aria-components";
4
+
5
+ //#region src/components/Slider/Slider.d.ts
6
+ /** Formal semantic identity — Slider root (Input entity). */
7
+ declare const sliderMeta: {
8
+ readonly displayName: "Slider";
9
+ readonly entity: "Input";
10
+ readonly structure: "root";
11
+ };
12
+ /** Props for the Slider component. */
13
+ interface SliderProps$1<T extends number | number[] = number> extends Omit<SliderProps<T>, 'style' | 'className' | 'children'> {
14
+ /** Visible label displayed above the track. */
15
+ label?: React.ReactNode;
16
+ /**
17
+ * Whether to render the current value(s) next to the label (RAC
18
+ * `SliderOutput`, locale-formatted via `formatOptions`).
19
+ * @default true
20
+ */
21
+ showOutput?: boolean;
22
+ }
23
+ /**
24
+ * A semantic slider built on React Aria's `Slider` — select one value (or a
25
+ * range) along a track. Entity = Input → reads `vars.colors.input.primary.*`.
26
+ * Supports `minValue`/`maxValue`/`step`, `orientation`, locale-aware
27
+ * `formatOptions`, and multiple thumbs (pass an array value for a range).
28
+ * Keyboard + RTL handling come from React Aria.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <Slider label="Volume" defaultValue={50} />
33
+ * <Slider label="Price" defaultValue={[20, 80]} formatOptions={{ style: 'currency', currency: 'USD' }} />
34
+ * ```
35
+ */
36
+ declare const Slider: {
37
+ <T extends number | number[] = number>({
38
+ label,
39
+ showOutput,
40
+ ...props
41
+ }: SliderProps$1<T>): import("react/jsx-runtime").JSX.Element;
42
+ displayName: "Slider";
43
+ };
44
+ //#endregion
45
+ export { Slider, SliderProps$1 as SliderProps, sliderMeta };
@@ -0,0 +1,45 @@
1
+
2
+ import { SliderProps } from "react-aria-components";
3
+ import * as React from "react";
4
+
5
+ //#region src/components/Slider/Slider.d.ts
6
+ /** Formal semantic identity — Slider root (Input entity). */
7
+ declare const sliderMeta: {
8
+ readonly displayName: "Slider";
9
+ readonly entity: "Input";
10
+ readonly structure: "root";
11
+ };
12
+ /** Props for the Slider component. */
13
+ interface SliderProps$1<T extends number | number[] = number> extends Omit<SliderProps<T>, 'style' | 'className' | 'children'> {
14
+ /** Visible label displayed above the track. */
15
+ label?: React.ReactNode;
16
+ /**
17
+ * Whether to render the current value(s) next to the label (RAC
18
+ * `SliderOutput`, locale-formatted via `formatOptions`).
19
+ * @default true
20
+ */
21
+ showOutput?: boolean;
22
+ }
23
+ /**
24
+ * A semantic slider built on React Aria's `Slider` — select one value (or a
25
+ * range) along a track. Entity = Input → reads `vars.colors.input.primary.*`.
26
+ * Supports `minValue`/`maxValue`/`step`, `orientation`, locale-aware
27
+ * `formatOptions`, and multiple thumbs (pass an array value for a range).
28
+ * Keyboard + RTL handling come from React Aria.
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * <Slider label="Volume" defaultValue={50} />
33
+ * <Slider label="Price" defaultValue={[20, 80]} formatOptions={{ style: 'currency', currency: 'USD' }} />
34
+ * ```
35
+ */
36
+ declare const Slider$1: {
37
+ <T extends number | number[] = number>({
38
+ label,
39
+ showOutput,
40
+ ...props
41
+ }: SliderProps$1<T>): import("react/jsx-runtime").JSX.Element;
42
+ displayName: "Slider";
43
+ };
44
+ //#endregion
45
+ export { Slider$1 as Slider, SliderProps$1 as SliderProps, sliderMeta };
@@ -0,0 +1,159 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { focusRingOutline } from "../../tokens/focusRing.mjs";
3
+ import { vars } from "@ttoss/fsl-theme/vars";
4
+ import { Label, Slider, SliderOutput, SliderThumb, SliderTrack } from "react-aria-components";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+
7
+ //#region src/components/Slider/Slider.tsx
8
+ /** Formal semantic identity — Slider root (Input entity). */
9
+ var sliderMeta = {
10
+ displayName: "Slider",
11
+ entity: "Input",
12
+ structure: "root"
13
+ };
14
+ var TRACK_THICKNESS = "0.375rem";
15
+ var THUMB_SIZE = "1.125rem";
16
+ /** The rail the thumb travels along. */
17
+ var buildTrackStyle = c => {
18
+ return {
19
+ boxSizing: "border-box",
20
+ position: "relative",
21
+ inlineSize: "100%",
22
+ blockSize: TRACK_THICKNESS,
23
+ borderRadius: vars.radii.round,
24
+ backgroundColor: c?.background?.disabled ?? c?.background?.default
25
+ };
26
+ };
27
+ /** The filled portion (from the first thumb — or 0 — to the last thumb). */
28
+ var buildFillStyle = ({
29
+ c,
30
+ state
31
+ }) => {
32
+ const lastIndex = state.values.length - 1;
33
+ const start = state.values.length > 1 ? state.getThumbPercent(0) : 0;
34
+ const end = state.getThumbPercent(lastIndex);
35
+ return {
36
+ position: "absolute",
37
+ blockSize: "100%",
38
+ insetInlineStart: `${start * 100}%`,
39
+ inlineSize: `${(end - start) * 100}%`,
40
+ borderRadius: "inherit",
41
+ backgroundColor: c?.border?.checked ?? c?.border?.default
42
+ };
43
+ };
44
+ /** The grabbable handle. */
45
+ var buildThumbStyle = ({
46
+ c,
47
+ isFocusVisible,
48
+ isDisabled
49
+ }) => {
50
+ const border = c?.border;
51
+ const background = c?.background;
52
+ const key = isDisabled ? "disabled" : "default";
53
+ return {
54
+ boxSizing: "border-box",
55
+ inlineSize: THUMB_SIZE,
56
+ blockSize: THUMB_SIZE,
57
+ borderRadius: vars.radii.round,
58
+ borderWidth: vars.border.outline.control.width,
59
+ borderStyle: vars.border.outline.control.style,
60
+ borderColor: border?.[key],
61
+ backgroundColor: background?.[key],
62
+ outline: focusRingOutline(isFocusVisible)
63
+ };
64
+ };
65
+ /**
66
+ * A semantic slider built on React Aria's `Slider` — select one value (or a
67
+ * range) along a track. Entity = Input → reads `vars.colors.input.primary.*`.
68
+ * Supports `minValue`/`maxValue`/`step`, `orientation`, locale-aware
69
+ * `formatOptions`, and multiple thumbs (pass an array value for a range).
70
+ * Keyboard + RTL handling come from React Aria.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * <Slider label="Volume" defaultValue={50} />
75
+ * <Slider label="Price" defaultValue={[20, 80]} formatOptions={{ style: 'currency', currency: 'USD' }} />
76
+ * ```
77
+ */
78
+ var Slider$1 = ({
79
+ label,
80
+ showOutput = true,
81
+ ...props
82
+ }) => {
83
+ const c = vars.colors.input.primary;
84
+ return /* @__PURE__ */jsxs(Slider, {
85
+ ...props,
86
+ "data-scope": "slider",
87
+ "data-part": "root",
88
+ style: {
89
+ boxSizing: "border-box",
90
+ display: "flex",
91
+ flexDirection: "column",
92
+ gap: vars.spacing.gap.stack.xs
93
+ },
94
+ children: [(label != null || showOutput) && /* @__PURE__ */jsxs("div", {
95
+ "data-scope": "slider",
96
+ "data-part": "labelRow",
97
+ style: {
98
+ display: "flex",
99
+ justifyContent: "space-between",
100
+ alignItems: "baseline",
101
+ color: c?.text?.default,
102
+ ...vars.text.label.md
103
+ },
104
+ children: [label != null && /* @__PURE__ */jsx(Label, {
105
+ "data-scope": "slider",
106
+ "data-part": "label",
107
+ children: label
108
+ }), showOutput && /* @__PURE__ */jsx(SliderOutput, {
109
+ "data-scope": "slider",
110
+ "data-part": "status"
111
+ })]
112
+ }), /* @__PURE__ */jsx(SliderTrack, {
113
+ "data-scope": "slider",
114
+ "data-part": "track",
115
+ style: {
116
+ boxSizing: "border-box",
117
+ display: "flex",
118
+ alignItems: "center",
119
+ blockSize: THUMB_SIZE,
120
+ inlineSize: "100%"
121
+ },
122
+ children: ({
123
+ state
124
+ }) => {
125
+ return /* @__PURE__ */jsxs("div", {
126
+ style: buildTrackStyle(c),
127
+ children: [/* @__PURE__ */jsx("div", {
128
+ "data-scope": "slider",
129
+ "data-part": "fill",
130
+ style: buildFillStyle({
131
+ c,
132
+ state
133
+ })
134
+ }), state.values.map((_, index) => {
135
+ return /* @__PURE__ */jsx(SliderThumb, {
136
+ index,
137
+ "data-scope": "slider",
138
+ "data-part": "control",
139
+ style: ({
140
+ isFocusVisible,
141
+ isDisabled
142
+ }) => {
143
+ return buildThumbStyle({
144
+ c,
145
+ isFocusVisible,
146
+ isDisabled
147
+ });
148
+ }
149
+ }, index);
150
+ })]
151
+ });
152
+ }
153
+ })]
154
+ });
155
+ };
156
+ Slider$1.displayName = sliderMeta.displayName;
157
+
158
+ //#endregion
159
+ export { Slider$1 as Slider, sliderMeta };
@@ -0,0 +1,176 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ const require_focusRing = require('../../tokens/focusRing.cjs');
3
+ const require_resolveInteractiveStyle = require('../../tokens/resolveInteractiveStyle.cjs');
4
+ let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
5
+ let react_aria_components = require("react-aria-components");
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+
8
+ //#region src/components/Switch/Switch.tsx
9
+ /** Formal semantic identity — Switch root (Selection entity, toggle.binary). */
10
+ var switchMeta = {
11
+ displayName: "Switch",
12
+ entity: "Selection",
13
+ structure: "root"
14
+ };
15
+ var TRACK_W = "2.5rem";
16
+ var TRACK_H = "1.5rem";
17
+ var THUMB_SIZE = "1.125rem";
18
+ var THUMB_OFFSET = "0.1875rem";
19
+ var TRACK_STYLE_STATIC = {
20
+ boxSizing: "border-box",
21
+ position: "relative",
22
+ flexShrink: 0,
23
+ display: "inline-block",
24
+ width: TRACK_W,
25
+ height: TRACK_H,
26
+ borderRadius: _ttoss_fsl_theme_vars.vars.radii.round,
27
+ borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.control.width,
28
+ borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.control.style,
29
+ transitionProperty: "background-color, border-color",
30
+ transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
31
+ transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing,
32
+ outlineOffset: "2px"
33
+ };
34
+ /** Sliding-track style (state-dependent background/border + focus ring). */
35
+ var buildTrackStyle = ({
36
+ c,
37
+ isDisabled,
38
+ isSelected,
39
+ isHovered,
40
+ isPressed,
41
+ isFocusVisible
42
+ }) => {
43
+ return {
44
+ ...TRACK_STYLE_STATIC,
45
+ backgroundColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.background, {
46
+ isDisabled,
47
+ isSelected,
48
+ isHovered,
49
+ isPressed
50
+ }),
51
+ borderColor: require_resolveInteractiveStyle.resolveInteractiveStyle(c?.border, {
52
+ isDisabled,
53
+ isSelected,
54
+ isFocusVisible
55
+ }),
56
+ outline: require_focusRing.focusRingOutline(isFocusVisible)
57
+ };
58
+ };
59
+ /**
60
+ * Thumb color:
61
+ * ON → text.checked (typically neutral.0 = white on brand track)
62
+ * OFF → border.default (typically neutral.300 = visible on light track)
63
+ */
64
+ var resolveThumbColor = ({
65
+ c,
66
+ isSelected
67
+ }) => {
68
+ const text = c?.text;
69
+ return isSelected ? text?.checked ?? text?.default : c?.border?.default;
70
+ };
71
+ /** Label color — disabled dominates default (Selection has no evaluation). */
72
+ var resolveLabelColor = ({
73
+ c,
74
+ isDisabled
75
+ }) => {
76
+ const text = c?.text;
77
+ return isDisabled ? text?.disabled : text?.default;
78
+ };
79
+ /**
80
+ * A semantic on/off toggle built on React Aria's Switch.
81
+ *
82
+ * Entity = Selection → reads `vars.colors.input.primary.*`, radii: `round`
83
+ * (pill track + circular thumb), border: `outline.control`,
84
+ * sizing: `hit.base`, motion: `feedback`.
85
+ *
86
+ * @example
87
+ * ```tsx
88
+ * <Switch>Enable notifications</Switch>
89
+ * <Switch defaultSelected>Dark mode</Switch>
90
+ * ```
91
+ */
92
+ var Switch = ({
93
+ children,
94
+ ...props
95
+ }) => {
96
+ const c = _ttoss_fsl_theme_vars.vars.colors.input.primary;
97
+ return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Switch, {
98
+ ...props,
99
+ "data-scope": "switch",
100
+ "data-part": "root",
101
+ style: ({
102
+ isDisabled
103
+ }) => {
104
+ return {
105
+ boxSizing: "border-box",
106
+ display: "inline-flex",
107
+ alignItems: "center",
108
+ gap: _ttoss_fsl_theme_vars.vars.spacing.gap.inline.sm,
109
+ minHeight: _ttoss_fsl_theme_vars.vars.sizing.hit.base,
110
+ cursor: isDisabled ? "not-allowed" : "pointer",
111
+ opacity: isDisabled ? _ttoss_fsl_theme_vars.vars.opacity.disabled : void 0,
112
+ ..._ttoss_fsl_theme_vars.vars.text.label.md,
113
+ color: isDisabled ? c?.text?.disabled : c?.text?.default
114
+ };
115
+ },
116
+ children: ({
117
+ isHovered,
118
+ isPressed,
119
+ isDisabled,
120
+ isFocusVisible,
121
+ isSelected
122
+ }) => {
123
+ const thumbInsetInlineStart = isSelected ? `calc(${TRACK_W} - ${THUMB_SIZE} - ${THUMB_OFFSET})` : THUMB_OFFSET;
124
+ return /* @__PURE__ */(0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, {
125
+ children: [/* @__PURE__ */(0, react_jsx_runtime.jsx)("span", {
126
+ "data-scope": "switch",
127
+ "data-part": "control",
128
+ "aria-hidden": true,
129
+ style: buildTrackStyle({
130
+ c,
131
+ isDisabled,
132
+ isSelected,
133
+ isHovered,
134
+ isPressed,
135
+ isFocusVisible
136
+ }),
137
+ children: /* @__PURE__ */(0, react_jsx_runtime.jsx)("span", {
138
+ "data-scope": "switch",
139
+ "data-part": "indicator",
140
+ "aria-hidden": true,
141
+ style: {
142
+ position: "absolute",
143
+ insetBlockStart: THUMB_OFFSET,
144
+ insetInlineStart: thumbInsetInlineStart,
145
+ width: THUMB_SIZE,
146
+ height: THUMB_SIZE,
147
+ borderRadius: _ttoss_fsl_theme_vars.vars.radii.round,
148
+ backgroundColor: resolveThumbColor({
149
+ c,
150
+ isSelected
151
+ }),
152
+ transitionProperty: "inset-inline-start, background-color",
153
+ transitionDuration: _ttoss_fsl_theme_vars.vars.motion.feedback.duration,
154
+ transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.feedback.easing
155
+ }
156
+ })
157
+ }), children != null && /* @__PURE__ */(0, react_jsx_runtime.jsx)("span", {
158
+ "data-scope": "switch",
159
+ "data-part": "label",
160
+ style: {
161
+ color: resolveLabelColor({
162
+ c,
163
+ isDisabled
164
+ })
165
+ },
166
+ children
167
+ })]
168
+ });
169
+ }
170
+ });
171
+ };
172
+ Switch.displayName = switchMeta.displayName;
173
+
174
+ //#endregion
175
+ exports.Switch = Switch;
176
+ exports.switchMeta = switchMeta;
@@ -0,0 +1,43 @@
1
+
2
+ import * as React from "react";
3
+ import { SwitchProps } from "react-aria-components";
4
+
5
+ //#region src/components/Switch/Switch.d.ts
6
+ /** Formal semantic identity — Switch root (Selection entity, toggle.binary). */
7
+ declare const switchMeta: {
8
+ readonly displayName: "Switch";
9
+ readonly entity: "Selection";
10
+ readonly structure: "root";
11
+ };
12
+ /**
13
+ * Props for the Switch component.
14
+ */
15
+ interface SwitchProps$1 extends Omit<SwitchProps, 'style' | 'children'> {
16
+ /**
17
+ * Label content displayed next to the switch track.
18
+ * Rendered inside a `data-part="label"` span.
19
+ */
20
+ children?: React.ReactNode;
21
+ }
22
+ /**
23
+ * A semantic on/off toggle built on React Aria's Switch.
24
+ *
25
+ * Entity = Selection → reads `vars.colors.input.primary.*`, radii: `round`
26
+ * (pill track + circular thumb), border: `outline.control`,
27
+ * sizing: `hit.base`, motion: `feedback`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <Switch>Enable notifications</Switch>
32
+ * <Switch defaultSelected>Dark mode</Switch>
33
+ * ```
34
+ */
35
+ declare const Switch: {
36
+ ({
37
+ children,
38
+ ...props
39
+ }: SwitchProps$1): import("react/jsx-runtime").JSX.Element;
40
+ displayName: "Switch";
41
+ };
42
+ //#endregion
43
+ export { Switch, SwitchProps$1 as SwitchProps, switchMeta };
@@ -0,0 +1,43 @@
1
+
2
+ import { SwitchProps } from "react-aria-components";
3
+ import * as React from "react";
4
+
5
+ //#region src/components/Switch/Switch.d.ts
6
+ /** Formal semantic identity — Switch root (Selection entity, toggle.binary). */
7
+ declare const switchMeta: {
8
+ readonly displayName: "Switch";
9
+ readonly entity: "Selection";
10
+ readonly structure: "root";
11
+ };
12
+ /**
13
+ * Props for the Switch component.
14
+ */
15
+ interface SwitchProps$1 extends Omit<SwitchProps, 'style' | 'children'> {
16
+ /**
17
+ * Label content displayed next to the switch track.
18
+ * Rendered inside a `data-part="label"` span.
19
+ */
20
+ children?: React.ReactNode;
21
+ }
22
+ /**
23
+ * A semantic on/off toggle built on React Aria's Switch.
24
+ *
25
+ * Entity = Selection → reads `vars.colors.input.primary.*`, radii: `round`
26
+ * (pill track + circular thumb), border: `outline.control`,
27
+ * sizing: `hit.base`, motion: `feedback`.
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * <Switch>Enable notifications</Switch>
32
+ * <Switch defaultSelected>Dark mode</Switch>
33
+ * ```
34
+ */
35
+ declare const Switch$1: {
36
+ ({
37
+ children,
38
+ ...props
39
+ }: SwitchProps$1): import("react/jsx-runtime").JSX.Element;
40
+ displayName: "Switch";
41
+ };
42
+ //#endregion
43
+ export { Switch$1 as Switch, SwitchProps$1 as SwitchProps, switchMeta };