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