@astryxdesign/core 0.4.0-canary.aba744c → 0.4.0-canary.dcf861c
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/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +7 -8
- 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/FileInput/FileInput.d.ts.map +1 -1
- package/dist/FileInput/FileInput.js +21 -10
- 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/MultiSelector/MultiSelector.d.ts +8 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +29 -19
- 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/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +43 -17
- package/dist/astryx.css +1 -0
- package/dist/astryx.umd.js +46 -46
- package/dist/astryx.umd.js.map +3 -3
- package/locales/en.json +32 -0
- package/locales/pseudo.json +24 -0
- package/package.json +2 -2
- package/src/ComplexSelector/ComplexSelector.test.tsx +15 -6
- package/src/ComplexSelector/ComplexSelector.tsx +6 -10
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +2 -1
- package/src/FileInput/FileInput.tsx +21 -8
- package/src/Indicator/index.ts +1 -0
- package/src/Indicator/types.ts +11 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +7 -0
- package/src/MultiSelector/MultiSelector.test.tsx +7 -3
- package/src/MultiSelector/MultiSelector.tsx +42 -15
- package/src/Popover/Popover.doc.mjs +2 -0
- package/src/Popover/usePopover.tsx +37 -4
- package/src/Selector/Selector.doc.mjs +8 -0
- package/src/Selector/Selector.test.tsx +142 -0
- package/src/Selector/Selector.tsx +69 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAA4B,KAAK,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAmB5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAkG9C,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB,CAAC,KAAK,CAAE,SAAQ,IAAI,CACvD,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,GAAG,UAAU,CACxB;IACC,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,sDAAsD;IACtD,QAAQ,CAAC,EAAE,CAAC,KAA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GA0BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EAAE,oBAAoB,EACjC,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,IAAW,EACX,KAAK,EACL,SAAmB,EACnB,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,WAAW,EACpB,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ComplexSelector.d.ts","sourceRoot":"","sources":["../../src/ComplexSelector/ComplexSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,EAKZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAA4B,KAAK,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAmB5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAkG9C,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,0BAA0B;IACzC,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,iDAAiD;IACjD,MAAM,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;IACtC,OAAO,CA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3B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;IAChD,qDAAqD;IACrD,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,WAAW,EAAE,oBAAoB,EACjC,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,IAAW,EACX,KAAK,EACL,SAAmB,EACnB,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,WAAW,EACpB,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,KAAK,CAAC,qBA0K7B;yBArMe,eAAe"}
|
|
@@ -195,6 +195,11 @@ export function ComplexSelector({
|
|
|
195
195
|
dialogLabel: label,
|
|
196
196
|
hasCloseButton: false,
|
|
197
197
|
hasAutoFocus: true,
|
|
198
|
+
// The popup's theme target belongs on the SURFACE — the element painting
|
|
199
|
+
// background, radius and elevation — which `usePopover` owns. Rendered on
|
|
200
|
+
// the content box below it, a theme's background or radius rule paints the
|
|
201
|
+
// wrong box.
|
|
202
|
+
surfaceTarget: 'complex-selector-popup',
|
|
198
203
|
onHide: () => {
|
|
199
204
|
document.getElementById(triggerId)?.focus();
|
|
200
205
|
}
|
|
@@ -209,15 +214,9 @@ export function ComplexSelector({
|
|
|
209
214
|
}
|
|
210
215
|
}, [changeAction, onChange, setOptimisticValue, startTransition]);
|
|
211
216
|
const triggerContent = triggerLabel ?? placeholder;
|
|
212
|
-
const content =
|
|
213
|
-
/*#__PURE__*/
|
|
214
|
-
// The theme target sits here, not on the layer: the layer element is a
|
|
215
|
-
// bare positioning box (useLayer zeroes its borders, padding and
|
|
216
|
-
// background), so this content box is the surface a theme has to reach to
|
|
217
|
-
// paint the popup.
|
|
218
|
-
_jsx("div", {
|
|
217
|
+
const content = /*#__PURE__*/_jsx("div", {
|
|
219
218
|
id: contentId,
|
|
220
|
-
...
|
|
219
|
+
...stylex.props(styles.content, contentXstyle),
|
|
221
220
|
children: children(optimisticValue, commitValue, popover.hide, {
|
|
222
221
|
isOpen: popover.isOpen,
|
|
223
222
|
isBusy,
|
|
@@ -58,7 +58,7 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
58
58
|
* </DropdownMenu>
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
|
-
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
61
|
+
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, xstyle, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
62
62
|
export declare namespace DropdownMenuRadioGroup {
|
|
63
63
|
var displayName: string;
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiB5C,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,SAAS,EACT,UAAU,CACX;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAuB,EACvB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,+BAiB7B;
|
|
1
|
+
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiB5C,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,SAAS,EACT,UAAU,CACX;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAuB,EACvB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,+BAiB7B;yBA3Be,sBAAsB"}
|
|
@@ -20,6 +20,14 @@ import { spacingVars } from "../theme/tokens.stylex.js";
|
|
|
20
20
|
import { mergeProps } from "../utils/index.js";
|
|
21
21
|
import { DropdownMenuRadioGroupContext } from "./DropdownMenuContext.js";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const styles = {
|
|
24
|
+
group: {
|
|
25
|
+
k1xSpc: "x78zum5",
|
|
26
|
+
kXwgrk: "xdt5ytf",
|
|
27
|
+
kOIVth: "x1lsbc85",
|
|
28
|
+
$$css: true
|
|
29
|
+
}
|
|
30
|
+
};
|
|
23
31
|
/**
|
|
24
32
|
* A single-select group of radio menu items (role="group" of menuitemradio).
|
|
25
33
|
*
|
|
@@ -43,6 +51,7 @@ export function DropdownMenuRadioGroup({
|
|
|
43
51
|
label,
|
|
44
52
|
hasCloseOnSelect = true,
|
|
45
53
|
children,
|
|
54
|
+
xstyle,
|
|
46
55
|
className,
|
|
47
56
|
style,
|
|
48
57
|
...rest
|
|
@@ -56,9 +65,7 @@ export function DropdownMenuRadioGroup({
|
|
|
56
65
|
...rest,
|
|
57
66
|
role: "group",
|
|
58
67
|
"aria-label": label,
|
|
59
|
-
...mergeProps({
|
|
60
|
-
className: "x78zum5 xdt5ytf x1lsbc85"
|
|
61
|
-
}, {
|
|
68
|
+
...mergeProps(stylex.props(styles.group, xstyle), {
|
|
62
69
|
className,
|
|
63
70
|
style
|
|
64
71
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.d.ts","sourceRoot":"","sources":["../../src/FileInput/FileInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AASlB,YAAY,EACV,WAAW,IAAI,eAAe,EAC9B,eAAe,IAAI,mBAAmB,GACvC,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC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Ae,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,aAAqB,EACrB,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,UAAkB,EAClB,OAAO,EACP,QAAQ,EACR,UAAkB,EAClB,eAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,MAAM,EAAE,UAAU,EAClB,aAA0B,EAC1B,WAAW,EACX,WAAW,EACX,IAAc,EACd,UAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BA+ZhB;yBA1be,SAAS"}
|
|
@@ -40,11 +40,11 @@ function formatFileSize(bytes) {
|
|
|
40
40
|
}
|
|
41
41
|
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
42
42
|
}
|
|
43
|
-
function validateFiles(files, accept, maxSize, maxFiles, isMultiple) {
|
|
43
|
+
function validateFiles(files, accept, maxSize, maxFiles, isMultiple, t) {
|
|
44
44
|
const errors = [];
|
|
45
45
|
let valid = files;
|
|
46
46
|
if (accept) {
|
|
47
|
-
const acceptedTypes = accept.split(',').map(
|
|
47
|
+
const acceptedTypes = accept.split(',').map(s => s.trim().toLowerCase());
|
|
48
48
|
valid = valid.filter(file => {
|
|
49
49
|
const matches = acceptedTypes.some(type => {
|
|
50
50
|
if (type.startsWith('.')) {
|
|
@@ -56,7 +56,9 @@ function validateFiles(files, accept, maxSize, maxFiles, isMultiple) {
|
|
|
56
56
|
return file.type.toLowerCase() === type;
|
|
57
57
|
});
|
|
58
58
|
if (!matches) {
|
|
59
|
-
errors.push(
|
|
59
|
+
errors.push(t('@astryx.fileInput.errorInvalidType', {
|
|
60
|
+
fileName: file.name
|
|
61
|
+
}));
|
|
60
62
|
}
|
|
61
63
|
return matches;
|
|
62
64
|
});
|
|
@@ -64,14 +66,19 @@ function validateFiles(files, accept, maxSize, maxFiles, isMultiple) {
|
|
|
64
66
|
if (maxSize != null) {
|
|
65
67
|
valid = valid.filter(file => {
|
|
66
68
|
if (file.size > maxSize) {
|
|
67
|
-
errors.push(
|
|
69
|
+
errors.push(t('@astryx.fileInput.errorMaxSize', {
|
|
70
|
+
fileName: file.name,
|
|
71
|
+
maxSize: formatFileSize(maxSize)
|
|
72
|
+
}));
|
|
68
73
|
return false;
|
|
69
74
|
}
|
|
70
75
|
return true;
|
|
71
76
|
});
|
|
72
77
|
}
|
|
73
78
|
if (isMultiple && maxFiles != null && valid.length > maxFiles) {
|
|
74
|
-
errors.push(
|
|
79
|
+
errors.push(t('@astryx.fileInput.errorMaxFiles', {
|
|
80
|
+
maxFiles
|
|
81
|
+
}));
|
|
75
82
|
valid = valid.slice(0, maxFiles);
|
|
76
83
|
}
|
|
77
84
|
return {
|
|
@@ -248,7 +255,7 @@ export function FileInput({
|
|
|
248
255
|
// The tooltip variant renders no message box; describe the input by the
|
|
249
256
|
// tooltip's content instead so the status is still announced.
|
|
250
257
|
statusTooltipDescribedBy, conveysRequired ? requiredID : null, showsDisabledMessage ? disabledMessageTooltip.describedBy : null].filter(Boolean).join(' ') || undefined;
|
|
251
|
-
const defaultPlaceholder = isMultiple ? '
|
|
258
|
+
const defaultPlaceholder = isMultiple ? t('@astryx.fileInput.placeholderMultiple') : t('@astryx.fileInput.placeholder');
|
|
252
259
|
const displayPlaceholder = placeholder ?? defaultPlaceholder;
|
|
253
260
|
const handleFiles = useCallback(fileList => {
|
|
254
261
|
if (isDisabled) {
|
|
@@ -257,7 +264,7 @@ export function FileInput({
|
|
|
257
264
|
const {
|
|
258
265
|
valid,
|
|
259
266
|
errors
|
|
260
|
-
} = validateFiles(fileList, accept, maxSize, maxFiles, isMultiple);
|
|
267
|
+
} = validateFiles(fileList, accept, maxSize, maxFiles, isMultiple, t);
|
|
261
268
|
if (errors.length > 0) {
|
|
262
269
|
setValidationError(errors[0]);
|
|
263
270
|
} else {
|
|
@@ -275,14 +282,18 @@ export function FileInput({
|
|
|
275
282
|
// status mounts, so only announce the attach here (do not
|
|
276
283
|
// double-announce errors).
|
|
277
284
|
if (errors.length === 0) {
|
|
278
|
-
announce(valid.length === 1 ?
|
|
285
|
+
announce(valid.length === 1 ? t('@astryx.fileInput.fileSelected', {
|
|
286
|
+
fileName: valid[0].name
|
|
287
|
+
}) : t('@astryx.fileInput.filesSelected', {
|
|
288
|
+
count: valid.length
|
|
289
|
+
}));
|
|
279
290
|
}
|
|
280
291
|
if (changeAction) {
|
|
281
292
|
startTransition(async () => {
|
|
282
293
|
await changeAction(result);
|
|
283
294
|
});
|
|
284
295
|
}
|
|
285
|
-
}, [accept, isDisabled, isMultiple, maxFiles, maxSize, onChange, changeAction, startTransition, announce]);
|
|
296
|
+
}, [accept, isDisabled, isMultiple, maxFiles, maxSize, onChange, changeAction, startTransition, announce, t]);
|
|
286
297
|
const handleInputChange = useCallback(e => {
|
|
287
298
|
const fileList = Array.from(e.target.files ?? []);
|
|
288
299
|
handleFiles(fileList);
|
|
@@ -388,7 +399,7 @@ export function FileInput({
|
|
|
388
399
|
...{
|
|
389
400
|
className: "x9ynric xjm74w1 x6pjikd xw6l6zx xv1l7n4 x2b8uid x87ps6o"
|
|
390
401
|
},
|
|
391
|
-
children: isDragOver ? '
|
|
402
|
+
children: isDragOver ? t('@astryx.fileInput.dropHint') : displayPlaceholder
|
|
392
403
|
})]
|
|
393
404
|
});
|
|
394
405
|
};
|
|
@@ -20,5 +20,5 @@ export { defaultIndicators, getIndicator } from './indicatorRegistry';
|
|
|
20
20
|
export type { CoreIndicatorName, IndicatorRegistrySource, } from './indicatorRegistry';
|
|
21
21
|
export { useIndicator } from './useIndicator';
|
|
22
22
|
export { indicatorScope } from './indicator.markers.stylex';
|
|
23
|
-
export type { IndicatorComponent, IndicatorFamily, IndicatorFamilyMap, IndicatorMap, IndicatorName, IndicatorNameOfFamily, IndicatorProps, IndicatorRegistry, IndicatorSize, IndicatorState, } from './types';
|
|
23
|
+
export type { IndicatorComponent, IndicatorFamily, IndicatorFamilyMap, IndicatorMap, IndicatorName, IndicatorNameOfFamily, IndicatorPosition, IndicatorProps, IndicatorRegistry, IndicatorSize, IndicatorState, } from './types';
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Indicator/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAE1D,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Indicator/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,qBAAqB,CAAC;AACpE,YAAY,EACV,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAE1D,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -58,6 +58,16 @@ export type IndicatorFamily = keyof IndicatorFamilyMap & string;
|
|
|
58
58
|
export type IndicatorState<F extends IndicatorFamily = IndicatorFamily> = IndicatorFamilyMap[F];
|
|
59
59
|
/** Indicator size scale — matches the control sizes of the owning inputs. */
|
|
60
60
|
export type IndicatorSize = 'sm' | 'md';
|
|
61
|
+
/**
|
|
62
|
+
* Which edge of its row an indicator sits on.
|
|
63
|
+
*
|
|
64
|
+
* Logical, not physical: `start` is the left edge in LTR and the right edge in
|
|
65
|
+
* RTL. Owned by the host component, not by the indicator — an indicator draws a
|
|
66
|
+
* picture and has no say in where the row puts it — which is why this is a prop
|
|
67
|
+
* on the components that lay out rows rather than part of
|
|
68
|
+
* {@link IndicatorProps}.
|
|
69
|
+
*/
|
|
70
|
+
export type IndicatorPosition = 'start' | 'end';
|
|
61
71
|
/**
|
|
62
72
|
* Props every indicator accepts.
|
|
63
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Indicator/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAE,GAAG,EAAC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,eAAe,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,0EAA0E;IAC1E,cAAc,EAAE,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC;CAC3D;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEhE,kEAAkE;AAClE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,IACpE,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAExB,6EAA6E;AAC7E,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,cAAc,CAC7B,CAAC,SAAS,eAAe,GAAG,eAAe,CAC3C,SAAQ,IAAI,CACZ,SAAS,CAAC,eAAe,CAAC,EAC1B,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,iBAAiB,GAAG,UAAU,CACvE;IACC,qDAAqD;IACrD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC3B,mEAAmE;IACnE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;IACzB;;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,EAAE,iBAAiB,CAAC;IACzB,kEAAkE;IAClE,QAAQ,EAAE,gBAAgB,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,YAAY,GAAG,MAAM,CAAC;AAExD,mDAAmD;AACnD,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,eAAe,IAAI;KAC5D,CAAC,IAAI,aAAa,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK;CAC5D,CAAC,aAAa,CAAC,CAAC;AAEjB;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;KAC7B,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAC"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import React, { type ReactNode } from 'react';
|
|
15
15
|
import { type IconType } from '../Icon';
|
|
16
16
|
import { type FieldStatusVariant } from '../Field';
|
|
17
|
+
import type { IndicatorPosition } from '../Indicator';
|
|
17
18
|
import type { MultiSelectorOptionType, MultiSelectorOptionData, MultiSelectorStatus } from './types';
|
|
18
19
|
import type { BaseProps } from '../BaseProps';
|
|
19
20
|
import type { SizeValue } from '../utils/types';
|
|
@@ -189,6 +190,12 @@ export interface MultiSelectorProps<T extends MultiSelectorOptionType = MultiSel
|
|
|
189
190
|
* Only called for selectable options (not dividers/sections or the select-all row).
|
|
190
191
|
*/
|
|
191
192
|
renderOption?: (option: MultiSelectorOptionData) => ReactNode;
|
|
193
|
+
/**
|
|
194
|
+
* Which edge of the option row carries the checkbox.
|
|
195
|
+
*
|
|
196
|
+
* @default 'start'
|
|
197
|
+
*/
|
|
198
|
+
indicatorPosition?: IndicatorPosition;
|
|
192
199
|
/**
|
|
193
200
|
* Whether the dropdown starts open on mount.
|
|
194
201
|
* Useful for showcases and previews.
|
|
@@ -215,7 +222,7 @@ export interface MultiSelectorProps<T extends MultiSelectorOptionType = MultiSel
|
|
|
215
222
|
* />
|
|
216
223
|
* ```
|
|
217
224
|
*/
|
|
218
|
-
export declare function MultiSelector<T extends MultiSelectorOptionType>({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, options, value, onChange, changeAction, isLoading, placeholder: placeholderFromProps, size: sizeProp, variant, status, statusVariant, labelTooltip, startIcon, hasClear, hasSelectAll, selectAllLabel: selectAllLabelFromProps, hasSearch, searchPlaceholder: searchPlaceholderFromProps, triggerDisplay, maxBadges, renderOption, isDefaultOpen, 'data-testid': testId, htmlName, width, xstyle, className, style, }: MultiSelectorProps<T>): React.JSX.Element;
|
|
225
|
+
export declare function MultiSelector<T extends MultiSelectorOptionType>({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, options, value, onChange, changeAction, isLoading, placeholder: placeholderFromProps, size: sizeProp, variant, status, statusVariant, labelTooltip, startIcon, hasClear, hasSelectAll, selectAllLabel: selectAllLabelFromProps, hasSearch, searchPlaceholder: searchPlaceholderFromProps, triggerDisplay, maxBadges, renderOption, indicatorPosition, isDefaultOpen, 'data-testid': testId, htmlName, width, xstyle, className, style, }: MultiSelectorProps<T>): React.JSX.Element;
|
|
219
226
|
export declare namespace MultiSelector {
|
|
220
227
|
var displayName: string;
|
|
221
228
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,EAML,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAE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;OAIG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IAEtC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AA+BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,uBAAuB,EAAE,EAC/D,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,OAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,QAAgB,EAChB,YAAoB,EACpB,cAAc,EAAE,uBAAuB,EACvC,SAAiB,EACjB,iBAAiB,EAAE,0BAA0B,EAC7C,cAAwB,EACxB,SAAa,EACb,YAAY,EACZ,iBAA2B,EAC3B,aAAqB,EACrB,aAAa,EAAE,MAAM,EACrB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBA47BvB;yBAh+Be,aAAa"}
|
|
@@ -281,6 +281,7 @@ export function MultiSelector({
|
|
|
281
281
|
triggerDisplay = 'count',
|
|
282
282
|
maxBadges = 3,
|
|
283
283
|
renderOption,
|
|
284
|
+
indicatorPosition = 'start',
|
|
284
285
|
isDefaultOpen = false,
|
|
285
286
|
'data-testid': testId,
|
|
286
287
|
htmlName,
|
|
@@ -422,7 +423,10 @@ export function MultiSelector({
|
|
|
422
423
|
hasAutoFocus: false,
|
|
423
424
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
424
425
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
425
|
-
role: 'none'
|
|
426
|
+
role: 'none',
|
|
427
|
+
// The theme target belongs on the SURFACE that paints the popup, which
|
|
428
|
+
// `usePopover` owns — not on the scrolling list inside it.
|
|
429
|
+
surfaceTarget: 'multi-selector-popup'
|
|
426
430
|
});
|
|
427
431
|
|
|
428
432
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -706,6 +710,25 @@ export function MultiSelector({
|
|
|
706
710
|
// checkbox is inert/decorative, so the indeterminate state must be
|
|
707
711
|
// conveyed through the option's accessible name (WCAG 4.1.2).
|
|
708
712
|
const isPartiallySelected = isSelectAll && selectAllState === 'indeterminate';
|
|
713
|
+
const checkbox = /*#__PURE__*/_jsx("div", {
|
|
714
|
+
inert: true,
|
|
715
|
+
...{
|
|
716
|
+
0: {
|
|
717
|
+
className: "x47corl x78zum5 x2lah0s"
|
|
718
|
+
},
|
|
719
|
+
1: {
|
|
720
|
+
className: "x47corl x78zum5 x2lah0s xvc5jky"
|
|
721
|
+
}
|
|
722
|
+
}[!!(indicatorPosition === 'end') << 0],
|
|
723
|
+
children: /*#__PURE__*/_jsx(CheckboxInput, {
|
|
724
|
+
label: "",
|
|
725
|
+
isLabelHidden: true,
|
|
726
|
+
value: checkboxValue,
|
|
727
|
+
onChange: () => {},
|
|
728
|
+
isDisabled: item.disabled,
|
|
729
|
+
size: size === 'lg' ? 'md' : size
|
|
730
|
+
})
|
|
731
|
+
});
|
|
709
732
|
return /*#__PURE__*/_jsxs("div", {
|
|
710
733
|
id: getItemId(flatIndex),
|
|
711
734
|
role: "option",
|
|
@@ -731,27 +754,14 @@ export function MultiSelector({
|
|
|
731
754
|
selected: isSelected ? 'selected' : null,
|
|
732
755
|
disabled: item.disabled ? 'disabled' : null
|
|
733
756
|
}), stylex.props(styles.item, isSelectAll ? selectAllSizeStyles[size] : itemSizeStyles[size], isSelectAll && styles.selectAllWrapper, isHighlighted && styles.itemHighlighted, item.disabled && styles.itemDisabled)),
|
|
734
|
-
children: [/*#__PURE__*/_jsx("
|
|
735
|
-
inert: true,
|
|
736
|
-
...{
|
|
737
|
-
className: "x47corl x78zum5 x2lah0s"
|
|
738
|
-
},
|
|
739
|
-
children: /*#__PURE__*/_jsx(CheckboxInput, {
|
|
740
|
-
label: "",
|
|
741
|
-
isLabelHidden: true,
|
|
742
|
-
value: checkboxValue,
|
|
743
|
-
onChange: () => {},
|
|
744
|
-
isDisabled: item.disabled,
|
|
745
|
-
size: size === 'lg' ? 'md' : size
|
|
746
|
-
})
|
|
747
|
-
}), renderOption && !isSelectAll ? renderOption(item) : /*#__PURE__*/_jsx("span", {
|
|
757
|
+
children: [indicatorPosition === 'start' && checkbox, renderOption && !isSelectAll ? renderOption(item) : /*#__PURE__*/_jsx("span", {
|
|
748
758
|
...{
|
|
749
759
|
className: "xeuugli xb3r6kr xlyipyv xuxw1ft"
|
|
750
760
|
},
|
|
751
761
|
children: item.label ?? item.value
|
|
752
|
-
})]
|
|
762
|
+
}), indicatorPosition === 'end' && checkbox]
|
|
753
763
|
}, item.value);
|
|
754
|
-
}, [renderOption, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
764
|
+
}, [renderOption, indicatorPosition, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
755
765
|
|
|
756
766
|
// Render all options. Uses sortedItems as the single source of truth for
|
|
757
767
|
// item order — no independent sorting here. Structural elements (dividers,
|
|
@@ -963,9 +973,9 @@ export function MultiSelector({
|
|
|
963
973
|
})
|
|
964
974
|
})]
|
|
965
975
|
}), popover.render(/*#__PURE__*/_jsxs("div", {
|
|
966
|
-
...
|
|
976
|
+
...{
|
|
967
977
|
className: "x9f619 xuyqlj2 x1odjw0f x9epnlk"
|
|
968
|
-
}
|
|
978
|
+
},
|
|
969
979
|
children: [renderSearch(), /*#__PURE__*/_jsx("div", {
|
|
970
980
|
id: listboxId,
|
|
971
981
|
role: "listbox",
|
|
@@ -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,i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;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;;;;;;;;OAWG;IACH,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,kBAAkB,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,
|
|
@@ -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,kBAAkB,EAAC,MAAM,SAAS,CAAC;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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,qBA20BxB;yBA50Be,QAAQ"}
|
|
@@ -43,7 +43,7 @@ import { groupStyles } from "../InputGroup/groupStyles.js";
|
|
|
43
43
|
import { useInputGroup } from "../InputGroup/InputGroupContext.js";
|
|
44
44
|
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
45
45
|
import { useTranslator } from "../i18n/index.js";
|
|
46
|
-
import { jsx as _jsx,
|
|
46
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
47
47
|
const styles = {
|
|
48
48
|
triggerContainer: {
|
|
49
49
|
kVAEAm: "x1n2onr6",
|
|
@@ -281,6 +281,7 @@ export function Selector(props) {
|
|
|
281
281
|
startIcon,
|
|
282
282
|
htmlName,
|
|
283
283
|
renderOption,
|
|
284
|
+
indicatorPosition = 'end',
|
|
284
285
|
hasSearch = false,
|
|
285
286
|
searchPlaceholder: searchPlaceholderFromProps,
|
|
286
287
|
placement,
|
|
@@ -382,7 +383,10 @@ export function Selector(props) {
|
|
|
382
383
|
hasAutoFocus: false,
|
|
383
384
|
// The popup's own role="listbox" is the exposed semantics; the trigger
|
|
384
385
|
// keeps DOM focus, so wrapping it in a modal dialog would misrepresent it.
|
|
385
|
-
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'
|
|
386
390
|
});
|
|
387
391
|
|
|
388
392
|
// Open dropdown on mount when isDefaultOpen is true
|
|
@@ -632,7 +636,41 @@ export function Selector(props) {
|
|
|
632
636
|
const renderItem = useCallback((item, flatIndex) => {
|
|
633
637
|
const isHighlighted = flatIndex === highlightedIndex;
|
|
634
638
|
const isSelected = item.value === normalizedValue;
|
|
635
|
-
|
|
639
|
+
|
|
640
|
+
/*
|
|
641
|
+
* Rendered UNCONDITIONALLY, with the state passed down: the default
|
|
642
|
+
* check draws nothing when unchecked, but a theme that replaces the
|
|
643
|
+
* `check` indicator with a radio needs the unselected state to draw
|
|
644
|
+
* its empty circle. `{isSelected && …}` would make that impossible.
|
|
645
|
+
*
|
|
646
|
+
* `selector-check` stays the stable target for the mark's position
|
|
647
|
+
* in the row; the indicator owns what the mark looks like.
|
|
648
|
+
*/
|
|
649
|
+
const mark = /*#__PURE__*/_jsx("span", {
|
|
650
|
+
...{
|
|
651
|
+
className: "x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo"
|
|
652
|
+
},
|
|
653
|
+
children: /*#__PURE__*/_jsx(SelectionMark, {
|
|
654
|
+
state: isSelected ? 'checked' : 'unchecked',
|
|
655
|
+
size: "sm",
|
|
656
|
+
isDisabled: item.disabled ?? false,
|
|
657
|
+
...themeProps('selector-check')
|
|
658
|
+
})
|
|
659
|
+
});
|
|
660
|
+
const optionContent = /*#__PURE__*/_jsx("span", {
|
|
661
|
+
...{
|
|
662
|
+
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
663
|
+
},
|
|
664
|
+
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
665
|
+
option: item
|
|
666
|
+
})
|
|
667
|
+
});
|
|
668
|
+
const content = indicatorPosition === 'start' ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
669
|
+
children: [mark, optionContent]
|
|
670
|
+
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
671
|
+
children: [optionContent, mark]
|
|
672
|
+
});
|
|
673
|
+
return /*#__PURE__*/_jsx("div", {
|
|
636
674
|
id: getItemId(flatIndex),
|
|
637
675
|
role: "option",
|
|
638
676
|
"aria-selected": isSelected,
|
|
@@ -640,21 +678,9 @@ export function Selector(props) {
|
|
|
640
678
|
onClick: () => onItemSelect(item),
|
|
641
679
|
onMouseEnter: () => onItemMouseEnter(item, flatIndex),
|
|
642
680
|
...stylex.props(styles.item, itemSizeStyles[size], isHighlighted && styles.itemHighlighted, isSelected && styles.itemSelected, item.disabled && styles.itemDisabled),
|
|
643
|
-
children:
|
|
644
|
-
...{
|
|
645
|
-
className: "x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli"
|
|
646
|
-
},
|
|
647
|
-
children: renderOption ? renderOption(item) : /*#__PURE__*/_jsx(DefaultOption, {
|
|
648
|
-
option: item
|
|
649
|
-
})
|
|
650
|
-
}), /*#__PURE__*/_jsx(SelectionMark, {
|
|
651
|
-
state: isSelected ? 'checked' : 'unchecked',
|
|
652
|
-
size: "sm",
|
|
653
|
-
isDisabled: item.disabled ?? false,
|
|
654
|
-
...themeProps('selector-check')
|
|
655
|
-
})]
|
|
681
|
+
children: content
|
|
656
682
|
}, item.value);
|
|
657
|
-
}, [renderOption, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
683
|
+
}, [renderOption, indicatorPosition, highlightedIndex, size, normalizedValue, getItemId, onItemSelect, onItemMouseEnter, SelectionMark]);
|
|
658
684
|
|
|
659
685
|
// Render all options (handling sections/dividers)
|
|
660
686
|
const renderOptions = useCallback(() => {
|
package/dist/astryx.css
CHANGED
|
@@ -1440,6 +1440,7 @@
|
|
|
1440
1440
|
.x1d77m7x:not(#\#):not(#\#):not(#\#):not(#\#){min-width:140px}
|
|
1441
1441
|
.x5w4yej:not(#\#):not(#\#):not(#\#):not(#\#){min-width:160px}
|
|
1442
1442
|
.xfb3i0g:not(#\#):not(#\#):not(#\#):not(#\#){min-width:180px}
|
|
1443
|
+
.xgomdpo:not(#\#):not(#\#):not(#\#):not(#\#){min-width:1rem}
|
|
1443
1444
|
.x1jzhcrs:not(#\#):not(#\#):not(#\#):not(#\#){min-width:200px}
|
|
1444
1445
|
.xt4ypqs:not(#\#):not(#\#):not(#\#):not(#\#){min-width:20px}
|
|
1445
1446
|
.x12rczxh:not(#\#):not(#\#):not(#\#):not(#\#){min-width:220px}
|