@kanso-labs/kanso-ui 0.11.21 → 0.12.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/README.md +32 -8
- package/dist/components/app-bar/index.d.ts +2 -2
- package/dist/components/app-bar/index.js +1 -1
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +4 -4
- package/dist/components/avatar/index.js +21 -15
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +2 -2
- package/dist/components/badge/index.js +1 -1
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/button/index.d.ts +32 -21
- package/dist/components/button/index.js +75 -19
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/card/index.d.ts +2 -2
- package/dist/components/card/index.js +1 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +5 -5
- package/dist/components/chip/index.js +5 -5
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/code/index.d.ts +2 -2
- package/dist/components/code/index.js +1 -1
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/container/index.d.ts +2 -2
- package/dist/components/container/index.js +1 -1
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -1
- package/dist/components/currency/index.d.ts +2 -2
- package/dist/components/currency/index.js +1 -1
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/feed/index.d.ts +2 -2
- package/dist/components/feed/index.js +1 -1
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +24 -18
- package/dist/components/icon-button/index.js +62 -15
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/keycap/index.d.ts +2 -2
- package/dist/components/keycap/index.js +1 -1
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/link/index.d.ts +2 -2
- package/dist/components/link/index.js +1 -1
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +2 -2
- package/dist/components/list-detail/index.js +1 -1
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +105 -0
- package/dist/components/popover/index.js +246 -0
- package/dist/components/popover/index.js.map +1 -0
- package/dist/components/product-icon/index.d.ts +3 -3
- package/dist/components/product-icon/index.js +23 -17
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +14 -4
- package/dist/components/separator/index.js +23 -9
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +26 -28
- package/dist/components/sheet/index.js +47 -82
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +2 -2
- package/dist/components/stack/index.js +1 -1
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.d.ts +2 -2
- package/dist/components/supporting-pane/index.js +1 -1
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +15 -8
- package/dist/components/tabs/index.js +133 -45
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text/index.d.ts +2 -2
- package/dist/components/text/index.js +1 -1
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +12 -5
- package/dist/components/text-field/index.js +48 -33
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js +53 -0
- package/dist/hooks/useImageLoadingStatus.js.map +1 -0
- package/dist/hooks/useRipple.js +1 -1
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/render/aria.js +66 -0
- package/dist/render/aria.js.map +1 -0
- package/dist/render/useRender.d.ts +28 -0
- package/dist/render/useRender.js +132 -0
- package/dist/render/useRender.js.map +1 -0
- package/dist/styles/merge.js +14 -8
- package/dist/styles/merge.js.map +1 -1
- package/dist/styles.css +88 -36
- package/package.json +4 -4
- package/dist/render/nativeButton.js +0 -26
- package/dist/render/nativeButton.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/card/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The three variants differ only in how they separate themselves from the\n// page: a shadow, a darker fill, or a border. Each therefore sits on a\n// different background, which is why the interaction styles below are keyed\n// by variant too — a state layer composites an 'on-color' over whatever the\n// container already is, so it cannot be written once for all three.\n//\n// color-mix() is inlined at each property rather than factored into a helper:\n// @stylexjs/babel-plugin only statically recognizes expressions written\n// directly as property values. Button's header comment records the same\n// constraint, and the :not(:disabled) guard there applies here for the same\n// reason — stylex's fixed pseudo-class ordering puts :hover after :disabled.\nconst styles = {\n base: {\n kaIpWk: \"xhpdng0\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n k1xSpc: \"x1lliihq\",\n kVQacm: \"xb3r6kr\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n filled: {\n kWkggS: \"x1rrhr5q\",\n $$css: true\n },\n interactive: {\n kkrTdU: \"x1ypdohk\",\n kVVagm: \"xln7xf2\",\n kzqmXN: \"xh8yej3\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x14s9m32\",\n kVAM5u: \"x133yhug\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n paddingDefault: {\n kmVPX3: \"xgc26li\",\n $$css: true\n },\n paddingNone: {\n kmVPX3: \"x1717udv\",\n $$css: true\n }\n};\nconst interactionStyles = {\n elevated: {\n kWkggS: \"xu5m21g x5r8g2b x1vnz5z6\",\n kGVxlE: \"x1g60mc1 x1fzngjt x19efjv6\",\n $$css: true\n },\n filled: {\n kWkggS: \"x1w49kxs xovjh5a x1rrhr5q\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x1jqfdmz x1dmgsxd x14s9m32\",\n $$css: true\n }\n};\n\n// Typed as the attributes a <div> accepts, because that is the surface every\n// element this can render shares. Anything element-specific — a button's\n// `type`, an anchor's `href` — would be wrong for the others, and does not\n// need to be here anyway: those are written on the element handed to\n// `render`, where TypeScript checks them against that element's own props.\ntype CardProps = {\n /**\n * Makes the card the thing you press: it ripples, lifts on hover, and takes\n * a focus ring. Renders a `<button>` unless `render` says otherwise. Leave\n * it off for a card that merely holds content, including one containing its\n * own buttons.\n * @default false\n */\n interactive?: boolean;\n /**\n * `none` removes the card's own padding, for a card whose children run to\n * its edges — a list of rows separated by rules.\n * @default 'default'\n */\n padding?: 'default' | 'none';\n /**\n * How the card separates itself from the page: `elevated` casts a shadow,\n * `filled` sits on a darker surface, `outlined` draws a border.\n * @default 'elevated'\n */\n variant?: CardVariant;\n} & RenderComponentProps<'div'>;\ntype CardVariant = 'elevated' | 'filled' | 'outlined';\n\n/**\n * A surface holding related content. `render` decides which element that\n * surface is, so a card that navigates can be a real `<a href>` — announced\n * as a link and opening in a new tab on a modifier click, which a `<button>`\n * with an onClick does neither of.\n *\n * `interactive` and `render` are separate axes. `interactive` says the card\n * is pressable and gives it the ripple, the hover lift, and a focus ring;\n * `render` says what it is. A pressable card with no `render` is a\n * `<button>`, which is the right default for one that acts rather than\n * navigates.\n */\nfunction Card({\n children,\n interactive = false,\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n padding = 'default',\n render,\n variant = 'elevated',\n ...props\n}: CardProps) {\n // The consumer's own pointer handlers are handed to useRipple to merge\n // rather than spread over its handlers afterwards, which is what Button\n // does and for the same reason: a plain spread means whichever object\n // comes last silently wins, so an onPointerDown on the call site would\n // replace the one driving the ripple and the card would stop rippling.\n const ripple = useRipple(interactive, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n const padded = padding === 'none' ? styles.paddingNone : styles.paddingDefault;\n return useRender({\n defaultTagName: interactive ? 'button' : 'div',\n props: {\n ...props,\n // Only when the default <button> is what renders. On an element the\n // call site chose, `type` is either meaningless or wrong — an <a>'s\n // `type` is a hint about the MIME type of what it links to — and that\n // element's own attributes are the call site's to write.\n ...(interactive && render === undefined ? {\n type: 'button'\n } : undefined),\n ...ripple.handlers,\n children: <>\n {children}\n {ripple.surface}\n </>,\n ...mergeStyles(stylex.props(styles.base, styles[variant], padded, interactive && styles.interactive, interactive && interactionStyles[variant]), props)\n },\n render\n });\n}\nexport type { CardProps };\nexport default Card;"],"mappings":";;;;;;AAmBA,MAAM,SAAS;CACb,MAAM;EACJ,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,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,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,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAM,oBAAoB;CACxB,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,OAAO;CACT;AACF;;;;;;;;;;;;;AA2CA,SAAS,KAAK,EACZ,UACA,cAAc,OACd,SACA,eACA,iBACA,eACA,gBACA,aACA,UAAU,WACV,QACA,UAAU,YACV,GAAG,WACS;CAMZ,MAAM,SAAS,UAAU,aAAa;EACpC;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,SAAS,YAAY,SAAS,OAAO,cAAc,OAAO;CAChE,OAAO,UAAU;EACf,gBAAgB,cAAc,WAAW;EACzC,OAAO;GACL,GAAG;GAKH,GAAI,eAAe,WAAW,KAAA,IAAY,EACxC,MAAM,SACR,IAAI,KAAA;GACJ,GAAG,OAAO;GACV,UAAU,qBAAA,UAAA,EAAA,UAAA,CACL,UACA,OAAO,OACV,EAAA,CAAA;GACF,GAAG,YAAY,MAAa,OAAO,MAAM,OAAO,UAAU,QAAQ,eAAe,OAAO,aAAa,eAAe,kBAAkB,QAAQ,GAAG,OAAK;EACxJ;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ToggleButtonProps } from "react-aria-components";
|
|
2
2
|
//#region src/components/chip/index.d.ts
|
|
3
|
-
type ChipProps
|
|
3
|
+
type ChipProps = ToggleButtonProps;
|
|
4
4
|
/**
|
|
5
|
-
* A chip is a two-state button, so its selected state is
|
|
6
|
-
* pass
|
|
5
|
+
* A chip is a two-state button, so its selected state is React Aria's
|
|
6
|
+
* `isSelected`: pass it with `onChange` to control it, or `defaultSelected` to
|
|
7
7
|
* let it keep its own state. Selection is announced through `aria-pressed`
|
|
8
8
|
* rather than a role of its own.
|
|
9
9
|
*/
|
|
10
|
-
declare function Chip
|
|
10
|
+
declare function Chip({ children, ...props }: ChipProps): import("react").JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { type ChipProps, Chip as default };
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { ToggleButton } from "react-aria-components";
|
|
5
5
|
//#region src/components/chip/index.tsx
|
|
6
6
|
/**
|
|
7
|
-
* A chip is a two-state button, so its selected state is
|
|
8
|
-
* pass
|
|
7
|
+
* A chip is a two-state button, so its selected state is React Aria's
|
|
8
|
+
* `isSelected`: pass it with `onChange` to control it, or `defaultSelected` to
|
|
9
9
|
* let it keep its own state. Selection is announced through `aria-pressed`
|
|
10
10
|
* rather than a role of its own.
|
|
11
11
|
*/
|
|
@@ -18,7 +18,7 @@ function Chip(t0) {
|
|
|
18
18
|
if ($[0] !== t0) {
|
|
19
19
|
const { children: t3, ...props } = t0;
|
|
20
20
|
children = t3;
|
|
21
|
-
T0 =
|
|
21
|
+
T0 = ToggleButton;
|
|
22
22
|
t1 = props;
|
|
23
23
|
t2 = mergeStatefulStyles(propsFor, props);
|
|
24
24
|
$[0] = t0;
|
|
@@ -51,7 +51,7 @@ function propsFor(state) {
|
|
|
51
51
|
return {
|
|
52
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 x18fpw6u x1qno0dh x1eaenvl xpc4ca7 x1a42vn9 x6gcojk xjbqb8w xd8uu4e x1fwvt7v xhfb3ry x1w5n3ug" },
|
|
53
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 x18fpw6u x1qno0dh x1eaenvl xpc4ca7 xctpbsp x1n0xrd1 x1qndd53 x15dekr4 x9r1u3d xhfb3ry x1sawysd" }
|
|
54
|
-
}[!!state.
|
|
54
|
+
}[!!state.isSelected << 0];
|
|
55
55
|
}
|
|
56
56
|
//#endregion
|
|
57
57
|
export { Chip as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["props","children"],"sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":["props","children"],"sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["import type { ToggleButtonProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ToggleButton } from 'react-aria-components';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// Each state composites an 'on-color' over its own container at the\n// interaction state's opacity rather than swapping in a separate hover color.\n// calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes, and it is inlined at each property because\n// @stylexjs/babel-plugin only statically recognizes expressions written\n// 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\ntype ChipProps = ToggleButtonProps;\n\n/**\n * A chip is a two-state button, so its selected state is React Aria's\n * `isSelected`: pass it with `onChange` to control it, or `defaultSelected` to\n * let it keep its own state. Selection is announced through `aria-pressed`\n * rather than a role of its own.\n */\nfunction Chip({\n children,\n ...props\n}: ChipProps) {\n return <ToggleButton {...props} {...mergeStatefulStyles(propsFor, props)}>\n {children}\n </ToggleButton>;\n}\n\n// StyleX has no way to target [data-selected] on the element it is styling,\n// so the selected styles cannot be chosen in CSS. React Aria's answer is to\n// let className and style be functions of the component's own render state,\n// which is what this is — and it is why an uncontrolled chip styles itself\n// correctly without this component keeping a copy of the state.\n//\n// mergeStatefulStyles takes the function rather than a computed result for\n// exactly that reason, and combines it with whatever the call site passed.\nfunction propsFor(state: ToggleButtonRenderProps) {\n return {\n 0: {\n className: \"x6s0dn4 x10w6t97 x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x1s07b3s x1ypdohk x3nfvp2 x2lah0s xkknnkr x14zspaw x1v9cpvo x126z3so x155f00i x1lz68p4 xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn xt970qd x18fpw6u x1qno0dh x1eaenvl xpc4ca7 x1a42vn9 x6gcojk xjbqb8w xd8uu4e x1fwvt7v xhfb3ry x1w5n3ug\"\n },\n 1: {\n className: \"x6s0dn4 x10w6t97 x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x1s07b3s x1ypdohk x3nfvp2 x2lah0s xkknnkr x14zspaw x1v9cpvo x126z3so x155f00i x1lz68p4 xrgy624 x1hl8ikr x9v5kkp x1t137rt x1de99jn xt970qd x18fpw6u x1qno0dh x1eaenvl xpc4ca7 xctpbsp x1n0xrd1 x1qndd53 x15dekr4 x9r1u3d xhfb3ry x1sawysd\"\n }\n }[!!state.isSelected << 0];\n}\nexport type { ChipProps };\nexport default Chip;"],"mappings":";;;;;;;;;;;AA0BA,SAAA,KAAA,IAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAc,MAAA,EAAA,UAAA,IAAA,GAAA,UAAA;EAAA,WAAA;EAIJ,KAAA;EAAiBA,KAAA;EAAW,KAAA,oBAAoB,UAAU,KAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,KAAA,EAAA;EAAA,WAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,EAAA,OAAA,YAAA,EAAA,OAAA,MAAA,EAAA,OAAA,IAAA;EAAjE,KAAA,oBAAC,IAAD;GAAa,GAAKA;GAAK,GAAM;GAC/B;EADe,CAAA;EAEH,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAFV;AAEU;AAWnB,SAAS,SAAS,OAAgC;CAChD,OAAO;EACL,GAAG,EACD,WAAW,4RACb;EACA,GAAG,EACD,WAAW,6RACb;CACF,EAAE,CAAC,CAAC,MAAM,cAAc;AAC1B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/code/index.d.ts
|
|
3
|
-
type CodeProps =
|
|
3
|
+
type CodeProps = RenderComponentProps<'code'>;
|
|
4
4
|
/**
|
|
5
5
|
* A fragment of code, a path, or an identifier set in the mono face. It
|
|
6
6
|
* renders a `<code>` and takes its scale from the text around it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRender","props"],"sources":["../../../src/components/code/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRender","props"],"sources":["../../../src/components/code/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// Sized in em rather than px, so a fragment of code takes the scale of\n// whatever it interrupts. A mono face at the same nominal size as the prose\n// around it reads a little larger — its glyphs are wider and its x-height\n// taller — so 0.875em is what makes the two look level rather than what makes\n// them measure the same.\n//\n// No background. The mono face against the serif and sans faces the rest of\n// the system uses is already an unmistakable signal, and a tint here would\n// introduce a second surface inside Card and Sheet, competing with the\n// hierarchy those already establish. A call site wanting one can wrap this.\n\ntype CodeProps = RenderComponentProps<'code'>;\n\n/**\n * A fragment of code, a path, or an identifier set in the mono face. It\n * renders a `<code>` and takes its scale from the text around it.\n */\nfunction Code({\n render,\n ...props\n}: CodeProps) {\n return useRender({\n defaultTagName: 'code',\n props: {\n ...props,\n ...mergeStyles({\n className: \"x9f619 x139gbkf xbppi91 x1s8wshw xj0a0fe\"\n }, props)\n },\n render\n });\n}\nexport type { CodeProps };\nexport default Code;"],"mappings":";;;;;;;;AAwBA,SAAA,KAAA,IAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAc,MAAA,EAAA,QAAA,IAAA,GAAA,UAAA;EAAA,SAAA;EAILA,KAAA;EACW,KAAA;EAEXC,KAAA;EACA,KAAA,YAAY,EAAA,WACF,2CACb,GAAG,KAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,SAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,EAAA,OAAA,IAAA;EAJJ,KAAA;GAAA,GACFA;GAAK,GACL;EAGL;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,UAAA,EAAA,QAAA,MAAA,EAAA,QAAA,IAAA;EAPc,KAAA;GAAA,gBACC;GAAM,OACf;GAKN;EAEH;EAAC,EAAA,KAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OATMD,GAAU,EAShB;AAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/container/index.d.ts
|
|
3
|
-
type ContainerProps =
|
|
3
|
+
type ContainerProps = RenderComponentProps<'div'> & {
|
|
4
4
|
/**
|
|
5
5
|
* How wide the content may run before it stops growing. The container is
|
|
6
6
|
* centred in whatever space is left over.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
2
3
|
import { mergeStyles } from "../../styles/merge.js";
|
|
3
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/container/index.tsx
|
|
5
5
|
const DEFAULT_MAX_INLINE_SIZE = "960px";
|
|
6
6
|
const _temp = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/container/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/container/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// The width fourteen of this library's own story files already centre their\n// page on, which is what makes it the default rather than a number picked\n// here. A measure is a property of the content: 960px suits a page of mixed\n// components, and prose wants something nearer 58ch, which is what the story\n// files that hold prose use. Say which one you mean rather than taking this.\nconst DEFAULT_MAX_INLINE_SIZE = '960px';\n\n// A dynamic style rather than a static one, for the same reason Feed's is:\n// the measure comes from the call site and StyleX compiles its classes ahead\n// of time, so the value is written to a custom property inline instead.\nconst _temp = {\n kB7OPa: \"x9f619\",\n kzqmXN: \"xh8yej3\",\n kUOVxO: \"xvueqy4\",\n ks0D6T: \"x13i5qev\",\n \"$$css\": true\n};\nconst styles = {\n paddingDefault: {\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n paddingNone: {\n kg3NbH: \"xnjsko4\",\n $$css: true\n },\n root: (maxInlineSize: string) => [_temp, {\n \"--x-maxInlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(maxInlineSize)\n }]\n};\ntype ContainerProps = RenderComponentProps<'div'> & {\n /**\n * How wide the content may run before it stops growing. The container is\n * centred in whatever space is left over.\n *\n * Worth setting. The default suits a page of mixed components; prose wants\n * a measure in `ch`, since what makes a line hard to read is how many\n * characters it holds rather than how many pixels.\n * @default '960px'\n */\n maxInlineSize?: string;\n /**\n * Inline padding, which is what keeps the content off the edge of the\n * window once it is narrower than the measure. `none` is for a container\n * nested inside one that already has it.\n * @default 'default'\n */\n padding?: 'default' | 'none';\n};\n\n/**\n * A centred measure for a page or a section of one: content grows to a width\n * and stops, with the leftover space split evenly either side.\n *\n * Layout only — it paints no surface and gives its children no container of\n * their own, which is what separates it from Card. It sets no gaps either, so\n * reach for Stack inside it for the rhythm between sections.\n *\n * `render` swaps the element, for a container that should be a `<main>` or a\n * `<section>` rather than a `<div>`.\n */\nfunction Container({\n maxInlineSize = DEFAULT_MAX_INLINE_SIZE,\n padding = 'default',\n render,\n ...props\n}: ContainerProps) {\n const padded = padding === 'none' ? styles.paddingNone : styles.paddingDefault;\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n ...mergeStyles(stylex.props(styles.root(maxInlineSize), padded), props)\n },\n render\n });\n}\nexport type { ContainerProps };\nexport default Container;"],"mappings":";;;;AAYA,MAAM,0BAA0B;AAKhC,MAAM,QAAQ;CACZ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;AACX;AACA,MAAM,SAAS;CACb,gBAAgB;EACd,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,OAAO;CACT;CACA,OAAO,kBAA0B,CAAC,OAAO,EACvC,uBAAsB,QAAO,OAAO,QAAQ,WAAW,MAAM,OAAO,OAAO,OAAO,MAAM,KAAA,EAAA,CAAW,aAAa,EAClH,CAAC;AACH;;;;;;;;;;;;AAgCA,SAAS,UAAU,EACjB,gBAAgB,yBAChB,UAAU,WACV,QACA,GAAG,WACc;CACjB,MAAM,SAAS,YAAY,SAAS,OAAO,cAAc,OAAO;CAChE,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,GAAG;GACH,GAAG,YAAY,MAAa,OAAO,KAAK,aAAa,GAAG,MAAM,GAAG,OAAK;EACxE;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mergeStyles } from "../../styles/merge.js";
|
|
2
2
|
import Button from "../button/index.js";
|
|
3
3
|
import Code from "../code/index.js";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/copy-field/index.tsx
|
|
7
7
|
const COPIED_RESET_MS = 2e3;
|
|
8
8
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/currency/index.d.ts
|
|
3
|
-
type CurrencyProps = Omit<
|
|
3
|
+
type CurrencyProps = Omit<RenderComponentProps<'span'>, 'children'> & {
|
|
4
4
|
/**
|
|
5
5
|
* ISO 4217 code for the currency to format in.
|
|
6
6
|
* @default 'USD'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
2
3
|
import { mergeStyles } from "../../styles/merge.js";
|
|
3
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/currency/index.tsx
|
|
5
5
|
const styles = { base: {
|
|
6
6
|
kB7OPa: "x9f619",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/currency/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/currency/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// Deliberately sets no font-size. The same value turns up at several sizes —\n// inside a list row, as a heading-scale figure, as a total — differing in\n// nothing else, so the size is the container's decision. What must never vary\n// is here: the mono face, tabular figures so a column of them lines up on the\n// decimal point, and the medium weight that separates a figure from the prose\n// around it.\nconst styles = {\n base: {\n kB7OPa: \"x9f619\",\n kMv6JI: \"xbppi91\",\n kcqcaj: \"xss6m8b\",\n k63SB2: \"x1bf3uqz\",\n $$css: true\n }\n};\nconst tones = {\n negative: {\n kMwMTN: \"x12gp0t\",\n $$css: true\n },\n neutral: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n positive: {\n kMwMTN: \"x4no3js\",\n $$css: true\n }\n};\n\n// U+2212 MINUS SIGN, not the U+002D hyphen Intl actually emits. The hyphen is\n// a typographic stand-in: it is narrower than the plus it pairs with and does\n// not sit on the same optical centre as the digits, which shows up as a\n// wobbling column the moment amounts are stacked.\nconst MINUS_SIGN = '−';\ntype CurrencyProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * ISO 4217 code for the currency to format in.\n * @default 'USD'\n */\n currency?: string;\n /**\n * BCP 47 locale to format for. Defaults to the runtime's own locale, so an\n * app that has not chosen one still formats the way its reader expects.\n */\n locale?: string;\n /**\n * When to show the sign. `auto` shows one only on negatives, `always` also\n * prefixes positives with a plus, and `never` shows neither — which leaves\n * colour as the only thing separating a credit from a debt, so reach for it\n * only where the direction is already stated some other way.\n * @default 'auto'\n */\n sign?: SignDisplay;\n /**\n * Which colour role to render in. `auto` follows the sign of `value`, with\n * zero reading as neutral.\n * @default 'auto'\n */\n tone?: Tone;\n /** The amount, in the currency's major units. */\n value: number;\n};\ntype SignDisplay = 'always' | 'auto' | 'never';\ntype Tone = 'auto' | 'negative' | 'neutral' | 'positive';\nfunction Currency({\n currency = 'USD',\n locale,\n render,\n sign = 'auto',\n tone = 'auto',\n value,\n ...props\n}: CurrencyProps) {\n return useRender({\n defaultTagName: 'span',\n props: {\n ...props,\n children: formatCurrency(value, {\n currency,\n locale,\n sign\n }),\n ...mergeStyles(stylex.props(styles.base, tones[resolveTone(value, tone)]), props)\n },\n render\n });\n}\n\n// formatToParts rather than a replace over the formatted string, so only the\n// sign is substituted. A blind replace would also hit a hyphen inside a\n// locale's currency name or grouping, and locales that wrap negatives in\n// parentheses have no minus to swap at all — both of which this leaves alone.\nfunction formatCurrency(value: number, options: {\n currency: string;\n locale: string | undefined;\n sign: SignDisplay;\n}) {\n return new Intl.NumberFormat(options.locale, {\n currency: options.currency,\n signDisplay: options.sign,\n style: 'currency'\n }).formatToParts(value).map(part => part.type === 'minusSign' ? MINUS_SIGN : part.value).join('');\n}\n\n// Zero is neither owed nor owing, so it takes the neutral role rather than\n// being forced into one of the two. Negative zero lands here too, which is\n// what a rounded-away debt should read as.\nfunction resolveTone(value: number, tone: Tone) {\n if (tone !== 'auto') {\n return tone;\n }\n if (value > 0) {\n return 'positive';\n }\n if (value < 0) {\n return 'negative';\n }\n return 'neutral';\n}\nexport type { CurrencyProps };\nexport default Currency;"],"mappings":";;;;AAaA,MAAM,SAAS,EACb,MAAM;CACJ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,OAAO;AACT,EACF;AACA,MAAM,QAAQ;CACZ,UAAU;EACR,QAAQ;EACR,OAAO;CACT;CACA,SAAS;EACP,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,OAAO;CACT;AACF;AAMA,MAAM,aAAa;AA+BnB,SAAS,SAAS,EAChB,WAAW,OACX,QACA,QACA,OAAO,QACP,OAAO,QACP,OACA,GAAG,WACa;CAChB,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,GAAG;GACH,UAAU,eAAe,OAAO;IAC9B;IACA;IACA;GACF,CAAC;GACD,GAAG,YAAY,MAAa,OAAO,MAAM,MAAM,YAAY,OAAO,IAAI,EAAE,GAAG,OAAK;EAClF;EACA;CACF,CAAC;AACH;AAMA,SAAS,eAAe,OAAe,SAIpC;CACD,OAAO,IAAI,KAAK,aAAa,QAAQ,QAAQ;EAC3C,UAAU,QAAQ;EAClB,aAAa,QAAQ;EACrB,OAAO;CACT,CAAC,CAAC,CAAC,cAAc,KAAK,CAAC,CAAC,KAAI,SAAQ,KAAK,SAAS,cAAc,aAAa,KAAK,KAAK,CAAC,CAAC,KAAK,EAAE;AAClG;AAKA,SAAS,YAAY,OAAe,MAAY;CAC9C,IAAI,SAAS,QACX,OAAO;CAET,IAAI,QAAQ,GACV,OAAO;CAET,IAAI,QAAQ,GACV,OAAO;CAET,OAAO;AACT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/feed/index.d.ts
|
|
3
|
-
type FeedProps =
|
|
3
|
+
type FeedProps = RenderComponentProps<'div'> & {
|
|
4
4
|
/**
|
|
5
5
|
* How narrow a cell may get before the grid drops a column. Every column is
|
|
6
6
|
* at least this wide and the grid fits as many as the space allows, which is
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
|
+
import { useRender } from "../../render/useRender.js";
|
|
2
3
|
import { mergeStyles } from "../../styles/merge.js";
|
|
3
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/feed/index.tsx
|
|
5
5
|
const DEFAULT_MIN_ITEM_WIDTH = "180px";
|
|
6
6
|
const _temp = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/feed/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/feed/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// Material 3's example minimum for an adaptive grid cell, and the only number\n// the spec puts on one. It is a floor rather than a recommendation: how narrow\n// a card can get before its contents stop making sense is a property of the\n// contents, which is why M3 leaves it a parameter rather than fixing it. Most\n// feeds should say what theirs is instead of taking this.\nconst DEFAULT_MIN_ITEM_WIDTH = '180px';\n\n// The third of Material 3's canonical layouts, after list-detail and\n// supporting pane. Where those two divide a page into panes, this arranges one\n// pane into a grid of comparable things — the spec's own examples are news and\n// social feeds, and a catalogue of cards is the same shape.\n//\n// M3 describes the grid by its cell rather than by its columns: Compose spells\n// it `GridCells.Adaptive(minSize)`, meaning every column is at least that wide\n// and the grid fits as many as it can. `repeat(auto-fill, minmax(…, 1fr))` is\n// the same sentence in CSS.\n//\n// So there are no breakpoints here, and that is the point rather than an\n// omission. The layout answers to the room it is given instead of to the width\n// of the window, which is what lets a feed inside a pane reflow with the pane.\n// It also means none of the query emission-order care that ListDetail and\n// SupportingPane both have to document applies.\n//\n// A function style rather than a static one, because the cell minimum comes\n// from the call site and StyleX compiles its classes ahead of time. StyleX\n// resolves that by writing the value to a custom property inline, which is the\n// same mechanism the token gallery's `durationBar` uses.\nconst _temp = {\n kB7OPa: \"x9f619\",\n k1xSpc: \"xrvj5dj\",\n kOIVth: \"xj2l1yv\",\n kumcoG: \"xqketvx\",\n \"$$css\": true\n};\nconst styles = {\n root: (minItemWidth: string) => [_temp, {\n \"--x-gridTemplateColumns\": `repeat(auto-fill, minmax(${minItemWidth}, 1fr))` != null ? `repeat(auto-fill, minmax(${minItemWidth}, 1fr))` : undefined\n }]\n};\ntype FeedProps = RenderComponentProps<'div'> & {\n /**\n * How narrow a cell may get before the grid drops a column. Every column is\n * at least this wide and the grid fits as many as the space allows, which is\n * how M3 describes an adaptive grid — by its cell rather than by a column\n * count per breakpoint.\n *\n * Worth setting. The default is the figure M3's own example uses, and it is\n * a floor rather than advice: only the contents know how narrow they can go.\n * @default '180px'\n */\n minItemWidth?: string;\n};\n\n/**\n * Material 3's feed layout: a grid of comparable items that fits as many\n * columns as the space allows, down to a single column when it allows only\n * one.\n *\n * Layout only — it paints no surface, and it gives its children no container\n * of their own, so each child is a grid cell exactly as it was written. That\n * is the difference from ListDetail and SupportingPane, which do wrap: those\n * two divide a page into named regions, where this one lays out however many\n * things it is handed.\n *\n * It reads the space it is in rather than the width of the window, so a feed\n * inside a pane reflows with the pane rather than with the browser.\n */\nfunction Feed({\n minItemWidth = DEFAULT_MIN_ITEM_WIDTH,\n render,\n ...props\n}: FeedProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n // The dynamic style carries the cell minimum as a custom property in\n // `style` rather than as a class, which is why the merge has to reach\n // `style` as well as `className` — see src/styles/merge.ts.\n ...mergeStyles(stylex.props(styles.root(minItemWidth)), props)\n },\n render\n });\n}\nexport type { FeedProps };\nexport default Feed;"],"mappings":";;;;AAYA,MAAM,yBAAyB;AAsB/B,MAAM,QAAQ;CACZ,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,SAAS;AACX;AACA,MAAM,SAAS,EACb,OAAO,iBAAyB,CAAC,OAAO,EACtC,2BAA2B,4BAA4B,aAAY,YAAa,OAAO,4BAA4B,aAAY,WAAY,KAAA,EAC7I,CAAC,EACH;;;;;;;;;;;;;;;AA6BA,SAAS,KAAK,EACZ,eAAe,wBACf,QACA,GAAG,WACS;CACZ,OAAO,UAAU;EACf,gBAAgB;EAChB,OAAO;GACL,GAAG;GAIH,GAAG,YAAY,MAAa,OAAO,KAAK,YAAY,CAAC,GAAG,OAAK;EAC/D;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ButtonDOMProps, ButtonState } from "../button/index.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { ClassNameOrFunction, StyleOrFunction } from "react-aria-components";
|
|
2
4
|
//#region src/components/icon-button/index.d.ts
|
|
3
5
|
type IconButtonProps = {
|
|
4
6
|
/**
|
|
@@ -7,6 +9,9 @@ type IconButtonProps = {
|
|
|
7
9
|
* nothing at all.
|
|
8
10
|
*/
|
|
9
11
|
'aria-label': string;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/** A function may compute the class from the button's render state. */
|
|
14
|
+
className?: ClassNameOrFunction<ButtonState>;
|
|
10
15
|
/**
|
|
11
16
|
* Disables the press ripple. The hover and pressed state layers are
|
|
12
17
|
* unaffected.
|
|
@@ -14,36 +19,37 @@ type IconButtonProps = {
|
|
|
14
19
|
*/
|
|
15
20
|
disableRipple?: boolean;
|
|
16
21
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* Read off `render` when that is a plain element, so
|
|
22
|
-
* `render={<a href="…" />}` needs nothing here. Worth setting only when
|
|
23
|
-
* `render` is a component or a function, where the tag it will produce
|
|
24
|
-
* cannot be read ahead of time.
|
|
25
|
-
*
|
|
26
|
-
* An anchor rendered this way is announced as a button rather than as a
|
|
27
|
-
* link, since that is what Base UI's non-native mode applies. For a control
|
|
28
|
-
* that should be announced as the link it is, reach for `Link`, or `Card`
|
|
29
|
-
* with `render`, neither of which imposes button semantics.
|
|
30
|
-
* @default true
|
|
22
|
+
* Where the button leads. Given one, the button is rendered as a link —
|
|
23
|
+
* an `<a>`, announced as the link it is — with the same styles and ripple.
|
|
24
|
+
* `render`, `type`, and the form and pending props apply to the button
|
|
25
|
+
* form only.
|
|
31
26
|
*/
|
|
32
|
-
|
|
27
|
+
href?: string;
|
|
28
|
+
/** The link's `rel`, when `href` is set. */
|
|
29
|
+
rel?: string;
|
|
33
30
|
/**
|
|
34
31
|
* Control size: `xs` 32px, `md` 40px, `lg` 56px — the same heights `Button`
|
|
35
32
|
* uses, so the two line up beside each other in a row.
|
|
36
33
|
* @default 'md'
|
|
37
34
|
*/
|
|
38
35
|
size?: 'lg' | 'md' | 'xs';
|
|
36
|
+
/** A function may compute the style from the button's render state. */
|
|
37
|
+
style?: StyleOrFunction<ButtonState>;
|
|
38
|
+
/** The link's `target`, when `href` is set. */
|
|
39
|
+
target?: string;
|
|
39
40
|
/**
|
|
40
41
|
* `standard` is transparent and tints what it sits on; `filled` and `tonal`
|
|
41
42
|
* carry a container of their own.
|
|
42
43
|
* @default 'standard'
|
|
43
44
|
*/
|
|
44
45
|
variant?: 'filled' | 'standard' | 'tonal';
|
|
45
|
-
} &
|
|
46
|
-
|
|
46
|
+
} & ButtonDOMProps;
|
|
47
|
+
/**
|
|
48
|
+
* A button that is an icon, at three control heights. Given `href` it is a
|
|
49
|
+
* link with the same appearance. Every `aria-*` prop is forwarded to the
|
|
50
|
+
* element; React Aria alone would keep only the labelling ones.
|
|
51
|
+
*/
|
|
52
|
+
declare function IconButton({ children, disableRipple, href, isDisabled, onClick, onContextMenu, onKeyDown, onKeyUp, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, rel, render, size, target, variant, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
47
53
|
//#endregion
|
|
48
54
|
export { type IconButtonProps, IconButton as default };
|
|
49
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
2
|
import { mergeStatefulStyles } from "../../styles/merge.js";
|
|
3
3
|
import { useRipple } from "../../hooks/useRipple.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ariaAttributesOf, buttonRenderer, linkRenderer } from "../../render/aria.js";
|
|
5
5
|
import { jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { Button } from "
|
|
6
|
+
import { Button, Link } from "react-aria-components";
|
|
7
7
|
//#region src/components/icon-button/index.tsx
|
|
8
8
|
const styles = {
|
|
9
9
|
base: {
|
|
10
10
|
kGNEyG: "x6s0dn4",
|
|
11
|
-
kaIpWk: "
|
|
11
|
+
kaIpWk: "xtt5grq x3y1ksm",
|
|
12
12
|
kMzoRj: "xc342km",
|
|
13
13
|
kB7OPa: "x9f619",
|
|
14
|
-
kkrTdU: "
|
|
14
|
+
kkrTdU: "x1ypdohk",
|
|
15
15
|
k1xSpc: "x3nfvp2",
|
|
16
16
|
kmuXW: "x2lah0s",
|
|
17
17
|
kjj79g: "xl56j7k",
|
|
@@ -27,9 +27,19 @@ const styles = {
|
|
|
27
27
|
kAMwcw: "x15l9jch",
|
|
28
28
|
$$css: true
|
|
29
29
|
},
|
|
30
|
+
disabled: {
|
|
31
|
+
kaIpWk: "x3y1ksm",
|
|
32
|
+
kkrTdU: "x1h6gzvc",
|
|
33
|
+
$$css: true
|
|
34
|
+
},
|
|
30
35
|
filled: {
|
|
31
|
-
kWkggS: "
|
|
32
|
-
kMwMTN: "
|
|
36
|
+
kWkggS: "xpky1to xyf7a0q xnety89",
|
|
37
|
+
kMwMTN: "xwjo7ld",
|
|
38
|
+
$$css: true
|
|
39
|
+
},
|
|
40
|
+
filledDisabled: {
|
|
41
|
+
kWkggS: "xepofeg",
|
|
42
|
+
kMwMTN: "x1xj74d8",
|
|
33
43
|
$$css: true
|
|
34
44
|
},
|
|
35
45
|
lg: {
|
|
@@ -45,13 +55,23 @@ const styles = {
|
|
|
45
55
|
$$css: true
|
|
46
56
|
},
|
|
47
57
|
standard: {
|
|
48
|
-
kWkggS: "
|
|
49
|
-
kMwMTN: "
|
|
58
|
+
kWkggS: "x83qkoq x1p2om7n xjbqb8w",
|
|
59
|
+
kMwMTN: "x1w5n3ug",
|
|
60
|
+
$$css: true
|
|
61
|
+
},
|
|
62
|
+
standardDisabled: {
|
|
63
|
+
kWkggS: "xjbqb8w",
|
|
64
|
+
kMwMTN: "x1xj74d8",
|
|
50
65
|
$$css: true
|
|
51
66
|
},
|
|
52
67
|
tonal: {
|
|
53
|
-
kWkggS: "
|
|
54
|
-
kMwMTN: "
|
|
68
|
+
kWkggS: "xxwd9aw x1hei0q8 xp89om9",
|
|
69
|
+
kMwMTN: "xscdzaa",
|
|
70
|
+
$$css: true
|
|
71
|
+
},
|
|
72
|
+
tonalDisabled: {
|
|
73
|
+
kWkggS: "xepofeg",
|
|
74
|
+
kMwMTN: "x1xj74d8",
|
|
55
75
|
$$css: true
|
|
56
76
|
},
|
|
57
77
|
xs: {
|
|
@@ -61,8 +81,18 @@ const styles = {
|
|
|
61
81
|
$$css: true
|
|
62
82
|
}
|
|
63
83
|
};
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
const disabledStyles = {
|
|
85
|
+
filled: styles.filledDisabled,
|
|
86
|
+
standard: styles.standardDisabled,
|
|
87
|
+
tonal: styles.tonalDisabled
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A button that is an icon, at three control heights. Given `href` it is a
|
|
91
|
+
* link with the same appearance. Every `aria-*` prop is forwarded to the
|
|
92
|
+
* element; React Aria alone would keep only the labelling ones.
|
|
93
|
+
*/
|
|
94
|
+
function IconButton({ children, disableRipple = false, href, isDisabled = false, onClick, onContextMenu, onKeyDown, onKeyUp, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, rel, render, size = "md", target, variant = "standard", ...props$1 }) {
|
|
95
|
+
const ripple = useRipple(!disableRipple && !isDisabled, {
|
|
66
96
|
onClick,
|
|
67
97
|
onContextMenu,
|
|
68
98
|
onPointerCancel,
|
|
@@ -70,12 +100,29 @@ function IconButton({ children, disabled = false, disableRipple = false, nativeB
|
|
|
70
100
|
onPointerLeave,
|
|
71
101
|
onPointerUp
|
|
72
102
|
});
|
|
103
|
+
const styleProps = mergeStatefulStyles((state) => props(styles.base, styles[variant], styles[size], state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]), props$1);
|
|
104
|
+
const element = {
|
|
105
|
+
aria: ariaAttributesOf(props$1),
|
|
106
|
+
onKeyDown,
|
|
107
|
+
onKeyUp
|
|
108
|
+
};
|
|
109
|
+
if (href !== void 0) return /* @__PURE__ */ jsxs(Link, {
|
|
110
|
+
href,
|
|
111
|
+
isDisabled,
|
|
112
|
+
rel,
|
|
113
|
+
render: linkRenderer(element),
|
|
114
|
+
target,
|
|
115
|
+
...ripple.handlers,
|
|
116
|
+
...props$1,
|
|
117
|
+
...styleProps,
|
|
118
|
+
children: [children, ripple.surface]
|
|
119
|
+
});
|
|
73
120
|
return /* @__PURE__ */ jsxs(Button, {
|
|
74
|
-
|
|
75
|
-
|
|
121
|
+
isDisabled,
|
|
122
|
+
render: buttonRenderer(element, render),
|
|
76
123
|
...ripple.handlers,
|
|
77
124
|
...props$1,
|
|
78
|
-
...
|
|
125
|
+
...styleProps,
|
|
79
126
|
children: [children, ripple.surface]
|
|
80
127
|
});
|
|
81
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ClassNameOrFunction, FocusableElement, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, Link as RACLink } from 'react-aria-components';\nimport type { ButtonDOMProps, ButtonState } from '../button';\nimport { useRipple } from '../../hooks/useRipple';\nimport { ariaAttributesOf, buttonRenderer, linkRenderer } from '../../render/aria';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Each variant composites an 'on-color' over its own container at the\n// interaction state's opacity, rather than swapping in a separate hover\n// color. calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes. Inlined at each property rather than factored\n// into a helper: @stylexjs/babel-plugin only statically recognizes\n// expressions written directly as property values.\n//\n// Disabled is a style of its own per variant rather than a `:disabled`\n// branch inside each property, for the reason Button's comment gives: given\n// `href` this renders as a link, which React Aria turns into a <span> while\n// disabled, and neither matches the pseudo-class. Applied last from the\n// render state, the disabled styles replace each property whole, hover and\n// pressed branches included.\n//\n// The corner softens from a circle to a rounded square while pressed, which\n// is the shape morph the source design gives this control. The two\n// transitioned properties take different curves — the colour change is\n// linear-ish and the shape change is emphasized — so the timing functions are\n// a matching comma list rather than one value.\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"xtt5grq x3y1ksm\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x1hl8ikr\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n kIyJzY: \"x1iuyhda\",\n k1ekBW: \"xb5u718\",\n kAMwcw: \"x15l9jch\",\n $$css: true\n },\n disabled: {\n kaIpWk: \"x3y1ksm\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n filled: {\n kWkggS: \"xpky1to xyf7a0q xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n filledDisabled: {\n kWkggS: \"xepofeg\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xnnlda6\",\n kGuDYH: \"x1s3cmhv\",\n kzqmXN: \"x15yg21f\",\n $$css: true\n },\n md: {\n kZKoxP: \"x1vqgdyp\",\n kGuDYH: \"x1pvqxga\",\n kzqmXN: \"x100vrsf\",\n $$css: true\n },\n standard: {\n kWkggS: \"x83qkoq x1p2om7n xjbqb8w\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n standardDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xxwd9aw x1hei0q8 xp89om9\",\n kMwMTN: \"xscdzaa\",\n $$css: true\n },\n tonalDisabled: {\n kWkggS: \"xepofeg\",\n kMwMTN: \"x1xj74d8\",\n $$css: true\n },\n xs: {\n kZKoxP: \"x10w6t97\",\n kGuDYH: \"xwsyq91\",\n kzqmXN: \"x1td3qas\",\n $$css: true\n }\n};\nconst disabledStyles = {\n filled: styles.filledDisabled,\n standard: styles.standardDisabled,\n tonal: styles.tonalDisabled\n};\ntype IconButtonProps = {\n /**\n * What the button does, in words. Required rather than optional: an icon\n * on its own has no accessible name, so without this the control announces\n * nothing at all.\n */\n 'aria-label': string;\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 and pressed state layers are\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 /** The link's `rel`, when `href` is set. */\n rel?: string;\n /**\n * Control size: `xs` 32px, `md` 40px, `lg` 56px — the same heights `Button`\n * uses, so the two line up beside each other in a row.\n * @default 'md'\n */\n size?: 'lg' | 'md' | 'xs';\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 * `standard` is transparent and tints what it sits on; `filled` and `tonal`\n * carry a container of their own.\n * @default 'standard'\n */\n variant?: 'filled' | 'standard' | 'tonal';\n} & ButtonDOMProps;\n\n/**\n * A button that is an icon, at three control heights. Given `href` it is a\n * link with the same appearance. Every `aria-*` prop is forwarded to the\n * element; React Aria alone would keep only the labelling ones.\n */\nfunction IconButton({\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 rel,\n render,\n size = 'md',\n target,\n variant = 'standard',\n ...props\n}: IconButtonProps) {\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, as in Button.\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], 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 {children}\n {ripple.surface}\n </RACButton>;\n}\nexport type { IconButtonProps };\nexport default IconButton;"],"mappings":";;;;;;;AA8BA,MAAM,SAAS;CACb,MAAM;EACJ,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,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,QAAQ;EACN,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,gBAAgB;EACd,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,UAAU;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,kBAAkB;EAChB,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,eAAe;EACb,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,IAAI;EACF,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF;AACA,MAAM,iBAAiB;CACrB,QAAQ,OAAO;CACf,UAAU,OAAO;CACjB,OAAO,OAAO;AAChB;;;;;;AAiDA,SAAS,WAAW,EAClB,UACA,gBAAgB,OAChB,MACA,aAAa,OACb,SACA,eACA,WACA,SACA,iBACA,eACA,gBACA,aACA,KACA,QACA,OAAO,MACP,QACA,UAAU,YACV,GAAG,WACe;CAMlB,MAAM,SAAS,UAA4B,CAAC,iBAAiB,CAAC,YAAY;EACxE;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CACD,MAAM,aAAa,qBAAqB,UAAuB,MAAa,OAAO,MAAM,OAAO,UAAU,OAAO,OAAO,MAAM,cAAc,OAAO,UAAU,MAAM,cAAc,eAAe,QAAQ,GAAG,OAAK;CAChN,MAAM,UAAU;EACd,MAAM,iBAAiB,OAAK;EAC5B;EACA;CACF;CACA,IAAI,SAAS,KAAA,GACX,OAAO,qBAAC,MAAD;EAAe;EAAkB;EAAiB;EAAK,QAAQ,aAAa,OAAO;EAAW;EAAQ,GAAI,OAAO;EAAU,GAAI;EAAO,GAAI;EAA1I,UAAA,CACF,UACA,OAAO,OACD;;CAEb,OAAO,qBAAC,QAAD;EAAuB;EAAY,QAAQ,eAAe,SAAS,MAAM;EAAG,GAAI,OAAO;EAAU,GAAI;EAAO,GAAI;EAAhH,UAAA,CACF,UACA,OAAO,OACC;;AACf"}
|
|
@@ -14,6 +14,7 @@ import Keycap, { KeycapProps } from "./keycap/index.js";
|
|
|
14
14
|
import Link, { LinkProps } from "./link/index.js";
|
|
15
15
|
import ListDetail, { ListDetailProps } from "./list-detail/index.js";
|
|
16
16
|
import ListItem, { ListItemProps } from "./list-item/index.js";
|
|
17
|
+
import Popover, { PopoverProps } from "./popover/index.js";
|
|
17
18
|
import ProductIcon, { ProductIconProps } from "./product-icon/index.js";
|
|
18
19
|
import Separator, { SeparatorProps } from "./separator/index.js";
|
|
19
20
|
import Sheet, { SheetProps } from "./sheet/index.js";
|
|
@@ -22,4 +23,4 @@ import SupportingPane, { SupportingPaneProps } from "./supporting-pane/index.js"
|
|
|
22
23
|
import Tabs, { TabsProps } from "./tabs/index.js";
|
|
23
24
|
import Text, { TextProps } from "./text/index.js";
|
|
24
25
|
import TextField, { TextFieldProps } from "./text-field/index.js";
|
|
25
|
-
export { AppBar, type AppBarProps, Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, Chip, type ChipProps, Code, type CodeProps, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, Feed, type FeedProps, IconButton, type IconButtonProps, Keycap, type KeycapProps, Link, type LinkProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, ProductIcon, type ProductIconProps, Separator, type SeparatorProps, Sheet, type SheetProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Tabs, type TabsProps, Text, TextField, type TextFieldProps, type TextProps };
|
|
26
|
+
export { AppBar, type AppBarProps, Avatar, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, Chip, type ChipProps, Code, type CodeProps, Container, type ContainerProps, CopyField, type CopyFieldProps, Currency, type CurrencyProps, Feed, type FeedProps, IconButton, type IconButtonProps, Keycap, type KeycapProps, Link, type LinkProps, ListDetail, type ListDetailProps, ListItem, type ListItemProps, Popover, type PopoverProps, ProductIcon, type ProductIconProps, Separator, type SeparatorProps, Sheet, type SheetProps, Stack, type StackAlign, type StackGap, type StackJustify, type StackProps, SupportingPane, type SupportingPaneProps, Tabs, type TabsProps, Text, TextField, type TextFieldProps, type TextProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RenderComponentProps } from "../../render/useRender.js";
|
|
2
2
|
//#region src/components/keycap/index.d.ts
|
|
3
|
-
type KeycapProps =
|
|
3
|
+
type KeycapProps = RenderComponentProps<'kbd'>;
|
|
4
4
|
/**
|
|
5
5
|
* A single key on a keyboard, as named in an instruction — `Enter`, `Esc`,
|
|
6
6
|
* `Ctrl`. It renders a `<kbd>` and takes its scale from the text around it. A
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useRender","props"],"sources":["../../../src/components/keycap/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","names":["useRender","props"],"sources":["../../../src/components/keycap/index.tsx"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// Named for the physical thing it draws rather than for the element it\n// renders. `Kbd` would match the tag, but a component library is read by\n// people writing call sites, not markup, and `Key` in that setting is already\n// spoken for several times over — an API key, an object key, React's own key\n// prop. A keycap is unambiguously the one on a keyboard.\n//\n// Sized in em for the same reason Code is: a key named inside a footnote and\n// one named inside a paragraph are the same component. The ratio is smaller\n// than Code's because the border adds height that the glyphs do not, and\n// matching Code's 0.875 leaves a keycap standing taller than the line it\n// sits in.\n//\n// Transparent rather than filled, so a keycap inside a Card or a Sheet does\n// not read as a nested surface. The border alone carries the metaphor.\n\ntype KeycapProps = RenderComponentProps<'kbd'>;\n\n/**\n * A single key on a keyboard, as named in an instruction — `Enter`, `Esc`,\n * `Ctrl`. It renders a `<kbd>` and takes its scale from the text around it. A\n * chord is several of these, combined at the call site.\n */\nfunction Keycap({\n render,\n ...props\n}: KeycapProps) {\n return useRender({\n defaultTagName: 'kbd',\n props: {\n ...props,\n ...mergeStyles({\n className: \"xjbqb8w x1fwvt7v x1tfhd1 x1y0btm7 xmkeg23 x9f619 x139gbkf x1rg5ohu xbppi91 xuegzgz x37zpob xt970qd xdomwbk xuxw1ft\"\n }, props)\n },\n render\n });\n}\nexport type { KeycapProps };\nexport default Keycap;"],"mappings":";;;;;;;;;AA6BA,SAAA,OAAA,IAAA;CAAA,MAAA,IAAA,EAAA,EAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAgB,MAAA,EAAA,QAAA,IAAA,GAAA,UAAA;EAAA,SAAA;EAIPA,KAAA;EACW,KAAA;EAEXC,KAAA;EACA,KAAA,YAAY,EAAA,WACF,qHACb,GAAG,KAAK;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA;EAAA,SAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;EAAA,KAAA,EAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,MAAA,EAAA,OAAA,IAAA;EAJJ,KAAA;GAAA,GACFA;GAAK,GACL;EAGL;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,UAAA,EAAA,QAAA,MAAA,EAAA,QAAA,IAAA;EAPc,KAAA;GAAA,gBACC;GAAK,OACd;GAKN;EAEH;EAAC,EAAA,KAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;EAAA,EAAA,MAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OATMD,GAAU,EAShB;AAAC"}
|