@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,191 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { focusRingOutline } from "../../tokens/focusRing.mjs";
|
|
3
|
+
import { resolveInteractiveStyle } from "../../tokens/resolveInteractiveStyle.mjs";
|
|
4
|
+
import { createPresenceScope } from "../scope.mjs";
|
|
5
|
+
import { vars } from "@ttoss/fsl-theme/vars";
|
|
6
|
+
import { FieldError, Input, Label, Text, TextField } from "react-aria-components";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
//#region src/composites/TextField/TextField.tsx
|
|
10
|
+
var textFieldScope = createPresenceScope("TextField");
|
|
11
|
+
/** Formal semantic identity — TextField root (Input entity, root part). */
|
|
12
|
+
var textFieldMeta = {
|
|
13
|
+
displayName: "TextField",
|
|
14
|
+
entity: "Input",
|
|
15
|
+
structure: "root"
|
|
16
|
+
};
|
|
17
|
+
/** Formal semantic identity — label slot. */
|
|
18
|
+
var textFieldLabelMeta = {
|
|
19
|
+
displayName: "TextFieldLabel",
|
|
20
|
+
entity: "Input",
|
|
21
|
+
structure: "label",
|
|
22
|
+
composition: "label"
|
|
23
|
+
};
|
|
24
|
+
/** Formal semantic identity — control slot (the actual input element). */
|
|
25
|
+
var textFieldControlMeta = {
|
|
26
|
+
displayName: "TextFieldControl",
|
|
27
|
+
entity: "Input",
|
|
28
|
+
structure: "control",
|
|
29
|
+
composition: "control"
|
|
30
|
+
};
|
|
31
|
+
/** Formal semantic identity — description slot (helper text). */
|
|
32
|
+
var textFieldDescriptionMeta = {
|
|
33
|
+
displayName: "TextFieldDescription",
|
|
34
|
+
entity: "Input",
|
|
35
|
+
structure: "description",
|
|
36
|
+
composition: "description"
|
|
37
|
+
};
|
|
38
|
+
/** Formal semantic identity — status slot (validation message). */
|
|
39
|
+
var textFieldErrorMeta = {
|
|
40
|
+
displayName: "TextFieldError",
|
|
41
|
+
entity: "Input",
|
|
42
|
+
structure: "validationMessage",
|
|
43
|
+
composition: "status"
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A semantic text input composite built on React Aria's `TextField`.
|
|
47
|
+
*
|
|
48
|
+
* Composes four slots: `TextFieldLabel`, `TextFieldControl`,
|
|
49
|
+
* `TextFieldDescription`, and `TextFieldError`. Each sub-part carries its
|
|
50
|
+
* own `ComponentMeta` with a `composition` role per FSL §4.
|
|
51
|
+
*
|
|
52
|
+
* Validation feedback is driven by React Aria's `isInvalid` prop or
|
|
53
|
+
* `validate` callback and surfaces on the control, label, and validation
|
|
54
|
+
* message via the `invalid` token State.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <TextField isRequired>
|
|
59
|
+
* <TextFieldLabel>Email</TextFieldLabel>
|
|
60
|
+
* <TextFieldControl type="email" />
|
|
61
|
+
* <TextFieldDescription>We never share your email.</TextFieldDescription>
|
|
62
|
+
* <TextFieldError />
|
|
63
|
+
* </TextField>
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
var TextField$1 = ({
|
|
67
|
+
children,
|
|
68
|
+
...props
|
|
69
|
+
}) => {
|
|
70
|
+
return /* @__PURE__ */jsx(TextField, {
|
|
71
|
+
...props,
|
|
72
|
+
"data-scope": "text-field",
|
|
73
|
+
"data-part": "root",
|
|
74
|
+
style: {
|
|
75
|
+
boxSizing: "border-box",
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "column",
|
|
78
|
+
gap: vars.spacing.gap.stack.xs
|
|
79
|
+
},
|
|
80
|
+
children: values => {
|
|
81
|
+
return /* @__PURE__ */jsx(textFieldScope.Provider, {
|
|
82
|
+
children: typeof children === "function" ? children(values) : children
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
TextField$1.displayName = textFieldMeta.displayName;
|
|
88
|
+
/** The label slot of a TextField. Wired to React Aria for a11y linkage. */
|
|
89
|
+
var TextFieldLabel = props => {
|
|
90
|
+
textFieldScope.use(textFieldLabelMeta.displayName);
|
|
91
|
+
const colors = vars.colors.input.primary;
|
|
92
|
+
return /* @__PURE__ */jsx(Label, {
|
|
93
|
+
...props,
|
|
94
|
+
"data-scope": "text-field",
|
|
95
|
+
"data-part": "label",
|
|
96
|
+
style: {
|
|
97
|
+
color: colors?.text?.default,
|
|
98
|
+
...vars.text.label.md
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
TextFieldLabel.displayName = textFieldLabelMeta.displayName;
|
|
103
|
+
/**
|
|
104
|
+
* The control slot of a TextField — the actual `<input>` element. Reads
|
|
105
|
+
* `isInvalid` from React Aria's render-props and surfaces the `invalid`
|
|
106
|
+
* State via `vars.colors.input.primary.*`.
|
|
107
|
+
*/
|
|
108
|
+
var TextFieldControl = props => {
|
|
109
|
+
textFieldScope.use(textFieldControlMeta.displayName);
|
|
110
|
+
const colors = vars.colors.input.primary;
|
|
111
|
+
return /* @__PURE__ */jsx(Input, {
|
|
112
|
+
...props,
|
|
113
|
+
"data-scope": "text-field",
|
|
114
|
+
"data-part": "control",
|
|
115
|
+
style: ({
|
|
116
|
+
isHovered,
|
|
117
|
+
isDisabled,
|
|
118
|
+
isFocusVisible,
|
|
119
|
+
isInvalid
|
|
120
|
+
}) => {
|
|
121
|
+
return {
|
|
122
|
+
boxSizing: "border-box",
|
|
123
|
+
minHeight: vars.sizing.hit.base,
|
|
124
|
+
paddingBlock: vars.spacing.inset.control.sm,
|
|
125
|
+
paddingInline: vars.spacing.inset.control.md,
|
|
126
|
+
borderRadius: vars.radii.control,
|
|
127
|
+
borderWidth: vars.border.outline.control.width,
|
|
128
|
+
borderStyle: vars.border.outline.control.style,
|
|
129
|
+
transitionDuration: vars.motion.feedback.duration,
|
|
130
|
+
transitionTimingFunction: vars.motion.feedback.easing,
|
|
131
|
+
transitionProperty: "background-color, border-color, color",
|
|
132
|
+
backgroundColor: resolveInteractiveStyle(colors?.background, {
|
|
133
|
+
isHovered,
|
|
134
|
+
isDisabled,
|
|
135
|
+
isInvalid
|
|
136
|
+
}),
|
|
137
|
+
borderColor: resolveInteractiveStyle(colors?.border, {
|
|
138
|
+
isDisabled,
|
|
139
|
+
isInvalid,
|
|
140
|
+
isFocusVisible
|
|
141
|
+
}),
|
|
142
|
+
color: resolveInteractiveStyle(colors?.text, {
|
|
143
|
+
isHovered,
|
|
144
|
+
isDisabled,
|
|
145
|
+
isInvalid
|
|
146
|
+
}) ?? colors?.text?.default,
|
|
147
|
+
outline: focusRingOutline(isFocusVisible),
|
|
148
|
+
...vars.text.label.md
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
TextFieldControl.displayName = textFieldControlMeta.displayName;
|
|
154
|
+
/** Helper/description text linked to the control via React Aria's slot. */
|
|
155
|
+
var TextFieldDescription = props => {
|
|
156
|
+
textFieldScope.use(textFieldDescriptionMeta.displayName);
|
|
157
|
+
const colors = vars.colors.input.primary;
|
|
158
|
+
return /* @__PURE__ */jsx(Text, {
|
|
159
|
+
slot: "description",
|
|
160
|
+
...props,
|
|
161
|
+
"data-scope": "text-field",
|
|
162
|
+
"data-part": "description",
|
|
163
|
+
style: {
|
|
164
|
+
color: colors?.text?.default,
|
|
165
|
+
...vars.text.label.sm
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
TextFieldDescription.displayName = textFieldDescriptionMeta.displayName;
|
|
170
|
+
/**
|
|
171
|
+
* Validation message — rendered by React Aria only when the field is
|
|
172
|
+
* invalid. Uses the `invalid` State of the canonical `input.primary`
|
|
173
|
+
* subtree (mirroring the control's invalid coloring).
|
|
174
|
+
*/
|
|
175
|
+
var TextFieldError = props => {
|
|
176
|
+
textFieldScope.use(textFieldErrorMeta.displayName);
|
|
177
|
+
const colors = vars.colors.input.primary;
|
|
178
|
+
return /* @__PURE__ */jsx(FieldError, {
|
|
179
|
+
...props,
|
|
180
|
+
"data-scope": "text-field",
|
|
181
|
+
"data-part": "validationMessage",
|
|
182
|
+
style: {
|
|
183
|
+
color: colors?.text?.invalid ?? colors?.text?.default,
|
|
184
|
+
...vars.text.label.sm
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
TextFieldError.displayName = textFieldErrorMeta.displayName;
|
|
189
|
+
|
|
190
|
+
//#endregion
|
|
191
|
+
export { TextField$1 as TextField, TextFieldControl, TextFieldDescription, TextFieldError, TextFieldLabel, textFieldControlMeta, textFieldDescriptionMeta, textFieldErrorMeta, textFieldLabelMeta, textFieldMeta };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
const require_escapeHatch = require('../../tokens/escapeHatch.cjs');
|
|
3
|
+
let _ttoss_fsl_theme_vars = require("@ttoss/fsl-theme/vars");
|
|
4
|
+
let react_aria_components = require("react-aria-components");
|
|
5
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
|
+
|
|
7
|
+
//#region src/composites/Tooltip/Tooltip.tsx
|
|
8
|
+
var TOOLTIP_MAX_WIDTH_DEFAULT = "min(280px, 90vw)";
|
|
9
|
+
var TOOLTIP_OFFSET_DEFAULT = 6;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a focusable trigger and its `Tooltip`. React Aria shows the tooltip on
|
|
12
|
+
* hover and keyboard focus and manages the delay.
|
|
13
|
+
*/
|
|
14
|
+
var TooltipTrigger = props => {
|
|
15
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.TooltipTrigger, {
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
TooltipTrigger.displayName = "TooltipTrigger";
|
|
20
|
+
/** Formal semantic identity — Tooltip surface (Overlay entity). */
|
|
21
|
+
var tooltipMeta = {
|
|
22
|
+
displayName: "Tooltip",
|
|
23
|
+
entity: "Overlay",
|
|
24
|
+
structure: "root"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A hover/focus tooltip (Overlay entity). Place inside a `TooltipTrigger`
|
|
28
|
+
* after the focusable trigger element.
|
|
29
|
+
*
|
|
30
|
+
* A tooltip must contain **only non-interactive text/content** — it is not a
|
|
31
|
+
* focus target and must never hold buttons, links, or form fields (use a
|
|
32
|
+
* `Popover` for interactive overlays).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <TooltipTrigger>
|
|
37
|
+
* <Button>Save</Button>
|
|
38
|
+
* <Tooltip>Saves the current draft</Tooltip>
|
|
39
|
+
* </TooltipTrigger>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
var Tooltip = ({
|
|
43
|
+
evaluation = "primary",
|
|
44
|
+
offset = TOOLTIP_OFFSET_DEFAULT,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const colors = _ttoss_fsl_theme_vars.vars.colors.informational[evaluation];
|
|
48
|
+
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(react_aria_components.Tooltip, {
|
|
49
|
+
...props,
|
|
50
|
+
offset,
|
|
51
|
+
"data-scope": "tooltip",
|
|
52
|
+
"data-part": "root",
|
|
53
|
+
"data-evaluation": evaluation,
|
|
54
|
+
style: {
|
|
55
|
+
boxSizing: "border-box",
|
|
56
|
+
maxWidth: require_escapeHatch.fslVar("--fsl-tooltip-max-width", TOOLTIP_MAX_WIDTH_DEFAULT),
|
|
57
|
+
borderRadius: _ttoss_fsl_theme_vars.vars.radii.surface,
|
|
58
|
+
borderWidth: _ttoss_fsl_theme_vars.vars.border.outline.surface.width,
|
|
59
|
+
borderStyle: _ttoss_fsl_theme_vars.vars.border.outline.surface.style,
|
|
60
|
+
borderColor: colors?.border?.default,
|
|
61
|
+
backgroundColor: colors?.background?.default,
|
|
62
|
+
color: colors?.text?.default,
|
|
63
|
+
boxShadow: _ttoss_fsl_theme_vars.vars.elevation.surface.overlay,
|
|
64
|
+
paddingBlock: _ttoss_fsl_theme_vars.vars.spacing.inset.surface.sm,
|
|
65
|
+
paddingInline: _ttoss_fsl_theme_vars.vars.spacing.inset.surface.md,
|
|
66
|
+
..._ttoss_fsl_theme_vars.vars.text.label.md,
|
|
67
|
+
transitionProperty: "opacity",
|
|
68
|
+
transitionDuration: _ttoss_fsl_theme_vars.vars.motion.transition.enter.duration,
|
|
69
|
+
transitionTimingFunction: _ttoss_fsl_theme_vars.vars.motion.transition.enter.easing,
|
|
70
|
+
zIndex: _ttoss_fsl_theme_vars.vars.zIndex.layer.overlay
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
Tooltip.displayName = tooltipMeta.displayName;
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
exports.Tooltip = Tooltip;
|
|
78
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
79
|
+
exports.tooltipMeta = tooltipMeta;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { EvaluationsFor } from "../../semantics/taxonomy.cjs";
|
|
3
|
+
import { TooltipProps, TooltipTriggerComponentProps } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
//#region src/composites/Tooltip/Tooltip.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a focusable trigger and its `Tooltip`. React Aria shows the tooltip on
|
|
8
|
+
* hover and keyboard focus and manages the delay.
|
|
9
|
+
*/
|
|
10
|
+
declare const TooltipTrigger: {
|
|
11
|
+
(props: TooltipTriggerComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
/** Formal semantic identity — Tooltip surface (Overlay entity). */
|
|
15
|
+
declare const tooltipMeta: {
|
|
16
|
+
readonly displayName: "Tooltip";
|
|
17
|
+
readonly entity: "Overlay";
|
|
18
|
+
readonly structure: "root";
|
|
19
|
+
};
|
|
20
|
+
/** Props for the Tooltip surface. */
|
|
21
|
+
interface TooltipProps$1 extends Omit<TooltipProps, 'style'> {
|
|
22
|
+
/**
|
|
23
|
+
* Semantic emphasis for the tooltip surface.
|
|
24
|
+
* @default 'primary'
|
|
25
|
+
*/
|
|
26
|
+
evaluation?: EvaluationsFor<(typeof tooltipMeta)['entity']>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A hover/focus tooltip (Overlay entity). Place inside a `TooltipTrigger`
|
|
30
|
+
* after the focusable trigger element.
|
|
31
|
+
*
|
|
32
|
+
* A tooltip must contain **only non-interactive text/content** — it is not a
|
|
33
|
+
* focus target and must never hold buttons, links, or form fields (use a
|
|
34
|
+
* `Popover` for interactive overlays).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <TooltipTrigger>
|
|
39
|
+
* <Button>Save</Button>
|
|
40
|
+
* <Tooltip>Saves the current draft</Tooltip>
|
|
41
|
+
* </TooltipTrigger>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const Tooltip: {
|
|
45
|
+
({
|
|
46
|
+
evaluation,
|
|
47
|
+
offset,
|
|
48
|
+
...props
|
|
49
|
+
}: TooltipProps$1): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
displayName: "Tooltip";
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { Tooltip, TooltipProps$1 as TooltipProps, TooltipTrigger, tooltipMeta };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
|
|
2
|
+
import { EvaluationsFor } from "../../semantics/taxonomy.mjs";
|
|
3
|
+
import { TooltipProps, TooltipTriggerComponentProps } from "react-aria-components";
|
|
4
|
+
|
|
5
|
+
//#region src/composites/Tooltip/Tooltip.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a focusable trigger and its `Tooltip`. React Aria shows the tooltip on
|
|
8
|
+
* hover and keyboard focus and manages the delay.
|
|
9
|
+
*/
|
|
10
|
+
declare const TooltipTrigger$1: {
|
|
11
|
+
(props: TooltipTriggerComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
/** Formal semantic identity — Tooltip surface (Overlay entity). */
|
|
15
|
+
declare const tooltipMeta: {
|
|
16
|
+
readonly displayName: "Tooltip";
|
|
17
|
+
readonly entity: "Overlay";
|
|
18
|
+
readonly structure: "root";
|
|
19
|
+
};
|
|
20
|
+
/** Props for the Tooltip surface. */
|
|
21
|
+
interface TooltipProps$1 extends Omit<TooltipProps, 'style'> {
|
|
22
|
+
/**
|
|
23
|
+
* Semantic emphasis for the tooltip surface.
|
|
24
|
+
* @default 'primary'
|
|
25
|
+
*/
|
|
26
|
+
evaluation?: EvaluationsFor<(typeof tooltipMeta)['entity']>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A hover/focus tooltip (Overlay entity). Place inside a `TooltipTrigger`
|
|
30
|
+
* after the focusable trigger element.
|
|
31
|
+
*
|
|
32
|
+
* A tooltip must contain **only non-interactive text/content** — it is not a
|
|
33
|
+
* focus target and must never hold buttons, links, or form fields (use a
|
|
34
|
+
* `Popover` for interactive overlays).
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <TooltipTrigger>
|
|
39
|
+
* <Button>Save</Button>
|
|
40
|
+
* <Tooltip>Saves the current draft</Tooltip>
|
|
41
|
+
* </TooltipTrigger>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
declare const Tooltip$1: {
|
|
45
|
+
({
|
|
46
|
+
evaluation,
|
|
47
|
+
offset,
|
|
48
|
+
...props
|
|
49
|
+
}: TooltipProps$1): import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
displayName: "Tooltip";
|
|
51
|
+
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { Tooltip$1 as Tooltip, TooltipProps$1 as TooltipProps, TooltipTrigger$1 as TooltipTrigger, tooltipMeta };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { fslVar } from "../../tokens/escapeHatch.mjs";
|
|
3
|
+
import { vars } from "@ttoss/fsl-theme/vars";
|
|
4
|
+
import { Tooltip, TooltipTrigger } from "react-aria-components";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/composites/Tooltip/Tooltip.tsx
|
|
8
|
+
var TOOLTIP_MAX_WIDTH_DEFAULT = "min(280px, 90vw)";
|
|
9
|
+
var TOOLTIP_OFFSET_DEFAULT = 6;
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a focusable trigger and its `Tooltip`. React Aria shows the tooltip on
|
|
12
|
+
* hover and keyboard focus and manages the delay.
|
|
13
|
+
*/
|
|
14
|
+
var TooltipTrigger$1 = props => {
|
|
15
|
+
return /* @__PURE__ */jsx(TooltipTrigger, {
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
TooltipTrigger$1.displayName = "TooltipTrigger";
|
|
20
|
+
/** Formal semantic identity — Tooltip surface (Overlay entity). */
|
|
21
|
+
var tooltipMeta = {
|
|
22
|
+
displayName: "Tooltip",
|
|
23
|
+
entity: "Overlay",
|
|
24
|
+
structure: "root"
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A hover/focus tooltip (Overlay entity). Place inside a `TooltipTrigger`
|
|
28
|
+
* after the focusable trigger element.
|
|
29
|
+
*
|
|
30
|
+
* A tooltip must contain **only non-interactive text/content** — it is not a
|
|
31
|
+
* focus target and must never hold buttons, links, or form fields (use a
|
|
32
|
+
* `Popover` for interactive overlays).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <TooltipTrigger>
|
|
37
|
+
* <Button>Save</Button>
|
|
38
|
+
* <Tooltip>Saves the current draft</Tooltip>
|
|
39
|
+
* </TooltipTrigger>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
var Tooltip$1 = ({
|
|
43
|
+
evaluation = "primary",
|
|
44
|
+
offset = TOOLTIP_OFFSET_DEFAULT,
|
|
45
|
+
...props
|
|
46
|
+
}) => {
|
|
47
|
+
const colors = vars.colors.informational[evaluation];
|
|
48
|
+
return /* @__PURE__ */jsx(Tooltip, {
|
|
49
|
+
...props,
|
|
50
|
+
offset,
|
|
51
|
+
"data-scope": "tooltip",
|
|
52
|
+
"data-part": "root",
|
|
53
|
+
"data-evaluation": evaluation,
|
|
54
|
+
style: {
|
|
55
|
+
boxSizing: "border-box",
|
|
56
|
+
maxWidth: fslVar("--fsl-tooltip-max-width", TOOLTIP_MAX_WIDTH_DEFAULT),
|
|
57
|
+
borderRadius: vars.radii.surface,
|
|
58
|
+
borderWidth: vars.border.outline.surface.width,
|
|
59
|
+
borderStyle: vars.border.outline.surface.style,
|
|
60
|
+
borderColor: colors?.border?.default,
|
|
61
|
+
backgroundColor: colors?.background?.default,
|
|
62
|
+
color: colors?.text?.default,
|
|
63
|
+
boxShadow: vars.elevation.surface.overlay,
|
|
64
|
+
paddingBlock: vars.spacing.inset.surface.sm,
|
|
65
|
+
paddingInline: vars.spacing.inset.surface.md,
|
|
66
|
+
...vars.text.label.md,
|
|
67
|
+
transitionProperty: "opacity",
|
|
68
|
+
transitionDuration: vars.motion.transition.enter.duration,
|
|
69
|
+
transitionTimingFunction: vars.motion.transition.enter.easing,
|
|
70
|
+
zIndex: vars.zIndex.layer.overlay
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
Tooltip$1.displayName = tooltipMeta.displayName;
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { Tooltip$1 as Tooltip, TooltipTrigger$1 as TooltipTrigger, tooltipMeta };
|