@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,234 @@
1
+
2
+ import { EvaluationsFor } from "../../semantics/taxonomy.mjs";
3
+ import { DialogProps, DialogTriggerProps, ModalOverlayProps } from "react-aria-components";
4
+ import * as React from "react";
5
+
6
+ //#region src/composites/Dialog/Dialog.d.ts
7
+ /**
8
+ * Formal semantic identity — what this component *is* (Layer 1).
9
+ *
10
+ * Entity = Overlay → CONTRACT.md §1 row:
11
+ * colors: `informational`, radii: `surface`, border: `outline.surface`,
12
+ * sizing: — (none), spacing: `inset.surface`, typography: `title + body + label`,
13
+ * motion: `transition`, elevation: `overlay`.
14
+ */
15
+ declare const dialogMeta: {
16
+ readonly displayName: "Dialog";
17
+ readonly entity: "Overlay";
18
+ readonly structure: "root";
19
+ };
20
+ /**
21
+ * Orchestrates open/close state between a trigger and a Dialog.
22
+ * Pure pass-through to React Aria — no semantic tokens applied.
23
+ */
24
+ declare const DialogTrigger$1: {
25
+ (props: DialogTriggerProps): import("react/jsx-runtime").JSX.Element;
26
+ displayName: string;
27
+ };
28
+ /**
29
+ * Props for the Dialog content surface.
30
+ *
31
+ * The composite owns its layout; pass `style`/`className` on a wrapping
32
+ * element rather than on the composite root. See CONTRIBUTING §4.
33
+ */
34
+ interface DialogProps$1 extends Omit<DialogProps, 'style' | 'className'> {
35
+ /**
36
+ * Semantic scope marker rendered as the `data-scope` attribute — lets
37
+ * composites built on Dialog (e.g. ConfirmationDialog) re-scope the
38
+ * surface for styling and testing hooks.
39
+ * @default 'dialog'
40
+ */
41
+ 'data-scope'?: string;
42
+ /**
43
+ * Semantic emphasis.
44
+ * @default 'primary'
45
+ */
46
+ evaluation?: EvaluationsFor<(typeof dialogMeta)['entity']>;
47
+ }
48
+ /**
49
+ * A semantic overlay dialog surface built on React Aria.
50
+ *
51
+ * This component renders the Dialog content area — the surface that holds
52
+ * title, body, and actions. It must be placed inside a `DialogModal`.
53
+ *
54
+ * Entity = Overlay → colors: `informational`, radii: `surface`,
55
+ * border: `outline.surface`, spacing: `inset.surface.md`,
56
+ * typography: `title.md`, `body.md`, `label.md`.
57
+ */
58
+ declare const Dialog$1: {
59
+ ({
60
+ evaluation,
61
+ "data-scope": dataScope,
62
+ children,
63
+ ...props
64
+ }: DialogProps$1): import("react/jsx-runtime").JSX.Element;
65
+ displayName: "Dialog";
66
+ };
67
+ /**
68
+ * Formal semantic identity for the DialogModal wrapper.
69
+ *
70
+ * DialogModal composes two DOM roots: a backdrop (ModalOverlay) and a
71
+ * surface (Modal). `structure` reflects the *semantically meaningful* part
72
+ * — the surface carries the evaluation tokens, radii, border, elevation,
73
+ * and is what a consumer styles. The backdrop is pure infrastructure (a
74
+ * scrim + positioner) and is not modeled as a separate component.
75
+ */
76
+ declare const dialogModalMeta: {
77
+ readonly displayName: "DialogModal";
78
+ readonly entity: "Overlay";
79
+ readonly structure: "surface";
80
+ };
81
+ /**
82
+ * Props for the DialogModal wrapper.
83
+ */
84
+ interface DialogModalProps extends Omit<ModalOverlayProps, 'style' | 'className'> {
85
+ /**
86
+ * Semantic emphasis for the surface colors.
87
+ * @default 'primary'
88
+ */
89
+ evaluation?: EvaluationsFor<(typeof dialogMeta)['entity']>;
90
+ }
91
+ /**
92
+ * A modal wrapper that renders a scrim backdrop and a positioned surface.
93
+ *
94
+ * Combines React Aria's ModalOverlay (backdrop) and Modal (surface)
95
+ * with semantic tokens from CONTRACT.md §1 (Entity = Overlay).
96
+ *
97
+ * @example
98
+ * ```tsx
99
+ * <DialogTrigger>
100
+ * <Button>Open</Button>
101
+ * <DialogModal>
102
+ * <Dialog>
103
+ * <DialogHeading>Title</DialogHeading>
104
+ * <p>Body content here.</p>
105
+ * </Dialog>
106
+ * </DialogModal>
107
+ * </DialogTrigger>
108
+ * ```
109
+ */
110
+ declare const DialogModal: {
111
+ ({
112
+ evaluation,
113
+ children,
114
+ ...props
115
+ }: DialogModalProps): import("react/jsx-runtime").JSX.Element;
116
+ displayName: string;
117
+ };
118
+ /**
119
+ * Formal semantic identity — heading slot inside Dialog (FSL §4).
120
+ */
121
+ declare const dialogHeadingMeta: {
122
+ readonly displayName: "DialogHeading";
123
+ readonly entity: "Overlay";
124
+ readonly structure: "title";
125
+ readonly composition: "heading";
126
+ };
127
+ /**
128
+ * Props for the DialogHeading component.
129
+ */
130
+ interface DialogHeadingProps extends Omit<React.HTMLAttributes<HTMLHeadingElement>, 'style' | 'className'> {
131
+ /**
132
+ * HTML heading level.
133
+ * @default 2
134
+ */
135
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
136
+ }
137
+ /**
138
+ * The title part of a Dialog, using `title.md` typography tokens.
139
+ * Wired to React Aria's `slot="title"` for accessibility.
140
+ *
141
+ * Must be rendered inside a `<Dialog>` — throws otherwise.
142
+ */
143
+ declare const DialogHeading: {
144
+ ({
145
+ level,
146
+ ...props
147
+ }: DialogHeadingProps): import("react/jsx-runtime").JSX.Element;
148
+ displayName: "DialogHeading";
149
+ };
150
+ /**
151
+ * Formal semantic identity — body slot inside Dialog (FSL §4).
152
+ */
153
+ declare const dialogBodyMeta: {
154
+ readonly displayName: "DialogBody";
155
+ readonly entity: "Overlay";
156
+ readonly structure: "body";
157
+ readonly composition: "body";
158
+ };
159
+ /**
160
+ * Props for the DialogBody component.
161
+ */
162
+ type DialogBodyProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'>;
163
+ /**
164
+ * The body content area of a Dialog, using `body.md` typography tokens.
165
+ *
166
+ * Must be rendered inside a `<Dialog>` — throws otherwise.
167
+ */
168
+ declare const DialogBody: {
169
+ (props: DialogBodyProps): import("react/jsx-runtime").JSX.Element;
170
+ displayName: "DialogBody";
171
+ };
172
+ /**
173
+ * Formal semantic identity — actions slot container inside Dialog.
174
+ */
175
+ declare const dialogActionsMeta: {
176
+ readonly displayName: "DialogActions";
177
+ readonly entity: "Overlay";
178
+ readonly structure: "actions";
179
+ };
180
+ /**
181
+ * Platform convention for action-button ordering inside `DialogActions`.
182
+ *
183
+ * - `ios` (macOS / iOS / Web default) — cancel (`dismissAction`) on the
184
+ * left, confirm (`primaryAction`) on the right. Matches Apple HIG and
185
+ * most web design systems.
186
+ * - `windows` — confirm (`primaryAction`) on the left, cancel
187
+ * (`dismissAction`) on the right. Matches the Windows/Fluent convention.
188
+ */
189
+ type DialogActionsPlatform = 'ios' | 'windows';
190
+ /**
191
+ * Props for the DialogActions component.
192
+ */
193
+ interface DialogActionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {
194
+ /**
195
+ * Platform convention for ordering action children by their
196
+ * `composition` prop. Children without a `composition` keep their
197
+ * source order after the ranked ones.
198
+ *
199
+ * @default 'ios'
200
+ */
201
+ platform?: DialogActionsPlatform;
202
+ }
203
+ /**
204
+ * The actions area of a Dialog (buttons, links).
205
+ *
206
+ * Runtime behavior: sorts children by their `composition` prop per the
207
+ * selected `platform` convention — this is what makes `composition` a
208
+ * behavior-driving FSL dimension and not mere decoration.
209
+ *
210
+ * @example
211
+ * ```tsx
212
+ * // Defaults to iOS: Cancel | Save
213
+ * <DialogActions>
214
+ * <Button composition="dismissAction" slot="close">Cancel</Button>
215
+ * <Button composition="primaryAction">Save</Button>
216
+ * </DialogActions>
217
+ *
218
+ * // Windows convention: Save | Cancel
219
+ * <DialogActions platform="windows">
220
+ * <Button composition="dismissAction" slot="close">Cancel</Button>
221
+ * <Button composition="primaryAction">Save</Button>
222
+ * </DialogActions>
223
+ * ```
224
+ */
225
+ declare const DialogActions: {
226
+ ({
227
+ platform,
228
+ children,
229
+ ...props
230
+ }: DialogActionsProps): import("react/jsx-runtime").JSX.Element;
231
+ displayName: "DialogActions";
232
+ };
233
+ //#endregion
234
+ export { Dialog$1 as Dialog, DialogActions, DialogActionsPlatform, DialogActionsProps, DialogBody, DialogBodyProps, DialogHeading, DialogHeadingProps, DialogModal, DialogModalProps, DialogProps$1 as DialogProps, DialogTrigger$1 as DialogTrigger, dialogActionsMeta, dialogBodyMeta, dialogHeadingMeta, dialogMeta, dialogModalMeta };
@@ -0,0 +1,360 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { createPresenceScope } from "../scope.mjs";
3
+ import { fslVar } from "../../tokens/escapeHatch.mjs";
4
+ import { vars } from "@ttoss/fsl-theme/vars";
5
+ import { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from "react-aria-components";
6
+ import { jsx } from "react/jsx-runtime";
7
+ import * as React from "react";
8
+
9
+ //#region src/composites/Dialog/Dialog.tsx
10
+ var dialogScope = createPresenceScope("Dialog");
11
+ /**
12
+ * Formal semantic identity — what this component *is* (Layer 1).
13
+ *
14
+ * Entity = Overlay → CONTRACT.md §1 row:
15
+ * colors: `informational`, radii: `surface`, border: `outline.surface`,
16
+ * sizing: — (none), spacing: `inset.surface`, typography: `title + body + label`,
17
+ * motion: `transition`, elevation: `overlay`.
18
+ */
19
+ var dialogMeta = {
20
+ displayName: "Dialog",
21
+ entity: "Overlay",
22
+ structure: "root"
23
+ };
24
+ /**
25
+ * Orchestrates open/close state between a trigger and a Dialog.
26
+ * Pure pass-through to React Aria — no semantic tokens applied.
27
+ */
28
+ var DialogTrigger$1 = props => {
29
+ return /* @__PURE__ */jsx(DialogTrigger, {
30
+ ...props
31
+ });
32
+ };
33
+ DialogTrigger$1.displayName = "DialogTrigger";
34
+ /**
35
+ * A semantic overlay dialog surface built on React Aria.
36
+ *
37
+ * This component renders the Dialog content area — the surface that holds
38
+ * title, body, and actions. It must be placed inside a `DialogModal`.
39
+ *
40
+ * Entity = Overlay → colors: `informational`, radii: `surface`,
41
+ * border: `outline.surface`, spacing: `inset.surface.md`,
42
+ * typography: `title.md`, `body.md`, `label.md`.
43
+ */
44
+ var Dialog$1 = ({
45
+ evaluation = "primary",
46
+ "data-scope": dataScope = "dialog",
47
+ children,
48
+ ...props
49
+ }) => {
50
+ const colors = vars.colors.informational[evaluation];
51
+ return /* @__PURE__ */jsx(Dialog, {
52
+ ...props,
53
+ "data-scope": dataScope,
54
+ "data-part": "root",
55
+ "data-evaluation": evaluation,
56
+ style: {
57
+ boxSizing: "border-box",
58
+ outline: "none",
59
+ padding: vars.spacing.inset.surface.md,
60
+ color: colors?.text?.default
61
+ },
62
+ children: state => {
63
+ return /* @__PURE__ */jsx(dialogScope.Provider, {
64
+ children: typeof children === "function" ? children(state) : children
65
+ });
66
+ }
67
+ });
68
+ };
69
+ Dialog$1.displayName = dialogMeta.displayName;
70
+ /**
71
+ * Formal semantic identity for the DialogModal wrapper.
72
+ *
73
+ * DialogModal composes two DOM roots: a backdrop (ModalOverlay) and a
74
+ * surface (Modal). `structure` reflects the *semantically meaningful* part
75
+ * — the surface carries the evaluation tokens, radii, border, elevation,
76
+ * and is what a consumer styles. The backdrop is pure infrastructure (a
77
+ * scrim + positioner) and is not modeled as a separate component.
78
+ */
79
+ var dialogModalMeta = {
80
+ displayName: "DialogModal",
81
+ entity: "Overlay",
82
+ structure: "surface"
83
+ };
84
+ var DIALOG_MAX_WIDTH_DEFAULT = "min(500px, 90vw)";
85
+ var DIALOG_MAX_HEIGHT_DEFAULT = "90vh";
86
+ /**
87
+ * The active enter/exit motion spec, or `null` when the surface is at rest.
88
+ * Collapses the repeated `transition[isEntering ? 'enter' : 'exit']` lookups
89
+ * into a single resolution the style builders read from.
90
+ */
91
+ var resolveTransitionPhase = ({
92
+ isEntering,
93
+ isExiting
94
+ }) => {
95
+ if (isEntering) return vars.motion.transition.enter;
96
+ if (isExiting) return vars.motion.transition.exit;
97
+ return null;
98
+ };
99
+ /** Scrim backdrop style — dims + centers, fades on enter/exit. */
100
+ var buildBackdropStyle = ({
101
+ isEntering,
102
+ isExiting
103
+ }) => {
104
+ const phase = resolveTransitionPhase({
105
+ isEntering,
106
+ isExiting
107
+ });
108
+ return {
109
+ position: "fixed",
110
+ inset: 0,
111
+ display: "flex",
112
+ alignItems: "center",
113
+ justifyContent: "center",
114
+ zIndex: vars.zIndex.layer.blocking,
115
+ backgroundColor: vars.overlay.scrim,
116
+ transition: phase ? `opacity ${phase.duration} ${phase.easing}` : void 0,
117
+ opacity: isExiting ? 0 : 1
118
+ };
119
+ };
120
+ /** Modal surface style — the blocking card; scales + fades on enter/exit. */
121
+ var buildModalSurfaceStyle = ({
122
+ colors,
123
+ isEntering,
124
+ isExiting
125
+ }) => {
126
+ const phase = resolveTransitionPhase({
127
+ isEntering,
128
+ isExiting
129
+ });
130
+ const inTransition = isEntering || isExiting;
131
+ return {
132
+ boxSizing: "border-box",
133
+ maxWidth: fslVar("--fsl-dialog-max-width", DIALOG_MAX_WIDTH_DEFAULT),
134
+ maxHeight: fslVar("--fsl-dialog-max-height", DIALOG_MAX_HEIGHT_DEFAULT),
135
+ overflow: "auto",
136
+ borderRadius: vars.radii.surface,
137
+ borderWidth: vars.border.outline.surface.width,
138
+ borderStyle: vars.border.outline.surface.style,
139
+ borderColor: colors?.border?.default,
140
+ boxShadow: vars.elevation.surface.overlay,
141
+ backgroundColor: colors?.background?.default,
142
+ outline: "none",
143
+ transition: phase ? `transform ${phase.duration} ${phase.easing}, opacity ${phase.duration} ${phase.easing}` : void 0,
144
+ transform: inTransition ? "scale(0.95)" : "scale(1)",
145
+ opacity: inTransition ? 0 : 1
146
+ };
147
+ };
148
+ /**
149
+ * A modal wrapper that renders a scrim backdrop and a positioned surface.
150
+ *
151
+ * Combines React Aria's ModalOverlay (backdrop) and Modal (surface)
152
+ * with semantic tokens from CONTRACT.md §1 (Entity = Overlay).
153
+ *
154
+ * @example
155
+ * ```tsx
156
+ * <DialogTrigger>
157
+ * <Button>Open</Button>
158
+ * <DialogModal>
159
+ * <Dialog>
160
+ * <DialogHeading>Title</DialogHeading>
161
+ * <p>Body content here.</p>
162
+ * </Dialog>
163
+ * </DialogModal>
164
+ * </DialogTrigger>
165
+ * ```
166
+ */
167
+ var DialogModal = ({
168
+ evaluation = "primary",
169
+ children,
170
+ ...props
171
+ }) => {
172
+ const colors = vars.colors.informational[evaluation];
173
+ return /* @__PURE__ */jsx(ModalOverlay, {
174
+ ...props,
175
+ "data-scope": "dialog",
176
+ "data-part": "backdrop",
177
+ style: ({
178
+ isEntering,
179
+ isExiting
180
+ }) => {
181
+ return buildBackdropStyle({
182
+ isEntering,
183
+ isExiting
184
+ });
185
+ },
186
+ children: /* @__PURE__ */jsx(Modal, {
187
+ "data-scope": "dialog",
188
+ "data-part": "surface",
189
+ "data-evaluation": evaluation,
190
+ style: ({
191
+ isEntering,
192
+ isExiting
193
+ }) => {
194
+ return buildModalSurfaceStyle({
195
+ colors,
196
+ isEntering,
197
+ isExiting
198
+ });
199
+ },
200
+ children
201
+ })
202
+ });
203
+ };
204
+ DialogModal.displayName = "DialogModal";
205
+ /**
206
+ * Formal semantic identity — heading slot inside Dialog (FSL §4).
207
+ */
208
+ var dialogHeadingMeta = {
209
+ displayName: "DialogHeading",
210
+ entity: "Overlay",
211
+ structure: "title",
212
+ composition: "heading"
213
+ };
214
+ /**
215
+ * The title part of a Dialog, using `title.md` typography tokens.
216
+ * Wired to React Aria's `slot="title"` for accessibility.
217
+ *
218
+ * Must be rendered inside a `<Dialog>` — throws otherwise.
219
+ */
220
+ var DialogHeading = ({
221
+ level = 2,
222
+ ...props
223
+ }) => {
224
+ dialogScope.use(dialogHeadingMeta.displayName);
225
+ return /* @__PURE__ */jsx(Heading, {
226
+ slot: "title",
227
+ level,
228
+ ...props,
229
+ "data-scope": "dialog",
230
+ "data-part": "title",
231
+ style: {
232
+ margin: 0,
233
+ ...vars.text.title.md
234
+ }
235
+ });
236
+ };
237
+ DialogHeading.displayName = dialogHeadingMeta.displayName;
238
+ /**
239
+ * Formal semantic identity — body slot inside Dialog (FSL §4).
240
+ */
241
+ var dialogBodyMeta = {
242
+ displayName: "DialogBody",
243
+ entity: "Overlay",
244
+ structure: "body",
245
+ composition: "body"
246
+ };
247
+ /**
248
+ * The body content area of a Dialog, using `body.md` typography tokens.
249
+ *
250
+ * Must be rendered inside a `<Dialog>` — throws otherwise.
251
+ */
252
+ var DialogBody = props => {
253
+ dialogScope.use(dialogBodyMeta.displayName);
254
+ return /* @__PURE__ */jsx("div", {
255
+ ...props,
256
+ "data-scope": "dialog",
257
+ "data-part": "body",
258
+ style: {
259
+ ...vars.text.body.md,
260
+ marginBlockStart: vars.spacing.gap.stack.md
261
+ }
262
+ });
263
+ };
264
+ DialogBody.displayName = dialogBodyMeta.displayName;
265
+ /**
266
+ * Formal semantic identity — actions slot container inside Dialog.
267
+ */
268
+ var dialogActionsMeta = {
269
+ displayName: "DialogActions",
270
+ entity: "Overlay",
271
+ structure: "actions"
272
+ };
273
+ /**
274
+ * Logical positions for each action composition role, per platform.
275
+ * Lower number = closer to the start of the flex row (left, when LTR).
276
+ *
277
+ * `justifyContent: 'flex-end'` pushes the row to the right; the platform
278
+ * mapping controls the *relative* order of actions within that row.
279
+ */
280
+ var ACTION_ORDER = {
281
+ ios: {
282
+ dismissAction: 0,
283
+ secondaryAction: 1,
284
+ primaryAction: 2
285
+ },
286
+ windows: {
287
+ primaryAction: 0,
288
+ secondaryAction: 1,
289
+ dismissAction: 2
290
+ }
291
+ };
292
+ /** Unknown / unclassified children preserve their source order after the ranked ones. */
293
+ var UNRANKED = Number.POSITIVE_INFINITY;
294
+ var getChildComposition = child => {
295
+ if (!React.isValidElement(child)) return void 0;
296
+ const props = child.props;
297
+ return typeof props.composition === "string" ? props.composition : void 0;
298
+ };
299
+ /**
300
+ * The actions area of a Dialog (buttons, links).
301
+ *
302
+ * Runtime behavior: sorts children by their `composition` prop per the
303
+ * selected `platform` convention — this is what makes `composition` a
304
+ * behavior-driving FSL dimension and not mere decoration.
305
+ *
306
+ * @example
307
+ * ```tsx
308
+ * // Defaults to iOS: Cancel | Save
309
+ * <DialogActions>
310
+ * <Button composition="dismissAction" slot="close">Cancel</Button>
311
+ * <Button composition="primaryAction">Save</Button>
312
+ * </DialogActions>
313
+ *
314
+ * // Windows convention: Save | Cancel
315
+ * <DialogActions platform="windows">
316
+ * <Button composition="dismissAction" slot="close">Cancel</Button>
317
+ * <Button composition="primaryAction">Save</Button>
318
+ * </DialogActions>
319
+ * ```
320
+ */
321
+ var DialogActions = ({
322
+ platform = "ios",
323
+ children,
324
+ ...props
325
+ }) => {
326
+ dialogScope.use(dialogActionsMeta.displayName);
327
+ const table = ACTION_ORDER[platform];
328
+ const sorted = React.Children.toArray(children).map((child, index) => {
329
+ const composition = getChildComposition(child);
330
+ return {
331
+ child,
332
+ rank: composition !== void 0 ? table[composition] ?? UNRANKED : UNRANKED,
333
+ index
334
+ };
335
+ }).sort((a, b) => {
336
+ if (a.rank !== b.rank) return a.rank - b.rank;
337
+ return a.index - b.index;
338
+ }).map(({
339
+ child
340
+ }) => {
341
+ return child;
342
+ });
343
+ return /* @__PURE__ */jsx("div", {
344
+ ...props,
345
+ "data-scope": "dialog",
346
+ "data-part": "actions",
347
+ "data-platform": platform,
348
+ style: {
349
+ display: "flex",
350
+ justifyContent: "flex-end",
351
+ gap: vars.spacing.gap.inline.md,
352
+ marginBlockStart: vars.spacing.gap.stack.lg
353
+ },
354
+ children: sorted
355
+ });
356
+ };
357
+ DialogActions.displayName = dialogActionsMeta.displayName;
358
+
359
+ //#endregion
360
+ export { Dialog$1 as Dialog, DialogActions, DialogBody, DialogHeading, DialogModal, DialogTrigger$1 as DialogTrigger, dialogActionsMeta, dialogBodyMeta, dialogHeadingMeta, dialogMeta, dialogModalMeta };