@setsquare/ui 0.4.0 → 0.5.0
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 +71 -0
- package/README.md +4 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lint/index.d.ts +5 -0
- package/dist/lint/index.d.ts.map +1 -1
- package/dist/lint/index.js +80 -3
- package/dist/lint/index.js.map +1 -1
- package/dist/styles/theme.css +2 -0
- package/dist/styles/tokens.css +9 -0
- package/dist/testing/index.d.ts +54 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +246 -9
- package/dist/testing/index.js.map +1 -1
- package/dist/tokens.json +25 -0
- package/dist/ui/breadcrumbs.d.ts +9 -1
- package/dist/ui/breadcrumbs.d.ts.map +1 -1
- package/dist/ui/breadcrumbs.js +3 -3
- package/dist/ui/breadcrumbs.js.map +1 -1
- package/dist/ui/button-styles.d.ts.map +1 -1
- package/dist/ui/button-styles.js +16 -6
- package/dist/ui/button-styles.js.map +1 -1
- package/dist/ui/combo-box.d.ts +6 -1
- package/dist/ui/combo-box.d.ts.map +1 -1
- package/dist/ui/combo-box.js +2 -2
- package/dist/ui/combo-box.js.map +1 -1
- package/dist/ui/drop-indicator.d.ts +21 -0
- package/dist/ui/drop-indicator.d.ts.map +1 -0
- package/dist/ui/drop-indicator.js +20 -0
- package/dist/ui/drop-indicator.js.map +1 -0
- package/dist/ui/grid-list.d.ts +10 -3
- package/dist/ui/grid-list.d.ts.map +1 -1
- package/dist/ui/grid-list.js +18 -7
- package/dist/ui/grid-list.js.map +1 -1
- package/dist/ui/switch.d.ts +2 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +5 -2
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/toolbar.d.ts +22 -0
- package/dist/ui/toolbar.d.ts.map +1 -0
- package/dist/ui/toolbar.js +22 -0
- package/dist/ui/toolbar.js.map +1 -0
- package/dist/ui/tree.d.ts +57 -12
- package/dist/ui/tree.d.ts.map +1 -1
- package/dist/ui/tree.js +54 -15
- package/dist/ui/tree.js.map +1 -1
- package/package.json +3 -3
package/dist/ui/breadcrumbs.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
export interface BreadcrumbItem {
|
|
2
2
|
label: string;
|
|
3
3
|
href?: string;
|
|
4
|
+
/** The label's language and direction, when it isn't the interface's: a page's own title (3.1.2). */
|
|
5
|
+
lang?: string;
|
|
6
|
+
dir?: 'ltr' | 'rtl' | 'auto';
|
|
4
7
|
}
|
|
5
8
|
export interface BreadcrumbsProps {
|
|
6
9
|
/** Ancestors first; the last item is the current page and is not a link. */
|
|
7
10
|
items: BreadcrumbItem[];
|
|
8
11
|
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* For places inside the page rather than pages (a block's parents in a page builder): called with an item's index
|
|
14
|
+
* when it's pressed. Items without an `href` are still links to a screen reader.
|
|
15
|
+
*/
|
|
16
|
+
onAction?: (index: number) => void;
|
|
9
17
|
className?: string;
|
|
10
18
|
}
|
|
11
19
|
/** Where you are (WCAG 2.4.8). Every page below the top level shows one. */
|
|
12
|
-
export declare function Breadcrumbs({ items, label, className }: BreadcrumbsProps): import("react").JSX.Element;
|
|
20
|
+
export declare function Breadcrumbs({ items, label, onAction, className, }: BreadcrumbsProps): import("react").JSX.Element;
|
|
13
21
|
//# sourceMappingURL=breadcrumbs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/ui/breadcrumbs.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"breadcrumbs.d.ts","sourceRoot":"","sources":["../../src/ui/breadcrumbs.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,KAAoB,EACpB,QAAQ,EACR,SAAS,GACV,EAAE,gBAAgB,+BAsClB"}
|
package/dist/ui/breadcrumbs.js
CHANGED
|
@@ -4,9 +4,9 @@ import { Breadcrumb, Breadcrumbs as RACBreadcrumbs, Link } from 'react-aria-comp
|
|
|
4
4
|
import { ChevronRight } from 'lucide-react';
|
|
5
5
|
import { cn } from '../lib/cn.js';
|
|
6
6
|
/** Where you are (WCAG 2.4.8). Every page below the top level shows one. */
|
|
7
|
-
export function Breadcrumbs({ items, label = 'Breadcrumb', className }) {
|
|
8
|
-
return (_jsx("nav", { "aria-label": label, className: cn('min-w-0', className), children: _jsx(RACBreadcrumbs, { className: "flex min-w-0 items-center gap-1 text-sm", children: items.map((item, i) => (_jsxs(Breadcrumb, { id: i, className: "flex min-w-0 items-center gap-1", children: [i > 0 && (_jsx(ChevronRight, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" })), _jsx(Link, { href: item.href, className: cn(
|
|
7
|
+
export function Breadcrumbs({ items, label = 'Breadcrumb', onAction, className, }) {
|
|
8
|
+
return (_jsx("nav", { "aria-label": label, className: cn('min-w-0', className), children: _jsx(RACBreadcrumbs, { className: "flex min-w-0 items-center gap-1 text-sm", onAction: onAction ? (key) => onAction(Number(key)) : undefined, children: items.map((item, i) => (_jsxs(Breadcrumb, { id: i, className: "flex min-w-0 items-center gap-1", children: [i > 0 && (_jsx(ChevronRight, { "aria-hidden": "true", className: "size-4 shrink-0 text-muted-foreground" })), _jsx(Link, { href: item.href, className: cn(
|
|
9
9
|
// The current page is not a link to press: React Aria disables it, and it keeps the default cursor.
|
|
10
|
-
'group/crumb flex min-h-target min-w-target max-w-[20ch] cursor-pointer items-center justify-center leading-5 no-underline outline-none data-current:cursor-default'), children: _jsx("span", { className: cn('min-w-0 truncate rounded-sm text-muted-foreground underline decoration-1 underline-offset-3', 'group-data-hovered/crumb:text-foreground group-data-focus-visible/crumb:focus-ring', 'group-data-current/crumb:font-semibold group-data-current/crumb:text-foreground group-data-current/crumb:no-underline'), children: item.label }) })] }, `${i}-${item.label}`))) }) }));
|
|
10
|
+
'group/crumb flex min-h-target min-w-target max-w-[20ch] cursor-pointer items-center justify-center leading-5 no-underline outline-none data-current:cursor-default'), children: _jsx("span", { lang: item.lang, dir: item.dir, className: cn('min-w-0 truncate rounded-sm text-muted-foreground underline decoration-1 underline-offset-3', 'group-data-hovered/crumb:text-foreground group-data-focus-visible/crumb:focus-ring', 'group-data-current/crumb:font-semibold group-data-current/crumb:text-foreground group-data-current/crumb:no-underline'), children: item.label }) })] }, `${i}-${item.label}`))) }) }));
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumbs.js","sourceRoot":"","sources":["../../src/ui/breadcrumbs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAE,WAAW,IAAI,cAAc,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM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,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAyBxB,CACd,CAAC,GACa,GACb,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-styles.d.ts","sourceRoot":"","sources":["../../src/ui/button-styles.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAC1F,qGAAqG;AACrG,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"button-styles.d.ts","sourceRoot":"","sources":["../../src/ui/button-styles.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAC1F,qGAAqG;AACrG,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAuD5E;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,GAAE;IACJ,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GACL,MAAM,CAGR"}
|
package/dist/ui/button-styles.js
CHANGED
|
@@ -11,16 +11,26 @@ import { cn } from '../lib/cn.js';
|
|
|
11
11
|
* The target is in the layout, not an overlay, so two neighbouring targets can never overlap.
|
|
12
12
|
*/
|
|
13
13
|
const target = 'group/button relative inline-flex shrink-0 cursor-pointer items-center justify-center min-h-target min-w-target no-underline outline-none select-none ' +
|
|
14
|
-
'data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pending:cursor-wait';
|
|
14
|
+
'data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pending:cursor-wait aria-disabled:cursor-not-allowed';
|
|
15
15
|
const visual = 'relative inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md border text-sm font-semibold no-underline ' +
|
|
16
16
|
'transition-colors duration-(--duration-fast) ease-(--ease-standard) group-data-focus-visible/button:focus-ring ' +
|
|
17
17
|
'[&_svg]:size-5 [&_svg]:shrink-0 group-data-pending/button:[&>svg:not([data-spinner])]:hidden';
|
|
18
|
+
// A button that can't act right now but keeps its focus (aria-disabled, with the reason in its description):
|
|
19
|
+
// muted words, on a muted ground for the filled variants and on no ground for ghost, hovered or not. Outline
|
|
20
|
+
// keeps its border and ground. Not faded, so its words stay readable (muted-foreground on muted, background and
|
|
21
|
+
// card are promised text pairs) and its focus ring keeps its contrast, which opacity on the paint would lose.
|
|
22
|
+
const filledOff = 'group-aria-disabled/button:bg-muted group-aria-disabled/button:text-muted-foreground';
|
|
23
|
+
const lineOff = 'group-aria-disabled/button:bg-transparent group-aria-disabled/button:text-muted-foreground';
|
|
18
24
|
const variants = {
|
|
19
|
-
primary: 'border-transparent bg-primary text-primary-foreground group-data-hovered/button:bg-primary-hover group-data-pressed/button:bg-primary-hover'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
primary: 'border-transparent bg-primary text-primary-foreground group-data-hovered/button:bg-primary-hover group-data-pressed/button:bg-primary-hover ' +
|
|
26
|
+
filledOff,
|
|
27
|
+
secondary: 'border-transparent bg-secondary text-secondary-foreground group-data-hovered/button:bg-accent group-data-pressed/button:bg-accent ' +
|
|
28
|
+
filledOff,
|
|
29
|
+
outline: 'border-input bg-background text-foreground group-data-hovered/button:bg-accent group-data-pressed/button:bg-accent group-aria-disabled/button:text-muted-foreground',
|
|
30
|
+
ghost: 'border-transparent bg-transparent text-foreground group-data-hovered/button:bg-accent group-data-pressed/button:bg-accent ' +
|
|
31
|
+
lineOff,
|
|
32
|
+
destructive: 'border-transparent bg-destructive text-destructive-foreground group-data-hovered/button:bg-destructive-hover group-data-pressed/button:bg-destructive-hover ' +
|
|
33
|
+
filledOff,
|
|
24
34
|
};
|
|
25
35
|
const sizes = {
|
|
26
36
|
default: 'min-h-control px-(--control-pad-x)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-styles.js","sourceRoot":"","sources":["../../src/ui/button-styles.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,0DAA0D;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAMlC;;;;;;;;GAQG;AACH,MAAM,MAAM,GACV,wJAAwJ;IACxJ,
|
|
1
|
+
{"version":3,"file":"button-styles.js","sourceRoot":"","sources":["../../src/ui/button-styles.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,0DAA0D;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAMlC;;;;;;;;GAQG;AACH,MAAM,MAAM,GACV,wJAAwJ;IACxJ,qHAAqH,CAAC;AAExH,MAAM,MAAM,GACV,gIAAgI;IAChI,iHAAiH;IACjH,8FAA8F,CAAC;AAEjG,6GAA6G;AAC7G,6GAA6G;AAC7G,gHAAgH;AAChH,8GAA8G;AAC9G,MAAM,SAAS,GACb,sFAAsF,CAAC;AACzF,MAAM,OAAO,GACX,4FAA4F,CAAC;AAE/F,MAAM,QAAQ,GAAkC;IAC9C,OAAO,EACL,8IAA8I;QAC9I,SAAS;IACX,SAAS,EACP,oIAAoI;QACpI,SAAS;IACX,OAAO,EACL,qKAAqK;IACvK,KAAK,EACH,4HAA4H;QAC5H,OAAO;IACT,WAAW,EACT,8JAA8J;QAC9J,SAAS;CACZ,CAAC;AAEF,MAAM,KAAK,GAAqC;IAC9C,OAAO,EAAE,oCAAoC;IAC7C,EAAE,EAAE,uBAAuB;IAC3B,kGAAkG;IAClG,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,cAAc;IACpB,SAAS,EAAE,iBAAiB;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAI,GAAgD,EAAE;IACvF,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,IAAI,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAI,GAKA,EAAE;IAEN,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,UAAU,GAAG,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IACnF,OAAO,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,SAAS,IAAI,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC5F,CAAC"}
|
package/dist/ui/combo-box.d.ts
CHANGED
|
@@ -11,8 +11,13 @@ export interface ComboBoxProps<T extends object> extends Omit<RACComboBoxProps<T
|
|
|
11
11
|
children: ReactNode | ((item: T) => ReactNode);
|
|
12
12
|
width?: FieldWidth;
|
|
13
13
|
labels?: Partial<FieldLabels>;
|
|
14
|
+
/**
|
|
15
|
+
* What the open list says when nothing is in it: "Searching…" while results load, or why nothing matched. Inside
|
|
16
|
+
* the list, because React Aria hides the rest of the page from assistive technology while the list is open.
|
|
17
|
+
*/
|
|
18
|
+
emptyState?: ReactNode;
|
|
14
19
|
className?: string;
|
|
15
20
|
}
|
|
16
21
|
/** Type to filter a long list, then choose (people, countries, projects). The list opens as you type or from the button. */
|
|
17
|
-
export declare function ComboBox<T extends object>({ label, description, errorMessage, requiredMessage, validate, placeholder, children, width, labels, className, ...props }: ComboBoxProps<T>): import("react").JSX.Element;
|
|
22
|
+
export declare function ComboBox<T extends object>({ label, description, errorMessage, requiredMessage, validate, placeholder, children, width, labels, emptyState, className, ...props }: ComboBoxProps<T>): import("react").JSX.Element;
|
|
18
23
|
//# sourceMappingURL=combo-box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../src/ui/combo-box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAGL,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,GAAG,EACT,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAUL,KAAK,UAAU,EACf,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,IAAI,CAC3D,gBAAgB,CAAC,CAAC,CAAC,EACnB,WAAW,GAAG,UAAU,GAAG,UAAU,CACtC;IACC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,KAAK,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC;IAC/C,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4HAA4H;AAC5H,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,EACzC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,eA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K,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,KAAY,EACZ,MAAM,EACN,UAAU,EACV,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,CAAC,CAAC,+BA+ClB"}
|
package/dist/ui/combo-box.js
CHANGED
|
@@ -8,7 +8,7 @@ import { FieldDescription, FieldError, FieldLabel, fieldBox, fieldInput, fieldSt
|
|
|
8
8
|
import { ListBox } from './list-box.js';
|
|
9
9
|
import { Popover } from './menu.js';
|
|
10
10
|
/** Type to filter a long list, then choose (people, countries, projects). The list opens as you type or from the button. */
|
|
11
|
-
export function ComboBox({ label, description, errorMessage, requiredMessage, validate, placeholder, children, width = 'md', labels, className, ...props }) {
|
|
12
|
-
return (_jsxs(RACComboBox, { ...props, validate: withRequired(props.isRequired, requiredMessage ?? `Choose ${lcFirst(label)}`, (v) => v == null, validate), className: cn(fieldStack, fieldWidths[width], className), children: [_jsx(FieldLabel, { isRequired: props.isRequired, children: label }), description && _jsx(FieldDescription, { children: description }), _jsx(FieldError, { errorPrefix: labels?.errorPrefix, requiredMessage: requiredMessage ?? `Choose ${lcFirst(label)}`, children: errorMessage }), _jsxs("div", { className: fieldBox, children: [_jsx(Input, { placeholder: placeholder, className: fieldInput }), _jsx(Button, { variant: "ghost", visualSize: "icon-sm", className: "me-1 justify-end", visualClassName: "text-muted-foreground group-data-hovered/button:text-foreground [&_svg]:size-4", children: _jsx(ChevronsUpDown, { "aria-hidden": "true" }) })] }), _jsx(Popover, { placement: "bottom start", className: "max-h-80", children: _jsx(ListBox, { renderEmptyState: () => (_jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children:
|
|
11
|
+
export function ComboBox({ label, description, errorMessage, requiredMessage, validate, placeholder, children, width = 'md', labels, emptyState, className, ...props }) {
|
|
12
|
+
return (_jsxs(RACComboBox, { ...props, validate: withRequired(props.isRequired, requiredMessage ?? `Choose ${lcFirst(label)}`, (v) => v == null, validate), className: cn(fieldStack, fieldWidths[width], className), children: [_jsx(FieldLabel, { isRequired: props.isRequired, children: label }), description && _jsx(FieldDescription, { children: description }), _jsx(FieldError, { errorPrefix: labels?.errorPrefix, requiredMessage: requiredMessage ?? `Choose ${lcFirst(label)}`, children: errorMessage }), _jsxs("div", { className: fieldBox, children: [_jsx(Input, { placeholder: placeholder, className: fieldInput }), _jsx(Button, { variant: "ghost", visualSize: "icon-sm", className: "me-1 justify-end", visualClassName: "text-muted-foreground group-data-hovered/button:text-foreground [&_svg]:size-4", children: _jsx(ChevronsUpDown, { "aria-hidden": "true" }) })] }), _jsx(Popover, { placement: "bottom start", className: "max-h-80", children: _jsx(ListBox, { renderEmptyState: () => (_jsx("p", { className: "px-3 py-2 text-sm text-muted-foreground", children: emptyState ?? 'No matches. Check the spelling or try fewer letters.' })), children: children }) })] }));
|
|
13
13
|
}
|
|
14
14
|
//# sourceMappingURL=combo-box.js.map
|
package/dist/ui/combo-box.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../../src/ui/combo-box.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,KAAK,GAGN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,GAGb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"combo-box.js","sourceRoot":"","sources":["../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OAAO,CAAC,KAAK,CAAC,EAAE,YAE7D,YAAY,GACF,EACb,eAAK,SAAS,EAAE,QAAQ,aACtB,KAAC,KAAK,IAAC,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,GAAI,EAE1D,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,UAAU,EAAC,SAAS,EACpB,SAAS,EAAC,kBAAkB,EAC5B,eAAe,EAAC,gFAAgF,YAEhG,KAAC,cAAc,mBAAa,MAAM,GAAG,GAC9B,IACL,EACN,KAAC,OAAO,IAAC,SAAS,EAAC,cAAc,EAAC,SAAS,EAAC,UAAU,YACpD,KAAC,OAAO,IACN,gBAAgB,EAAE,GAAG,EAAE,CAAC,CACtB,YAAG,SAAS,EAAC,yCAAyC,YACnD,UAAU,IAAI,sDAAsD,GACnE,CACL,YAEA,QAAiB,GACV,GACF,IACE,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DropIndicatorProps as RACDropIndicatorProps } from 'react-aria-components';
|
|
2
|
+
export interface DropIndicatorProps extends Omit<RACDropIndicatorProps, 'className' | 'style'> {
|
|
3
|
+
/**
|
|
4
|
+
* What the line is drawn over. `surface` (the default): the editor's own lists, a 4px `brand` line with a 2px
|
|
5
|
+
* `background` halo. `canvas`: a page the product doesn't style, such as a page builder's canvas, a 4px
|
|
6
|
+
* `canvas-mark` line with a 2px `canvas-mark-halo` halo, the same in every theme, so one of the two tones has
|
|
7
|
+
* 3:1 against whatever is underneath.
|
|
8
|
+
*/
|
|
9
|
+
tone?: 'surface' | 'canvas';
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Where a dragged row will land, between two rows of a Tree or a GridList. Give it to `useDragAndDrop`'s
|
|
14
|
+
* `renderDropIndicator`: `renderDropIndicator: (target) => <DropIndicator target={target} />`.
|
|
15
|
+
*
|
|
16
|
+
* Two tones, so it reads on any surface: a 4px line with a 2px halo. It takes no room until it's the target, so
|
|
17
|
+
* rows never jump while something is dragged over them. React Aria names it for a screen reader ("Insert between
|
|
18
|
+
* Hero and Fixtures") and moves through these by keyboard during a drag.
|
|
19
|
+
*/
|
|
20
|
+
export declare function DropIndicator({ tone, className, ...props }: DropIndicatorProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=drop-indicator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-indicator.d.ts","sourceRoot":"","sources":["../../src/ui/drop-indicator.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,IAAI,qBAAqB,EACjD,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,WAAW,GAAG,OAAO,CAAC;IAC5F;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAgB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,+BAkB1F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { DropIndicator as RACDropIndicator, } from 'react-aria-components';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
/**
|
|
6
|
+
* Where a dragged row will land, between two rows of a Tree or a GridList. Give it to `useDragAndDrop`'s
|
|
7
|
+
* `renderDropIndicator`: `renderDropIndicator: (target) => <DropIndicator target={target} />`.
|
|
8
|
+
*
|
|
9
|
+
* Two tones, so it reads on any surface: a 4px line with a 2px halo. It takes no room until it's the target, so
|
|
10
|
+
* rows never jump while something is dragged over them. React Aria names it for a screen reader ("Insert between
|
|
11
|
+
* Hero and Fixtures") and moves through these by keyboard during a drag.
|
|
12
|
+
*/
|
|
13
|
+
export function DropIndicator({ tone = 'surface', className, ...props }) {
|
|
14
|
+
return (_jsx(RACDropIndicator, { ...props, className: ({ isDropTarget }) => cn('relative z-10 h-0 outline-none', isDropTarget &&
|
|
15
|
+
"before:absolute before:inset-x-2 before:-top-0.5 before:h-1 before:rounded-full before:content-[''] forced-colors:before:bg-[Highlight] forced-colors:before:forced-color-adjust-none", isDropTarget &&
|
|
16
|
+
(tone === 'canvas'
|
|
17
|
+
? 'before:bg-canvas-mark before:shadow-[0_0_0_2px_var(--canvas-mark-halo)]'
|
|
18
|
+
: 'before:bg-brand before:shadow-[0_0_0_2px_var(--background)]'), className) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=drop-indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-indicator.js","sourceRoot":"","sources":["../../src/ui/drop-indicator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,aAAa,IAAI,gBAAgB,GAElC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAalC;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsB;IACzF,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,SAAS,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAC9B,EAAE,CACA,gCAAgC,EAChC,YAAY;YACV,uLAAuL,EACzL,YAAY;YACV,CAAC,IAAI,KAAK,QAAQ;gBAChB,CAAC,CAAC,yEAAyE;gBAC3E,CAAC,CAAC,6DAA6D,CAAC,EACpE,SAAS,CACV,GAEH,CACH,CAAC;AACJ,CAAC"}
|
package/dist/ui/grid-list.d.ts
CHANGED
|
@@ -7,8 +7,13 @@ export interface GridListProps<T extends object> extends Omit<RACGridListProps<T
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* A list of items people act on — members, files, integrations — where each row can hold its own buttons.
|
|
10
|
-
*
|
|
11
|
-
* gets a SelectionCheckbox; Space or a click on the row toggles it. The list is `relative` because it scrolls
|
|
10
|
+
* ↑ ↓ move between rows and → through a row's own controls; Tab leaves the list. With
|
|
11
|
+
* `selectionMode="multiple"` every row gets a SelectionCheckbox; Space or a click on the row toggles it. The list is `relative` because it scrolls,
|
|
12
|
+
* and because React Aria positions its drop indicators absolutely.
|
|
13
|
+
*
|
|
14
|
+
* Drag and drop: pass `dragAndDropHooks` from React Aria's `useDragAndDrop`, with
|
|
15
|
+
* `renderDropIndicator: (target) => <DropIndicator target={target} />`. Every draggable row then shows a drag
|
|
16
|
+
* button, which is how a keyboard or screen reader drag starts.
|
|
12
17
|
*/
|
|
13
18
|
export declare function GridList<T extends object>({ className, ...props }: GridListProps<T>): import("react").JSX.Element;
|
|
14
19
|
export interface GridListItemProps extends Omit<RACGridListItemProps, 'className' | 'children'> {
|
|
@@ -17,8 +22,10 @@ export interface GridListItemProps extends Omit<RACGridListItemProps, 'className
|
|
|
17
22
|
description?: ReactNode;
|
|
18
23
|
/** Buttons for this row only. Name them with the row ("Remove Priya Shah"). */
|
|
19
24
|
actions?: ReactNode;
|
|
25
|
+
/** Words for the drag button, when the row can be dragged. React Aria's own ("Drag {name}") by default. */
|
|
26
|
+
dragLabel?: string;
|
|
20
27
|
className?: string;
|
|
21
28
|
}
|
|
22
29
|
/** Selected: brand-subtle, the 3px sidebar-primary marker and a ticked box — the same signals as a table row. */
|
|
23
|
-
export declare function GridListItem({ children, description, actions, className, ...props }: GridListItemProps): import("react").JSX.Element;
|
|
30
|
+
export declare function GridListItem({ children, description, actions, dragLabel, className, ...props }: GridListItemProps): import("react").JSX.Element;
|
|
24
31
|
//# sourceMappingURL=grid-list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-list.d.ts","sourceRoot":"","sources":["../../src/ui/grid-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"grid-list.d.ts","sourceRoot":"","sources":["../../src/ui/grid-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAIL,KAAK,iBAAiB,IAAI,oBAAoB,EAC9C,KAAK,aAAa,IAAI,gBAAgB,EACvC,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC;IAC7F,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,CAAC,CAAC,CAAC,+BAWnF;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,WAAW,GAAG,UAAU,CAAC;IAC7F,QAAQ,EAAE,SAAS,CAAC;IACpB,sDAAsD;IACtD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iHAAiH;AACjH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,OAAO,EACP,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAgDnB"}
|
package/dist/ui/grid-list.js
CHANGED
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { GripVertical } from 'lucide-react';
|
|
4
|
+
import { Button as RACButton, GridList as RACGridList, GridListItem as RACGridListItem, } from 'react-aria-components';
|
|
4
5
|
import { cn } from '../lib/cn.js';
|
|
5
6
|
import { SelectionCheckbox } from './checkbox.js';
|
|
6
7
|
/**
|
|
7
8
|
* A list of items people act on — members, files, integrations — where each row can hold its own buttons.
|
|
8
|
-
*
|
|
9
|
-
* gets a SelectionCheckbox; Space or a click on the row toggles it. The list is `relative` because it scrolls
|
|
9
|
+
* ↑ ↓ move between rows and → through a row's own controls; Tab leaves the list. With
|
|
10
|
+
* `selectionMode="multiple"` every row gets a SelectionCheckbox; Space or a click on the row toggles it. The list is `relative` because it scrolls,
|
|
11
|
+
* and because React Aria positions its drop indicators absolutely.
|
|
12
|
+
*
|
|
13
|
+
* Drag and drop: pass `dragAndDropHooks` from React Aria's `useDragAndDrop`, with
|
|
14
|
+
* `renderDropIndicator: (target) => <DropIndicator target={target} />`. Every draggable row then shows a drag
|
|
15
|
+
* button, which is how a keyboard or screen reader drag starts.
|
|
10
16
|
*/
|
|
11
17
|
export function GridList({ className, ...props }) {
|
|
12
|
-
return (_jsx(RACGridList, { ...props, className: cn('relative flex max-h-[inherit] flex-col overflow-auto rounded-lg border border-border bg-card text-sm outline-none data-focus-visible:focus-ring', className) }));
|
|
18
|
+
return (_jsx(RACGridList, { ...props, className: cn('relative flex max-h-[inherit] flex-col overflow-auto rounded-lg border border-border bg-card text-sm outline-none data-focus-visible:focus-ring', 'data-drop-target:bg-brand-subtle data-drop-target:outline-2 data-drop-target:outline-solid data-drop-target:outline-brand data-drop-target:-outline-offset-2', className) }));
|
|
13
19
|
}
|
|
14
20
|
/** Selected: brand-subtle, the 3px sidebar-primary marker and a ticked box — the same signals as a table row. */
|
|
15
|
-
export function GridListItem({ children, description, actions, className, ...props }) {
|
|
21
|
+
export function GridListItem({ children, description, actions, dragLabel, className, ...props }) {
|
|
16
22
|
const textValue = props.textValue ?? (typeof children === 'string' ? children : undefined);
|
|
17
|
-
return (_jsx(RACGridListItem, { ...props, textValue: textValue, className: cn(
|
|
23
|
+
return (_jsx(RACGridListItem, { ...props, textValue: textValue, className: ({ allowsDragging }) => cn(
|
|
18
24
|
// React Aria sets data-hovered only on a row that can be selected or has an action: the pointer then.
|
|
19
|
-
'group/item relative flex min-h-[calc(var(--control-height)+12px)] cursor-default items-center gap-3 border-b border-border
|
|
25
|
+
'group/item relative flex min-h-[calc(var(--control-height)+12px)] cursor-default items-center gap-3 border-b border-border py-1.5 pe-3 outline-none last:border-b-0',
|
|
26
|
+
// A draggable row starts with its drag button, whose target is wider than its paint: the row gives it
|
|
27
|
+
// the start padding rather than the button reaching into it.
|
|
28
|
+
allowsDragging ? 'ps-1' : 'ps-3', 'data-hovered:cursor-pointer data-disabled:cursor-not-allowed data-hovered:bg-accent data-selected:bg-brand-subtle data-selected:shadow-[inset_3px_0_0_var(--sidebar-primary)] data-focus-visible:focus-ring-inset data-disabled:opacity-60', 'data-dragging:opacity-50 data-drop-target:bg-brand-subtle data-drop-target:outline-2 data-drop-target:outline-solid data-drop-target:outline-brand data-drop-target:-outline-offset-2',
|
|
29
|
+
// Forced colours drop the selected ground and the inset marker: draw the marker in Highlight instead.
|
|
30
|
+
"forced-colors:data-selected:before:absolute forced-colors:data-selected:before:inset-y-1 forced-colors:data-selected:before:start-0 forced-colors:data-selected:before:w-[3px] forced-colors:data-selected:before:bg-[Highlight] forced-colors:data-selected:before:forced-color-adjust-none forced-colors:data-selected:before:content-['']", className), children: ({ selectionMode, selectionBehavior, allowsDragging }) => (_jsxs(_Fragment, { children: [allowsDragging && (_jsx(RACButton, { slot: "drag", "aria-label": dragLabel, className: "group/grid-drag relative flex min-h-target min-w-target shrink-0 cursor-grab items-center justify-center outline-none", children: _jsx("span", { className: "flex size-control-sm items-center justify-center rounded-md text-muted-foreground group-data-focus-visible/grid-drag:focus-ring group-data-hovered/grid-drag:bg-muted group-data-hovered/grid-drag:text-foreground", children: _jsx(GripVertical, { "aria-hidden": "true", className: "size-4" }) }) })), selectionMode !== 'none' && selectionBehavior === 'toggle' && (_jsx(SelectionCheckbox, { className: "-ml-1" })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "leading-5 font-medium text-foreground", children: children }), description && (_jsx("span", { className: "text-[13px] leading-5 text-muted-foreground", children: description }))] }), actions && _jsx("span", { className: "flex shrink-0 items-center gap-1", children: actions })] })) }));
|
|
20
31
|
}
|
|
21
32
|
//# sourceMappingURL=grid-list.js.map
|
package/dist/ui/grid-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-list.js","sourceRoot":"","sources":["../../src/ui/grid-list.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EACL,QAAQ,IAAI,WAAW,EACvB,YAAY,IAAI,eAAe,GAGhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQlD
|
|
1
|
+
{"version":3,"file":"grid-list.js","sourceRoot":"","sources":["../../src/ui/grid-list.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,MAAM,IAAI,SAAS,EACnB,QAAQ,IAAI,WAAW,EACvB,YAAY,IAAI,eAAe,GAGhC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQlD;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAmB,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoB;IAClF,OAAO,CACL,KAAC,WAAW,OACN,KAAK,EACT,SAAS,EAAE,EAAE,CACX,iJAAiJ,EACj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AI,eAAM,SAAS,EAAC,kCAAkC,YAAE,OAAO,GAAQ,IAC9E,CACJ,GACe,CACnB,CAAC;AACJ,CAAC"}
|
package/dist/ui/switch.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export interface SwitchProps extends Omit<RACSwitchProps, 'className' | 'childre
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* On/off that takes effect immediately — confirm the change with a status message. Inside a form that is
|
|
10
|
-
* submitted later, use a Checkbox. On: the thumb moves right and the track fills, never colour alone.
|
|
10
|
+
* submitted later, use a Checkbox. On: the thumb moves right and the track fills, never colour alone. In forced
|
|
11
|
+
* colours the track and thumb are drawn in the system's colours (Canvas and CanvasText, Highlight when on).
|
|
11
12
|
*/
|
|
12
13
|
export declare function Switch({ children, description, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
13
14
|
//# sourceMappingURL=switch.d.ts.map
|
package/dist/ui/switch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAuB,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGhG,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,UAAU,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAuB,KAAK,WAAW,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGhG,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,UAAU,CAAC;IACjF,QAAQ,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,WAAW,+BAkCjF"}
|
package/dist/ui/switch.js
CHANGED
|
@@ -4,9 +4,12 @@ import { Switch as RACSwitch } from 'react-aria-components';
|
|
|
4
4
|
import { cn } from '../lib/cn.js';
|
|
5
5
|
/**
|
|
6
6
|
* On/off that takes effect immediately — confirm the change with a status message. Inside a form that is
|
|
7
|
-
* submitted later, use a Checkbox. On: the thumb moves right and the track fills, never colour alone.
|
|
7
|
+
* submitted later, use a Checkbox. On: the thumb moves right and the track fills, never colour alone. In forced
|
|
8
|
+
* colours the track and thumb are drawn in the system's colours (Canvas and CanvasText, Highlight when on).
|
|
8
9
|
*/
|
|
9
10
|
export function Switch({ children, description, className, ...props }) {
|
|
10
|
-
return (_jsxs(RACSwitch, { ...props, className: cn('group/choice relative flex min-h-target cursor-pointer items-start gap-3 py-[calc((var(--target-min)-var(--choice-size))/2)] text-sm leading-5 text-foreground outline-none data-disabled:cursor-not-allowed data-disabled:opacity-60 data-readonly:cursor-default', className), children: [_jsx("span", { "aria-hidden": "true", className: cn('relative mt-[calc((20px-var(--choice-size))/2)] h-choice w-[calc(var(--choice-size)*1.8)] shrink-0 rounded-full border border-input bg-muted transition-colors duration-(--duration-fast)', 'group-data-focus-visible/choice:focus-ring group-data-selected/choice:border-primary group-data-selected/choice:bg-primary'
|
|
11
|
+
return (_jsxs(RACSwitch, { ...props, className: cn('group/choice relative flex min-h-target cursor-pointer items-start gap-3 py-[calc((var(--target-min)-var(--choice-size))/2)] text-sm leading-5 text-foreground outline-none data-disabled:cursor-not-allowed data-disabled:opacity-60 data-readonly:cursor-default', className), children: [_jsx("span", { "aria-hidden": "true", className: cn('relative mt-[calc((20px-var(--choice-size))/2)] h-choice w-[calc(var(--choice-size)*1.8)] shrink-0 rounded-full border border-input bg-muted transition-colors duration-(--duration-fast)', 'group-data-focus-visible/choice:focus-ring group-data-selected/choice:border-primary group-data-selected/choice:bg-primary',
|
|
12
|
+
// Forced colours drop backgrounds, and with them the thumb: the system's colours, kept, draw it instead.
|
|
13
|
+
'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:forced-color-adjust-none forced-colors:group-data-selected/choice:border-[Highlight] forced-colors:group-data-selected/choice:bg-[Highlight]'), children: _jsx("span", { className: cn('absolute top-1/2 left-[2px] size-[calc(var(--choice-size)-6px)] -translate-y-1/2 rounded-full bg-muted-foreground', 'transition-[left] duration-(--duration-fast) motion-reduce:transition-none aaa:transition-none', 'group-data-selected/choice:left-[calc(100%-var(--choice-size)+4px)] group-data-selected/choice:bg-primary-foreground', 'forced-colors:bg-[CanvasText] forced-colors:group-data-selected/choice:bg-[HighlightText]') }) }), _jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { children: children }), description && _jsx("span", { className: "text-[13px] text-muted-foreground", children: description })] })] }));
|
|
11
14
|
}
|
|
12
15
|
//# sourceMappingURL=switch.js.map
|
package/dist/ui/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,IAAI,SAAS,EAAsC,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAQlC
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,IAAI,SAAS,EAAsC,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAQlC;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,EAAe;IAChF,OAAO,CAEL,MAAC,SAAS,OACJ,KAAK,EACT,SAAS,EAAE,EAAE,CACX,oQAAoQ,EACpQ,SAAS,CACV,aAED,8BACc,MAAM,EAClB,SAAS,EAAE,EAAE,CACX,2LAA2L,EAC3L,4HAA4H;gBAC5H,yGAAyG;gBACzG,wNAAwN,CACzN,YAED,eACE,SAAS,EAAE,EAAE,CACX,mHAAmH,EACnH,gGAAgG,EAChG,sHAAsH,EACtH,2FAA2F,CAC5F,GACD,GACG,EACP,gBAAM,SAAS,EAAC,uBAAuB,aACrC,yBAAO,QAAQ,GAAQ,EACtB,WAAW,IAAI,eAAM,SAAS,EAAC,mCAAmC,YAAE,WAAW,GAAQ,IACnF,IACG,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type ToolbarProps as RACToolbarProps } from 'react-aria-components';
|
|
2
|
+
export interface ToolbarProps extends Omit<RACToolbarProps, 'className' | 'aria-label'> {
|
|
3
|
+
/** Required: what the buttons act on, such as "Fixtures actions". */
|
|
4
|
+
'aria-label': string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A row of buttons that act on one thing: a block on a canvas, a selection, a rich text field. React Aria's
|
|
9
|
+
* Toolbar, so it is one stop in the tab order: ← → (↑ ↓ when vertical) move between its buttons, Home and End go to
|
|
10
|
+
* the ends, and Tab leaves it. It wraps instead of overflowing, so nothing is cut off at 320px (1.4.10); a toolbar
|
|
11
|
+
* that would wrap onto more than two lines should move its less-used commands into a `MenuTrigger` at its end.
|
|
12
|
+
* Buttons inside it are ordinary `IconButton`s and `Button`s, at least `--target-min` square, `--control-gap`
|
|
13
|
+
* apart. A button that can't act right now (Move up on the first block) is better left enabled with
|
|
14
|
+
* `aria-disabled="true"` and a reason in its description than `isDisabled`: React Aria skips disabled buttons,
|
|
15
|
+
* so a button that disables itself while focused would drop focus.
|
|
16
|
+
*/
|
|
17
|
+
export declare function Toolbar({ className, orientation, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
18
|
+
/** A line between groups of buttons in a Toolbar. Decorative to sight, a separator to a screen reader. */
|
|
19
|
+
export declare function ToolbarSeparator({ className }: {
|
|
20
|
+
className?: string;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=toolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.d.ts","sourceRoot":"","sources":["../../src/ui/toolbar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,IAAI,eAAe,EACrC,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,YAAY,CAAC;IACrF,qEAAqE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,EAAE,SAAS,EAAE,WAA0B,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,+BAWxF;AAED,0GAA0G;AAC1G,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,+BAOrE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Separator as RACSeparator, Toolbar as RACToolbar, } from 'react-aria-components';
|
|
4
|
+
import { cn } from '../lib/cn.js';
|
|
5
|
+
/**
|
|
6
|
+
* A row of buttons that act on one thing: a block on a canvas, a selection, a rich text field. React Aria's
|
|
7
|
+
* Toolbar, so it is one stop in the tab order: ← → (↑ ↓ when vertical) move between its buttons, Home and End go to
|
|
8
|
+
* the ends, and Tab leaves it. It wraps instead of overflowing, so nothing is cut off at 320px (1.4.10); a toolbar
|
|
9
|
+
* that would wrap onto more than two lines should move its less-used commands into a `MenuTrigger` at its end.
|
|
10
|
+
* Buttons inside it are ordinary `IconButton`s and `Button`s, at least `--target-min` square, `--control-gap`
|
|
11
|
+
* apart. A button that can't act right now (Move up on the first block) is better left enabled with
|
|
12
|
+
* `aria-disabled="true"` and a reason in its description than `isDisabled`: React Aria skips disabled buttons,
|
|
13
|
+
* so a button that disables itself while focused would drop focus.
|
|
14
|
+
*/
|
|
15
|
+
export function Toolbar({ className, orientation = 'horizontal', ...props }) {
|
|
16
|
+
return (_jsx(RACToolbar, { orientation: orientation, ...props, className: cn('flex flex-wrap items-center gap-(--control-gap) outline-none aria-[orientation=vertical]:flex-col', className) }));
|
|
17
|
+
}
|
|
18
|
+
/** A line between groups of buttons in a Toolbar. Decorative to sight, a separator to a screen reader. */
|
|
19
|
+
export function ToolbarSeparator({ className }) {
|
|
20
|
+
return (_jsx(RACSeparator, { orientation: "vertical", className: cn('mx-0.5 h-6 w-px self-center bg-border', className) }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../src/ui/toolbar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,OAAO,IAAI,UAAU,GAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAQlC;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,SAAS,EAAE,WAAW,GAAG,YAAY,EAAE,GAAG,KAAK,EAAgB;IACvF,OAAO,CACL,KAAC,UAAU,IACT,WAAW,EAAE,WAAW,KACpB,KAAK,EACT,SAAS,EAAE,EAAE,CACX,mGAAmG,EACnG,SAAS,CACV,GACD,CACH,CAAC;AACJ,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,gBAAgB,CAAC,EAAE,SAAS,EAA0B;IACpE,OAAO,CACL,KAAC,YAAY,IACX,WAAW,EAAC,UAAU,EACtB,SAAS,EAAE,EAAE,CAAC,uCAAuC,EAAE,SAAS,CAAC,GACjE,CACH,CAAC;AACJ,CAAC"}
|
package/dist/ui/tree.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { TreeSection as RACTreeSection, type TreeItemProps as RACTreeItemProps, type TreeProps as RACTreeProps } from 'react-aria-components';
|
|
3
|
+
import { type IconProp } from './icon.js';
|
|
3
4
|
/** A tree is named by a visible heading (`aria-labelledby`) or, when it has none, by `aria-label`. */
|
|
4
5
|
type TreeName = {
|
|
5
6
|
'aria-label': string;
|
|
@@ -10,11 +11,19 @@ export type TreeProps<T extends object> = Omit<RACTreeProps<T>, 'className' | 'a
|
|
|
10
11
|
className?: string;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
|
-
* Nested things people open, close and act on: the steps of a workflow and their outcomes,
|
|
14
|
-
* resource. React Aria's Tree, a `treegrid` and one tab stop. ↑ ↓ move between rows, → opens a
|
|
15
|
-
* it, Home and End go to the ends, and typing jumps to the next row whose name starts with what you
|
|
16
|
-
* open row, → moves to the row's own buttons.
|
|
17
|
-
*
|
|
14
|
+
* Nested things people open, close and act on: the blocks of a page, the steps of a workflow and their outcomes,
|
|
15
|
+
* operations grouped by resource. React Aria's Tree, a `treegrid` and one tab stop. ↑ ↓ move between rows, → opens a
|
|
16
|
+
* row and ← closes it, Home and End go to the ends, and typing jumps to the next row whose name starts with what you
|
|
17
|
+
* typed. On an open row, → moves to the row's own buttons.
|
|
18
|
+
*
|
|
19
|
+
* It draws no box of its own: rows sit on whatever surface holds the tree (a panel, a card), `--nav-item-gap`
|
|
20
|
+
* apart, like a nav list. The tree is `relative` because it scrolls, and because React Aria positions its drop
|
|
21
|
+
* indicators absolutely.
|
|
22
|
+
*
|
|
23
|
+
* Drag and drop: pass `dragAndDropHooks` from React Aria's `useDragAndDrop`, with
|
|
24
|
+
* `renderDropIndicator: (target) => <DropIndicator target={target} />`. Every draggable row then shows a drag
|
|
25
|
+
* button, which is how a keyboard or screen reader drag starts: Enter on it, ↑ ↓ to a drop place, Enter to drop,
|
|
26
|
+
* Esc to cancel.
|
|
18
27
|
*/
|
|
19
28
|
export declare function Tree<T extends object>({ className, ...props }: TreeProps<T>): import("react").JSX.Element;
|
|
20
29
|
export interface TreeItemProps<T extends object = object> extends Omit<RACTreeItemProps<T>, 'className' | 'children' | 'textValue' | 'style'> {
|
|
@@ -22,21 +31,57 @@ export interface TreeItemProps<T extends object = object> extends Omit<RACTreeIt
|
|
|
22
31
|
title: ReactNode;
|
|
23
32
|
/** Required when `title` isn't a string: the words typeahead matches and a screen reader reads. */
|
|
24
33
|
textValue?: string;
|
|
25
|
-
/**
|
|
34
|
+
/** What kind of thing the row is: a block's type, a step's verb. 16px, `brand` while the row is selected. */
|
|
35
|
+
icon?: IconProp;
|
|
36
|
+
/**
|
|
37
|
+
* A few words after the title, on the same line: a block's heading, a count. When they don't fit beside the
|
|
38
|
+
* title they move under it and wrap there. They're never cut short, so text spacing and zoom lose none of them
|
|
39
|
+
* (1.4.12). A string is added to the row's accessible name, so the words are never only seen.
|
|
40
|
+
*/
|
|
26
41
|
description?: ReactNode;
|
|
27
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* A `StatusBadge` for this row: a check result ("2nd H1"), a draft, a lock. It sits after the description,
|
|
44
|
+
* before the actions. Always an icon and a word.
|
|
45
|
+
*/
|
|
46
|
+
status?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* The status in words for a screen reader ("2nd H1, must fix"). React Aria names a row from its `textValue`
|
|
49
|
+
* alone, so without this the status is only seen, never heard. Added to the row's name after the description.
|
|
50
|
+
*/
|
|
51
|
+
statusLabel?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Buttons for this row only. Name them with the row ("Actions for Fixtures"). They show on the selected row,
|
|
54
|
+
* the row with focus and the row under the pointer, so the tree stays quiet; keyboard focus on a row shows them
|
|
55
|
+
* before → reaches them. `alwaysShowActions` keeps them showing, for a row that can't be selected.
|
|
56
|
+
*/
|
|
28
57
|
actions?: ReactNode;
|
|
58
|
+
alwaysShowActions?: boolean;
|
|
29
59
|
/** The rows inside this one: `TreeItem`s, or a React Aria `Collection` of them. */
|
|
30
60
|
children?: ReactNode;
|
|
61
|
+
/** Words for the drag button, when the row can be dragged. React Aria's own ("Drag {title}") by default. */
|
|
62
|
+
dragLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* `false` leaves the drag button off a row that can't move, such as a column in a page layout, in a tree that
|
|
65
|
+
* otherwise drags. React Aria has no per-row switch for dragging (only for `disabledBehavior="all"`, which also
|
|
66
|
+
* takes the row out of focus), so the tree's `getItems` should give such a row a type its drop targets refuse.
|
|
67
|
+
*/
|
|
68
|
+
allowsDragging?: boolean;
|
|
31
69
|
className?: string;
|
|
32
70
|
}
|
|
33
71
|
/**
|
|
34
|
-
* One row and the rows inside it
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* GridList; with multiple selection, a ticked box too.
|
|
72
|
+
* One row and the rows inside it, on one line while it fits: chevron, icon, title, description, status, then its
|
|
73
|
+
* buttons. Each level indents by `--tree-indent` (16px). A row is at least `--nav-item-height` tall and `--target-min` at AAA,
|
|
74
|
+
* rounded, with the `accent` ground on hover. Selected: `brand-subtle`, the 3px `sidebar-primary` marker, a bold
|
|
75
|
+
* title and a `brand` icon, as in a GridList and the sidebar; with multiple selection, a ticked box too.
|
|
76
|
+
*
|
|
77
|
+
* A row that only holds other rows, such as a column in a page layout, can be focused and opened but never
|
|
78
|
+
* selected: put its id in the Tree's `disabledKeys` and set `disabledBehavior="selection"`. React Aria then
|
|
79
|
+
* leaves it focusable and doesn't mark it disabled, so it isn't dimmed.
|
|
80
|
+
*
|
|
81
|
+
* While a drag is over the row, as a place to drop into, it gets the `brand-subtle` ground and a 2px `brand`
|
|
82
|
+
* outline inside its edge. The row being dragged fades to 50%.
|
|
38
83
|
*/
|
|
39
|
-
export declare function TreeItem<T extends object = object>({ title, textValue, description, actions, children, className, ...props }: TreeItemProps<T>): import("react").JSX.Element;
|
|
84
|
+
export declare function TreeItem<T extends object = object>({ title, textValue, icon, description, status, statusLabel, actions, alwaysShowActions, children, dragLabel, allowsDragging: rowDrags, className, ...props }: TreeItemProps<T>): import("react").JSX.Element;
|
|
40
85
|
/** React Aria doesn't export its TreeSection's props by name. */
|
|
41
86
|
type RACTreeSectionProps<T extends object> = Parameters<typeof RACTreeSection<T>>[0];
|
|
42
87
|
export interface TreeSectionProps<T extends object> extends Omit<RACTreeSectionProps<T>, 'className'> {
|
package/dist/ui/tree.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/ui/tree.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAML,WAAW,IAAI,cAAc,EAC7B,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,SAAS,IAAI,YAAY,EAC/B,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/ui/tree.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAML,WAAW,IAAI,cAAc,EAC7B,KAAK,aAAa,IAAI,gBAAgB,EACtC,KAAK,SAAS,IAAI,YAAY,EAC/B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEtD,sGAAsG;AACtG,KAAK,QAAQ,GAAG;IAAE,YAAY,EAAE,MA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