@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,161 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
const require_Button = require('../../components/Button/Button.cjs');
|
|
3
|
+
const require_scope = require('../scope.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/composites/Form/Form.tsx
|
|
9
|
+
var formScope = require_scope.createPresenceScope("Form");
|
|
10
|
+
/**
|
|
11
|
+
* Formal semantic identity — Form root (Structure entity, root part).
|
|
12
|
+
*/
|
|
13
|
+
var formMeta = {
|
|
14
|
+
displayName: "Form",
|
|
15
|
+
entity: "Structure",
|
|
16
|
+
structure: "root"
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A semantic form scope built on React Aria's native `Form`.
|
|
20
|
+
*
|
|
21
|
+
* Coordinates nested Input / Selection / Action parts around a single
|
|
22
|
+
* submission and validation contract. Field-level `State.invalid` is driven
|
|
23
|
+
* by React Aria's `validationErrors` propagation — this component adds no
|
|
24
|
+
* state machinery of its own.
|
|
25
|
+
*
|
|
26
|
+
* Entity = Structure. The root is visually transparent — only
|
|
27
|
+
* `vars.spacing.gap.stack.md` between children. No color tokens are read
|
|
28
|
+
* here; chrome lives on the nested input / action parts.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Form onSubmit={(e) => { e.preventDefault(); … }}>
|
|
33
|
+
* <TextField name="email" isRequired>
|
|
34
|
+
* <TextFieldLabel>Email</TextFieldLabel>
|
|
35
|
+
* <TextFieldControl type="email" />
|
|
36
|
+
* <TextFieldError />
|
|
37
|
+
* </TextField>
|
|
38
|
+
* <FormActions>
|
|
39
|
+
* <Button type="reset" evaluation="muted">Reset</Button>
|
|
40
|
+
* <FormSubmit>Save</FormSubmit>
|
|
41
|
+
* </FormActions>
|
|
42
|
+
* </Form>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
var Form = ({
|
|
46
|
+
children,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
49
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(formScope.Provider, {
|
|
50
|
+
children: /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Form, {
|
|
51
|
+
...props,
|
|
52
|
+
"data-scope": "form",
|
|
53
|
+
"data-part": "root",
|
|
54
|
+
style: {
|
|
55
|
+
boxSizing: "border-box",
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
gap: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.md,
|
|
59
|
+
..._ttoss_fsl_theme_vars.vars.text.label.md
|
|
60
|
+
},
|
|
61
|
+
children
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Form.displayName = formMeta.displayName;
|
|
66
|
+
/**
|
|
67
|
+
* Formal semantic identity — supporting action row slot within a Form.
|
|
68
|
+
*/
|
|
69
|
+
var formActionsMeta = {
|
|
70
|
+
displayName: "FormActions",
|
|
71
|
+
entity: "Structure",
|
|
72
|
+
structure: "actions",
|
|
73
|
+
composition: "supporting"
|
|
74
|
+
};
|
|
75
|
+
var justifyMap = {
|
|
76
|
+
start: "flex-start",
|
|
77
|
+
end: "flex-end",
|
|
78
|
+
between: "space-between"
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A horizontal row for a Form's action buttons (submit, cancel, reset).
|
|
82
|
+
*
|
|
83
|
+
* The `composition: 'supporting'` slot tags this row as supplementary to
|
|
84
|
+
* the Form's primary input content — host CSS or future composites may
|
|
85
|
+
* target `[data-composition="supporting"]` for layout variants.
|
|
86
|
+
*/
|
|
87
|
+
var FormActions = ({
|
|
88
|
+
align = "end",
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}) => {
|
|
92
|
+
formScope.use(formActionsMeta.displayName);
|
|
93
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)("div", {
|
|
94
|
+
...props,
|
|
95
|
+
"data-scope": "form",
|
|
96
|
+
"data-part": "actions",
|
|
97
|
+
"data-composition": "supporting",
|
|
98
|
+
style: {
|
|
99
|
+
boxSizing: "border-box",
|
|
100
|
+
display: "flex",
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: justifyMap[align],
|
|
104
|
+
gap: _ttoss_fsl_theme_vars.vars.spacing.gap.inline.md,
|
|
105
|
+
marginBlockStart: _ttoss_fsl_theme_vars.vars.spacing.gap.stack.sm
|
|
106
|
+
},
|
|
107
|
+
children
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
FormActions.displayName = formActionsMeta.displayName;
|
|
111
|
+
/**
|
|
112
|
+
* Formal semantic identity — the primary commit action inside a Form.
|
|
113
|
+
*/
|
|
114
|
+
var formSubmitMeta = {
|
|
115
|
+
displayName: "FormSubmit",
|
|
116
|
+
entity: "Action",
|
|
117
|
+
structure: "root",
|
|
118
|
+
composition: "primaryAction"
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The primary commit button inside a {@link Form}.
|
|
122
|
+
*
|
|
123
|
+
* A thin wrapper around {@link Button} that fixes `type="submit"` and
|
|
124
|
+
* reassigns defaults so the commit-happy path is free of boilerplate:
|
|
125
|
+
* `consequence="committing"` (second real Consequence callsite with a
|
|
126
|
+
* value distinct from `MenuItem`'s typical `destructive` / `neutral`) and
|
|
127
|
+
* `composition="primaryAction"` (advertises the slot to host layout CSS).
|
|
128
|
+
*
|
|
129
|
+
* Visual styling is inherited from `Button`; FormSubmit adds no chrome.
|
|
130
|
+
* The only extra DOM signal it layers on is `data-composition` and
|
|
131
|
+
* `data-pending` when `isPending` is true.
|
|
132
|
+
*
|
|
133
|
+
* Entity = Action → same token row as `Button` (`vars.colors.action.*`).
|
|
134
|
+
*/
|
|
135
|
+
var FormSubmit = ({
|
|
136
|
+
consequence = "committing",
|
|
137
|
+
composition = "primaryAction",
|
|
138
|
+
isPending = false,
|
|
139
|
+
isDisabled,
|
|
140
|
+
...props
|
|
141
|
+
}) => {
|
|
142
|
+
formScope.use(formSubmitMeta.displayName);
|
|
143
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(require_Button.Button, {
|
|
144
|
+
...props,
|
|
145
|
+
type: "submit",
|
|
146
|
+
"data-scope": "form-submit",
|
|
147
|
+
consequence,
|
|
148
|
+
isDisabled: isDisabled ?? isPending,
|
|
149
|
+
"data-composition": composition,
|
|
150
|
+
"data-pending": isPending || void 0
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
FormSubmit.displayName = formSubmitMeta.displayName;
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
exports.Form = Form;
|
|
157
|
+
exports.FormActions = FormActions;
|
|
158
|
+
exports.FormSubmit = FormSubmit;
|
|
159
|
+
exports.formActionsMeta = formActionsMeta;
|
|
160
|
+
exports.formMeta = formMeta;
|
|
161
|
+
exports.formSubmitMeta = formSubmitMeta;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
|
|
2
|
+
import { CompositionsFor, ConsequencesFor } from "../../semantics/taxonomy.cjs";
|
|
3
|
+
import { ButtonProps as ButtonProps$1 } from "../../components/Button/Button.cjs";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { FormProps } from "react-aria-components";
|
|
6
|
+
|
|
7
|
+
//#region src/composites/Form/Form.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Formal semantic identity — Form root (Structure entity, root part).
|
|
10
|
+
*/
|
|
11
|
+
declare const formMeta: {
|
|
12
|
+
readonly displayName: "Form";
|
|
13
|
+
readonly entity: "Structure";
|
|
14
|
+
readonly structure: "root";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Props for the Form component.
|
|
18
|
+
*
|
|
19
|
+
* The Form root carries no `evaluation` prop: under the evidence rule
|
|
20
|
+
* (CONTRIBUTING §2.3) a dimension only appears on a component if a runtime
|
|
21
|
+
* dispatches on it. The Form root is visually transparent — colors,
|
|
22
|
+
* spacing of authorial emphasis live on the nested Input / Action parts —
|
|
23
|
+
* so adding `evaluation` here would be reserving API surface for a
|
|
24
|
+
* speculative future consumer. Re-introduce it the day a real consumer
|
|
25
|
+
* (e.g. background card chrome) needs it.
|
|
26
|
+
*
|
|
27
|
+
* The composite owns its layout; pass `style`/`className` on a wrapping
|
|
28
|
+
* element rather than on the composite root. See CONTRIBUTING §4.
|
|
29
|
+
*/
|
|
30
|
+
interface FormProps$1 extends Omit<FormProps, 'style' | 'className'> {
|
|
31
|
+
/**
|
|
32
|
+
* Form content — typically TextField / Select / Checkbox / RadioGroup
|
|
33
|
+
* composites plus a {@link FormActions} row at the end.
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A semantic form scope built on React Aria's native `Form`.
|
|
39
|
+
*
|
|
40
|
+
* Coordinates nested Input / Selection / Action parts around a single
|
|
41
|
+
* submission and validation contract. Field-level `State.invalid` is driven
|
|
42
|
+
* by React Aria's `validationErrors` propagation — this component adds no
|
|
43
|
+
* state machinery of its own.
|
|
44
|
+
*
|
|
45
|
+
* Entity = Structure. The root is visually transparent — only
|
|
46
|
+
* `vars.spacing.gap.stack.md` between children. No color tokens are read
|
|
47
|
+
* here; chrome lives on the nested input / action parts.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Form onSubmit={(e) => { e.preventDefault(); … }}>
|
|
52
|
+
* <TextField name="email" isRequired>
|
|
53
|
+
* <TextFieldLabel>Email</TextFieldLabel>
|
|
54
|
+
* <TextFieldControl type="email" />
|
|
55
|
+
* <TextFieldError />
|
|
56
|
+
* </TextField>
|
|
57
|
+
* <FormActions>
|
|
58
|
+
* <Button type="reset" evaluation="muted">Reset</Button>
|
|
59
|
+
* <FormSubmit>Save</FormSubmit>
|
|
60
|
+
* </FormActions>
|
|
61
|
+
* </Form>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const Form: {
|
|
65
|
+
({
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}: FormProps$1): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
displayName: "Form";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Formal semantic identity — supporting action row slot within a Form.
|
|
73
|
+
*/
|
|
74
|
+
declare const formActionsMeta: {
|
|
75
|
+
readonly displayName: "FormActions";
|
|
76
|
+
readonly entity: "Structure";
|
|
77
|
+
readonly structure: "actions";
|
|
78
|
+
readonly composition: "supporting";
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Props for the FormActions component.
|
|
82
|
+
*/
|
|
83
|
+
interface FormActionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {
|
|
84
|
+
/**
|
|
85
|
+
* Alignment of the action row. Defaults to end-alignment which matches
|
|
86
|
+
* the platform convention for submit-on-the-right layouts.
|
|
87
|
+
* @default 'end'
|
|
88
|
+
*/
|
|
89
|
+
align?: 'start' | 'end' | 'between';
|
|
90
|
+
/**
|
|
91
|
+
* Action buttons — typically a {@link FormSubmit} plus optional reset /
|
|
92
|
+
* cancel Buttons.
|
|
93
|
+
*/
|
|
94
|
+
children?: React.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A horizontal row for a Form's action buttons (submit, cancel, reset).
|
|
98
|
+
*
|
|
99
|
+
* The `composition: 'supporting'` slot tags this row as supplementary to
|
|
100
|
+
* the Form's primary input content — host CSS or future composites may
|
|
101
|
+
* target `[data-composition="supporting"]` for layout variants.
|
|
102
|
+
*/
|
|
103
|
+
declare const FormActions: {
|
|
104
|
+
({
|
|
105
|
+
align,
|
|
106
|
+
children,
|
|
107
|
+
...props
|
|
108
|
+
}: FormActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
displayName: "FormActions";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Formal semantic identity — the primary commit action inside a Form.
|
|
113
|
+
*/
|
|
114
|
+
declare const formSubmitMeta: {
|
|
115
|
+
readonly displayName: "FormSubmit";
|
|
116
|
+
readonly entity: "Action";
|
|
117
|
+
readonly structure: "root";
|
|
118
|
+
readonly composition: "primaryAction";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Props for the FormSubmit component.
|
|
122
|
+
*
|
|
123
|
+
* Wraps {@link Button} — inherits every Button prop except `type` (always
|
|
124
|
+
* `"submit"`) and reassigns semantic defaults. `consequence`, `composition`,
|
|
125
|
+
* and `isPending` are surfaced explicitly because their defaults differ
|
|
126
|
+
* from Button's.
|
|
127
|
+
*/
|
|
128
|
+
interface FormSubmitProps extends Omit<ButtonProps$1, 'type'> {
|
|
129
|
+
/**
|
|
130
|
+
* Effect on state. Emitted as `data-consequence`; not used for coloring
|
|
131
|
+
* (visual distinction, if any, is a theme / host-CSS concern — same
|
|
132
|
+
* contract as `MenuItem`).
|
|
133
|
+
* @default 'committing'
|
|
134
|
+
*/
|
|
135
|
+
consequence?: ConsequencesFor<(typeof formSubmitMeta)['entity']>;
|
|
136
|
+
/**
|
|
137
|
+
* Composition slot within the Form. Emitted as `data-composition` for
|
|
138
|
+
* host CSS / tests / future composites.
|
|
139
|
+
* @default 'primaryAction'
|
|
140
|
+
*/
|
|
141
|
+
composition?: CompositionsFor<(typeof formSubmitMeta)['entity']>;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the form is currently submitting. When true, the button is
|
|
144
|
+
* disabled to prevent double-submit and emits `data-pending` for host
|
|
145
|
+
* CSS (spinner, skeleton). Host-controlled — fsl-ui does not own the
|
|
146
|
+
* submission lifecycle.
|
|
147
|
+
*/
|
|
148
|
+
isPending?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The primary commit button inside a {@link Form}.
|
|
152
|
+
*
|
|
153
|
+
* A thin wrapper around {@link Button} that fixes `type="submit"` and
|
|
154
|
+
* reassigns defaults so the commit-happy path is free of boilerplate:
|
|
155
|
+
* `consequence="committing"` (second real Consequence callsite with a
|
|
156
|
+
* value distinct from `MenuItem`'s typical `destructive` / `neutral`) and
|
|
157
|
+
* `composition="primaryAction"` (advertises the slot to host layout CSS).
|
|
158
|
+
*
|
|
159
|
+
* Visual styling is inherited from `Button`; FormSubmit adds no chrome.
|
|
160
|
+
* The only extra DOM signal it layers on is `data-composition` and
|
|
161
|
+
* `data-pending` when `isPending` is true.
|
|
162
|
+
*
|
|
163
|
+
* Entity = Action → same token row as `Button` (`vars.colors.action.*`).
|
|
164
|
+
*/
|
|
165
|
+
declare const FormSubmit: {
|
|
166
|
+
({
|
|
167
|
+
consequence,
|
|
168
|
+
composition,
|
|
169
|
+
isPending,
|
|
170
|
+
isDisabled,
|
|
171
|
+
...props
|
|
172
|
+
}: FormSubmitProps): import("react/jsx-runtime").JSX.Element;
|
|
173
|
+
displayName: "FormSubmit";
|
|
174
|
+
};
|
|
175
|
+
//#endregion
|
|
176
|
+
export { Form, FormActions, FormActionsProps, FormProps$1 as FormProps, FormSubmit, FormSubmitProps, formActionsMeta, formMeta, formSubmitMeta };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
|
|
2
|
+
import { CompositionsFor, ConsequencesFor } from "../../semantics/taxonomy.mjs";
|
|
3
|
+
import { ButtonProps as ButtonProps$1 } from "../../components/Button/Button.mjs";
|
|
4
|
+
import { FormProps } from "react-aria-components";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
|
|
7
|
+
//#region src/composites/Form/Form.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* Formal semantic identity — Form root (Structure entity, root part).
|
|
10
|
+
*/
|
|
11
|
+
declare const formMeta: {
|
|
12
|
+
readonly displayName: "Form";
|
|
13
|
+
readonly entity: "Structure";
|
|
14
|
+
readonly structure: "root";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Props for the Form component.
|
|
18
|
+
*
|
|
19
|
+
* The Form root carries no `evaluation` prop: under the evidence rule
|
|
20
|
+
* (CONTRIBUTING §2.3) a dimension only appears on a component if a runtime
|
|
21
|
+
* dispatches on it. The Form root is visually transparent — colors,
|
|
22
|
+
* spacing of authorial emphasis live on the nested Input / Action parts —
|
|
23
|
+
* so adding `evaluation` here would be reserving API surface for a
|
|
24
|
+
* speculative future consumer. Re-introduce it the day a real consumer
|
|
25
|
+
* (e.g. background card chrome) needs it.
|
|
26
|
+
*
|
|
27
|
+
* The composite owns its layout; pass `style`/`className` on a wrapping
|
|
28
|
+
* element rather than on the composite root. See CONTRIBUTING §4.
|
|
29
|
+
*/
|
|
30
|
+
interface FormProps$1 extends Omit<FormProps, 'style' | 'className'> {
|
|
31
|
+
/**
|
|
32
|
+
* Form content — typically TextField / Select / Checkbox / RadioGroup
|
|
33
|
+
* composites plus a {@link FormActions} row at the end.
|
|
34
|
+
*/
|
|
35
|
+
children?: React.ReactNode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A semantic form scope built on React Aria's native `Form`.
|
|
39
|
+
*
|
|
40
|
+
* Coordinates nested Input / Selection / Action parts around a single
|
|
41
|
+
* submission and validation contract. Field-level `State.invalid` is driven
|
|
42
|
+
* by React Aria's `validationErrors` propagation — this component adds no
|
|
43
|
+
* state machinery of its own.
|
|
44
|
+
*
|
|
45
|
+
* Entity = Structure. The root is visually transparent — only
|
|
46
|
+
* `vars.spacing.gap.stack.md` between children. No color tokens are read
|
|
47
|
+
* here; chrome lives on the nested input / action parts.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Form onSubmit={(e) => { e.preventDefault(); … }}>
|
|
52
|
+
* <TextField name="email" isRequired>
|
|
53
|
+
* <TextFieldLabel>Email</TextFieldLabel>
|
|
54
|
+
* <TextFieldControl type="email" />
|
|
55
|
+
* <TextFieldError />
|
|
56
|
+
* </TextField>
|
|
57
|
+
* <FormActions>
|
|
58
|
+
* <Button type="reset" evaluation="muted">Reset</Button>
|
|
59
|
+
* <FormSubmit>Save</FormSubmit>
|
|
60
|
+
* </FormActions>
|
|
61
|
+
* </Form>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
declare const Form$1: {
|
|
65
|
+
({
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}: FormProps$1): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
displayName: "Form";
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Formal semantic identity — supporting action row slot within a Form.
|
|
73
|
+
*/
|
|
74
|
+
declare const formActionsMeta: {
|
|
75
|
+
readonly displayName: "FormActions";
|
|
76
|
+
readonly entity: "Structure";
|
|
77
|
+
readonly structure: "actions";
|
|
78
|
+
readonly composition: "supporting";
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Props for the FormActions component.
|
|
82
|
+
*/
|
|
83
|
+
interface FormActionsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'style' | 'className'> {
|
|
84
|
+
/**
|
|
85
|
+
* Alignment of the action row. Defaults to end-alignment which matches
|
|
86
|
+
* the platform convention for submit-on-the-right layouts.
|
|
87
|
+
* @default 'end'
|
|
88
|
+
*/
|
|
89
|
+
align?: 'start' | 'end' | 'between';
|
|
90
|
+
/**
|
|
91
|
+
* Action buttons — typically a {@link FormSubmit} plus optional reset /
|
|
92
|
+
* cancel Buttons.
|
|
93
|
+
*/
|
|
94
|
+
children?: React.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A horizontal row for a Form's action buttons (submit, cancel, reset).
|
|
98
|
+
*
|
|
99
|
+
* The `composition: 'supporting'` slot tags this row as supplementary to
|
|
100
|
+
* the Form's primary input content — host CSS or future composites may
|
|
101
|
+
* target `[data-composition="supporting"]` for layout variants.
|
|
102
|
+
*/
|
|
103
|
+
declare const FormActions: {
|
|
104
|
+
({
|
|
105
|
+
align,
|
|
106
|
+
children,
|
|
107
|
+
...props
|
|
108
|
+
}: FormActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
displayName: "FormActions";
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Formal semantic identity — the primary commit action inside a Form.
|
|
113
|
+
*/
|
|
114
|
+
declare const formSubmitMeta: {
|
|
115
|
+
readonly displayName: "FormSubmit";
|
|
116
|
+
readonly entity: "Action";
|
|
117
|
+
readonly structure: "root";
|
|
118
|
+
readonly composition: "primaryAction";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Props for the FormSubmit component.
|
|
122
|
+
*
|
|
123
|
+
* Wraps {@link Button} — inherits every Button prop except `type` (always
|
|
124
|
+
* `"submit"`) and reassigns semantic defaults. `consequence`, `composition`,
|
|
125
|
+
* and `isPending` are surfaced explicitly because their defaults differ
|
|
126
|
+
* from Button's.
|
|
127
|
+
*/
|
|
128
|
+
interface FormSubmitProps extends Omit<ButtonProps$1, 'type'> {
|
|
129
|
+
/**
|
|
130
|
+
* Effect on state. Emitted as `data-consequence`; not used for coloring
|
|
131
|
+
* (visual distinction, if any, is a theme / host-CSS concern — same
|
|
132
|
+
* contract as `MenuItem`).
|
|
133
|
+
* @default 'committing'
|
|
134
|
+
*/
|
|
135
|
+
consequence?: ConsequencesFor<(typeof formSubmitMeta)['entity']>;
|
|
136
|
+
/**
|
|
137
|
+
* Composition slot within the Form. Emitted as `data-composition` for
|
|
138
|
+
* host CSS / tests / future composites.
|
|
139
|
+
* @default 'primaryAction'
|
|
140
|
+
*/
|
|
141
|
+
composition?: CompositionsFor<(typeof formSubmitMeta)['entity']>;
|
|
142
|
+
/**
|
|
143
|
+
* Whether the form is currently submitting. When true, the button is
|
|
144
|
+
* disabled to prevent double-submit and emits `data-pending` for host
|
|
145
|
+
* CSS (spinner, skeleton). Host-controlled — fsl-ui does not own the
|
|
146
|
+
* submission lifecycle.
|
|
147
|
+
*/
|
|
148
|
+
isPending?: boolean;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The primary commit button inside a {@link Form}.
|
|
152
|
+
*
|
|
153
|
+
* A thin wrapper around {@link Button} that fixes `type="submit"` and
|
|
154
|
+
* reassigns defaults so the commit-happy path is free of boilerplate:
|
|
155
|
+
* `consequence="committing"` (second real Consequence callsite with a
|
|
156
|
+
* value distinct from `MenuItem`'s typical `destructive` / `neutral`) and
|
|
157
|
+
* `composition="primaryAction"` (advertises the slot to host layout CSS).
|
|
158
|
+
*
|
|
159
|
+
* Visual styling is inherited from `Button`; FormSubmit adds no chrome.
|
|
160
|
+
* The only extra DOM signal it layers on is `data-composition` and
|
|
161
|
+
* `data-pending` when `isPending` is true.
|
|
162
|
+
*
|
|
163
|
+
* Entity = Action → same token row as `Button` (`vars.colors.action.*`).
|
|
164
|
+
*/
|
|
165
|
+
declare const FormSubmit: {
|
|
166
|
+
({
|
|
167
|
+
consequence,
|
|
168
|
+
composition,
|
|
169
|
+
isPending,
|
|
170
|
+
isDisabled,
|
|
171
|
+
...props
|
|
172
|
+
}: FormSubmitProps): import("react/jsx-runtime").JSX.Element;
|
|
173
|
+
displayName: "FormSubmit";
|
|
174
|
+
};
|
|
175
|
+
//#endregion
|
|
176
|
+
export { Form$1 as Form, FormActions, FormActionsProps, FormProps$1 as FormProps, FormSubmit, FormSubmitProps, formActionsMeta, formMeta, formSubmitMeta };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Button as Button$1 } from "../../components/Button/Button.mjs";
|
|
3
|
+
import { createPresenceScope } from "../scope.mjs";
|
|
4
|
+
import { vars } from "@ttoss/fsl-theme/vars";
|
|
5
|
+
import { Form } from "react-aria-components";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/composites/Form/Form.tsx
|
|
9
|
+
var formScope = createPresenceScope("Form");
|
|
10
|
+
/**
|
|
11
|
+
* Formal semantic identity — Form root (Structure entity, root part).
|
|
12
|
+
*/
|
|
13
|
+
var formMeta = {
|
|
14
|
+
displayName: "Form",
|
|
15
|
+
entity: "Structure",
|
|
16
|
+
structure: "root"
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A semantic form scope built on React Aria's native `Form`.
|
|
20
|
+
*
|
|
21
|
+
* Coordinates nested Input / Selection / Action parts around a single
|
|
22
|
+
* submission and validation contract. Field-level `State.invalid` is driven
|
|
23
|
+
* by React Aria's `validationErrors` propagation — this component adds no
|
|
24
|
+
* state machinery of its own.
|
|
25
|
+
*
|
|
26
|
+
* Entity = Structure. The root is visually transparent — only
|
|
27
|
+
* `vars.spacing.gap.stack.md` between children. No color tokens are read
|
|
28
|
+
* here; chrome lives on the nested input / action parts.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <Form onSubmit={(e) => { e.preventDefault(); … }}>
|
|
33
|
+
* <TextField name="email" isRequired>
|
|
34
|
+
* <TextFieldLabel>Email</TextFieldLabel>
|
|
35
|
+
* <TextFieldControl type="email" />
|
|
36
|
+
* <TextFieldError />
|
|
37
|
+
* </TextField>
|
|
38
|
+
* <FormActions>
|
|
39
|
+
* <Button type="reset" evaluation="muted">Reset</Button>
|
|
40
|
+
* <FormSubmit>Save</FormSubmit>
|
|
41
|
+
* </FormActions>
|
|
42
|
+
* </Form>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
var Form$1 = ({
|
|
46
|
+
children,
|
|
47
|
+
...props
|
|
48
|
+
}) => {
|
|
49
|
+
return /* @__PURE__ */jsx(formScope.Provider, {
|
|
50
|
+
children: /* @__PURE__ */jsx(Form, {
|
|
51
|
+
...props,
|
|
52
|
+
"data-scope": "form",
|
|
53
|
+
"data-part": "root",
|
|
54
|
+
style: {
|
|
55
|
+
boxSizing: "border-box",
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
gap: vars.spacing.gap.stack.md,
|
|
59
|
+
...vars.text.label.md
|
|
60
|
+
},
|
|
61
|
+
children
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Form$1.displayName = formMeta.displayName;
|
|
66
|
+
/**
|
|
67
|
+
* Formal semantic identity — supporting action row slot within a Form.
|
|
68
|
+
*/
|
|
69
|
+
var formActionsMeta = {
|
|
70
|
+
displayName: "FormActions",
|
|
71
|
+
entity: "Structure",
|
|
72
|
+
structure: "actions",
|
|
73
|
+
composition: "supporting"
|
|
74
|
+
};
|
|
75
|
+
var justifyMap = {
|
|
76
|
+
start: "flex-start",
|
|
77
|
+
end: "flex-end",
|
|
78
|
+
between: "space-between"
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A horizontal row for a Form's action buttons (submit, cancel, reset).
|
|
82
|
+
*
|
|
83
|
+
* The `composition: 'supporting'` slot tags this row as supplementary to
|
|
84
|
+
* the Form's primary input content — host CSS or future composites may
|
|
85
|
+
* target `[data-composition="supporting"]` for layout variants.
|
|
86
|
+
*/
|
|
87
|
+
var FormActions = ({
|
|
88
|
+
align = "end",
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}) => {
|
|
92
|
+
formScope.use(formActionsMeta.displayName);
|
|
93
|
+
return /* @__PURE__ */jsx("div", {
|
|
94
|
+
...props,
|
|
95
|
+
"data-scope": "form",
|
|
96
|
+
"data-part": "actions",
|
|
97
|
+
"data-composition": "supporting",
|
|
98
|
+
style: {
|
|
99
|
+
boxSizing: "border-box",
|
|
100
|
+
display: "flex",
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
justifyContent: justifyMap[align],
|
|
104
|
+
gap: vars.spacing.gap.inline.md,
|
|
105
|
+
marginBlockStart: vars.spacing.gap.stack.sm
|
|
106
|
+
},
|
|
107
|
+
children
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
FormActions.displayName = formActionsMeta.displayName;
|
|
111
|
+
/**
|
|
112
|
+
* Formal semantic identity — the primary commit action inside a Form.
|
|
113
|
+
*/
|
|
114
|
+
var formSubmitMeta = {
|
|
115
|
+
displayName: "FormSubmit",
|
|
116
|
+
entity: "Action",
|
|
117
|
+
structure: "root",
|
|
118
|
+
composition: "primaryAction"
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* The primary commit button inside a {@link Form}.
|
|
122
|
+
*
|
|
123
|
+
* A thin wrapper around {@link Button} that fixes `type="submit"` and
|
|
124
|
+
* reassigns defaults so the commit-happy path is free of boilerplate:
|
|
125
|
+
* `consequence="committing"` (second real Consequence callsite with a
|
|
126
|
+
* value distinct from `MenuItem`'s typical `destructive` / `neutral`) and
|
|
127
|
+
* `composition="primaryAction"` (advertises the slot to host layout CSS).
|
|
128
|
+
*
|
|
129
|
+
* Visual styling is inherited from `Button`; FormSubmit adds no chrome.
|
|
130
|
+
* The only extra DOM signal it layers on is `data-composition` and
|
|
131
|
+
* `data-pending` when `isPending` is true.
|
|
132
|
+
*
|
|
133
|
+
* Entity = Action → same token row as `Button` (`vars.colors.action.*`).
|
|
134
|
+
*/
|
|
135
|
+
var FormSubmit = ({
|
|
136
|
+
consequence = "committing",
|
|
137
|
+
composition = "primaryAction",
|
|
138
|
+
isPending = false,
|
|
139
|
+
isDisabled,
|
|
140
|
+
...props
|
|
141
|
+
}) => {
|
|
142
|
+
formScope.use(formSubmitMeta.displayName);
|
|
143
|
+
return /* @__PURE__ */jsx(Button$1, {
|
|
144
|
+
...props,
|
|
145
|
+
type: "submit",
|
|
146
|
+
"data-scope": "form-submit",
|
|
147
|
+
consequence,
|
|
148
|
+
isDisabled: isDisabled ?? isPending,
|
|
149
|
+
"data-composition": composition,
|
|
150
|
+
"data-pending": isPending || void 0
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
FormSubmit.displayName = formSubmitMeta.displayName;
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
156
|
+
export { Form$1 as Form, FormActions, FormSubmit, formActionsMeta, formMeta, formSubmitMeta };
|