@kanso-labs/kanso-ui 0.34.16 → 0.35.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 +59 -3
- package/dist/components/app-bar/index.js +1 -0
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +1 -0
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +2 -2
- package/dist/components/breadcrumbs/index.js +1 -0
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +2 -2
- package/dist/components/button/index.js +40 -28
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.js +1 -0
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.js +2 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +2 -2
- package/dist/components/checkbox-group/index.js +1 -0
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +2 -2
- package/dist/components/chip/index.js +1 -0
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +2 -2
- package/dist/components/chip-group/index.js +1 -0
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +2 -2
- package/dist/components/color-area/index.js +35 -29
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +9 -4
- package/dist/components/color-field/index.js +33 -30
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +2 -2
- package/dist/components/color-picker/index.js +63 -57
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.d.ts +2 -1
- package/dist/components/color-slider/index.js +1 -0
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.d.ts +2 -2
- package/dist/components/color-swatch/index.js +24 -18
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +2 -2
- package/dist/components/color-swatch-picker/index.js +1 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.d.ts +2 -1
- package/dist/components/color-wheel/index.js +1 -0
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +7 -2
- package/dist/components/combo-box/index.js +64 -60
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/container/index.js +1 -0
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +2 -2
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.js +1 -0
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +2 -2
- package/dist/components/date-field/index.js +1 -0
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +2 -2
- package/dist/components/date-range-picker/index.js +1 -0
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +2 -2
- package/dist/components/dialog/index.js +40 -34
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +2 -2
- package/dist/components/disclosure/index.js +1 -0
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.d.ts +2 -2
- package/dist/components/disclosure-group/index.js +1 -0
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +2 -2
- package/dist/components/drop-zone/index.js +1 -0
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/feed/index.js +1 -0
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/form/index.d.ts +2 -2
- package/dist/components/form/index.js +1 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +2 -2
- package/dist/components/icon-button/index.js +63 -50
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.js +1 -0
- 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 -0
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.d.ts +2 -2
- package/dist/components/list/index.js +1 -0
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +2 -2
- package/dist/components/list-box/index.js +7 -6
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-detail/index.js +1 -0
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +2 -2
- package/dist/components/list-item/index.js +43 -31
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +2 -2
- package/dist/components/menu/index.js +44 -38
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +2 -2
- package/dist/components/meter/index.js +1 -0
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +2 -2
- package/dist/components/navigation-tree/index.js +11 -10
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +7 -1
- package/dist/components/number-field/index.js +56 -51
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +2 -2
- package/dist/components/popover/index.js +65 -59
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.js +1 -0
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +2 -2
- package/dist/components/progress-indicator/index.js +1 -0
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +3 -3
- package/dist/components/radio-group/index.js +1 -0
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +2 -1
- package/dist/components/range-calendar/index.js +1 -0
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +7 -1
- package/dist/components/search-field/index.js +22 -19
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +2 -2
- package/dist/components/segmented-button/index.js +1 -0
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.d.ts +2 -2
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +2 -1
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +2 -2
- package/dist/components/sheet/index.js +40 -34
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +2 -1
- package/dist/components/slider/index.js +1 -0
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +2 -2
- package/dist/components/snackbar/index.js +1 -0
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/stack/index.js +1 -0
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.js +1 -0
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +2 -2
- package/dist/components/switch/index.js +1 -0
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +2 -2
- package/dist/components/tabs/index.js +1 -0
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.js +1 -0
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text/index.js +1 -0
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +8 -2
- package/dist/components/text-area/index.js +37 -34
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +7 -2
- package/dist/components/text-field/index.js +39 -36
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +2 -2
- package/dist/components/time-field/index.js +1 -0
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +2 -2
- package/dist/components/token-field/index.js +102 -70
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +2 -2
- package/dist/components/toolbar/index.js +1 -0
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +41 -35
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +2 -2
- package/dist/components/tree/index.js +7 -6
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/hooks.js +1 -0
- package/dist/drag/hooks.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.js +32 -30
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/react-aria.js +1 -0
- package/dist/render/ref.js +23 -0
- package/dist/render/ref.js.map +1 -0
- package/dist/styles/merge.js +4 -3
- package/dist/styles/merge.js.map +1 -1
- package/dist/styles.css +13 -9
- package/dist/stylesheet.d.ts +3 -0
- package/package.json +11 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["DOMAttributes","ReactNode","ButtonRenderProps","ClassNameOrFunction","FocusableElement","ButtonProps","RACButtonProps","StyleOrFunction","stylex","Button","RACButton","Link","RACLink","useRipple","ariaAttributesOf","buttonRenderer","linkRenderer","focus","mergeStatefulStyles","colors","radii","shadows","sizing","spacing","stateLayerOpacity","typography","ProgressIndicator","Ripple","ReturnType","TARGET_SIZE","FORCED_COLORS","styles","base","kGNEyG","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kVAEAm","kybGjl","$$css","disabled","elevated","kWkggS","kGVxlE","kMwMTN","elevatedDisabled","filled","filledDisabled","label","labelPending","k33iCy","lg","kZKoxP","kg3NbH","md","kgeoSG","kGOzcv","kpsdNU","kEoFBp","outlined","outlinedDisabled","pending","kpwlN0","kjj79g","text","textDisabled","tonal","tonalDisabled","xl","xs","xxl","outlineWidths","disabledStyles","ButtonDOMProps","Omit","GlobalEventKey","Pick","HTMLElement","children","className","ButtonState","disableRipple","href","pendingLabel","rel","size","ButtonSize","style","target","variant","ButtonVariant","Exclude","t0","$","_c","t1","isDisabled","t2","isPending","t3","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","t4","render","t5","t6","props","undefined","t7","ripple","t8","state","ring","styleProps","element","aria","handlers","surface","T0","t9","t10","t11","buttonContent","t12","Button","_c","props","stylex.props","RACLink","RACButton"],"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 { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, sizing, 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// **Under forced colours a container is drawn as a rule.** That mode drops\n// the shadow and paints author backgrounds in a system colour, which left a\n// filled, tonal or elevated button as a label with nothing round it. `base`\n// draws a 1px `ButtonText` border there instead. Outlined keeps its own rule,\n// and text stays without one, as the page draws it. The mode repaints a\n// disabled button's fade at full strength as well. Chromium greys a disabled\n// `<button>` there by itself, but not the `<span>` React Aria renders for a\n// disabled link, so the disabled styles name `GrayText` for the label and\n// the edge rather than leave it to the browser.\n//\n// Two independent axes, applied base -> variant -> size. The variant carries\n// colour and the size carries geometry, so the two never argue: inline\n// padding belongs to the size alone, and every size declares its own.\n//\n// That is deliberate rather than incidental. The buttons page gives padding\n// per size — its Small button padding is 16dp, the 24dp beside it being the\n// older value the page marks as not recommended — and gives the five colour\n// styles no padding of their own. A text button is therefore as wide as a\n// filled one at the same size, which is what the code draws.\n//\n// This did once read the other way, with `md` declaring no padding so a\n// medium button fell through to its variant's. `fix(button)!: the spec's\n// five sizes` replaced that when the component took the page's sizes, since\n// a per-variant padding had nowhere to sit once every size carried one. The\n// comment describing the old cascade outlived it by some months, which is\n// how it came to say `text` keeps a tighter padding it has never had — back\n// then `text` declared 16dp while a filled `md` declared none at all, so the\n// text button was the wider of the two.\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\n\n/**\n * The press area the buttons page requires, which its two smallest sizes are\n * drawn under. A literal rather than `sizing.controlMd`, which holds the same\n * number, for the reason IconButton's `TARGET_SIZE` gives: a consumer\n * resizing their medium controls should not shrink a target the page states\n * as a floor.\n */\nconst TARGET_SIZE = '48px';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n kaIpWk: \"x1dkaolv\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\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 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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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: \"xs1ryiz\",\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 kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1gvacq5\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"x1rv7mn0\",\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 xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kMzoRj: \"xc342km\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n textDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\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 kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1arwny6\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"xig8zya\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"x173yhrv\",\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 isPending = 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 //\n // Off while pending for the same reason, and for a second one. React Aria\n // nulls out the handlers it derived itself while pending — the click among\n // them — but not the separate copy of the global pointer events that\n // carries ours, so a press still reached the ripple and started it while\n // the click that would have ended it never arrived. The ripple stayed at\n // its pressed opacity until some later press completed a cycle of its own.\n const ripple = useRipple<FocusableElement>(!disableRipple && !isDisabled && !isPending, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n const styleProps = mergeStatefulStyles((state: ButtonState) => stylex.props(styles.base, focus.ring, 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} isPending={isPending} 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":";;;;;;;;;;AAoFA,MAAM+B,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRX,QAAQ;EACRU,OAAO;CACT;CACAE,UAAU;E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BAAC,QAAD;GAAM,WAAU;GAC/B,UAAA,oBAAC,mBAAD;IAAmB,cAAYf;IAAc,iBAAA;IAAgB,MAAK;IAAM,MAAK;IAAU,SAAQ;GAAU,CAAA;EACrG,CAAA,IAAI;EACXgC,OAAOQ;CACV,EAAA,CAAA;AACJ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","DOMAttributes","ReactNode","RefAttributes","ButtonRenderProps","ClassNameOrFunction","FocusableElement","ButtonProps","RACButtonProps","StyleOrFunction","stylex","Button","RACButton","Link","RACLink","useRipple","ariaAttributesOf","buttonRenderer","linkRenderer","refCallback","focus","mergeStatefulStyles","colors","radii","shadows","sizing","spacing","stateLayerOpacity","typography","ProgressIndicator","Ripple","ReturnType","TARGET_SIZE","FORCED_COLORS","styles","base","kGNEyG","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","kVAEAm","kybGjl","$$css","disabled","elevated","kWkggS","kGVxlE","kMwMTN","elevatedDisabled","filled","filledDisabled","label","labelPending","k33iCy","lg","kZKoxP","kg3NbH","md","kgeoSG","kGOzcv","kpsdNU","kEoFBp","outlined","outlinedDisabled","pending","kpwlN0","kjj79g","text","textDisabled","tonal","tonalDisabled","xl","xs","xxl","outlineWidths","disabledStyles","ButtonDOMProps","Omit","GlobalEventKey","Pick","HTMLElement","children","className","ButtonState","disableRipple","href","pendingLabel","rel","size","ButtonSize","style","target","variant","ButtonVariant","Exclude","t0","$","t1","isDisabled","t2","isPending","t3","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","t4","ref","render","t5","t6","props","undefined","t7","ripple","t8","state","ring","styleProps","element","aria","t9","forwarded","handlers","surface","T0","t10","t11","t12","buttonContent","t13","Button","_c","props","stylex.props","RACLink","RACButton"],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { DOMAttributes, ReactNode, RefAttributes } 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 { refCallback } from '../../render/ref';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, shadows, sizing, 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// **Under forced colours a container is drawn as a rule.** That mode drops\n// the shadow and paints author backgrounds in a system colour, which left a\n// filled, tonal or elevated button as a label with nothing round it. `base`\n// draws a 1px `ButtonText` border there instead. Outlined keeps its own rule,\n// and text stays without one, as the page draws it. The mode repaints a\n// disabled button's fade at full strength as well. Chromium greys a disabled\n// `<button>` there by itself, but not the `<span>` React Aria renders for a\n// disabled link, so the disabled styles name `GrayText` for the label and\n// the edge rather than leave it to the browser.\n//\n// Two independent axes, applied base -> variant -> size. The variant carries\n// colour and the size carries geometry, so the two never argue: inline\n// padding belongs to the size alone, and every size declares its own.\n//\n// That is deliberate rather than incidental. The buttons page gives padding\n// per size — its Small button padding is 16dp, the 24dp beside it being the\n// older value the page marks as not recommended — and gives the five colour\n// styles no padding of their own. A text button is therefore as wide as a\n// filled one at the same size, which is what the code draws.\n//\n// This did once read the other way, with `md` declaring no padding so a\n// medium button fell through to its variant's. `fix(button)!: the spec's\n// five sizes` replaced that when the component took the page's sizes, since\n// a per-variant padding had nowhere to sit once every size carried one. The\n// comment describing the old cascade outlived it by some months, which is\n// how it came to say `text` keeps a tighter padding it has never had — back\n// then `text` declared 16dp while a filled `md` declared none at all, so the\n// text button was the wider of the two.\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\n\n/**\n * The press area the buttons page requires, which its two smallest sizes are\n * drawn under. A literal rather than `sizing.controlMd`, which holds the same\n * number, for the reason IconButton's `TARGET_SIZE` gives: a consumer\n * resizing their medium controls should not shrink a target the page states\n * as a floor.\n */\nconst TARGET_SIZE = '48px';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n kaIpWk: \"x1dkaolv\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\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 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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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: \"xs1ryiz\",\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 kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1gvacq5\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"x1rv7mn0\",\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 xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kMzoRj: \"xc342km\",\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n textDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\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 kVAM5u: \"xmnqt3w\",\n kGVxlE: \"x1gnnqk1\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\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 kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1arwny6\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"xig8zya\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"x173yhrv\",\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 isPending = false,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n pendingLabel = 'Loading',\n ref,\n rel,\n render,\n size = 'md',\n target,\n variant = 'filled',\n ...props\n}: ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\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 //\n // Off while pending for the same reason, and for a second one. React Aria\n // nulls out the handlers it derived itself while pending — the click among\n // them — but not the separate copy of the global pointer events that\n // carries ours, so a press still reached the ripple and started it while\n // the click that would have ended it never arrived. The ripple stayed at\n // its pressed opacity until some later press completed a cycle of its own.\n const ripple = useRipple<FocusableElement>(!disableRipple && !isDisabled && !isPending, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n const styleProps = mergeStatefulStyles((state: ButtonState) => stylex.props(styles.base, focus.ring, 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 // The element is a link or a button, so the ref is typed as either, and is\n // handed to each as the callback both accept — see src/render/ref.ts.\n const forwarded = refCallback(ref);\n if (href !== undefined) {\n return <RACLink href={href} isDisabled={isDisabled} ref={forwarded} rel={rel} render={linkRenderer(element)} target={target} {...ripple.handlers} {...props} {...styleProps}>\n {children}\n {ripple.surface}\n </RACLink>;\n }\n return <RACButton isDisabled={isDisabled} isPending={isPending} ref={forwarded} 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":";;;;;;;;;;;;AAuFA,MAAMmC,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRX,QAAQ;EACRU,OAAO;CACT;CACAE,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,kBAAkB;EAChBH,QAAQ;EACRlB,QAAQ;EACRmB,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAO,QAAQ;EACNJ,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAQ,gBAAgB;EACdL,QAAQ;EACRlB,QAAQ;EACRmB,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAS,OAAO;EACLlB,QAAQ;EACRS,OAAO;CACT;CACAU,cAAc;EACZC,QAAQ;EACRX,OAAO;CACT;CACAY,IAAI;EACFC,QAAQ;EACRrB,QAAQ;EACRC,QA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CAAA;AACJ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RefAttributes } from "react";
|
|
1
2
|
import { CalendarProps, DateValue } from "react-aria-components";
|
|
2
3
|
//#region src/components/calendar/index.d.ts
|
|
3
4
|
type CalendarProps$1<T extends DateValue = DateValue> = Omit<CalendarProps<T>, 'children' | 'className' | 'style'> & {
|
|
@@ -26,7 +27,7 @@ type CalendarProps$1<T extends DateValue = DateValue> = Omit<CalendarProps<T>, '
|
|
|
26
27
|
* The call site's `className` and `style` land on the container, which is the
|
|
27
28
|
* element a layout positions.
|
|
28
29
|
*/
|
|
29
|
-
declare function Calendar$1<T extends DateValue>(props: CalendarProps$1<T>): import("react").JSX.Element;
|
|
30
|
+
declare function Calendar$1<T extends DateValue>(props: CalendarProps$1<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
30
31
|
//#endregion
|
|
31
32
|
export { type CalendarProps$1 as CalendarProps, Calendar$1 as default };
|
|
32
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CalendarDate","ReactElement","DateValue","CalendarProps","RACCalendarProps","stylex","Calendar","RACCalendar","CalendarCell","RACCalendarCell","CalendarGrid","RACCalendarGrid","CalendarGridBody","RACCalendarGridBody","CalendarGridHeader","CalendarHeader","monthOffsets","calendarStyles","focus","mergeStatefulStyles","Omit","T","className","style","props","$","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","CalendarDate","ReactElement","RefAttributes","DateValue","CalendarProps","RACCalendarProps","stylex","Calendar","RACCalendar","CalendarCell","RACCalendarCell","CalendarGrid","RACCalendarGrid","CalendarGridBody","RACCalendarGridBody","CalendarGridHeader","CalendarHeader","monthOffsets","calendarStyles","focus","mergeStatefulStyles","Omit","T","className","style","props","$","t0","root","t1","t2","Symbol","for","months","t3","visibleDuration","map","_temp","t4","t5","offset","grid","gridCell","cellClassName","state","isDisabled","isSelected","isToday","isUnavailable","cell","ring","cellToday","cellSelected","cellUnavailable","cellDisabled","date","Calendar","_c","props","stylex.props","RACCalendar","RACCalendarGrid","CalendarGridHeader","RACCalendarGridBody","RACCalendarCell"],"sources":["../../../src/components/calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Calendar as RACCalendar, CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody } from 'react-aria-components';\nimport { CalendarGridHeader, CalendarHeader } from '../../calendar';\nimport { monthOffsets } from '../../calendar/months';\nimport { calendarStyles } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's docked calendar: a month grid with a circle on the\n// selected date and an outline on today. Its values are that page's — a\n// 360dp container on the high surface container, 48dp date cells with a 40dp\n// state layer inside them, body-large for both the weekday row and the dates,\n// primary for the selected circle and for today's outline.\n//\n// The page's container is 456dp tall, which this does not take: that height\n// is a picker's, counting a headline and an action row the calendar itself\n// does not draw. What is held instead is the grid, at six weeks — the most\n// any month occupies — so the calendar keeps its height as the month moves\n// and a shorter month leaves its last rows empty. `months` in\n// `src/calendar/styles.ts` is where the room is reserved.\n//\n// Four things are this component's own.\n//\n// **The cell is a circle in a square.** The page gives the date a 48dp\n// container and a 40dp state layer, which is a 40dp circle with 4dp of room\n// around it. The grid's `border-spacing` is what supplies that room, so the\n// circle is the element and the square is the space between circles — rather\n// than a 48dp box with a 40dp box inside it.\n//\n// **A date from the month either side is faded because it is disabled, not\n// because it is outside.** React Aria marks those cells `data-outside-month`\n// and disables them in the same breath, so a treatment keyed on the first\n// would never draw anything the second had not already drawn. The disabled\n// fade is the page's 38% either way.\n//\n// **Today reads as today whether or not it is selected.** The page gives it\n// an outline and the primary label; selected gives it a filled circle and the\n// on-primary label. A selected today takes the fill, since a circle already\n// says where you are and two rings would say it twice.\n//\n// **The month is moved by IconButton's shape rather than by IconButton.**\n// React Aria wires `slot=\"previous\"` and `slot=\"next\"` on its own `Button`,\n// and IconButton renders React Aria's `Button` too — so nesting one inside\n// the slot would put two buttons where the page draws one. The chevrons take\n// the standard icon button's 40dp square and its state layer instead.\n\ntype CalendarProps<T extends DateValue = DateValue> = Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n};\n\n/**\n * A month calendar for picking a date. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'\n *\n * <Calendar aria-label=\"Label\" defaultValue={today(getLocalTimeZone())} />\n * ```\n *\n * `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual\n * dates out, and `visibleDuration` of `{ months: 2 }` draws two months side\n * by side. Name it with `aria-label` or `aria-labelledby`; React Aria\n * composes the visible month into that name itself.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Calendar<T extends DateValue>(props: CalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarHeader />\n <div {...stylex.props(calendarStyles.months)}>\n {monthOffsets(props.visibleDuration?.months ?? 1).map(offset => <RACCalendarGrid key={offset.months} offset={offset} {...stylex.props(calendarStyles.grid)}>\n <CalendarGridHeader />\n <RACCalendarGridBody>{gridCell}</RACCalendarGridBody>\n </RACCalendarGrid>)}\n </div>\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters. `selected` is applied after `today`, so a selected today\n// takes the fill rather than the outline — a circle already says where you\n// are, and two rings would say it twice. `disabled` is last of all, and\n// StyleX replaces a property whole, so it takes the hover branches with it.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isSelected: boolean;\n isToday: boolean;\n isUnavailable: boolean;\n}) {\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,SAAAS,WAAAkB,SAAA;CAAA,MAAAC,IAAA3B,EAAA,EAAA;CAAA,IAAA4B;CAAA,IAAAD,EAAA,OAAAD,SAAA;EACwCE,KAAAP,oBAAoBd,MAAaY,eAAcU,IAAK,GAAGH,OAAK;EAACC,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;EAC/FH,KAAA,oBAAC,gBAAD,CAAe,CAAA;EACNC,KAAAxB,MAAaY,eAAce,MAAO;EAACP,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAD,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAD,QAAAU,iBAAAF,QAAA;EACzCC,KAAAjB,aAAaQ,QAAKU,iBAAwBF,UAA7B,CAAkC,CAAC,CAAAG,IAAKC,KAGlC;EAACX,EAAA,KAAAD,QAAAU,iBAAAF;EAAAP,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAQ,IAAA;EAJvBI,KAAA,oBAAA,OAAA;GAKM,GALGR;GACNI,UAAAA;EAIG,CAAA;EAAAR,EAAA,KAAAQ;EAAAR,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAAD,WAAAC,EAAA,OAAAC,MAAAD,EAAA,QAAAY,IAAA;EAPHC,KAAA,qBAACqB,UAAD;GAAY,GAAQnC;GAAK,GAAME;GAA/B,UAAA,CACHE,IACAS,EAFe;;EAQHZ,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,MAAAY;EAAAZ,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OARTa;AAQS;AATlB,SAAAF,MAAAG,QAAA;CAAA,OAIwE,qBAACqB,cAAD;EAA6CrB;EAAM,GAAMlC,MAAaY,eAAcuB,IAAK;EAAzF,UAAA,CAC5D,oBAACqB,sBAAD,CAAmB,CAAA,GACnB,oBAACC,kBAAD,EAAA,UAAsBrB,SAAF,CAAA,CAFwD;CAAMF,GAAAA,OAAMP,MAAZ;AAG5D;AAa5B,SAASU,cAAcC,OAKpB;CACD,OAAOtC,MAAaY,eAAe+B,MAAM9B,MAAM+B,MAAMN,MAAMG,WAAW7B,eAAeiC,WAAWP,MAAME,cAAc5B,eAAekC,cAAcR,MAAMI,iBAAiB9B,eAAemC,iBAAiBT,MAAMC,cAAc3B,eAAeoC,YAAY,CAAC,CAAC/B,aAAa;AACxQ;AACA,SAASmB,SAASa,MAAkC;CAClD,OAAO,oBAACS,cAAD;EAAiB,WAAWrB;EAAqBY;CAAK,CAAA;AAC/D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
|
|
2
3
|
import { useRender } from "../../render/useRender.js";
|
|
3
4
|
import { mergeStyles } from "../../styles/merge.js";
|
|
@@ -13,7 +14,7 @@ const styles = {
|
|
|
13
14
|
kB7OPa: "x9f619",
|
|
14
15
|
kMwMTN: "x1heor9g",
|
|
15
16
|
k1xSpc: "x1lliihq",
|
|
16
|
-
kVQacm: "
|
|
17
|
+
kVQacm: "x7giv3",
|
|
17
18
|
kVAEAm: "x1n2onr6",
|
|
18
19
|
kybGjl: "x1hl2dhg",
|
|
19
20
|
$$css: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["stylex","RenderComponentProps","useRipple","useRender","focus","mergeStyles","colors","radii","shadows","spacing","stateLayerOpacity","styles","base","kaIpWk","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kVQacm","kVAEAm","kybGjl","$$css","elevated","kWkggS","kGVxlE","filled","interactive","kkrTdU","kVVagm","kzqmXN","k9WMMc","outlined","kVAM5u","ksu8eU","paddingDefault","kmVPX3","paddingNone","interactionStyles","CardProps","padding","variant","CardVariant","Card","t0","$","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","stylex","RenderComponentProps","useRipple","useRender","focus","mergeStyles","colors","radii","shadows","spacing","stateLayerOpacity","styles","base","kaIpWk","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kVQacm","kVAEAm","kybGjl","$$css","elevated","kWkggS","kGVxlE","filled","interactive","kkrTdU","kVVagm","kzqmXN","k9WMMc","outlined","kVAM5u","ksu8eU","paddingDefault","kmVPX3","paddingNone","interactionStyles","CardProps","padding","variant","CardVariant","Card","t0","$","children","t1","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","t2","render","t3","props","undefined","t4","ripple","padded","t5","t6","type","t7","handlers","t8","surface","t9","ring","t10","t11","defaultTagName","_c","props","stylex.props"],"sources":["../../../src/components/card/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useRender } from '../../render/useRender';\nimport { focus } from '../../styles/focus';\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: \"x62ce2h\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n k1xSpc: \"x1lliihq\",\n kVQacm: \"x7giv3\",\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 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 && focus.ring, interactive && interactionStyles[variant]), props)\n },\n render\n });\n}\nexport type { CardProps };\nexport default Card;"],"mappings":";;;;;;;;;AAsBA,MAAMa,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAI,QAAQ;EACNF,QAAQ;EACRF,OAAO;CACT;CACAK,aAAa;EACXC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRT,OAAO;CACT;CACAU,UAAU;EACRR,QAAQ;EACRS,QAAQ;EACRC,QAAQ;EACRnB,QAAQ;EACRO,OAAO;CACT;CACAa,gBAAgB;EACdC,QAAQ;EACRd,OAAO;CACT;CACAe,aAAa;EACXD,QAAQ;EACRd,OAAO;CACT;AACF;AACA,MAAMgB,oBAAoB;CACxBf,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAI,QAAQ;EACNF,QAAQ;EACRF,OAAO;CACT;CACAU,UAAU;EACRR,QAAQ;EACRF,OAAO;CACT;AACF;;;;;;;;;;;;;AA2CA,SAAAqB,KAAAC,IAAA;CAAA,MAAAC,IAAA7C,EAAA,EAAA;CAAc,MAAA,EAAA8C,UAAAnB,aAAAoB,IAAAC,SAAAC,eAAAC,iBAAAC,eAAAC,gBAAAC,aAAAb,SAAAc,IAAAC,QAAAd,SAAAe,IAA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KAAA/D,YAAYL,MAAaW,OAAMC,MAAOD,OAAO6B,UAAUoB,QAAQlC,eAAef,OAAMe,aAAcA,eAAetB,MAAKiE,MAAO3C,eAAeW,kBAAkBG,QAAQ,GAAGgB,OAAK;CAAC,IAAAc;CAAA,IAAA1B,EAAA,QAAAY,WAAAZ,EAAA,QAAAe,OAAAM,YAAArB,EAAA,QAAAkB,MAAAlB,EAAA,QAAAsB,MAAAtB,EAAA,QAAAwB,IAAA;EAd7KE,MAAA;GAAA,GACFd;GAAK,GAKJM;GAES,GACVE;GAAenB,UACRqB;GAGL,GACFE;EACL;EAACxB,EAAA,MAAAY;EAAAZ,EAAA,MAAAe,OAAAM;EAAArB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAsB;EAAAtB,EAAA,MAAAwB;EAAAxB,EAAA,MAAA0B;CAAA,OAAAA,MAAA1B,EAAA;CAAA,IAAA2B;CAAA,IAAA3B,EAAA,QAAAU,UAAAV,EAAA,QAAA0B,OAAA1B,EAAA,QAAAiB,IAAA;EAjBcU,MAAA;GAAAC,gBACCX;GAA8BL,OACvCc;GAeNhB;EAEH;EAACV,EAAA,MAAAU;EAAAV,EAAA,MAAA0B;EAAA1B,EAAA,MAAAiB;EAAAjB,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,OAnBMzC,UAAUoE,GAmBhB;AAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, RefAttributes } from "react";
|
|
2
2
|
import { CheckboxFieldProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/checkbox/index.d.ts
|
|
4
4
|
type CheckboxProps = {
|
|
@@ -33,7 +33,7 @@ type CheckboxProps = {
|
|
|
33
33
|
* The call site's `className` and `style` land on the field as a whole,
|
|
34
34
|
* which is the element a layout positions.
|
|
35
35
|
*/
|
|
36
|
-
declare function Checkbox({ children, description, error, ...props }: CheckboxProps): import("react").JSX.Element;
|
|
36
|
+
declare function Checkbox({ children, description, error, ...props }: CheckboxProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
37
37
|
//#endregion
|
|
38
38
|
export { type CheckboxProps, Checkbox as default };
|
|
39
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","CheckboxButtonRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","CheckboxButton","CheckboxField","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","state","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","_c","validationBehavior","T0","t1","t2","field","t3","t4","t5","Symbol","for","messages","t6","t7","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxButton, CheckboxField } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"xrpadme\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\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 memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple) {\n return (state: CheckboxButtonRenderProps) => {\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </CheckboxButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} />\n </div>\n </CheckboxField>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;AAmCA,MAAMoB,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;AACA,MAAMY,gBAAgB;CACpBH,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;AAgCA,SAASqB,cAAcP,UAAqBQ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EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,MAAAb,EAAA,QAAAE,oBAAA;EANHY,KAAA,qBAAC,IAAD;GAA0B,WAAAV;GAAwCF;GAAkB,GAAMV;GAAK,GAAMa;GAArG,UAAA,CACHG,IAGAK,EAJiB;;EAOHb,EAAA,MAAAG;EAAAH,EAAA,MAAAR;EAAAQ,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAE;EAAAF,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAPXc;AAOW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxButtonRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","CheckboxButton","CheckboxField","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","state","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","validationBehavior","T0","t1","t2","field","t3","t4","t5","Symbol","for","messages","t6","t7","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxButton, CheckboxField } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"xrpadme\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\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 memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple) {\n return (state: CheckboxButtonRenderProps) => {\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </CheckboxButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} />\n </div>\n </CheckboxField>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;;AAqCA,MAAMuB,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,Q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A,OAAAnC,OAAA;EAA7C+C,KAAA,oBAAA,OAAA;GAEM,GAFGJ;GACP,UAAA,oBAAC,cAAD;IAA2BrC;IAAoBN;IAAc,OAAA;GAAK,CAAA;EAC9D,CAAA;EAAAmC,EAAA,KAAA7B;EAAA6B,EAAA,KAAAnC;EAAAmC,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,QAAAE,MAAAF,EAAA,QAAAR,WAAAQ,EAAA,QAAAG,MAAAH,EAAA,QAAAI,MAAAJ,EAAA,QAAAO,MAAAP,EAAA,QAAAY,MAAAZ,EAAA,QAAAC,oBAAA;EANHY,KAAA,qBAAC,IAAD;GAA0B,WAAAV;GAAwCF;GAAkB,GAAMT;GAAK,GAAMY;GAArG,UAAA,CACHG,IAGAK,EAJiB;;EAOHZ,EAAA,MAAAE;EAAAF,EAAA,MAAAR;EAAAQ,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAO;EAAAP,EAAA,MAAAY;EAAAZ,EAAA,MAAAC;EAAAD,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,OAPXa;AAOW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, RefAttributes } from "react";
|
|
2
2
|
import { CheckboxGroupProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/checkbox-group/index.d.ts
|
|
4
4
|
type CheckboxGroupProps$1 = {
|
|
@@ -36,7 +36,7 @@ type CheckboxGroupProps$1 = {
|
|
|
36
36
|
* The call site's `className` and `style` land on the group as a whole,
|
|
37
37
|
* which is the element a layout positions.
|
|
38
38
|
*/
|
|
39
|
-
declare function CheckboxGroup$1({ children, description, error, label, ...props }: CheckboxGroupProps$1): import("react").JSX.Element;
|
|
39
|
+
declare function CheckboxGroup$1({ children, description, error, label, ...props }: CheckboxGroupProps$1 & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { type CheckboxGroupProps$1 as CheckboxGroupProps, CheckboxGroup$1 as default };
|
|
42
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state","CheckboxGroup","_c","props","RACCheckboxGroup","stylex.props"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\n\ntype CheckboxGroupProps = {\n /** The checkboxes, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the boxes' error\n * colours and `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\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 memoises\n// the result on its inputs. The label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div className=\"x78zum5 xdt5ytf\">{children}</div>\n <FieldMessage description={description} error={error} inset={false} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,SAAAQ,gBAAAa,IAAA;CAAA,MAAAC,IAAArB,EAAA,EAAA;CAAuB,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AAC,OAAD;GAAK,WAAU;GAAmBH;EAAc,CAAA;EAChD,oBAAC,cAAD;GAA2BC;GAAoBC;GAAO,OAAO;EAAM,CAAA;CACrE,EAAA,CAAA;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
1
|
+
import { ReactNode, RefAttributes } from "react";
|
|
2
2
|
import { ToggleButtonProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/chip/index.d.ts
|
|
4
4
|
type ChipProps = Omit<ToggleButtonProps, 'children'> & {
|
|
@@ -16,7 +16,7 @@ type ChipProps = Omit<ToggleButtonProps, 'children'> & {
|
|
|
16
16
|
* let it keep its own state. Selection is announced through `aria-pressed`
|
|
17
17
|
* rather than a role of its own.
|
|
18
18
|
*/
|
|
19
|
-
declare function Chip({ children, onKeyDown, onKeyUp, render, ...props }: ChipProps): import("react").JSX.Element;
|
|
19
|
+
declare function Chip({ children, onKeyDown, onKeyUp, render, ...props }: ChipProps & RefAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { type ChipProps, Chip as default };
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","ToggleButtonProps","RACToggleButtonProps","ToggleButtonRenderProps","stylex","ToggleButton","chipGlyph","chipLabel","chipStyles","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","ChipProps","Omit","children","Chip","t0","$","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","ToggleButtonProps","RACToggleButtonProps","ToggleButtonRenderProps","stylex","ToggleButton","chipGlyph","chipLabel","chipStyles","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","ChipProps","Omit","children","Chip","t0","$","T0","t1","t2","t3","t4","onKeyDown","onKeyUp","render","props","element","aria","propsFor","chipContent","t5","state","isSelected","base","target","ring","selected","unselected","isDisabled","disabled","disabledSelected","disabledUnselected","_c","stylex.props"],"sources":["../../../src/components/chip/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ToggleButtonProps as RACToggleButtonProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ToggleButton } from 'react-aria-components';\nimport { chipGlyph, chipLabel } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { ariaAttributesOf, toggleButtonRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The pill, its two containers, its check and its disabled treatment are the\n// chip module's in `src/chip`, shared with the chips a ChipGroup draws; what\n// is here is React Aria's `ToggleButton` around them, which is what makes a\n// standalone chip a two-state button rather than one of a set.\n//\n// Two of the call site's props go on the element through `src/render/aria`\n// rather than through that spread, as `Button` and `IconButton` do. React\n// Aria builds a button's attributes from an allowlist that holds only the\n// labelling `aria-*` and the state it manages itself, so any other one — a\n// shortcut, an owned element — is dropped before it reaches the DOM. And it\n// wraps a keyboard handler it is given so that the event stops there unless\n// the handler asks otherwise, which is its convention rather than the DOM's;\n// on the element the handler bubbles, so an Escape pressed on a chip inside\n// a dialog still reaches the dialog.\n\ntype ChipProps = Omit<RACToggleButtonProps, 'children'> & {\n /**\n * The chip's label. A node rather than React Aria's node-or-function,\n * since the chip puts its own check before whatever this is and a function\n * would be handed a `defaultChildren` the chip never rendered. ChipGroup's\n * chip narrows it the same way, for the same reason.\n */\n children?: ReactNode;\n};\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 onKeyDown,\n onKeyUp,\n render,\n ...props\n}: ChipProps & RefAttributes<HTMLButtonElement>) {\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n return <ToggleButton render={toggleButtonRenderer(element, render)} {...props} {...mergeStatefulStyles(propsFor, props)}>\n {chipContent(children)}\n </ToggleButton>;\n}\n\n// What the chip draws, from React Aria's render state: the check while it is\n// selected, then the label. Built by a call rather than written inline at\n// the prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its input.\nfunction chipContent(children: ReactNode) {\n return (state: ToggleButtonRenderProps) => <>\n {chipGlyph(state.isSelected)}\n {chipLabel(children)}\n </>;\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 stylex.props(chipStyles.base, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, state.isDisabled && chipStyles.disabled, state.isDisabled && (state.isSelected ? chipStyles.disabledSelected : chipStyles.disabledUnselected));\n}\nexport type { ChipProps };\nexport default Chip;"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,SAAAmB,KAAAC,IAAA;CAAA,MAAAC,IAAApB,EAAA,EAAA;CAAA,IAAAqB;CAAA,IAAAJ;CAAA,IAAAK;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAD,IAAA;EAAc,MAAA,EAAAF,UAAAQ,IAAAC,WAAAC,SAAAC,QAAA,GAAAC,UAAAV;EAAAF,WAAAQ;EAOZ,MAAAK,UAAgB;GAAAC,MACRpB,iBAAiBkB,KAAK;GAACH;GAAAC;EAG/B;EACQN,KAAAd;EAAqBe,KAAAV,qBAAqBkB,SAASF,MAAM;EAAOC,KAAAA;EAAWL,KAAAV,oBAAoBkB,UAAUH,KAAK;EAACT,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAH;EAAAG,EAAA,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ps, TagProps } from "react-aria-components";
|
|
3
3
|
//#region src/components/chip-group/index.d.ts
|
|
4
4
|
type ChipGroupChipProps = Omit<TagProps, 'children' | 'className' | 'style'> & {
|
|
@@ -40,7 +40,7 @@ type ChipGroupProps<T extends object = object> = {
|
|
|
40
40
|
*/
|
|
41
41
|
removeLabel?: string;
|
|
42
42
|
} & Omit<TagGroupProps, 'children'> & Pick<TagListProps<T>, 'items' | 'renderEmptyState'>;
|
|
43
|
-
declare function ChipGroup<T extends object = object>({ children, description, error, items, label, removeLabel, renderEmptyState, ...props }: ChipGroupProps<T>): import("react").JSX.Element;
|
|
43
|
+
declare function ChipGroup<T extends object = object>({ children, description, error, items, label, removeLabel, renderEmptyState, ...props }: ChipGroupProps<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
44
44
|
declare namespace ChipGroup {
|
|
45
45
|
var Chip: typeof ChipGroupChip;
|
|
46
46
|
}
|