@kanso-labs/kanso-ui 0.19.0 → 0.20.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/dist/chip/styles.js +86 -0
- package/dist/chip/styles.js.map +1 -0
- package/dist/components/autocomplete/index.d.ts +45 -0
- package/dist/components/autocomplete/index.js +77 -0
- package/dist/components/autocomplete/index.js.map +1 -0
- package/dist/components/breadcrumbs/index.d.ts +57 -0
- package/dist/components/breadcrumbs/index.js +133 -0
- package/dist/components/breadcrumbs/index.js.map +1 -0
- package/dist/components/button/index.d.ts +9 -3
- package/dist/components/button/index.js +15 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/checkbox/index.js +1 -1
- package/dist/components/chip/index.js +3 -4
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +50 -0
- package/dist/components/chip-group/index.js +117 -0
- package/dist/components/chip-group/index.js.map +1 -0
- package/dist/components/combo-box/index.d.ts +89 -0
- package/dist/components/combo-box/index.js +141 -0
- package/dist/components/combo-box/index.js.map +1 -0
- package/dist/components/disclosure/index.d.ts +68 -0
- package/dist/components/disclosure/index.js +169 -0
- package/dist/components/disclosure/index.js.map +1 -0
- package/dist/components/disclosure-group/index.d.ts +37 -0
- package/dist/components/disclosure-group/index.js +52 -0
- package/dist/components/disclosure-group/index.js.map +1 -0
- package/dist/components/icon-button/index.d.ts +47 -9
- package/dist/components/icon-button/index.js +83 -4
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +12 -1
- package/dist/components/list/index.d.ts +97 -0
- package/dist/components/list/index.js +195 -0
- package/dist/components/list/index.js.map +1 -0
- package/dist/components/list-box/index.d.ts +1 -1
- package/dist/components/list-box/index.js +44 -30
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +14 -4
- package/dist/components/menu/index.js +53 -35
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/number-field/index.js +1 -1
- package/dist/components/search-field/index.js +1 -1
- package/dist/components/segmented-button/index.d.ts +69 -0
- package/dist/components/segmented-button/index.js +149 -0
- package/dist/components/segmented-button/index.js.map +1 -0
- package/dist/components/select/index.d.ts +82 -0
- package/dist/components/select/index.js +125 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/separator/index.d.ts +7 -6
- package/dist/components/separator/index.js +25 -9
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/switch/index.js +3 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +81 -0
- package/dist/components/token-field/index.js +78 -0
- package/dist/components/token-field/index.js.map +1 -0
- package/dist/components/toolbar/index.d.ts +51 -0
- package/dist/components/toolbar/index.js +85 -0
- package/dist/components/toolbar/index.js.map +1 -0
- package/dist/field/index.d.ts +2 -2
- package/dist/field/index.js +95 -18
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.js +16 -5
- package/dist/react-aria.d.ts +2 -2
- package/dist/react-aria.js +2 -2
- package/dist/render/aria.js +15 -1
- package/dist/render/aria.js.map +1 -1
- package/dist/styles.css +174 -24
- package/package.json +2 -2
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//#region src/chip/styles.ts
|
|
2
|
+
const chipStyles = {
|
|
3
|
+
base: {
|
|
4
|
+
kGNEyG: "x6s0dn4",
|
|
5
|
+
kZKoxP: "x10w6t97",
|
|
6
|
+
kaIpWk: "x1xdvaa9",
|
|
7
|
+
ksu8eU: "x1y0btm7",
|
|
8
|
+
kMzoRj: "xmkeg23",
|
|
9
|
+
kB7OPa: "x9f619",
|
|
10
|
+
kkrTdU: "x1ypdohk",
|
|
11
|
+
k1xSpc: "x3nfvp2",
|
|
12
|
+
kmuXW: "x2lah0s",
|
|
13
|
+
kMv6JI: "xkknnkr",
|
|
14
|
+
kGuDYH: "x14zspaw",
|
|
15
|
+
k63SB2: "x1v9cpvo",
|
|
16
|
+
kOIVth: "x126z3so",
|
|
17
|
+
kb6lSQ: "x155f00i",
|
|
18
|
+
kLWn49: "x1lz68p4",
|
|
19
|
+
kjBf7l: "xrgy624",
|
|
20
|
+
kInvED: "x1hl8ikr",
|
|
21
|
+
k3XXqK: "x9v5kkp x1t137rt",
|
|
22
|
+
kMeerF: "x1de99jn",
|
|
23
|
+
k8WAf4: "xt970qd",
|
|
24
|
+
kg3NbH: "x790zyz",
|
|
25
|
+
kIyJzY: "x1qno0dh",
|
|
26
|
+
k1ekBW: "x1eaenvl",
|
|
27
|
+
kAMwcw: "xpc4ca7",
|
|
28
|
+
$$css: true
|
|
29
|
+
},
|
|
30
|
+
disabled: {
|
|
31
|
+
kMwMTN: "x1xj74d8",
|
|
32
|
+
kkrTdU: "x1h6gzvc",
|
|
33
|
+
$$css: true
|
|
34
|
+
},
|
|
35
|
+
disabledSelected: {
|
|
36
|
+
kWkggS: "xepofeg",
|
|
37
|
+
$$css: true
|
|
38
|
+
},
|
|
39
|
+
disabledUnselected: {
|
|
40
|
+
kWkggS: "xjbqb8w",
|
|
41
|
+
kVAM5u: "xrh88j3",
|
|
42
|
+
$$css: true
|
|
43
|
+
},
|
|
44
|
+
remove: {
|
|
45
|
+
kGNEyG: "x6s0dn4",
|
|
46
|
+
kWkggS: "xy3r1oc x15a1ka xjbqb8w",
|
|
47
|
+
kZKoxP: "xmix8c7",
|
|
48
|
+
kaIpWk: "x3y1ksm",
|
|
49
|
+
kMzoRj: "xc342km",
|
|
50
|
+
kB7OPa: "x9f619",
|
|
51
|
+
kMwMTN: "x1heor9g",
|
|
52
|
+
kkrTdU: "x1ypdohk",
|
|
53
|
+
k1xSpc: "x3nfvp2",
|
|
54
|
+
kmuXW: "x2lah0s",
|
|
55
|
+
kzqmXN: "x1xp8n7a",
|
|
56
|
+
kjj79g: "xl56j7k",
|
|
57
|
+
k71WvV: "x1kfc2zf",
|
|
58
|
+
kjBf7l: "x14ytart",
|
|
59
|
+
kInvED: "x1y3gkto",
|
|
60
|
+
k3XXqK: "x9v5kkp x1t137rt",
|
|
61
|
+
kMeerF: "x1de99jn",
|
|
62
|
+
kmVPX3: "x1717udv",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
removeGlyph: {
|
|
66
|
+
kZKoxP: "xmix8c7",
|
|
67
|
+
kzqmXN: "x1xp8n7a",
|
|
68
|
+
$$css: true
|
|
69
|
+
},
|
|
70
|
+
selected: {
|
|
71
|
+
kWkggS: "xnqsvhv xlizrex x15dekr4",
|
|
72
|
+
kVAM5u: "x9r1u3d",
|
|
73
|
+
kMwMTN: "x1sawysd",
|
|
74
|
+
$$css: true
|
|
75
|
+
},
|
|
76
|
+
unselected: {
|
|
77
|
+
kWkggS: "x83qkoq x1p2om7n xjbqb8w",
|
|
78
|
+
kVAM5u: "x133yhug",
|
|
79
|
+
kMwMTN: "x1w5n3ug",
|
|
80
|
+
$$css: true
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
//#endregion
|
|
84
|
+
export { chipStyles };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":[],"sources":["../../src/chip/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The pill the chips page draws, shared by the two components that draw one:\n// Chip, which is a toggle on its own, and ChipGroup's chip, which is one of a\n// set that can also be removed. The measurements and roles are the page's\n// filter chip — a 32dp container with an 8dp corner and 16dp of inline\n// padding, an outline variant border while unselected, the secondary\n// container pair once selected.\n//\n// Each state composites an on-colour over its own container at the\n// interaction state's opacity rather than swapping in a separate hover\n// colour. `calc(<opacity> * 100%)` turns the token's unitless 0-1 ratio into\n// the percentage `color-mix()` takes, and it is inlined at each property\n// because @stylexjs/babel-plugin only statically recognises expressions\n// written directly as property values.\n//\n// The selected chip drops its border rather than recolouring it: it has a\n// container of its own to define its edge, and a border on top of that reads\n// as a second, competing outline.\n//\n// Disabled is applied from render state rather than from `:disabled`. Chip is\n// a button and would match the pseudo-class; a chip in a group is React\n// Aria's `Tag`, which is a div and never will. One mechanism serves both, and\n// StyleX replaces a property whole, so the disabled styles take the hover and\n// pressed branches of whichever state they are applied over.\n//\n// Apart from any component so a chip in a group and a chip on its own cannot\n// drift; see `src/row` for the same arrangement around a list's row.\n\nconst chipStyles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"x10w6t97\",\n kaIpWk: \"x1xdvaa9\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"x790zyz\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1eaenvl\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n disabledSelected: {\n kWkggS: \"xepofeg\",\n $$css: true\n },\n disabledUnselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3\",\n $$css: true\n },\n remove: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xy3r1oc x15a1ka xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kaIpWk: \"x3y1ksm\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n k71WvV: \"x1kfc2zf\",\n kjBf7l: \"x14ytart\",\n kInvED: \"x1y3gkto\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n $$css: true\n },\n removeGlyph: {\n kZKoxP: \"xmix8c7\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n selected: {\n kWkggS: \"xnqsvhv xlizrex x15dekr4\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n unselected: {\n kWkggS: \"x83qkoq x1p2om7n xjbqb8w\",\n kVAM5u: \"x133yhug\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\nexport { chipStyles };"],"mappings":";AA+BA,MAAM,aAAa;CACjB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,kBAAkB;EAChB,QAAQ;EACR,OAAO;CACT;CACA,oBAAoB;EAClB,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { AutocompleteProps } from "react-aria-components";
|
|
3
|
+
//#region src/components/autocomplete/index.d.ts
|
|
4
|
+
type AutocompleteFilter<T extends object = object> = NonNullable<AutocompleteProps<T>['filter']>;
|
|
5
|
+
type AutocompleteProps$1<T extends object = object> = {
|
|
6
|
+
/**
|
|
7
|
+
* The search input and the collection it filters, in whatever the page
|
|
8
|
+
* puts around them. React Aria needs both somewhere inside.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Which options a search keeps. Defaults to a locale-aware contains match
|
|
13
|
+
* on each option's text — React Aria's own default is to filter nothing,
|
|
14
|
+
* which is right for a collection that arrives filtered and wrong for one
|
|
15
|
+
* written out in the page.
|
|
16
|
+
*/
|
|
17
|
+
filter?: AutocompleteFilter<T>;
|
|
18
|
+
} & Omit<AutocompleteProps<T>, 'children' | 'filter'>;
|
|
19
|
+
/**
|
|
20
|
+
* A search input that filters the collection under it. Its value is React
|
|
21
|
+
* Aria's: pass `inputValue` with `onInputChange` to control what has been
|
|
22
|
+
* typed, or `defaultInputValue` to let it keep its own.
|
|
23
|
+
*
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <Autocomplete>
|
|
26
|
+
* <SearchField label="Search" placeholder="Search" />
|
|
27
|
+
* <ListBox aria-label="Results">
|
|
28
|
+
* <ListBox.Item id="first">First item</ListBox.Item>
|
|
29
|
+
* </ListBox>
|
|
30
|
+
* </Autocomplete>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* It renders no element of its own, so the input and the collection sit
|
|
34
|
+
* wherever the page puts them — side by side in a panel, in a `Menu.Content`,
|
|
35
|
+
* or in a `Dialog` as a command palette. That is also why it takes no
|
|
36
|
+
* `className` or `style`: there is nothing for them to land on.
|
|
37
|
+
*
|
|
38
|
+
* Keyboard focus stays in the input while the arrow keys move through the
|
|
39
|
+
* collection, which is React Aria's virtual focus. `disableVirtualFocus`
|
|
40
|
+
* turns that off and makes the collection tabbable instead.
|
|
41
|
+
*/
|
|
42
|
+
declare function Autocomplete$1<T extends object = object>({ children, filter, ...props }: AutocompleteProps$1<T>): import("react").JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { type AutocompleteFilter, type AutocompleteProps$1 as AutocompleteProps, Autocomplete$1 as default };
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Autocomplete, useFilter } from "react-aria-components";
|
|
4
|
+
//#region src/components/autocomplete/index.tsx
|
|
5
|
+
/**
|
|
6
|
+
* A search input that filters the collection under it. Its value is React
|
|
7
|
+
* Aria's: pass `inputValue` with `onInputChange` to control what has been
|
|
8
|
+
* typed, or `defaultInputValue` to let it keep its own.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Autocomplete>
|
|
12
|
+
* <SearchField label="Search" placeholder="Search" />
|
|
13
|
+
* <ListBox aria-label="Results">
|
|
14
|
+
* <ListBox.Item id="first">First item</ListBox.Item>
|
|
15
|
+
* </ListBox>
|
|
16
|
+
* </Autocomplete>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* It renders no element of its own, so the input and the collection sit
|
|
20
|
+
* wherever the page puts them — side by side in a panel, in a `Menu.Content`,
|
|
21
|
+
* or in a `Dialog` as a command palette. That is also why it takes no
|
|
22
|
+
* `className` or `style`: there is nothing for them to land on.
|
|
23
|
+
*
|
|
24
|
+
* Keyboard focus stays in the input while the arrow keys move through the
|
|
25
|
+
* collection, which is React Aria's virtual focus. `disableVirtualFocus`
|
|
26
|
+
* turns that off and makes the collection tabbable instead.
|
|
27
|
+
*/
|
|
28
|
+
function Autocomplete$1(t0) {
|
|
29
|
+
const $ = c(12);
|
|
30
|
+
let children;
|
|
31
|
+
let filter;
|
|
32
|
+
let props;
|
|
33
|
+
if ($[0] !== t0) {
|
|
34
|
+
({children, filter, ...props} = t0);
|
|
35
|
+
$[0] = t0;
|
|
36
|
+
$[1] = children;
|
|
37
|
+
$[2] = filter;
|
|
38
|
+
$[3] = props;
|
|
39
|
+
} else {
|
|
40
|
+
children = $[1];
|
|
41
|
+
filter = $[2];
|
|
42
|
+
props = $[3];
|
|
43
|
+
}
|
|
44
|
+
let t1;
|
|
45
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
46
|
+
t1 = { sensitivity: "base" };
|
|
47
|
+
$[4] = t1;
|
|
48
|
+
} else t1 = $[4];
|
|
49
|
+
const { contains } = useFilter(t1);
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[5] !== contains || $[6] !== filter) {
|
|
52
|
+
t2 = filter ?? containsFilter(contains);
|
|
53
|
+
$[5] = contains;
|
|
54
|
+
$[6] = filter;
|
|
55
|
+
$[7] = t2;
|
|
56
|
+
} else t2 = $[7];
|
|
57
|
+
let t3;
|
|
58
|
+
if ($[8] !== children || $[9] !== props || $[10] !== t2) {
|
|
59
|
+
t3 = /* @__PURE__ */ jsx(Autocomplete, {
|
|
60
|
+
filter: t2,
|
|
61
|
+
...props,
|
|
62
|
+
children
|
|
63
|
+
});
|
|
64
|
+
$[8] = children;
|
|
65
|
+
$[9] = props;
|
|
66
|
+
$[10] = t2;
|
|
67
|
+
$[11] = t3;
|
|
68
|
+
} else t3 = $[11];
|
|
69
|
+
return t3;
|
|
70
|
+
}
|
|
71
|
+
function containsFilter(contains) {
|
|
72
|
+
return (textValue, inputValue) => contains(textValue, inputValue);
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { Autocomplete$1 as default };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["children"],"sources":["../../../src/components/autocomplete/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { AutocompleteProps as RACAutocompleteProps } from 'react-aria-components'\n\nimport {\n Autocomplete as RACAutocomplete,\n useFilter,\n} from 'react-aria-components'\n\n// The search page's search with suggestions, as the wrapper React Aria makes\n// it: a search input over a collection, where typing narrows what the\n// collection shows. It draws nothing of its own — the input is SearchField,\n// the collection is ListBox or Menu, and where the two sit is the page's\n// business, which is what lets the same wrapper be a searchable list, a\n// filtered menu and a command palette inside a Dialog.\n//\n// Every other component here is a shape; this one is a behaviour, so it\n// renders no element and takes no `className` or `style`. There is nothing\n// for them to land on, and a wrapper element added to give them somewhere\n// would be a layout decision this component has no business making — the\n// three shapes above want three different ones.\n//\n// One thing is added to React Aria's. **Filtering is on by default.** Their\n// wrapper filters nothing unless it is handed a predicate, on the grounds\n// that a collection fed from a server may already be filtered. A collection\n// written out in the page is the common case here, and a search box that\n// does not search is a puzzle rather than a default, so `filter` falls back\n// to the same locale-aware contains match ComboBox uses. A collection that\n// filters itself passes a predicate that always returns true.\n\n// React Aria's own filter signature. Taken from the prop rather than written\n// out, since its third parameter is a collection node whose type this package\n// does not depend on directly.\ntype AutocompleteFilter<T extends object = object> = NonNullable<\n RACAutocompleteProps<T>['filter']\n>\n\ntype AutocompleteProps<T extends object = object> = {\n /**\n * The search input and the collection it filters, in whatever the page\n * puts around them. React Aria needs both somewhere inside.\n */\n children?: ReactNode\n /**\n * Which options a search keeps. Defaults to a locale-aware contains match\n * on each option's text — React Aria's own default is to filter nothing,\n * which is right for a collection that arrives filtered and wrong for one\n * written out in the page.\n */\n filter?: AutocompleteFilter<T>\n} & Omit<RACAutocompleteProps<T>, 'children' | 'filter'>\n\n/**\n * A search input that filters the collection under it. Its value is React\n * Aria's: pass `inputValue` with `onInputChange` to control what has been\n * typed, or `defaultInputValue` to let it keep its own.\n *\n * ```tsx\n * <Autocomplete>\n * <SearchField label=\"Search\" placeholder=\"Search\" />\n * <ListBox aria-label=\"Results\">\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * </ListBox>\n * </Autocomplete>\n * ```\n *\n * It renders no element of its own, so the input and the collection sit\n * wherever the page puts them — side by side in a panel, in a `Menu.Content`,\n * or in a `Dialog` as a command palette. That is also why it takes no\n * `className` or `style`: there is nothing for them to land on.\n *\n * Keyboard focus stays in the input while the arrow keys move through the\n * collection, which is React Aria's virtual focus. `disableVirtualFocus`\n * turns that off and makes the collection tabbable instead.\n */\nfunction Autocomplete<T extends object = object>({\n children,\n filter,\n ...props\n}: AutocompleteProps<T>) {\n const { contains } = useFilter({ sensitivity: 'base' })\n\n return (\n <RACAutocomplete<T> filter={filter ?? containsFilter(contains)} {...props}>\n {children}\n </RACAutocomplete>\n )\n}\n\n// React Aria's filter is handed the node as well as the two strings, which a\n// contains match has no use for. Built by a call rather than written inline\n// at the prop, which is what react-perf's no-new-function-as-prop is after;\n// the React Compiler memoises the result on its input.\nfunction containsFilter(\n contains: (textValue: string, inputValue: string) => boolean,\n) {\n return (textValue: string, inputValue: string) =>\n contains(textValue, inputValue)\n}\n\nexport type { AutocompleteFilter, AutocompleteProps }\n\nexport default Autocomplete\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA0EA,SAAA,eAAA,IAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAiD,CAAA,CAAA,UAAA,QAAA,GAAA,SAAA;EAI1B,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,WAAA,EAAA;EAAA,SAAA,EAAA;EAAA,QAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EACU,KAAA,EAAA,aAAe,OAAO;EAAC,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAtD,MAAA,EAAA,aAAqB,UAAU,EAAuB;CAAC,IAAA;CAAA,IAAA,EAAA,OAAA,YAAA,EAAA,OAAA,QAAA;EAGzB,KAAA,UAAU,eAAe,QAAQ;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,YAAA,EAAA,OAAA,SAAA,EAAA,QAAA,IAAA;EAA9D,KAAA,oBAAC,cAAD;GAA4B,QAAA;GAAkC,GAAM;GACjE;EADa,CAAA;EAEE,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAFlB;AAEkB;AAQtB,SAAS,eACP,UACA;CACA,QAAQ,WAAmB,eACzB,SAAS,WAAW,UAAU;AAClC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BreadcrumbProps, BreadcrumbsProps } from "react-aria-components";
|
|
3
|
+
//#region src/components/breadcrumbs/index.d.ts
|
|
4
|
+
type BreadcrumbsItemProps = Omit<BreadcrumbProps, 'children' | 'className' | 'style'> & {
|
|
5
|
+
/** The item's label. */
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
/** A function may compute the class from the item's render state. */
|
|
8
|
+
className?: BreadcrumbProps['className'];
|
|
9
|
+
/**
|
|
10
|
+
* Where the item leads. Leave it out on an item the page handles through
|
|
11
|
+
* the trail's `onAction`, and on the current one, which is never a link.
|
|
12
|
+
*/
|
|
13
|
+
href?: string;
|
|
14
|
+
/** The link's `rel`. */
|
|
15
|
+
rel?: string;
|
|
16
|
+
/** A function may compute the style from the item's render state. */
|
|
17
|
+
style?: BreadcrumbProps['style'];
|
|
18
|
+
/** The link's `target`. */
|
|
19
|
+
target?: string;
|
|
20
|
+
};
|
|
21
|
+
type BreadcrumbsProps$1<T extends object = object> = Omit<BreadcrumbsProps<T>, 'children'> & {
|
|
22
|
+
/** The trail, as `Breadcrumbs.Item` entries. */
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A trail of links back up a hierarchy, ending at the page you are on.
|
|
27
|
+
* React Aria makes the last item the current one and marks it
|
|
28
|
+
* `aria-current="page"`; everything before it is a link.
|
|
29
|
+
*
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <Breadcrumbs aria-label="Label">
|
|
32
|
+
* <Breadcrumbs.Item href="#first">First item</Breadcrumbs.Item>
|
|
33
|
+
* <Breadcrumbs.Item href="#second">Second item</Breadcrumbs.Item>
|
|
34
|
+
* <Breadcrumbs.Item>Third item</Breadcrumbs.Item>
|
|
35
|
+
* </Breadcrumbs>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* Name it with `aria-label` or `aria-labelledby`. A page that navigates
|
|
39
|
+
* without an `href` gives each item an `id` and the trail an `onAction`,
|
|
40
|
+
* which is React Aria's and reports the key that was pressed.
|
|
41
|
+
*
|
|
42
|
+
* The call site's `className` and `style` land on the list, which is the
|
|
43
|
+
* element a layout positions.
|
|
44
|
+
*/
|
|
45
|
+
declare function Breadcrumbs$1<T extends object = object>(props: BreadcrumbsProps$1<T>): import("react").JSX.Element;
|
|
46
|
+
declare namespace Breadcrumbs$1 {
|
|
47
|
+
var Item: typeof BreadcrumbsItem;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One entry in the trail. Give it an `href` to navigate, or an `id` and let
|
|
51
|
+
* the trail's `onAction` handle it. The last entry is the current page and
|
|
52
|
+
* is drawn as text rather than a link, whatever it is given.
|
|
53
|
+
*/
|
|
54
|
+
declare function BreadcrumbsItem({ children, href, rel, target, ...props }: BreadcrumbsItemProps): import("react").JSX.Element;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { type BreadcrumbsItemProps, type BreadcrumbsProps$1 as BreadcrumbsProps, Breadcrumbs$1 as default };
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
|
|
2
|
+
import { ChevronEndGlyph } from "../../glyphs/index.js";
|
|
3
|
+
import Link$1 from "../link/index.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { Breadcrumb, Breadcrumbs } from "react-aria-components";
|
|
7
|
+
//#region src/components/breadcrumbs/index.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A trail of links back up a hierarchy, ending at the page you are on.
|
|
10
|
+
* React Aria makes the last item the current one and marks it
|
|
11
|
+
* `aria-current="page"`; everything before it is a link.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <Breadcrumbs aria-label="Label">
|
|
15
|
+
* <Breadcrumbs.Item href="#first">First item</Breadcrumbs.Item>
|
|
16
|
+
* <Breadcrumbs.Item href="#second">Second item</Breadcrumbs.Item>
|
|
17
|
+
* <Breadcrumbs.Item>Third item</Breadcrumbs.Item>
|
|
18
|
+
* </Breadcrumbs>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Name it with `aria-label` or `aria-labelledby`. A page that navigates
|
|
22
|
+
* without an `href` gives each item an `id` and the trail an `onAction`,
|
|
23
|
+
* which is React Aria's and reports the key that was pressed.
|
|
24
|
+
*
|
|
25
|
+
* The call site's `className` and `style` land on the list, which is the
|
|
26
|
+
* element a layout positions.
|
|
27
|
+
*/
|
|
28
|
+
function Breadcrumbs$1(props) {
|
|
29
|
+
const $ = c(5);
|
|
30
|
+
let t0;
|
|
31
|
+
if ($[0] !== props) {
|
|
32
|
+
t0 = mergeStyles({ className: "x6s0dn4 x9f619 x1w5n3ug x78zum5 x1a02dak xkknnkr x14zspaw x1v9cpvo xzoy561 x155f00i x1lz68p4 xe8uvvx x1ghz6dp x1717udv" }, props);
|
|
33
|
+
$[0] = props;
|
|
34
|
+
$[1] = t0;
|
|
35
|
+
} else t0 = $[1];
|
|
36
|
+
let t1;
|
|
37
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
38
|
+
t1 = /* @__PURE__ */ jsx(Breadcrumbs, {
|
|
39
|
+
...props,
|
|
40
|
+
...t0
|
|
41
|
+
});
|
|
42
|
+
$[2] = props;
|
|
43
|
+
$[3] = t0;
|
|
44
|
+
$[4] = t1;
|
|
45
|
+
} else t1 = $[4];
|
|
46
|
+
return t1;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* One entry in the trail. Give it an `href` to navigate, or an `id` and let
|
|
50
|
+
* the trail's `onAction` handle it. The last entry is the current page and
|
|
51
|
+
* is drawn as text rather than a link, whatever it is given.
|
|
52
|
+
*/
|
|
53
|
+
function BreadcrumbsItem(t0) {
|
|
54
|
+
const $ = c(18);
|
|
55
|
+
let T0;
|
|
56
|
+
let children;
|
|
57
|
+
let href;
|
|
58
|
+
let rel;
|
|
59
|
+
let t1;
|
|
60
|
+
let t2;
|
|
61
|
+
let target;
|
|
62
|
+
if ($[0] !== t0) {
|
|
63
|
+
const { children: t3, href: t4, rel: t5, target: t6, ...props } = t0;
|
|
64
|
+
children = t3;
|
|
65
|
+
href = t4;
|
|
66
|
+
rel = t5;
|
|
67
|
+
target = t6;
|
|
68
|
+
T0 = Breadcrumb;
|
|
69
|
+
t1 = props;
|
|
70
|
+
t2 = mergeStatefulStyles({ className: "x6s0dn4 x9f619 x78zum5 xzoy561" }, props);
|
|
71
|
+
$[0] = t0;
|
|
72
|
+
$[1] = T0;
|
|
73
|
+
$[2] = children;
|
|
74
|
+
$[3] = href;
|
|
75
|
+
$[4] = rel;
|
|
76
|
+
$[5] = t1;
|
|
77
|
+
$[6] = t2;
|
|
78
|
+
$[7] = target;
|
|
79
|
+
} else {
|
|
80
|
+
T0 = $[1];
|
|
81
|
+
children = $[2];
|
|
82
|
+
href = $[3];
|
|
83
|
+
rel = $[4];
|
|
84
|
+
t1 = $[5];
|
|
85
|
+
t2 = $[6];
|
|
86
|
+
target = $[7];
|
|
87
|
+
}
|
|
88
|
+
let t3;
|
|
89
|
+
if ($[8] !== children || $[9] !== href || $[10] !== rel || $[11] !== target) {
|
|
90
|
+
t3 = itemContent(children, href, rel, target);
|
|
91
|
+
$[8] = children;
|
|
92
|
+
$[9] = href;
|
|
93
|
+
$[10] = rel;
|
|
94
|
+
$[11] = target;
|
|
95
|
+
$[12] = t3;
|
|
96
|
+
} else t3 = $[12];
|
|
97
|
+
let t4;
|
|
98
|
+
if ($[13] !== T0 || $[14] !== t1 || $[15] !== t2 || $[16] !== t3) {
|
|
99
|
+
t4 = /* @__PURE__ */ jsx(T0, {
|
|
100
|
+
...t1,
|
|
101
|
+
...t2,
|
|
102
|
+
children: t3
|
|
103
|
+
});
|
|
104
|
+
$[13] = T0;
|
|
105
|
+
$[14] = t1;
|
|
106
|
+
$[15] = t2;
|
|
107
|
+
$[16] = t3;
|
|
108
|
+
$[17] = t4;
|
|
109
|
+
} else t4 = $[17];
|
|
110
|
+
return t4;
|
|
111
|
+
}
|
|
112
|
+
function itemContent(children, href, rel, target) {
|
|
113
|
+
return (state) => {
|
|
114
|
+
if (state.isCurrent) return /* @__PURE__ */ jsx("span", {
|
|
115
|
+
"aria-current": "page",
|
|
116
|
+
className: "x139gbkf",
|
|
117
|
+
children
|
|
118
|
+
});
|
|
119
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Link$1, {
|
|
120
|
+
href,
|
|
121
|
+
rel,
|
|
122
|
+
target,
|
|
123
|
+
tone: "inherit",
|
|
124
|
+
underline: "hover",
|
|
125
|
+
children
|
|
126
|
+
}), /* @__PURE__ */ jsx(ChevronEndGlyph, { className: "xmix8c7 x2lah0s x1xp8n7a x19axjrm x1c071of" })] });
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
Breadcrumbs$1.Item = BreadcrumbsItem;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Breadcrumbs$1 as default };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["props"],"sources":["../../../src/components/breadcrumbs/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { BreadcrumbRenderProps, BreadcrumbProps as RACBreadcrumbProps, BreadcrumbsProps as RACBreadcrumbsProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Breadcrumb as RACBreadcrumb, Breadcrumbs as RACBreadcrumbs } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Link from '../link';\n\n// A trail of links back up a hierarchy, ending at the page you are on. The\n// design system carries no breadcrumbs page, so the two nearest ones stand\n// in: the row takes the top app bar's muted content role, and each link the\n// text button's label-large type. Both are written down here rather than\n// guessed at each call site.\n//\n// React Aria decides which item is current — the last one — and marks it\n// `aria-current=\"page\"`. The trail is an ordered list, which is what a screen\n// reader reads it as, and `Breadcrumbs.Item` is one entry in it.\n//\n// Three things are this component's own.\n//\n// **The current item is text, not a link.** React Aria's own answer is a\n// disabled link, and a disabled link takes the library's disabled treatment\n// — the content role at 38%, which fades the one item the trail exists to\n// name. Here it is a span carrying `aria-current=\"page\"` instead, in the\n// full-strength content role, so the page you are on is the most legible\n// thing in the row rather than the least.\n//\n// **The chevron belongs to the item before it.** Each item that is not the\n// current one draws one after its link, which puts a separator between every\n// pair and none at the end. It says \"further in\" rather than \"to the right\",\n// so it mirrors under a right-to-left writing mode.\n//\n// **A link is drawn as a link in a place already understood to be links.**\n// `tone=\"inherit\"` takes the row's muted colour and `underline=\"hover\"`\n// leaves the rule for a pointer, which is what Link's own documentation\n// names this case for. The row's position is what announces them.\n//\n// `onAction` is React Aria's and is not wrapped: give each item an `id` and\n// the trail reports which one was pressed, for a page that navigates without\n// an `href`.\n\ntype BreadcrumbsItemProps = Omit<RACBreadcrumbProps, 'children' | 'className' | 'style'> & {\n /** The item's label. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACBreadcrumbProps['className'];\n /**\n * Where the item leads. Leave it out on an item the page handles through\n * the trail's `onAction`, and on the current one, which is never a link.\n */\n href?: string;\n /** The link's `rel`. */\n rel?: string;\n /** A function may compute the style from the item's render state. */\n style?: RACBreadcrumbProps['style'];\n /** The link's `target`. */\n target?: string;\n};\ntype BreadcrumbsProps<T extends object = object> = Omit<RACBreadcrumbsProps<T>, 'children'> & {\n /** The trail, as `Breadcrumbs.Item` entries. */\n children?: ReactNode;\n};\n\n/**\n * A trail of links back up a hierarchy, ending at the page you are on.\n * React Aria makes the last item the current one and marks it\n * `aria-current=\"page\"`; everything before it is a link.\n *\n * ```tsx\n * <Breadcrumbs aria-label=\"Label\">\n * <Breadcrumbs.Item href=\"#first\">First item</Breadcrumbs.Item>\n * <Breadcrumbs.Item href=\"#second\">Second item</Breadcrumbs.Item>\n * <Breadcrumbs.Item>Third item</Breadcrumbs.Item>\n * </Breadcrumbs>\n * ```\n *\n * Name it with `aria-label` or `aria-labelledby`. A page that navigates\n * without an `href` gives each item an `id` and the trail an `onAction`,\n * which is React Aria's and reports the key that was pressed.\n *\n * The call site's `className` and `style` land on the list, which is the\n * element a layout positions.\n */\nfunction Breadcrumbs<T extends object = object>(props: BreadcrumbsProps<T>) {\n return <RACBreadcrumbs<T> {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x1w5n3ug x78zum5 x1a02dak xkknnkr x14zspaw x1v9cpvo xzoy561 x155f00i x1lz68p4 xe8uvvx x1ghz6dp x1717udv\"\n }, props)} />;\n}\n\n/**\n * One entry in the trail. Give it an `href` to navigate, or an `id` and let\n * the trail's `onAction` handle it. The last entry is the current page and\n * is drawn as text rather than a link, whatever it is given.\n */\nfunction BreadcrumbsItem({\n children,\n href,\n rel,\n target,\n ...props\n}: BreadcrumbsItemProps) {\n return <RACBreadcrumb {...props} {...mergeStatefulStyles({\n className: \"x6s0dn4 x9f619 x78zum5 xzoy561\"\n }, props)}>\n {itemContent(children, href, rel, target)}\n </RACBreadcrumb>;\n}\n\n// What an entry draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction itemContent(children: ReactNode, href: string | undefined, rel: string | undefined, target: string | undefined) {\n return (state: BreadcrumbRenderProps) => {\n if (state.isCurrent) {\n return <span aria-current=\"page\" className=\"x139gbkf\">\n {children}\n </span>;\n }\n return <>\n <Link href={href} rel={rel} target={target} tone=\"inherit\" underline=\"hover\">\n {children}\n </Link>\n <ChevronEndGlyph className=\"xmix8c7 x2lah0s x1xp8n7a x19axjrm x1c071of\" />\n </>;\n };\n}\nBreadcrumbs.Item = BreadcrumbsItem;\nexport type { BreadcrumbsItemProps, BreadcrumbsProps };\nexport default Breadcrumbs;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFA,SAAA,cAAA,OAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA;EAC2C,KAAA,YAAY,EAAA,WACxC,yHACb,GAAG,KAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,SAAA,EAAA,OAAA,IAAA;EAFF,KAAA,oBAAC,aAAD;GAAe,GAAQ;GAAK,GAAM;EAEhC,CAAA;EAAI,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA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AAA,OAAA,KAAA,EAAA;CAAA,OAJX;AAIW;AAOpB,SAAS,YAAY,UAAqB,MAA0B,KAAyB,QAA4B;CACvH,QAAQ,UAAiC;EACvC,IAAI,MAAM,WACR,OAAO,oBAAC,QAAD;GAAM,gBAAa;GAAO,WAAU;GACtC;EACG,CAAA;EAEV,OAAO,qBAAA,UAAA,EAAA,UAAA,CACH,oBAAC,QAAD;GAAY;GAAW;GAAa;GAAQ,MAAK;GAAU,WAAU;GAClE;EACG,CAAA,GACN,oBAAC,iBAAD,EAAiB,WAAU,6CAA4C,CAAA,CACzE,EAAA,CAAA;CACJ;AACF;AACA,cAAY,OAAO"}
|
|
@@ -38,15 +38,21 @@ type ButtonProps$1 = {
|
|
|
38
38
|
style?: StyleOrFunction<ButtonState>;
|
|
39
39
|
/** The link's `target`, when `href` is set. */
|
|
40
40
|
target?: string;
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* How much weight the button pulls. `filled` and `tonal` carry a container
|
|
43
|
+
* of their own; `outlined` and `text` sit on the page; `elevated` sits on
|
|
44
|
+
* a low surface and lifts off it with a shadow, for a button that has to
|
|
45
|
+
* separate from a busy background rather than from the page.
|
|
46
|
+
* @default 'filled'
|
|
47
|
+
*/
|
|
42
48
|
variant?: ButtonVariant;
|
|
43
49
|
} & ButtonDOMProps;
|
|
44
50
|
type ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';
|
|
45
51
|
type ButtonState = Pick<ButtonRenderProps, 'isDisabled' | 'isFocused' | 'isFocusVisible' | 'isHovered' | 'isPressed'>;
|
|
46
|
-
type ButtonVariant = 'filled' | 'outlined' | 'text' | 'tonal';
|
|
52
|
+
type ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal';
|
|
47
53
|
type GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof ButtonProps, 'onBlur' | 'onClick' | 'onFocus'>;
|
|
48
54
|
/**
|
|
49
|
-
* The design's button, at
|
|
55
|
+
* The design's button, at five emphasis levels and five control heights.
|
|
50
56
|
* Given `href` it is a link with the same appearance. Every `aria-*` prop is
|
|
51
57
|
* forwarded to the element; React Aria alone would keep only the labelling
|
|
52
58
|
* ones.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
|
-
import { useRipple } from "../../hooks/useRipple.js";
|
|
4
3
|
import { ariaAttributesOf, buttonRenderer, linkRenderer } from "../../render/aria.js";
|
|
4
|
+
import { useRipple } from "../../hooks/useRipple.js";
|
|
5
5
|
import ProgressIndicator from "../progress-indicator/index.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { Button, Link } from "react-aria-components";
|
|
@@ -32,6 +32,18 @@ const styles = {
|
|
|
32
32
|
kkrTdU: "x1h6gzvc",
|
|
33
33
|
$$css: true
|
|
34
34
|
},
|
|
35
|
+
elevated: {
|
|
36
|
+
kWkggS: "x1k1wbbp x3k5p2v xf9j7ge x1vnz5z6",
|
|
37
|
+
kGVxlE: "x1g60mc1 x1fzngjt x19efjv6",
|
|
38
|
+
kMwMTN: "x1mxwv8y",
|
|
39
|
+
$$css: true
|
|
40
|
+
},
|
|
41
|
+
elevatedDisabled: {
|
|
42
|
+
kWkggS: "xepofeg",
|
|
43
|
+
kGVxlE: "x1gnnqk1",
|
|
44
|
+
kMwMTN: "x1xj74d8",
|
|
45
|
+
$$css: true
|
|
46
|
+
},
|
|
35
47
|
filled: {
|
|
36
48
|
kWkggS: "xpky1to x16z974x xyf7a0q xnety89",
|
|
37
49
|
kGVxlE: "xpk4wdd x1955hzl x1gnnqk1",
|
|
@@ -162,13 +174,14 @@ const outlineWidths = {
|
|
|
162
174
|
}
|
|
163
175
|
};
|
|
164
176
|
const disabledStyles = {
|
|
177
|
+
elevated: styles.elevatedDisabled,
|
|
165
178
|
filled: styles.filledDisabled,
|
|
166
179
|
outlined: styles.outlinedDisabled,
|
|
167
180
|
text: styles.textDisabled,
|
|
168
181
|
tonal: styles.tonalDisabled
|
|
169
182
|
};
|
|
170
183
|
/**
|
|
171
|
-
* The design's button, at
|
|
184
|
+
* The design's button, at five emphasis levels and five control heights.
|
|
172
185
|
* Given `href` it is a link with the same appearance. Every `aria-*` prop is
|
|
173
186
|
* forwarded to the element; React Aria alone would keep only the labelling
|
|
174
187
|
* ones.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import type { DOMAttributes, ReactNode } from 'react';\nimport type { ButtonRenderProps, ClassNameOrFunction, FocusableElement, ButtonProps as RACButtonProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, Link as RACLink } from 'react-aria-components';\nimport { useRipple } from '../../hooks/useRipple';\nimport { ariaAttributesOf, buttonRenderer, linkRenderer } from '../../render/aria';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport ProgressIndicator from '../progress-indicator';\n\n// Each variant composites its label colour over its container at the\n// interaction state's opacity, rather than swapping in a separate\n// hover/pressed color: filled and tonal paint the 'on-color' over the\n// container, outlined and text paint the label colour over a transparent\n// one. The pairs are the buttons spec page's newer values: tonal on\n// secondary container, outlined with an outline variant border and an\n// on-surface-variant label, text on primary.\n// calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes. Inlined rather than factored into a helper:\n// @stylexjs/babel-plugin only statically recognizes expressions written\n// directly as property values, and a call to an externally-defined function\n// isn't one of them.\n//\n// Disabled is a style of its own per variant rather than a `:disabled`\n// branch inside each property: a button given `href` renders as a link,\n// which React Aria turns into a <span> while disabled, and neither matches\n// the pseudo-class. The disabled styles are applied last from the render\n// state's `isDisabled`, and StyleX replaces a property whole, so they also\n// take the hover and pressed branches with them — which is what keeps a\n// hovered disabled button from lighting up.\n//\n// Two independent axes, applied base -> variant -> size. The order is what\n// lets `text` keep its tighter inline padding at the default size while the\n// other sizes still set their own: `md` deliberately declares no\n// paddingInline, so a medium button falls through to whatever its variant\n// asked for, and every other size overrides it. That mirrors the source\n// design's own cascade, where the size classes are declared after the\n// variant ones and win on padding for exactly the same reason.\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x3y1ksm\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n filled: {\n kWkggS: \"xpky1to x16z974x xyf7a0q xnety89\",\n kGVxlE: \"xpk4wdd x1955hzl x1gnnqk1\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n filledDisabled: {\n kWkggS: \"xepofeg\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n label: {\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n labelPending: {\n k33iCy: \"xlshs6z\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x1dg9itu x1yu1589 x1728qcm xjbqb8w\",\n kVAM5u: \"x133yhug\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n outlinedDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n pending: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kpwlN0: \"x10a8y8t\",\n kjj79g: \"xl56j7k\",\n kVAEAm: \"x10l6tqk\",\n $$css: true\n },\n text: {\n kWkggS: \"x12vej0r x598nmq x14dcer4 xjbqb8w\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n textDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xnqsvhv xc87fxa xlizrex x15dekr4\",\n kGVxlE: \"xpk4wdd x1955hzl x1gnnqk1\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tonalDisabled: {\n kWkggS: \"xepofeg\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n xl: {\n kZKoxP: \"xjp8j0k\",\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kg3NbH: \"x1sdxjpb\",\n $$css: true\n },\n xs: {\n kZKoxP: \"x10w6t97\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"xn866dk\",\n kMv6JI: \"x1vsmgmf\",\n kGuDYH: \"xh9c4x\",\n k63SB2: \"x1y15vu6\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xoqu3bc\",\n kLWn49: \"x10x9d6x\",\n kg3NbH: \"x1dao9b2\",\n $$css: true\n }\n};\n\n// The outlined button's border thickens with the size, as the page's size\n// tokens have it: 1dp up to M, 2dp at L, 3dp at XL. A style per size rather\n// than a value in the size style, since a border on a filled button would\n// draw in the label colour.\nconst outlineWidths = {\n lg: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n $$css: true\n }\n};\nconst disabledStyles = {\n filled: styles.filledDisabled,\n outlined: styles.outlinedDisabled,\n text: styles.textDisabled,\n tonal: styles.tonalDisabled\n};\ntype ButtonDOMProps = Omit<RACButtonProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype ButtonProps = {\n children?: ReactNode;\n /** A function may compute the class from the button's render state. */\n className?: ClassNameOrFunction<ButtonState>;\n /**\n * Disables the press ripple. The hover/pressed background state layer is\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * Where the button leads. Given one, the button is rendered as a link —\n * an `<a>`, announced as the link it is — with the same styles and ripple.\n * `render`, `type`, and the form and pending props apply to the button\n * form only.\n */\n href?: string;\n /**\n * The name of the ring shown while the button is pending, for a screen\n * reader. The label it replaces is hidden while it shows.\n * @default 'Loading'\n */\n pendingLabel?: string;\n /** The link's `rel`, when `href` is set. */\n rel?: string;\n /**\n * Control height: `xs` 32px, `md` 40px, `lg` 56px, `xl` 96px, `xxl` 136px —\n * the buttons spec page's XS, S, M, L and XL, each with its own inline\n * padding and type role. `md` is the page's default.\n * @default 'md'\n */\n size?: ButtonSize;\n /** A function may compute the style from the button's render state. */\n style?: StyleOrFunction<ButtonState>;\n /** The link's `target`, when `href` is set. */\n target?: string;\n /** @default 'filled' */\n variant?: ButtonVariant;\n} & ButtonDOMProps;\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\n\n// The render state both of React Aria's elements share. A className or\n// style function written against it serves the button and the link alike;\n// `isPending` belongs to the button alone, and `isCurrent` to the link, so\n// neither is here: a `className` written against this state serves both\n// elements. What the button draws while pending is decided in\n// `buttonContent`, which sees React Aria's own state rather than this one.\ntype ButtonState = Pick<ButtonRenderProps, 'isDisabled' | 'isFocused' | 'isFocusVisible' | 'isHovered' | 'isPressed'>;\ntype ButtonVariant = 'filled' | 'outlined' | 'text' | 'tonal';\n\n// React Aria types the global DOM events — pointer, mouse, touch, wheel and\n// the rest — against the element each component renders, and a handler\n// written for a <button> does not type-check against an <a>. The keys are\n// retyped against HTMLElement here so one set of props serves both forms;\n// the events React Aria defines itself (press, focus, keyboard) keep its\n// types, since it hands those its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACButtonProps, 'onBlur' | 'onClick' | 'onFocus'>;\n\n/**\n * The design's button, at four emphasis levels and five control heights.\n * Given `href` it is a link with the same appearance. Every `aria-*` prop is\n * forwarded to the element; React Aria alone would keep only the labelling\n * ones.\n */\nfunction Button({\n children,\n disableRipple = false,\n href,\n isDisabled = false,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n pendingLabel = 'Loading',\n rel,\n render,\n size = 'md',\n target,\n variant = 'filled',\n ...props\n}: ButtonProps) {\n // `props` (className/style, etc.) is spread separately: `className` and\n // `style` there may be functions of render state, which ripple's own\n // handler-only merge doesn't need to know about. It is also why the styles\n // below merge through mergeStatefulStyles rather than the plain\n // mergeStyles. The ripple is off while disabled: React Aria still forwards\n // pointer events to a disabled element, and a press that changes nothing\n // should not look like one.\n const ripple = useRipple<FocusableElement>(!disableRipple && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n const styleProps = mergeStatefulStyles((state: ButtonState) => stylex.props(styles.base, styles[variant], styles[size], variant === 'outlined' && outlineWidths[size], state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]), props);\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n if (href !== undefined) {\n return <RACLink href={href} isDisabled={isDisabled} rel={rel} render={linkRenderer(element)} target={target} {...ripple.handlers} {...props} {...styleProps}>\n {children}\n {ripple.surface}\n </RACLink>;\n }\n return <RACButton isDisabled={isDisabled} render={buttonRenderer(element, render)} {...ripple.handlers} {...props} {...styleProps}>\n {buttonContent(children, pendingLabel, ripple)}\n </RACButton>;\n}\n// What the button draws: its label, hidden while the button is pending, with\n// the ring over it. The ring takes the button's own content colour rather\n// than the progress page's primary, which on a filled button is the fill\n// itself and so invisible. The label stays in the flow so the button keeps its\n// width, which is what stops a form jumping the moment it is submitted.\n// React Aria wants the progress bar in the accessibility tree as soon as the\n// button goes pending, so it is rendered from the render state rather than\n// after a delay.\n//\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler\n// memoises the result on its inputs.\nfunction buttonContent(children: ReactNode, pendingLabel: string, ripple: Ripple) {\n return (state: ButtonRenderProps) => <>\n <span {...{\n 0: {\n className: \"xjp7ctv\"\n },\n 1: {\n className: \"xjp7ctv xlshs6z\"\n }\n }[!!state.isPending << 0]}>\n {children}\n </span>\n {state.isPending ? <span className=\"x6s0dn4 x78zum5 x10a8y8t xl56j7k x10l6tqk\">\n <ProgressIndicator aria-label={pendingLabel} isIndeterminate size=\"1em\" tone=\"inherit\" variant=\"circular\" />\n </span> : null}\n {ripple.surface}\n </>;\n}\nexport type { ButtonDOMProps, ButtonProps, ButtonSize, ButtonState, ButtonVariant };\nexport default Button;"],"mappings":";;;;;;;;AAwCA,MAAM,SAAS;CACb,MAAM;EACJ,QAAQ;EACR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AAI;EAClH,UAAA,cAAc,UAAU,cAAc,MAAM;CACpC,CAAA;AACf;AAaA,SAAS,cAAc,UAAqB,cAAsB,QAAgB;CAChF,QAAQ,UAA6B,qBAAA,UAAA,EAAA,UAAA;EACjC,oBAAC,QAAD;GAAM,GAAI;IACV,GAAG,EACD,WAAW,UACb;IACA,GAAG,EACD,WAAW,kBACb;GACF,EAAE,CAAC,CAAC,MAAM,aAAa;GAClB;EACG,CAAA;EACL,MAAM,YAAY,oBAAC,QAAD;GAAM,WAAU;GAC/B,UAAA,oBAAC,mBAAD;IAAmB,cAAY;IAAc,iBAAA;IAAgB,MAAK;IAAM,MAAK;IAAU,SAAQ;GAAU,CAAA;EACrG,CAAA,IAAI;EACX,OAAO;CACV,EAAA,CAAA;AACJ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import type { DOMAttributes, ReactNode } from 'react';\nimport type { ButtonRenderProps, ClassNameOrFunction, FocusableElement, ButtonProps as RACButtonProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, Link as RACLink } from 'react-aria-components';\nimport { useRipple } from '../../hooks/useRipple';\nimport { ariaAttributesOf, buttonRenderer, linkRenderer } from '../../render/aria';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport ProgressIndicator from '../progress-indicator';\n\n// Each variant composites its label colour over its container at the\n// interaction state's opacity, rather than swapping in a separate\n// hover/pressed color: filled and tonal paint the 'on-color' over the\n// container, outlined, text and elevated paint the label colour over their\n// own. The pairs are the buttons spec page's newer values: tonal on\n// secondary container, outlined with an outline variant border and an\n// on-surface-variant label, text on primary, elevated on surface container\n// low with a primary label.\n//\n// **Elevated is the one variant whose shadow is part of its identity.** The\n// page rests it at elevation 1 rather than flat, raises it on hover and\n// returns it to 1 while pressed — where filled and tonal rest flat and lift\n// only on hover. Disabled drops it to none, since a shadow says a control is\n// available to press.\n// calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes. Inlined rather than factored into a helper:\n// @stylexjs/babel-plugin only statically recognizes expressions written\n// directly as property values, and a call to an externally-defined function\n// isn't one of them.\n//\n// Disabled is a style of its own per variant rather than a `:disabled`\n// branch inside each property: a button given `href` renders as a link,\n// which React Aria turns into a <span> while disabled, and neither matches\n// the pseudo-class. The disabled styles are applied last from the render\n// state's `isDisabled`, and StyleX replaces a property whole, so they also\n// take the hover and pressed branches with them — which is what keeps a\n// hovered disabled button from lighting up.\n//\n// Two independent axes, applied base -> variant -> size. The order is what\n// lets `text` keep its tighter inline padding at the default size while the\n// other sizes still set their own: `md` deliberately declares no\n// paddingInline, so a medium button falls through to whatever its variant\n// asked for, and every other size overrides it. That mirrors the source\n// design's own cascade, where the size classes are declared after the\n// variant ones and win on padding for exactly the same reason.\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x3y1ksm\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1k1wbbp x3k5p2v xf9j7ge x1vnz5z6\",\n kGVxlE: \"x1g60mc1 x1fzngjt x19efjv6\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n elevatedDisabled: {\n kWkggS: \"xepofeg\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n filled: {\n kWkggS: \"xpky1to x16z974x xyf7a0q xnety89\",\n kGVxlE: \"xpk4wdd x1955hzl x1gnnqk1\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n filledDisabled: {\n kWkggS: \"xepofeg\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n label: {\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n labelPending: {\n k33iCy: \"xlshs6z\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x1dg9itu x1yu1589 x1728qcm xjbqb8w\",\n kVAM5u: \"x133yhug\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n outlinedDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n pending: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x78zum5\",\n kpwlN0: \"x10a8y8t\",\n kjj79g: \"xl56j7k\",\n kVAEAm: \"x10l6tqk\",\n $$css: true\n },\n text: {\n kWkggS: \"x12vej0r x598nmq x14dcer4 xjbqb8w\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n textDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xnqsvhv xc87fxa xlizrex x15dekr4\",\n kGVxlE: \"xpk4wdd x1955hzl x1gnnqk1\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tonalDisabled: {\n kWkggS: \"xepofeg\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n xl: {\n kZKoxP: \"xjp8j0k\",\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kg3NbH: \"x1sdxjpb\",\n $$css: true\n },\n xs: {\n kZKoxP: \"x10w6t97\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"xn866dk\",\n kMv6JI: \"x1vsmgmf\",\n kGuDYH: \"xh9c4x\",\n k63SB2: \"x1y15vu6\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xoqu3bc\",\n kLWn49: \"x10x9d6x\",\n kg3NbH: \"x1dao9b2\",\n $$css: true\n }\n};\n\n// The outlined button's border thickens with the size, as the page's size\n// tokens have it: 1dp up to M, 2dp at L, 3dp at XL. A style per size rather\n// than a value in the size style, since a border on a filled button would\n// draw in the label colour.\nconst outlineWidths = {\n lg: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n $$css: true\n }\n};\nconst disabledStyles = {\n elevated: styles.elevatedDisabled,\n filled: styles.filledDisabled,\n outlined: styles.outlinedDisabled,\n text: styles.textDisabled,\n tonal: styles.tonalDisabled\n};\ntype ButtonDOMProps = Omit<RACButtonProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype ButtonProps = {\n children?: ReactNode;\n /** A function may compute the class from the button's render state. */\n className?: ClassNameOrFunction<ButtonState>;\n /**\n * Disables the press ripple. The hover/pressed background state layer is\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * Where the button leads. Given one, the button is rendered as a link —\n * an `<a>`, announced as the link it is — with the same styles and ripple.\n * `render`, `type`, and the form and pending props apply to the button\n * form only.\n */\n href?: string;\n /**\n * The name of the ring shown while the button is pending, for a screen\n * reader. The label it replaces is hidden while it shows.\n * @default 'Loading'\n */\n pendingLabel?: string;\n /** The link's `rel`, when `href` is set. */\n rel?: string;\n /**\n * Control height: `xs` 32px, `md` 40px, `lg` 56px, `xl` 96px, `xxl` 136px —\n * the buttons spec page's XS, S, M, L and XL, each with its own inline\n * padding and type role. `md` is the page's default.\n * @default 'md'\n */\n size?: ButtonSize;\n /** A function may compute the style from the button's render state. */\n style?: StyleOrFunction<ButtonState>;\n /** The link's `target`, when `href` is set. */\n target?: string;\n /**\n * How much weight the button pulls. `filled` and `tonal` carry a container\n * of their own; `outlined` and `text` sit on the page; `elevated` sits on\n * a low surface and lifts off it with a shadow, for a button that has to\n * separate from a busy background rather than from the page.\n * @default 'filled'\n */\n variant?: ButtonVariant;\n} & ButtonDOMProps;\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\n\n// The render state both of React Aria's elements share. A className or\n// style function written against it serves the button and the link alike;\n// `isPending` belongs to the button alone, and `isCurrent` to the link, so\n// neither is here: a `className` written against this state serves both\n// elements. What the button draws while pending is decided in\n// `buttonContent`, which sees React Aria's own state rather than this one.\ntype ButtonState = Pick<ButtonRenderProps, 'isDisabled' | 'isFocused' | 'isFocusVisible' | 'isHovered' | 'isPressed'>;\ntype ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal';\n\n// React Aria types the global DOM events — pointer, mouse, touch, wheel and\n// the rest — against the element each component renders, and a handler\n// written for a <button> does not type-check against an <a>. The keys are\n// retyped against HTMLElement here so one set of props serves both forms;\n// the events React Aria defines itself (press, focus, keyboard) keep its\n// types, since it hands those its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACButtonProps, 'onBlur' | 'onClick' | 'onFocus'>;\n\n/**\n * The design's button, at five emphasis levels and five control heights.\n * Given `href` it is a link with the same appearance. Every `aria-*` prop is\n * forwarded to the element; React Aria alone would keep only the labelling\n * ones.\n */\nfunction Button({\n children,\n disableRipple = false,\n href,\n isDisabled = false,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n pendingLabel = 'Loading',\n rel,\n render,\n size = 'md',\n target,\n variant = 'filled',\n ...props\n}: ButtonProps) {\n // `props` (className/style, etc.) is spread separately: `className` and\n // `style` there may be functions of render state, which ripple's own\n // handler-only merge doesn't need to know about. It is also why the styles\n // below merge through mergeStatefulStyles rather than the plain\n // mergeStyles. The ripple is off while disabled: React Aria still forwards\n // pointer events to a disabled element, and a press that changes nothing\n // should not look like one.\n const ripple = useRipple<FocusableElement>(!disableRipple && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n const styleProps = mergeStatefulStyles((state: ButtonState) => stylex.props(styles.base, styles[variant], styles[size], variant === 'outlined' && outlineWidths[size], state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]), props);\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n if (href !== undefined) {\n return <RACLink href={href} isDisabled={isDisabled} rel={rel} render={linkRenderer(element)} target={target} {...ripple.handlers} {...props} {...styleProps}>\n {children}\n {ripple.surface}\n </RACLink>;\n }\n return <RACButton isDisabled={isDisabled} render={buttonRenderer(element, render)} {...ripple.handlers} {...props} {...styleProps}>\n {buttonContent(children, pendingLabel, ripple)}\n </RACButton>;\n}\n// What the button draws: its label, hidden while the button is pending, with\n// the ring over it. The ring takes the button's own content colour rather\n// than the progress page's primary, which on a filled button is the fill\n// itself and so invisible. The label stays in the flow so the button keeps its\n// width, which is what stops a form jumping the moment it is submitted.\n// React Aria wants the progress bar in the accessibility tree as soon as the\n// button goes pending, so it is rendered from the render state rather than\n// after a delay.\n//\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler\n// memoises the result on its inputs.\nfunction buttonContent(children: ReactNode, pendingLabel: string, ripple: Ripple) {\n return (state: ButtonRenderProps) => <>\n <span {...{\n 0: {\n className: \"xjp7ctv\"\n },\n 1: {\n className: \"xjp7ctv xlshs6z\"\n }\n }[!!state.isPending << 0]}>\n {children}\n </span>\n {state.isPending ? <span className=\"x6s0dn4 x78zum5 x10a8y8t xl56j7k x10l6tqk\">\n <ProgressIndicator aria-label={pendingLabel} isIndeterminate size=\"1em\" tone=\"inherit\" variant=\"circular\" />\n </span> : null}\n {ripple.surface}\n </>;\n}\nexport type { ButtonDOMProps, ButtonProps, ButtonSize, ButtonState, ButtonVariant };\nexport default Button;"],"mappings":";;;;;;;;AA+CA,MAAM,SAAS;CACb,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,kBAAkB;EAChB,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OA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cAAY;IAAc,iBAAA;IAAgB,MAAK;IAAM,MAAK;IAAU,SAAQ;GAAU,CAAA;EACrG,CAAA,IAAI;EACX,OAAO;CACV,EAAA,CAAA;AACJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
|
+
import { CheckGlyph, IndeterminateGlyph } from "../../glyphs/index.js";
|
|
3
4
|
import { useRipple } from "../../hooks/useRipple.js";
|
|
4
5
|
import { invalidFrom, useFieldValidationBehavior } from "../../field/root.js";
|
|
5
6
|
import { FieldMessage } from "../../field/index.js";
|
|
6
|
-
import { CheckGlyph, IndeterminateGlyph } from "../../glyphs/index.js";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { c } from "react/compiler-runtime";
|
|
9
9
|
import { CheckboxButton, CheckboxField } from "react-aria-components";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
1
2
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
|
+
import { chipStyles } from "../../chip/styles.js";
|
|
2
4
|
import { jsx } from "react/jsx-runtime";
|
|
3
5
|
import { c } from "react/compiler-runtime";
|
|
4
6
|
import { ToggleButton } from "react-aria-components";
|
|
@@ -48,10 +50,7 @@ function Chip(t0) {
|
|
|
48
50
|
return t3;
|
|
49
51
|
}
|
|
50
52
|
function propsFor(state) {
|
|
51
|
-
return
|
|
52
|
-
0: { className: "x6s0dn4 x10w6t97 x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x1s07b3s x1ypdohk x3nfvp2 x2lah0s xkknnkr x14zspaw x1v9cpvo x126z3so x155f00i x1lz68p4 xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn xt970qd x790zyz x1qno0dh x1eaenvl xpc4ca7 x1a42vn9 x6gcojk xjbqb8w xd8uu4e x133yhug xhfb3ry x1w5n3ug" },
|
|
53
|
-
1: { className: "x6s0dn4 x10w6t97 x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x1s07b3s x1ypdohk x3nfvp2 x2lah0s xkknnkr x14zspaw x1v9cpvo x126z3so x155f00i x1lz68p4 xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn xt970qd x790zyz x1qno0dh x1eaenvl xpc4ca7 xctpbsp x1n0xrd1 x1qndd53 x15dekr4 x9r1u3d xhfb3ry x1sawysd" }
|
|
54
|
-
}[!!state.isSelected << 0];
|
|
53
|
+
return props(chipStyles.base, state.isSelected ? chipStyles.selected : chipStyles.unselected, state.isDisabled && chipStyles.disabled, state.isDisabled && (state.isSelected ? chipStyles.disabledSelected : chipStyles.disabledUnselected));
|
|
55
54
|
}
|
|
56
55
|
//#endregion
|
|
57
56
|
export { Chip as default };
|