@astryxdesign/core 0.4.0 → 0.4.1
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/CHANGELOG.md +39 -0
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +1 -2
- package/dist/AspectRatio/index.d.ts.map +1 -1
- package/dist/AspectRatio/index.js +1 -2
- package/dist/Badge/Badge.d.ts.map +1 -1
- package/dist/Badge/Badge.js +1 -2
- package/dist/Badge/index.d.ts.map +1 -1
- package/dist/Badge/index.js +1 -2
- package/dist/Banner/Banner.d.ts +3 -0
- package/dist/Banner/Banner.d.ts.map +1 -1
- package/dist/Banner/Banner.js +17 -3
- package/dist/Blockquote/Blockquote.d.ts.map +1 -1
- package/dist/Blockquote/Blockquote.js +1 -2
- package/dist/Blockquote/index.d.ts.map +1 -1
- package/dist/Blockquote/index.js +1 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +2 -2
- package/dist/Card/Card.d.ts.map +1 -1
- package/dist/Card/Card.js +1 -2
- package/dist/Card/index.d.ts.map +1 -1
- package/dist/Card/index.js +1 -2
- package/dist/Center/Center.d.ts.map +1 -1
- package/dist/Center/Center.js +1 -2
- package/dist/Center/index.d.ts.map +1 -1
- package/dist/Center/index.js +1 -2
- package/dist/Code/Code.d.ts.map +1 -1
- package/dist/Code/Code.js +1 -2
- package/dist/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPalette.js +5 -0
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +7 -8
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +23 -10
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +44 -16
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +32 -13
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +10 -3
- package/dist/Field/PanelSearchInput.d.ts +81 -0
- package/dist/Field/PanelSearchInput.d.ts.map +1 -0
- package/dist/Field/PanelSearchInput.js +151 -0
- package/dist/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +21 -10
- package/dist/Grid/Grid.d.ts.map +1 -1
- package/dist/Grid/Grid.js +1 -2
- package/dist/Grid/index.d.ts.map +1 -1
- package/dist/Grid/index.js +1 -2
- package/dist/Icon/globalIconRegistry.d.ts +5 -4
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +5 -4
- package/dist/Indicator/index.d.ts +1 -1
- package/dist/Indicator/index.d.ts.map +1 -1
- package/dist/Indicator/types.d.ts +10 -0
- package/dist/Indicator/types.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +24 -50
- package/dist/MultiSelector/MultiSelector.d.ts +8 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +134 -102
- package/dist/Popover/usePopover.d.ts +15 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +14 -2
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -3
- package/dist/Section/Section.d.ts.map +1 -1
- package/dist/Section/Section.js +1 -2
- package/dist/Section/index.d.ts.map +1 -1
- package/dist/Section/index.js +1 -2
- package/dist/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +135 -95
- package/dist/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/Skeleton/Skeleton.js +1 -2
- package/dist/Skeleton/index.d.ts.map +1 -1
- package/dist/Skeleton/index.js +1 -2
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +2 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +3 -3
- package/dist/Table/TableRow.d.ts +1 -1
- package/dist/Table/TableRow.d.ts.map +1 -1
- package/dist/Table/TableRow.js +4 -2
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +7 -2
- package/dist/Timestamp/Timestamp.d.ts.map +1 -1
- package/dist/Timestamp/Timestamp.js +14 -3
- package/dist/Timestamp/formatInstant.d.ts +11 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +3 -1
- package/dist/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden/VisuallyHidden.js +1 -2
- package/dist/VisuallyHidden/index.d.ts.map +1 -1
- package/dist/VisuallyHidden/index.js +1 -2
- package/dist/astryx.css +18 -17
- package/dist/astryx.umd.js +45 -45
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/useInputStatusIcon.d.ts.map +1 -1
- package/dist/hooks/useInputStatusIcon.js +17 -4
- package/dist/theme/defineTheme.d.ts +2 -2
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +2 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/tokens.stylex.d.ts +12 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +23 -0
- package/dist/utils/focusOutline.stylex.d.ts +34 -19
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +46 -33
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -1
- package/dist/utils/interactionModality.d.ts +34 -0
- package/dist/utils/interactionModality.d.ts.map +1 -0
- package/dist/utils/interactionModality.js +70 -0
- package/locales/en.json +40 -0
- package/locales/pseudo.json +30 -0
- package/package.json +2 -2
- package/src/AppShell/AppShell.doc.mjs +3 -0
- package/src/AspectRatio/AspectRatio.tsx +0 -2
- package/src/AspectRatio/index.ts +0 -2
- package/src/Badge/Badge.tsx +0 -2
- package/src/Badge/index.ts +0 -2
- package/src/Banner/Banner.test.tsx +58 -1
- package/src/Banner/Banner.tsx +24 -5
- package/src/Blockquote/Blockquote.tsx +0 -2
- package/src/Blockquote/index.ts +0 -2
- package/src/Button/Button.doc.mjs +2 -2
- package/src/Button/Button.tsx +5 -4
- package/src/Card/Card.tsx +0 -2
- package/src/Card/index.ts +0 -2
- package/src/Center/Center.tsx +0 -2
- package/src/Center/index.ts +0 -2
- package/src/CheckboxInput/CheckboxInput.test.tsx +8 -3
- package/src/Code/Code.tsx +0 -2
- package/src/CommandPalette/CommandPalette.test.tsx +54 -0
- package/src/CommandPalette/CommandPalette.tsx +5 -0
- package/src/ComplexSelector/ComplexSelector.test.tsx +15 -6
- package/src/ComplexSelector/ComplexSelector.tsx +6 -10
- package/src/DateInput/DateInput.test.tsx +19 -0
- package/src/DateInput/DateInput.tsx +3 -6
- package/src/DateRangeInput/DateRangeInput.tsx +3 -9
- package/src/DateTimeInput/DateTimeInput.test.tsx +79 -1
- package/src/DateTimeInput/DateTimeInput.tsx +23 -9
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +2 -1
- package/src/Field/PanelSearchInput.tsx +271 -0
- package/src/FileInput/FileInput.tsx +21 -8
- package/src/Grid/Grid.tsx +0 -2
- package/src/Grid/index.ts +0 -2
- package/src/Icon/globalIconRegistry.tsx +5 -4
- package/src/Indicator/Indicator.doc.mjs +1 -1
- package/src/Indicator/index.ts +1 -0
- package/src/Indicator/types.ts +11 -0
- package/src/Lightbox/Lightbox.tsx +2 -11
- package/src/MultiSelector/MultiSelector.doc.mjs +9 -0
- package/src/MultiSelector/MultiSelector.test.tsx +135 -5
- package/src/MultiSelector/MultiSelector.tsx +170 -127
- package/src/Popover/Popover.doc.mjs +2 -0
- package/src/Popover/usePopover.tsx +37 -4
- package/src/ProgressBar/ProgressBar.tsx +2 -8
- package/src/Section/Section.tsx +0 -2
- package/src/Section/index.ts +0 -2
- package/src/Selector/Selector.doc.mjs +10 -0
- package/src/Selector/Selector.test.tsx +386 -2
- package/src/Selector/Selector.tsx +182 -122
- package/src/Skeleton/Skeleton.tsx +0 -2
- package/src/Skeleton/index.ts +0 -2
- package/src/Slider/Slider.tsx +2 -11
- package/src/Switch/Switch.tsx +10 -2
- package/src/Table/Table.test.tsx +31 -0
- package/src/Table/TableRow.tsx +6 -0
- package/src/TimeInput/TimeInput.test.tsx +54 -0
- package/src/TimeInput/TimeInput.tsx +17 -2
- package/src/Timestamp/Timestamp.test.tsx +91 -14
- package/src/Timestamp/Timestamp.tsx +14 -2
- package/src/Timestamp/formatInstant.ts +16 -1
- package/src/TopNav/TopNavMegaMenu.doc.mjs +5 -0
- package/src/TreeList/TreeList.test.tsx +3 -2
- package/src/VisuallyHidden/VisuallyHidden.tsx +0 -2
- package/src/VisuallyHidden/index.ts +0 -2
- package/src/hooks/useInputStatusIcon.tsx +8 -8
- package/src/serverSafeComponents.test.ts +665 -0
- package/src/theme/defineTheme.ts +3 -0
- package/src/theme/generateThemeRules.test.ts +17 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/tokens.stylex.ts +18 -0
- package/src/theme/tokens.test.ts +37 -0
- package/src/utils/focusOutline.stylex.ts +37 -23
- package/src/utils/index.ts +4 -0
- package/src/utils/interactionModality.ts +74 -0
|
@@ -109,6 +109,21 @@ export interface UsePopoverOptions {
|
|
|
109
109
|
* @default true
|
|
110
110
|
*/
|
|
111
111
|
hasSurface?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Theme-target name stamped on the popup SURFACE — the element that paints
|
|
114
|
+
* the background, radius and elevation — without the `astryx-` prefix
|
|
115
|
+
* (e.g. `'complex-selector-popup'`).
|
|
116
|
+
*
|
|
117
|
+
* The surface is created here, not by the calling component, so a component
|
|
118
|
+
* that wants its popup themeable cannot reach it on its own: a target it
|
|
119
|
+
* renders itself lands on its content INSIDE the surface, where a background
|
|
120
|
+
* or radius rule paints the wrong box. Name the surface through this option
|
|
121
|
+
* and document the class in the component's `theming.targets`.
|
|
122
|
+
*
|
|
123
|
+
* The shared `astryx-popover-surface` class is always present alongside it,
|
|
124
|
+
* so a theme can style every popup surface at once.
|
|
125
|
+
*/
|
|
126
|
+
surfaceTarget?: string;
|
|
112
127
|
}
|
|
113
128
|
/**
|
|
114
129
|
* Return type for usePopover
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAW,KAAK,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"usePopover.d.ts","sourceRoot":"","sources":["../../src/Popover/usePopover.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAAiC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAW,KAAK,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAgEnD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,YAAY,C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,KAAK,SAAS,CAAC;IAEvE;;OAEG;IACH,YAAY,EAAE;QACZ,eAAe,EAAE,QAAQ,GAAG,MAAM,CAAC;QACnC,eAAe,EAAE,OAAO,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,gBAAgB,CA2K5E"}
|
|
@@ -24,6 +24,9 @@ import { Button } from "../Button/index.js";
|
|
|
24
24
|
import { rtlStyles } from "../utils/index.js";
|
|
25
25
|
import { useTranslator } from "../i18n/index.js";
|
|
26
26
|
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
27
|
+
import { mergeProps } from "../utils/mergeProps.js";
|
|
28
|
+
import { themeProps } from "../utils/themeProps.js";
|
|
29
|
+
import { stableClassName } from "../naming.js";
|
|
27
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
31
|
const styles = {
|
|
29
32
|
surface: {
|
|
@@ -107,6 +110,7 @@ export function usePopover(options = {}) {
|
|
|
107
110
|
hasEscapeDismiss = true,
|
|
108
111
|
hasAutoFocus = true,
|
|
109
112
|
hasSurface = true,
|
|
113
|
+
surfaceTarget,
|
|
110
114
|
hasCloseButton = true,
|
|
111
115
|
closeButtonLabel: closeButtonLabelFromProps,
|
|
112
116
|
dialogLabel,
|
|
@@ -188,12 +192,20 @@ export function usePopover(options = {}) {
|
|
|
188
192
|
|
|
189
193
|
// Wrapped render function that includes surface styles and optional hidden close button
|
|
190
194
|
const render = useCallback((children, props) => {
|
|
195
|
+
// `mergeProps` is positional — a third OBJECT argument is read as
|
|
196
|
+
// `style`, not as more props — so the surface's classes are composed
|
|
197
|
+
// into one props object before merging with the StyleX result.
|
|
198
|
+
const surfaceProps = themeProps('popover-surface');
|
|
199
|
+
const surfaceClassName = surfaceTarget != null ? `${surfaceProps.className} ${stableClassName(surfaceTarget)}` : surfaceProps.className;
|
|
191
200
|
return layer.render(/*#__PURE__*/_jsxs("div", {
|
|
192
201
|
ref: contentRef,
|
|
193
202
|
role: role === 'dialog' ? 'dialog' : undefined,
|
|
194
203
|
"aria-modal": role === 'dialog' && isModal ? true : undefined,
|
|
195
204
|
"aria-label": role === 'dialog' ? dialogLabel : undefined,
|
|
196
|
-
...
|
|
205
|
+
...mergeProps({
|
|
206
|
+
...surfaceProps,
|
|
207
|
+
className: surfaceClassName
|
|
208
|
+
}, stylex.props(styles.contentWrapper, hasSurface && styles.surface, xstyle)),
|
|
197
209
|
children: [children, hasCloseButton && /*#__PURE__*/_jsx("div", {
|
|
198
210
|
...stylex.props(styles.closeButtonWrapper, rtlStyles.centerInline('100%')),
|
|
199
211
|
children: /*#__PURE__*/_jsx(Button, {
|
|
@@ -206,7 +218,7 @@ export function usePopover(options = {}) {
|
|
|
206
218
|
...props,
|
|
207
219
|
xstyle: props?.xstyle
|
|
208
220
|
});
|
|
209
|
-
}, [layer, hasCloseButton, hasSurface, closeButtonLabel, contentRef, dialogLabel, role, isModal, xstyle]);
|
|
221
|
+
}, [layer, hasCloseButton, hasSurface, surfaceTarget, closeButtonLabel, contentRef, dialogLabel, role, isModal, xstyle]);
|
|
210
222
|
return {
|
|
211
223
|
triggerRef,
|
|
212
224
|
contentRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,SAAS,CAAC;AAUnD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC;AAE7D;;;;;;G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W"}
|
|
@@ -21,6 +21,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
22
22
|
import { colorVars, spacingVars, radiusVars, fontWeightVars, durationVars, easeVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
23
23
|
import { mergeProps } from "../utils/index.js";
|
|
24
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
24
25
|
import { themeProps } from "../utils/themeProps.js";
|
|
25
26
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
26
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -90,8 +91,6 @@ const styles = {
|
|
|
90
91
|
k87sOh: "xwa60dl",
|
|
91
92
|
kzqmXN: "x63cpjl",
|
|
92
93
|
kZKoxP: "xhovv34",
|
|
93
|
-
kI3sdo: "x1a2a7pz x17nn4n9",
|
|
94
|
-
kInvED: "x1wfwxd8 x7s97pk",
|
|
95
94
|
k3aq6I: "x11lhmoz xoffwj3",
|
|
96
95
|
$$css: true
|
|
97
96
|
}
|
|
@@ -366,7 +365,7 @@ export function ProgressBar({
|
|
|
366
365
|
...mergeProps(themeProps('progressbar-mark', {
|
|
367
366
|
variant: fillVariant,
|
|
368
367
|
placement: mark.isOnFill ? 'fill' : 'track'
|
|
369
|
-
}), stylex.props(styles.mark, mark.isOnFill ? markOnFillStyles[fillVariant] : isDisabled ? markOnTrackStyles.trackDisabled : markOnTrackStyles.track)),
|
|
368
|
+
}), stylex.props(focusOutlineStyles.focusVisible, styles.mark, mark.isOnFill ? markOnFillStyles[fillVariant] : isDisabled ? markOnTrackStyles.trackDisabled : markOnTrackStyles.track)),
|
|
370
369
|
style: {
|
|
371
370
|
insetInlineStart: `${mark.pct}%`
|
|
372
371
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../src/Section/Section.tsx"],"names":[],"mappings":"
|
|
1
|
+
{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T,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,YAAY,+BA0Ed;yBAzFe,OAAO"}
|
package/dist/Section/Section.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file Section.tsx
|
|
7
5
|
* @input Uses container utility, StyleX
|
|
@@ -14,6 +12,7 @@
|
|
|
14
12
|
* - /apps/storybook/stories/Section.stories.tsx (storybook stories)
|
|
15
13
|
* - /packages/cli/assets/templates/blocks/components/Section/ (showcase blocks)
|
|
16
14
|
*/
|
|
15
|
+
|
|
17
16
|
import * as stylex from '@stylexjs/stylex';
|
|
18
17
|
import "../theme/tokens.stylex.js";
|
|
19
18
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Section/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Section/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,IAAI,CAAC;IACd,WAAW,EAAE,IAAI,CAAC;IAClB,KAAK,EAAE,IAAI,CAAC;CACb;AAED,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,YAAY,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC"}
|
package/dist/Section/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import React, { type ReactNode } from 'react';
|
|
16
16
|
import { type IconType } from '../Icon';
|
|
17
|
+
import type { IndicatorPosition } from '../Indicator';
|
|
17
18
|
import { type FieldStatusVariant } from '../Field';
|
|
18
19
|
import type { LayerPlacement } from '../Layer/useLayer';
|
|
19
20
|
import type { SelectorOptionType, SelectorOptionData } from './types';
|
|
@@ -144,6 +145,15 @@ interface SelectorPropsBase<T extends SelectorOptionType = SelectorOptionType> e
|
|
|
144
145
|
* Only called for selectable options (not dividers/sections).
|
|
145
146
|
*/
|
|
146
147
|
renderOption?: (option: SelectorOptionData) => ReactNode;
|
|
148
|
+
/**
|
|
149
|
+
* Which edge of the option row carries the selected mark. `start` reserves a
|
|
150
|
+
* mark column ahead of every label so they stay aligned, the way a native
|
|
151
|
+
* menu does; `end` is the house convention shared with Typeahead and
|
|
152
|
+
* CommandPalette.
|
|
153
|
+
*
|
|
154
|
+
* @default 'end'
|
|
155
|
+
*/
|
|
156
|
+
indicatorPosition?: IndicatorPosition;
|
|
147
157
|
/**
|
|
148
158
|
* Whether to show a search input for filtering options.
|
|
149
159
|
* @default false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAEpD,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAGlB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAgBtD,OAAO,KAAK,EAAC,kBAAkB,EAAE,kBAAk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,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEJ,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IACzE,yBAAyB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC;AAwC3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,kBAAkB,EACnD,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,qBAo1BxB;yBAr1Be,QAAQ"}
|
|
@@ -26,7 +26,7 @@ import { Field, InputClearButton, inputStatusBorderStyles, inputStatusHoverShado
|
|
|
26
26
|
import { Divider } from "../Divider/index.js";
|
|
27
27
|
import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
28
28
|
import { Spinner } from "../Spinner/index.js";
|
|
29
|
-
import {
|
|
29
|
+
import { PanelSearchInput } from "../Field/PanelSearchInput.js";
|
|
30
30
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
31
31
|
import "../theme/tokens.stylex.js";
|
|
32
32
|
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars, borderVars } from "../theme/tokens.stylex.js";
|
|
@@ -37,12 +37,13 @@ import { SelectorOption } from "./SelectorOption.js";
|
|
|
37
37
|
import { getInputARIA, mergeProps } from "../utils/index.js";
|
|
38
38
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
39
39
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
|
+
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
40
41
|
import { stableClassName } from "../naming.js";
|
|
41
42
|
import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
42
43
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
43
44
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
44
45
|
import { useTranslator } from "../i18n/index.js";
|
|
45
|
-
import { jsx as _jsx,
|
|
46
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
46
47
|
const styles = {
|
|
47
48
|
triggerContainer: {
|
|
48
49
|
kVAEAm: "x1n2onr6",
|
|
@@ -86,8 +87,6 @@ const styles = {
|
|
|
86
87
|
kKwaWg: "x1ilzqfv xq8i9tn",
|
|
87
88
|
kGVxlE: "x1gnnqk1 x1irk71m x15ysqaf",
|
|
88
89
|
k63SB2: "x1e4wzip",
|
|
89
|
-
kI3sdo: "x1a2a7pz x1irc7jg",
|
|
90
|
-
kInvED: "x1wfwxd8 xscfbxq",
|
|
91
90
|
k1ekBW: "xrafxwg",
|
|
92
91
|
k3aq6I: "x3oybdh xk4oym4",
|
|
93
92
|
$$css: true
|
|
@@ -97,12 +96,26 @@ const styles = {
|
|
|
97
96
|
k3aq6I: "x1c071of x1pdlv7q",
|
|
98
97
|
$$css: true
|
|
99
98
|
},
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
statusButton: {
|
|
100
|
+
k1xSpc: "x78zum5",
|
|
101
|
+
kGNEyG: "x6s0dn4",
|
|
102
|
+
kjj79g: "xl56j7k",
|
|
103
|
+
kmVPX3: "x1717udv",
|
|
104
|
+
kogj98: "x1ghz6dp",
|
|
105
|
+
kMzoRj: "xc342km",
|
|
106
|
+
ksu8eU: "xng3xce",
|
|
107
|
+
kWkggS: "xjbqb8w",
|
|
108
|
+
kMwMTN: "x1heor9g",
|
|
109
|
+
kkrTdU: "x1ypdohk",
|
|
110
|
+
kaIpWk: "xh6dtrn",
|
|
102
111
|
$$css: true
|
|
103
112
|
},
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
searchRowInput: {
|
|
114
|
+
kg3NbH: "x2hg6jq",
|
|
115
|
+
$$css: true
|
|
116
|
+
},
|
|
117
|
+
popover: {
|
|
118
|
+
k7Eaqz: "xrzjruh",
|
|
106
119
|
$$css: true
|
|
107
120
|
},
|
|
108
121
|
divider: {
|
|
@@ -268,6 +281,7 @@ export function Selector(props) {
|
|
|
268
281
|
startIcon,
|
|
269
282
|
htmlName,
|
|
270
283
|
renderOption,
|
|
284
|
+
indicatorPosition = 'end',
|
|
271
285
|
hasSearch = false,
|
|
272
286
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
273
287
|
placement,
|
|
@@ -301,7 +315,7 @@ export function Selector(props) {
|
|
|
301
315
|
const searchRef = useRef(null);
|
|
302
316
|
const inputGroup = useInputGroup();
|
|
303
317
|
const [searchQuery, setSearchQuery] = useState('');
|
|
304
|
-
// A typed query shows
|
|
318
|
+
// A typed query shows the search row's clear (✕) button, which becomes
|
|
305
319
|
// the next tab stop after the search input.
|
|
306
320
|
const hasQuery = searchQuery.length > 0;
|
|
307
321
|
const [, startTransition] = useTransition();
|
|
@@ -369,7 +383,10 @@ export function Selector(props) {
|
|
|
369
383
|
hasAutoFocus: false,
|
|
370
384
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
371
385
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
372
|
-
role: 'none'
|
|
386
|
+
role: 'none',
|
|
387
|
+
// The theme target belongs on the SURFACE that paints the popup, which
|
|
388
|
+
// `usePopover` owns — not on the scrolling list inside it.
|
|
389
|
+
surfaceTarget: 'selector-popup'
|
|
373
390
|
});
|
|
374
391
|
|
|
375
392
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -541,13 +558,39 @@ export function Selector(props) {
|
|
|
541
558
|
if (!hasSearch) {
|
|
542
559
|
return null;
|
|
543
560
|
}
|
|
544
|
-
return /*#__PURE__*/_jsx(
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
561
|
+
return /*#__PURE__*/_jsx(PanelSearchInput, {
|
|
562
|
+
ref: searchRef,
|
|
563
|
+
id: searchId
|
|
564
|
+
// The search row is the panel's header: a magnifier, a borderless
|
|
565
|
+
// input, and the shared clear (✕) button. It deliberately does NOT
|
|
566
|
+
// render a bordered TextInput — the popup is already a bordered
|
|
567
|
+
// surface, and a field inside it drew a second box within that box.
|
|
568
|
+
,
|
|
569
|
+
label: t('@astryx.selector.searchOptions')
|
|
570
|
+
// Same accessible name the TextInput's built-in clear produced
|
|
571
|
+
// ("Clear Search options"), so the affordance keeps its name while its
|
|
572
|
+
// chrome changes.
|
|
573
|
+
,
|
|
574
|
+
clearLabel: t('@astryx.textInput.clearLabel', {
|
|
575
|
+
label: t('@astryx.selector.searchOptions')
|
|
576
|
+
}),
|
|
577
|
+
...themeProps('selector-search'),
|
|
578
|
+
xstyle: variant !== 'ghost' && styles.searchRowInput
|
|
579
|
+
// When hasSearch is set, focus moves into this input on open, so it —
|
|
580
|
+
// not the trigger — must be the combobox that reports the highlighted
|
|
581
|
+
// option via aria-activedescendant (comboboxes-4). A bare searchbox
|
|
582
|
+
// left the highlight silent to screen readers.
|
|
583
|
+
,
|
|
584
|
+
role: "combobox",
|
|
585
|
+
"aria-expanded": popover.isOpen,
|
|
586
|
+
"aria-controls": listboxId,
|
|
587
|
+
"aria-autocomplete": "list",
|
|
588
|
+
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
589
|
+
value: searchQuery,
|
|
590
|
+
onValueChange: handleSearchChange,
|
|
591
|
+
onContainerKeyDown: e => {
|
|
592
|
+
// The clear (✕) button lives inside the row, after the input in DOM
|
|
593
|
+
// order. When it is focused and the user tabs forward there is
|
|
551
594
|
// nothing else in the popup, so dismiss it (Shift+Tab returns to the
|
|
552
595
|
// input natively). Key events originating on the input are handled on
|
|
553
596
|
// the input below; ignore them here so we don't double-dismiss.
|
|
@@ -558,57 +601,25 @@ export function Selector(props) {
|
|
|
558
601
|
onKeyDown(e);
|
|
559
602
|
}
|
|
560
603
|
},
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
//
|
|
565
|
-
//
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
width: "100%"
|
|
579
|
-
// When hasSearch is set, focus moves into this input on open, so it —
|
|
580
|
-
// not the trigger — must be the combobox that reports the highlighted
|
|
581
|
-
// option via aria-activedescendant (comboboxes-4). A bare searchbox
|
|
582
|
-
// left the highlight silent to screen readers. role + aria-* pass
|
|
583
|
-
// through to the underlying <input> via BaseProps.
|
|
584
|
-
,
|
|
585
|
-
role: "combobox",
|
|
586
|
-
"aria-expanded": popover.isOpen,
|
|
587
|
-
"aria-controls": listboxId,
|
|
588
|
-
"aria-autocomplete": "list",
|
|
589
|
-
"aria-activedescendant": popover.isOpen && highlightedIndex >= 0 ? getItemId(highlightedIndex) : undefined,
|
|
590
|
-
value: searchQuery,
|
|
591
|
-
onChange: handleSearchChange,
|
|
592
|
-
onKeyDown: e => {
|
|
593
|
-
// Arrow keys navigate options; Enter selects; Escape closes.
|
|
594
|
-
// Home/End are left to the input for caret movement (APG editable
|
|
595
|
-
// combobox); PageUp/PageDown are the sanctioned substitute for
|
|
596
|
-
// jumping to the first/last option.
|
|
597
|
-
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
598
|
-
onKeyDown(e);
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
602
|
-
// moves focus to it (keeping the popup open) so the affordance is
|
|
603
|
-
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
604
|
-
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
605
|
-
onKeyDown(e);
|
|
606
|
-
}
|
|
607
|
-
},
|
|
608
|
-
placeholder: searchPlaceholder
|
|
609
|
-
})
|
|
604
|
+
onKeyDown: e => {
|
|
605
|
+
// Arrow keys navigate options; Enter selects; Escape closes.
|
|
606
|
+
// Home/End are left to the input for caret movement (APG editable
|
|
607
|
+
// combobox); PageUp/PageDown are the sanctioned substitute for
|
|
608
|
+
// jumping to the first/last option.
|
|
609
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'PageUp' || e.key === 'PageDown' || e.key === 'Enter' || e.key === 'Escape') {
|
|
610
|
+
onKeyDown(e);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
// Tab: when a query is showing the clear (✕) button, forward-tab
|
|
614
|
+
// moves focus to it (keeping the popup open) so the affordance is
|
|
615
|
+
// keyboard-reachable. Every other Tab dismisses the popup as usual.
|
|
616
|
+
if (e.key === 'Tab' && (e.shiftKey || !hasQuery)) {
|
|
617
|
+
onKeyDown(e);
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
placeholder: searchPlaceholder
|
|
610
621
|
});
|
|
611
|
-
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, t]);
|
|
622
|
+
}, [hasSearch, searchId, listboxId, searchQuery, hasQuery, searchPlaceholder, handleSearchChange, onKeyDown, popover.isOpen, highlightedIndex, getItemId, variant, t]);
|
|
612
623
|
|
|
613
624
|
// The single-selection mark, resolved from the theme once per render. A
|
|
614
625
|
// theme that maps `check` to another indicator (a radio, say) changes every
|
|
@@ -619,7 +630,41 @@ export function Selector(props) {
|
|
|
619
630
|
const renderItem = useCallback((item, flatIndex) => {
|
|
620
631
|
const isHighlighted = flatIndex === highlightedIndex;
|
|
621
632
|
const isSelected = item.value === normalizedValue;
|
|
622
|
-
|
|
633
|
+
|
|
634
|
+
/*
|
|
635
|
+
* Rendered UNCONDITIONALLY, with the state passed down: the default
|
|
636
|
+
* check draws nothing when unchecked, but a theme that replaces the
|
|
637
|
+
* `check` indicator with a radio needs the unselected state to draw
|
|
638
|
+
* its empty circle. `{isSelected && …}` would make that impossible.
|
|
639
|
+
*
|
|
640
|
+
* `selector-check` stays the stable target for the mark's position
|
|
641
|
+
* in the row; the indicator owns what the mark looks like.
|
|
642
|
+
*/
|
|
643
|
+
const mark = /*#__PURE__*/_jsx("span", {
|
|
644
|
+
...{
|
|
645
|
+
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo"
|
|
646
|
+
},
|
|
647
|
+
children: /*#__PURE__*/_jsx(SelectionMark, {
|
|
648
|
+
state: isSelected ? 'checked' : 'unchecked',
|
|
649
|
+
size: "sm",
|
|
650
|
+
isDisabled: item.disabled ?? false,
|
|
651
|
+
...themeProps('selector-check')
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
const optionContent = /*#__PURE__*/_jsx("span", {
|
|
655
|
+
...{
|
|
656
|
+
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
657
|
+
},
|
|
658
|
+
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
659
|
+
option: item
|
|
660
|
+
})
|
|
661
|
+
});
|
|
662
|
+
const content = indicatorPosition === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
663
|
+
children: [mark, optionContent]
|
|
664
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
665
|
+
children: [optionContent, mark]
|
|
666
|
+
});
|
|
667
|
+
return /*#__PURE__*/_jsx("div", {
|
|
623
668
|
id: getItemId(flatIndex),
|
|
624
669
|
role: "option",
|
|
625
670
|
"aria-selected": isSelected,
|
|
@@ -627,21 +672,9 @@ export function Selector(props) {
|
|
|
627
672
|
onClick: () => onItemSelect(item),
|
|
628
673
|
onMouseEnter: () => onItemMouseEnter(item, flatIndex),
|
|
629
674
|
...stylex.props(styles.item, itemSizeStyles[size], isHighlighted && styles.itemHighlighted, isSelected && styles.itemSelected, item.disabled && styles.itemDisabled),
|
|
630
|
-
children:
|
|
631
|
-
...{
|
|
632
|
-
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
633
|
-
},
|
|
634
|
-
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
635
|
-
option: item
|
|
636
|
-
})
|
|
637
|
-
}), /*#__PURE__*/_jsx(SelectionMark, {
|
|
638
|
-
state: isSelected ? 'checked' : 'unchecked',
|
|
639
|
-
size: "sm",
|
|
640
|
-
isDisabled: item.disabled ?? false,
|
|
641
|
-
...themeProps('selector-check')
|
|
642
|
-
})]
|
|
675
|
+
children: content
|
|
643
676
|
}, item.value);
|
|
644
|
-
}, [renderOption, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
677
|
+
}, [renderOption, indicatorPosition, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
645
678
|
|
|
646
679
|
// Render all options (handling sections/dividers)
|
|
647
680
|
const renderOptions = useCallback(() => {
|
|
@@ -689,16 +722,21 @@ export function Selector(props) {
|
|
|
689
722
|
if (sectionItems.length === 0) {
|
|
690
723
|
continue;
|
|
691
724
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
elements.push(/*#__PURE__*/_jsx("div", {
|
|
725
|
+
// The heading lives INSIDE the group and is aria-hidden: the group
|
|
726
|
+
// already carries the title as its accessible name, so exposing the
|
|
727
|
+
// text again would announce it twice. This also keeps role="listbox"'s
|
|
728
|
+
// children to option/group only — the old labeled Divider sat in the
|
|
729
|
+
// listbox as a stray role="separator".
|
|
730
|
+
elements.push(/*#__PURE__*/_jsxs("div", {
|
|
699
731
|
role: "group",
|
|
700
732
|
"aria-label": option.title,
|
|
701
|
-
children:
|
|
733
|
+
children: [option.title && /*#__PURE__*/_jsx("div", {
|
|
734
|
+
"aria-hidden": "true",
|
|
735
|
+
...mergeProps(themeProps('selector-section-heading'), {
|
|
736
|
+
className: "xu0wf1k xf314gf x9ynric x141an7d x1ltkj2j xv1l7n4 x87ps6o"
|
|
737
|
+
}),
|
|
738
|
+
children: option.title
|
|
739
|
+
}), sectionItems]
|
|
702
740
|
}, `section-${i}`));
|
|
703
741
|
} else if (isOptionData(option)) {
|
|
704
742
|
const normalized = normalizeOption(option);
|
|
@@ -733,7 +771,7 @@ export function Selector(props) {
|
|
|
733
771
|
size,
|
|
734
772
|
status: status?.type ?? null,
|
|
735
773
|
disabled: isDisabled ? 'disabled' : null
|
|
736
|
-
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, !selectedItem && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
774
|
+
}), stylex.props(inputWrapperStyles.base, styles.triggerContainer, sizeStyles[size], variant === 'ghost' && styles.triggerGhost, variant === 'ghost' && focusOutlineStyles.focusWithin, isDisabled && inputWrapperStyles.disabled, variant === 'ghost' && isDisabled && styles.triggerGhostDisabled, !selectedItem && styles.triggerPlaceholder, variant !== 'ghost' && status && inputStatusBorderStyles[status.type], variant !== 'ghost' && status && !isDisabled && inputStatusHoverShadowStyles[status.type], variant !== 'ghost' && inputGroup && groupStyles.inGroup, xstyle), className, style),
|
|
737
775
|
children: [startIcon && renderIconSlot(startIcon, {
|
|
738
776
|
size: 'sm',
|
|
739
777
|
color: 'secondary'
|
|
@@ -798,9 +836,7 @@ export function Selector(props) {
|
|
|
798
836
|
"aria-label": t(STATUS_BUTTON_LABEL_KEY[status.type]),
|
|
799
837
|
"aria-describedby": statusTooltip.describedBy,
|
|
800
838
|
onClick: e => e.stopPropagation(),
|
|
801
|
-
...
|
|
802
|
-
className: "x78zum5 x6s0dn4 xl56j7k x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1heor9g x1ypdohk xh6dtrn x1a2a7pz x1p25gnr x1y3gkto"
|
|
803
|
-
},
|
|
839
|
+
...stylex.props(focusOutlineStyles.focusVisible, styles.statusButton),
|
|
804
840
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
805
841
|
icon: STATUS_ICON_MAP[status.type],
|
|
806
842
|
size: "sm",
|
|
@@ -832,7 +868,7 @@ export function Selector(props) {
|
|
|
832
868
|
})
|
|
833
869
|
})]
|
|
834
870
|
}), popover.render(hasSearch ? /*#__PURE__*/_jsxs("div", {
|
|
835
|
-
children: [renderSearch(), /*#__PURE__*/_jsx("div", {
|
|
871
|
+
children: [renderSearch(), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx("div", {
|
|
836
872
|
ref: listboxRef,
|
|
837
873
|
id: listboxId,
|
|
838
874
|
role: "listbox",
|
|
@@ -870,6 +906,10 @@ export function Selector(props) {
|
|
|
870
906
|
}), {
|
|
871
907
|
placement: popoverPlacement,
|
|
872
908
|
alignment: 'start',
|
|
909
|
+
// The system's standard menu clearance, except in overlay mode:
|
|
910
|
+
// there the measured negative margin owns the block geometry and
|
|
911
|
+
// the menu is meant to sit on the trigger, not clear it.
|
|
912
|
+
offset: shouldOverlaySelectedItem ? undefined : spacingVars['--spacing-1'],
|
|
873
913
|
xstyle: [styles.popover, layerAnimations[popoverPlacement]],
|
|
874
914
|
style: popoverOffsetStyle
|
|
875
915
|
}), showStatusTooltip && statusTooltip.renderTooltip(status?.message ?? ''), showsDisabledMessage && disabledMessageTooltip.renderTooltip(disabledMessage)]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/Skeleton/Skeleton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../src/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAoE3C,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;EAuBhB,CAAC;AAgBH,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,YAAY,CAAC;AAMvD,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAc,EACd,MAAe,EACf,MAAM,EAAE,UAAc,EACtB,KAAS,EACT,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,aAAa,+BA0Bf;yBArCe,QAAQ"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file Skeleton.tsx
|
|
7
5
|
* @input Uses React, StyleX keyframes and tokens
|
|
@@ -14,6 +12,7 @@
|
|
|
14
12
|
* - /apps/storybook/stories/Skeleton.stories.tsx
|
|
15
13
|
* - /packages/cli/assets/templates/blocks/components/Skeleton/ (showcase blocks)
|
|
16
14
|
*/
|
|
15
|
+
|
|
17
16
|
import * as stylex from '@stylexjs/stylex';
|
|
18
17
|
import "../theme/tokens.stylex.js";
|
|
19
18
|
import { colorVars, radiusVars, durationVars } from "../theme/tokens.stylex.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Skeleton/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Skeleton/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,YAAY,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC"}
|
package/dist/Skeleton/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
'use client';
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* @file index.ts
|
|
7
5
|
* @input Imports from Skeleton component files
|
|
@@ -10,4 +8,5 @@
|
|
|
10
8
|
*
|
|
11
9
|
* SYNC: When modified, update this header and /packages/core/src/Skeleton/Skeleton.doc.mjs
|
|
12
10
|
*/
|
|
11
|
+
|
|
13
12
|
export { Skeleton } from "./Skeleton.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/Slider/Slider.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../src/Slider/Slider.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAIhD,OAAO,KAAK,EAAC,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