@kanso-labs/kanso-ui 0.45.22 → 0.45.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/badge/index.js.map +1 -1
- package/dist/button/context.js.map +1 -1
- package/dist/button/group.js.map +1 -1
- package/dist/button/hooks.js.map +1 -1
- package/dist/button/index.d.ts +3 -4
- package/dist/button/index.js.map +1 -1
- package/dist/button/styles.js.map +1 -1
- package/dist/button/toggle.js.map +1 -1
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js.map +1 -1
- package/dist/carousel/arrangement.d.ts +1 -2
- package/dist/carousel/arrangement.js.map +1 -1
- package/dist/chip/index.js.map +1 -1
- package/dist/chip/label.js.map +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/empty.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/styles.js.map +1 -1
- package/dist/collection/text.js.map +1 -1
- package/dist/color-scheme.d.ts +1 -2
- package/dist/color-scheme.js.map +1 -1
- package/dist/components/app-bar/index.d.ts +1 -2
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +1 -2
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.d.ts +1 -2
- package/dist/components/avatar/index.js.map +1 -1
- package/dist/components/badge/index.d.ts +1 -2
- package/dist/components/badge/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +1 -2
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +1 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/button-group/index.d.ts +1 -2
- package/dist/components/button-group/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +1 -2
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/card/index.d.ts +1 -2
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +1 -2
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/checkbox/index.d.ts +1 -2
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +1 -2
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip/index.d.ts +1 -2
- package/dist/components/chip/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +1 -2
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/code/index.d.ts +1 -2
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +1 -2
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +1 -2
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +1 -2
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.d.ts +1 -2
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.d.ts +1 -2
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +1 -2
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.d.ts +1 -2
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +1 -2
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/container/index.d.ts +1 -2
- package/dist/components/container/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +1 -2
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/currency/index.d.ts +1 -2
- package/dist/components/currency/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +1 -2
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +1 -2
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +1 -2
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +1 -2
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +1 -2
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.d.ts +1 -2
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +1 -2
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/drop-zone/styles.js.map +1 -1
- package/dist/components/fab/index.d.ts +1 -2
- package/dist/components/fab/index.js.map +1 -1
- package/dist/components/fab-menu/index.d.ts +1 -2
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/feed/index.d.ts +1 -2
- package/dist/components/feed/index.js.map +1 -1
- package/dist/components/form/index.d.ts +1 -2
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/icon-button/index.d.ts +1 -2
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/keycap/index.d.ts +1 -2
- package/dist/components/keycap/index.js.map +1 -1
- package/dist/components/link/index.d.ts +1 -2
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list/index.d.ts +1 -2
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +1 -2
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/list-detail/index.d.ts +1 -2
- package/dist/components/list-detail/index.js.map +1 -1
- package/dist/components/list-item/index.d.ts +1 -2
- package/dist/components/list-item/index.js.map +1 -1
- package/dist/components/loading-indicator/index.d.ts +1 -2
- package/dist/components/loading-indicator/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +1 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +1 -2
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-bar/index.d.ts +1 -2
- package/dist/components/navigation-bar/index.js.map +1 -1
- package/dist/components/navigation-rail/index.d.ts +1 -2
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +1 -2
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +1 -2
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +1 -2
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/product-icon/index.d.ts +1 -2
- package/dist/components/product-icon/index.js.map +1 -1
- package/dist/components/progress-indicator/index.d.ts +1 -2
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +1 -2
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +1 -2
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +1 -2
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/search-view/index.d.ts +1 -2
- package/dist/components/search-view/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +1 -2
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.d.ts +1 -2
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +1 -2
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +1 -2
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +1 -2
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.d.ts +1 -2
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/split-button/index.d.ts +1 -2
- package/dist/components/split-button/index.js.map +1 -1
- package/dist/components/stack/index.d.ts +1 -2
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/supporting-pane/index.d.ts +1 -2
- package/dist/components/supporting-pane/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +1 -2
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/table/index.d.ts +1 -2
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +1 -2
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/tag/index.d.ts +1 -2
- package/dist/components/tag/index.js.map +1 -1
- package/dist/components/text/index.d.ts +1 -2
- package/dist/components/text/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +1 -2
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +1 -2
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +1 -2
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/time-picker/index.d.ts +1 -2
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +1 -2
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +1 -2
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +1 -2
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +1 -2
- package/dist/components/tree/index.js.map +1 -1
- package/dist/control/index.js.map +1 -1
- package/dist/control/styles.js.map +1 -1
- package/dist/drag/hooks.d.ts +1 -2
- package/dist/drag/hooks.js.map +1 -1
- package/dist/drag/index.js.map +1 -1
- package/dist/drag/styles.js.map +1 -1
- package/dist/fab/styles.js.map +1 -1
- package/dist/field/index.d.ts +3 -4
- package/dist/field/index.js.map +1 -1
- package/dist/field/press.js.map +1 -1
- package/dist/field/root.js.map +1 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/glyphs/index.js.map +1 -1
- package/dist/glyphs/styles.js.map +1 -1
- package/dist/hooks/useAppBarScroll.d.ts +1 -2
- package/dist/hooks/useAppBarScroll.js.map +1 -1
- package/dist/hooks/useBottomEdge.js.map +1 -1
- package/dist/hooks/useClippedTitle.js.map +1 -1
- package/dist/hooks/useImageLoadingStatus.js.map +1 -1
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/hooks/useScrollStop.js.map +1 -1
- package/dist/hooks/useToggleGroupDisabled.js.map +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.js.map +1 -1
- package/dist/indicator/index.js.map +1 -1
- package/dist/indicator/styles.d.ts +1 -2
- package/dist/indicator/styles.js.map +1 -1
- package/dist/kanso-ui-core/defaults-DMH0HWCw.d.ts +1 -2
- package/dist/keycap/context.js.map +1 -1
- package/dist/layout.d.ts +1 -2
- package/dist/layout.js.map +1 -1
- package/dist/mark/index.js.map +1 -1
- package/dist/mark/initials.js.map +1 -1
- package/dist/mark/styles.js.map +1 -1
- package/dist/navigation/context.js.map +1 -1
- package/dist/navigation/index.d.ts +2 -3
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/overlay/index.js.map +1 -1
- package/dist/render/aria.js.map +1 -1
- package/dist/render/content.js.map +1 -1
- package/dist/render/name.d.ts +1 -2
- package/dist/render/ref.js.map +1 -1
- package/dist/render/useRender.d.ts +1 -2
- package/dist/render/useRender.js.map +1 -1
- package/dist/row/index.js.map +1 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/chequer.js.map +1 -1
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/icon-button.js.map +1 -1
- package/dist/styles/merge.js.map +1 -1
- package/dist/styles/overlay.d.ts +2 -3
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles/picker.js.map +1 -1
- package/dist/styles/ripple.js.map +1 -1
- package/dist/styles/scheme.js.map +1 -1
- package/dist/swatch/index.js.map +1 -1
- package/dist/theme-scope.d.ts +1 -2
- package/dist/theme-scope.js.map +1 -1
- package/dist/tokens/design.tokens.stylex.js.map +1 -1
- package/dist/tokens/values.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","ClassNameOrFunction","PressEvent","StyleOrFunction","stylex","useContext","useState","ToggleGroupStateContext","ButtonClassesState","ButtonDOMProps","ButtonLinkForm","ButtonPressForm","ButtonState","ButtonToggleForm","ButtonGroupItem","ButtonBase","ToggleButtonBase","ButtonGroupItemContext","groupPressHandlers","useSelection","pressThen","focus","colors","motion","radii","shadows","sizing","spacing","stateLayerOpacity","typography","TARGET_SIZE","FORCED_COLORS","styles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kjj79g","kb6lSQ","kLWn49","ks0D6T","kHjlTd","kVAEAm","k9WMMc","kybGjl","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","elevated","kWkggS","kGVxlE","kMwMTN","elevatedDisabled","elevatedToggleSelected","filled","filledDisabled","filledToggle","filledToggleSelected","icon","kmuXW","lg","kAzted","k8WAf4","kg3NbH","md","kgeoSG","kGOzcv","kpsdNU","kEoFBp","outlined","outlinedDisabled","outlinedToggleSelected","pending","text","textDisabled","tonal","tonalDisabled","tonalToggleSelected","xl","xs","xxl","OUTLINE_WIDTHS","const","outlinedSizes","iconSizes","PADDINGS","shifted","padding","value","val","undefined","roundShapes","kaIpWk","squareShapes","pressedShapes","hovered","focused","pressed","disabledStyles","toggleContainers","selected","unselected","ButtonProps","variant","Exclude","ButtonVariant","children","className","disableRipple","pendingLabel","shape","ButtonShape","size","ButtonSize","style","ToggleVariant","Button","t0","$","defaultSelected","href","isPending","isSelected","onChange","rel","t1","ownSize","target","t2","props","group","inSelectingGroup","grouped","onPressStart","onPressEnd","t3","selection","keyHeld","setKeyHeld","press","event","event_0","pointerType","ripples","t4","content","t5","buttonClasses","toggleClasses","isToggle","onPress","toggle","state","ring","isHovered","isPressed","isFocusVisible","groupStyles","isDisabled","border","shift","container","Button","_c","props","stylex.props"],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, PressEvent, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useState } from 'react';\nimport { ToggleGroupStateContext } from 'react-aria-components';\nimport type { ButtonClassesState, ButtonDOMProps, ButtonLinkForm, ButtonPressForm, ButtonState, ButtonToggleForm } from '../../button';\nimport type { ButtonGroupItem } from '../../button/context';\nimport { ButtonBase, ToggleButtonBase } from '../../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { groupPressHandlers } from '../../button/group';\nimport { useSelection } from '../../button/hooks';\nimport { pressThen } from '../../button/toggle';\nimport { focus } from '../../styles/focus';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\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// **The outlined rule is faint on purpose.** Outline variant sits at about\n// 1.6:1 against the surface in the light theme and 2:1 in the dark, under the\n// 3:1 WCAG asks of a boundary that identifies a control. The rule is not that\n// boundary: the label identifies the button, in on-surface-variant at about\n// 9:1, and the rule only shows how far the button reaches. IconButton's\n// outlined variant draws its rule in the same role for the same reason.\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// The hover, focus and pressed layers come from React Aria's render state,\n// `isHovered`, `isFocusVisible` and `isPressed`, rather than from `:hover`,\n// `:focus-visible` and `:active`. On a touch screen Chromium leaves `:hover`\n// on the last element tapped, so the layer and its lifted shadow stayed on a\n// button after the tap had ended, where React Aria ignores the emulated mouse\n// events that follow a touch. And React Aria prevents the default of the\n// keydown that presses a button with Space or Enter, so `:active` never\n// matched a keyboard press, which `isPressed` reports like any other.\n//\n// A press is one layer, as the page draws it: the ripple at the pressed\n// opacity, over the container at rest. The hover layer and its lift come off\n// while the button is pressed, so neither stacks under the ripple, and the\n// `pressed` table is the layer a button draws in the ripple's place: when\n// `disableRipple` turns the ripple off, and while a key holds the button\n// down, since the ripple answers a key only once it is released. The layer\n// then gives way to the ripple, which plays its whole press from there.\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 win\n// over any state layer applied before them.\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.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it is React Aria's `ToggleButton`, which\n// announces the state through `aria-pressed`, as IconButton's toggle does.\n// The page gives four of the five styles a second pair of colour roles for\n// it: a filled toggle rests on surface container with an on-surface-variant\n// label and takes primary once selected, a tonal one moves from the\n// secondary container pair to secondary, an elevated one keeps its low\n// surface until it takes primary, and an outlined one swaps its rule for the\n// inverse surface pair. Under forced colours a selected toggle of any style\n// is filled `Highlight`, as IconButton's is. The page gives text no pair, so\n// a text button given those props stays a plain one.\n//\n// **The corner is a shape the button morphs between**, from the page's size\n// token sets. `round` rests at half the container's height, which is the pill\n// for a label on one line, and `square` at the size's square corner: 12dp up\n// to the page's S, 16dp at M and 28dp above. A press tightens either to the\n// size's pressed corner, 8dp, 12dp or 16dp, and a toggle trades its shape for\n// the other once selected — a round one for the square corner, a square one\n// for the round. The corner eases over the motion tokens' short duration, as\n// the container, label and rule colours and the shadow do between states, and\n// all of them move at once for a reader who asks for reduced motion.\n//\n// The round corner is a length rather than the pill token's 9999px, because\n// the browser draws a corner no larger than half the box and eases the value\n// as written. From 9999px a press spent all but the last frame or two of its\n// 150ms above the 20dp a medium button can show, so the corner held round and\n// then jumped. From half the height every frame of the ease is one the eye\n// can see. A label that wraps makes a button taller than that, and its ends a\n// little less than round, as a connected ButtonGroup's already are.\n//\n// What every button does past its own styles — the ripple, the link and\n// toggle forms, the pending ring and `aria-busy`, a parent's disabled state\n// — is `src/button`'s, shared with IconButton.\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 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 kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n kHjlTd: \"xj0a0fe\",\n kVAEAm: \"x1n2onr6\",\n k9WMMc: \"x2b8uid\",\n kybGjl: \"x1hl2dhg\",\n kIyJzY: \"x4ukx00 x12w9bfk\",\n k1ekBW: \"xidvh3d\",\n kAMwcw: \"xmg88ys\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kGVxlE: \"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 elevatedToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n filled: {\n kWkggS: \"xnety89\",\n kGVxlE: \"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 filledToggle: {\n kWkggS: \"x1mjdul6\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n icon: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n lg: {\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kAzted: \"xdovgog\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n md: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"xun2zgk\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kAzted: \"x1cio8j0\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n outlined: {\n kWkggS: \"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 outlinedToggleSelected: {\n kWkggS: \"x1c5gpgi x1jzqe4\",\n kVAM5u: \"x9r1u3d x1n2ykn\",\n kMwMTN: \"x1girmi0 x1k5gbb1\",\n $$css: true\n },\n pending: {\n kkrTdU: \"x19v85br\",\n $$css: true\n },\n text: {\n kWkggS: \"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: \"x15dekr4\",\n kGVxlE: \"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 tonalToggleSelected: {\n kWkggS: \"x167r6xl x1jzqe4\",\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n xl: {\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kAzted: \"x112cvos\",\n k8WAf4: \"xny1cbh\",\n kg3NbH: \"x1sdxjpb\",\n $$css: true\n },\n xs: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"xun2zgk\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kOIVth: \"xzoy561\",\n kAzted: \"xlzjxrf\",\n k8WAf4: \"xmqoko8\",\n kg3NbH: \"x18fpw6u\",\n $$css: true\n },\n xxl: {\n kMv6JI: \"x1vsmgmf\",\n kGuDYH: \"xh9c4x\",\n k63SB2: \"x1y15vu6\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xoqu3bc\",\n kLWn49: \"x10x9d6x\",\n kAzted: \"xldltni\",\n k8WAf4: \"x1lrxzt4\",\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 OUTLINE_WIDTHS = {\n lg: '1px',\n md: '1px',\n xl: '2px',\n xs: '1px',\n xxl: '3px'\n} as const;\n\n// The outlined button draws its rule inside the width the other variants\n// take, as the page's buttons do: the padding gives up what the border takes,\n// so an outlined and a filled button with one label are one width, and a\n// group mixing them lines up. The height needs nothing, since it is a floor\n// the border already counts towards.\nconst outlinedSizes = {\n lg: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"xfeiziq\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"x1uvede8\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n kg3NbH: \"xrhf21y\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"x9t8nta\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n kg3NbH: \"x1wz3vkj\",\n $$css: true\n }\n};\n\n// The icon each size draws, from the page's size token sets: 20dp for the\n// two small sizes, then 24, 32 and 40. The gap before it is the size's own,\n// which `base`, `xl` and `xxl` already set as the page gives them.\nconst iconSizes = {\n lg: {\n kGuDYH: \"x1pvqxga\",\n $$css: true\n },\n md: {\n kGuDYH: \"xwsyq91\",\n $$css: true\n },\n xl: {\n kGuDYH: \"x1s3cmhv\",\n $$css: true\n },\n xs: {\n kGuDYH: \"xwsyq91\",\n $$css: true\n },\n xxl: {\n kGuDYH: \"x1tgwohi\",\n $$css: true\n }\n};\n\n// Each size's inline padding again, for the one place it is read at runtime:\n// a standard ButtonGroup widening a pressed button by adding to it. The size\n// styles above write the same values, and an outlined button's border comes\n// off them here as it does in `outlinedSizes`.\nconst PADDINGS = {\n lg: spacing.xl,\n md: spacing.lg,\n xl: '48px',\n xs: spacing.md,\n xxl: '64px'\n};\n\n// The padding a standard group sets while it widens or narrows the button.\nconst shifted = {\n padding: (value: string) => [{\n kg3NbH: value != null ? \"x30g6up\" : value,\n $$css: true\n }, {\n \"--x-paddingInline\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(value)\n }]\n};\n\n// The round corner each size rests at, and a square toggle once selected:\n// half the container's height — see the header for why not the pill's\n// 9999px. `min()` leaves the pill token in charge below that, so a scheme\n// that sets `--kui-radius-pill` small still draws round buttons at its corner.\nconst roundShapes = {\n lg: {\n kaIpWk: \"x1j5kmnq\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1y5wlyh\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x39tcx0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"xcslhsm\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xjy9rn5\",\n $$css: true\n }\n};\n\n// The square corner each size rests at, and a round toggle once selected.\nconst squareShapes = {\n lg: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n md: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x19pkqky\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"x19pkqky\",\n $$css: true\n }\n};\n\n// The corner each size presses to, whatever its shape. Applied after the\n// resting and selected shapes, so a press is felt whichever the button rests\n// at.\nconst pressedShapes = {\n lg: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n }\n};\n\n// The interaction state layers, one style per variant for each state, applied\n// from React Aria's render state — see the header for why that and not the\n// pseudo-classes. In the order they are applied, so where two hold the later\n// wins, as the page draws one layer at a time: focus over hover, and a press\n// over both. Hover lifts filled and tonal off the page and raises elevated a\n// level, and a press brings each back to where it rests.\n//\n// A toggle's containers carry a layer of their own, each the label colour\n// over that container, applied after the variant's so the variant still\n// decides the shadow. A selected toggle's keeps its forced-colours\n// `Highlight`, since a later style replaces the property whole.\nconst hovered = {\n elevated: {\n kWkggS: \"xltxkvm\",\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"xo1ct44\",\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"xtxe0ya\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1hxzsxp x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1fctxn6\",\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12r95rf x1jzqe4\",\n $$css: true\n }\n};\nconst focused = {\n elevated: {\n kWkggS: \"xcn1wy9\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"xhodiby\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1ppcb1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"xn4e5mw x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x16tkg7c x1jzqe4\",\n $$css: true\n }\n};\n\n// The pressed layer of a button whose ripple is off, drawn in the ripple's\n// place — see the header. Its shadow is the variant's resting one, which the\n// hover's lift no longer covers while the button is pressed.\nconst pressed = {\n elevated: {\n kWkggS: \"x1d33wxb\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"x7b25lv\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1qdfkg1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x167cdfs x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12o6fnv x1jzqe4\",\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};\n\n// Which container a toggle draws, selected and not, by its name in the\n// tables above. Three of the eight are the plain button's own: an unselected\n// tonal, elevated or outlined toggle is the tonal, elevated or outlined\n// button.\nconst toggleContainers = {\n elevated: {\n selected: 'elevatedToggleSelected',\n unselected: 'elevated'\n },\n filled: {\n selected: 'filledToggleSelected',\n unselected: 'filledToggle'\n },\n outlined: {\n selected: 'outlinedToggleSelected',\n unselected: 'outlined'\n },\n tonal: {\n selected: 'tonalToggleSelected',\n unselected: 'tonal'\n }\n} as const;\ntype ButtonProps = ButtonDOMProps & (ButtonLinkForm | ButtonPressForm | (ButtonToggleForm & {\n /**\n * A toggle takes any variant but `text`, which the page gives no\n * selected colours.\n */\n variant?: Exclude<ButtonVariant, 'text'>;\n})) & {\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. A press then draws its layer as a background\n * instead, at the same pressed opacity, so the button reads the same\n * either way. The hover and focus layers are unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, at the page's icon size for the button's size:\n * 20px at `xs` and `md`, 24px at `lg`, 32px at `xl` and 40px at `xxl`. Draw\n * it `1em` square in `currentColor`, as every icon here is, and it follows.\n * Hidden with the label while the button is pending.\n */\n icon?: ReactNode;\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. Left out, it is\n * the word for it in the I18nProvider's locale — \"Loading\" in English.\n */\n pendingLabel?: string;\n /**\n * The corner the button rests at: `round` is the pill, `square` the\n * page's rounded rectangle, 12px up to `md`, 16px at `lg` and 28px above.\n * Either tightens while pressed, and a toggle trades one for the other\n * once selected.\n * @default 'round'\n */\n shape?: ButtonShape;\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 /**\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};\ntype ButtonShape = 'round' | 'square';\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\ntype ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal';\n\n// The four styles the page gives a toggle's colour pairs; see the header.\ntype ToggleVariant = keyof typeof toggleContainers;\n\n/**\n * The design's button, at five emphasis levels and five control heights,\n * round or square. Given `href` it is a link with the same appearance. Every\n * `aria-*` prop is forwarded to the element; React Aria alone would keep only\n * the labelling ones.\n *\n * Given `isSelected`, `defaultSelected` or `onChange` it is a toggle, which\n * reports its state through `aria-pressed` and draws the page's second pair\n * of colour roles for its variant. The three forms are exclusive, so a toggle\n * given `href` does not compile, and nor does a `text` toggle, which the page\n * gives no selected colours — a `text` button in a selecting `ButtonGroup`\n * is the one that toggles, for the group's sake. A toggle may be pending,\n * for a state saved somewhere slow: the ring replaces its label and a press\n * changes nothing until it clears.\n *\n * ```tsx\n * <Button defaultSelected variant=\"tonal\">\n * Label\n * </Button>\n * ```\n */\nfunction Button({\n children,\n defaultSelected,\n href,\n icon,\n isPending,\n isSelected,\n onChange,\n pendingLabel,\n rel,\n shape = 'round',\n size: ownSize,\n target,\n variant = 'filled',\n ...props\n}: ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n // A ButtonGroup or a SplitButton around the button hands it a size, its\n // shape at the group's inner edges and the press interaction; see\n // src/button/context.ts. A size named here still wins.\n const group = useContext(ButtonGroupItemContext);\n const size = ownSize ?? group?.size ?? 'md';\n // A group that selects is React Aria's ToggleButtonGroup, whose buttons\n // have to be toggles to take part in its selection.\n const inSelectingGroup = useContext(ToggleGroupStateContext) !== null;\n const grouped = groupPressHandlers(group, props.onPressStart, props.onPressEnd);\n const onPressEnd = grouped.onPressEnd ?? props.onPressEnd;\n const onPressStart = grouped.onPressStart ?? props.onPressStart;\n const selection = useSelection({\n defaultSelected,\n isSelected,\n onChange\n });\n // Whether a key holds the button down, which the ripple does not draw\n // until the key is released, so the pressed layer draws in its place.\n const [keyHeld, setKeyHeld] = useState(false);\n const press = {\n onPressEnd: (event: PressEvent) => {\n setKeyHeld(false);\n onPressEnd?.(event);\n },\n onPressStart: (event: PressEvent) => {\n setKeyHeld(event.pointerType === 'keyboard');\n onPressStart?.(event);\n }\n };\n const ripples = props.disableRipple !== true && !keyHeld;\n\n // The icon goes in with the label, inside what ButtonBase hides while the\n // button is pending, so the ring takes the place of both.\n const content = icon === undefined ? children : <>\n <span {...stylex.props(styles.icon, iconSizes[size])}>{icon}</span>\n {children}\n </>;\n\n // A selecting ButtonGroup around it makes it React Aria's ToggleButton, to\n // take part in the group's selection — a text button too, which draws its\n // selection by nothing but the group's shape. Whether a button sits in one\n // does not change from one render to the next.\n if (inSelectingGroup) {\n return <ToggleButtonBase {...props} {...press} classes={variant === 'text' ? buttonClasses(shape, size, variant, group, ripples) : toggleClasses(shape, size, variant, group, ripples)} isPending={isPending}>\n {content}\n </ToggleButtonBase>;\n }\n\n // The three props that make this a toggle on its own, read as IconButton\n // reads them, and on the same component as the plain button so a toggle\n // whose `isSelected` is still loading stays one element when it arrives.\n // The types keep them off a `text` button; the check here keeps a call\n // site that slipped past them a plain button, as it always was.\n const isToggle = variant !== 'text' && (defaultSelected !== undefined || isSelected !== undefined || onChange !== undefined);\n return <ButtonBase {...props} {...press} classes={isToggle ? toggleClasses(shape, size, variant, group, ripples) : buttonClasses(shape, size, variant, group, ripples)} href={href} isPending={isPending} isSelected={isToggle ? selection.selected : undefined} onPress={isToggle ? pressThen(props.onPress, selection.toggle) : props.onPress} pendingLabel={pendingLabel} rel={rel} target={target}>\n {content}\n </ButtonBase>;\n}\n\n// The button's own classes, from React Aria's render state — see the header\n// for why that and not the pseudo-classes, and for why a press drops the\n// hover layer and draws its own only where the ripple does not. Built by a\n// call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction buttonClasses(shape: ButtonShape, size: ButtonSize, variant: ButtonVariant, group: ButtonGroupItem | null, ripples: boolean) {\n return (state: ButtonClassesState) => stylex.props(styles.base, focus.ring, styles[variant], styles[size], shape === 'square' ? squareShapes[size] : roundShapes[size], variant === 'outlined' && outlinedSizes[size], state.isHovered && !state.isPressed && hovered[variant], state.isFocusVisible && focused[variant], state.isPressed && !ripples && pressed[variant], state.isPressed && pressedShapes[size], groupStyles(group, size, variant, state), state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]);\n}\n\n// What a group lays over the button: its own styles for the button's state,\n// and the standard group's widening or narrowing as extra inline padding,\n// half of the shift on either side.\nfunction groupStyles(group: ButtonGroupItem | null, size: ButtonSize, variant: ButtonVariant, state: ButtonState) {\n if (group === null) {\n return null;\n }\n const border = variant === 'outlined' ? OUTLINE_WIDTHS[size] : '0px';\n return [group.styles?.(state), group.shift !== 0 && shifted.padding(`calc(${PADDINGS[size]} - ${border} + ${group.shift / 2}px)`)];\n}\n\n// A toggle's classes: the plain button's, with the container and its layers\n// swapped for the toggle's pair, and the selected shape between the resting\n// and the pressed one. The variant's own style and layers still go first, for\n// the shadow and the rule they carry. Built by a call for the reason\n// `buttonClasses` is.\nfunction toggleClasses(shape: ButtonShape, size: ButtonSize, variant: ToggleVariant, group: ButtonGroupItem | null, ripples: boolean) {\n return (state: ButtonClassesState) => {\n const isSelected = state.isSelected === true;\n const container = toggleContainers[variant][isSelected ? 'selected' : 'unselected'];\n return stylex.props(styles.base, focus.ring, styles[variant], styles[container], styles[size], shape === 'square' ? squareShapes[size] : roundShapes[size], isSelected && (shape === 'square' ? roundShapes[size] : squareShapes[size]), variant === 'outlined' && outlinedSizes[size], state.isHovered && !state.isPressed && hovered[variant], state.isHovered && !state.isPressed && hovered[container], state.isFocusVisible && focused[variant], state.isFocusVisible && focused[container], state.isPressed && !ripples && pressed[variant], state.isPressed && !ripples && pressed[container], state.isPressed && pressedShapes[size], groupStyles(group, size, variant, state), state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]);\n };\n}\nexport type { ButtonDOMProps, ButtonProps, ButtonShape, ButtonSize, ButtonState, ButtonVariant };\nexport default Button;"],"mappings":";;;;;;;;;;;;;;AAkJA,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,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRlB,QAAQ;EACRiB,OAAO;CACT;CACAE,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,kBAAkB;EAChBH,QAAQ;EACRxB,QAAQ;EACRyB,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAO,wBAAwB;EACtBJ,QAAQ;EACRE,QAAQ;EACRL,OAAO;CACT;CACAQ,QAAQ;EACNL,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAS,gBAAgB;EACdN,QAAQ;EACRxB,QAAQ;EACRyB,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAU,cAAc;EACZP,QAAQ;EACRE,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xB;AACF"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","useContext","useState","ToggleGroupStateContext","ButtonGroupItemContext","groupPressHandlers","useSelection","pressThen","focus","spacing","styles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kOIVth","kjj79g","kb6lSQ","kLWn49","ks0D6T","kHjlTd","kVAEAm","k9WMMc","kybGjl","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","elevated","kWkggS","kGVxlE","kMwMTN","elevatedDisabled","elevatedToggleSelected","filled","filledDisabled","filledToggle","filledToggleSelected","icon","kmuXW","lg","kAzted","k8WAf4","kg3NbH","md","kgeoSG","kGOzcv","kpsdNU","kEoFBp","outlined","outlinedDisabled","outlinedToggleSelected","pending","text","textDisabled","tonal","tonalDisabled","tonalToggleSelected","xl","xs","xxl","OUTLINE_WIDTHS","outlinedSizes","iconSizes","PADDINGS","shifted","padding","value","val","undefined","roundShapes","kaIpWk","squareShapes","pressedShapes","hovered","focused","pressed","disabledStyles","toggleContainers","selected","unselected","variant","children","disableRipple","pendingLabel","shape","size","Button","t0","$","defaultSelected","href","isPending","isSelected","onChange","rel","t1","ownSize","target","t2","props","group","inSelectingGroup","grouped","onPressStart","onPressEnd","t3","selection","keyHeld","setKeyHeld","press","event","event_0","pointerType","ripples","t4","content","t5","buttonClasses","toggleClasses","isToggle","onPress","toggle","state","ring","isHovered","isPressed","isFocusVisible","groupStyles","isDisabled","border","shift","container"],"sources":["../../../src/components/button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, PressEvent, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useState } from 'react';\nimport { ToggleGroupStateContext } from 'react-aria-components';\nimport type { ButtonClassesState, ButtonDOMProps, ButtonLinkForm, ButtonPressForm, ButtonState, ButtonToggleForm } from '../../button';\nimport type { ButtonGroupItem } from '../../button/context';\nimport { ButtonBase, ToggleButtonBase } from '../../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { groupPressHandlers } from '../../button/group';\nimport { useSelection } from '../../button/hooks';\nimport { pressThen } from '../../button/toggle';\nimport { focus } from '../../styles/focus';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\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// **The outlined rule is faint on purpose.** Outline variant sits at about\n// 1.6:1 against the surface in the light theme and 2:1 in the dark, under the\n// 3:1 WCAG asks of a boundary that identifies a control. The rule is not that\n// boundary: the label identifies the button, in on-surface-variant at about\n// 9:1, and the rule only shows how far the button reaches. IconButton's\n// outlined variant draws its rule in the same role for the same reason.\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// The hover, focus and pressed layers come from React Aria's render state,\n// `isHovered`, `isFocusVisible` and `isPressed`, rather than from `:hover`,\n// `:focus-visible` and `:active`. On a touch screen Chromium leaves `:hover`\n// on the last element tapped, so the layer and its lifted shadow stayed on a\n// button after the tap had ended, where React Aria ignores the emulated mouse\n// events that follow a touch. And React Aria prevents the default of the\n// keydown that presses a button with Space or Enter, so `:active` never\n// matched a keyboard press, which `isPressed` reports like any other.\n//\n// A press is one layer, as the page draws it: the ripple at the pressed\n// opacity, over the container at rest. The hover layer and its lift come off\n// while the button is pressed, so neither stacks under the ripple, and the\n// `pressed` table is the layer a button draws in the ripple's place: when\n// `disableRipple` turns the ripple off, and while a key holds the button\n// down, since the ripple answers a key only once it is released. The layer\n// then gives way to the ripple, which plays its whole press from there.\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 win\n// over any state layer applied before them.\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.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it is React Aria's `ToggleButton`, which\n// announces the state through `aria-pressed`, as IconButton's toggle does.\n// The page gives four of the five styles a second pair of colour roles for\n// it: a filled toggle rests on surface container with an on-surface-variant\n// label and takes primary once selected, a tonal one moves from the\n// secondary container pair to secondary, an elevated one keeps its low\n// surface until it takes primary, and an outlined one swaps its rule for the\n// inverse surface pair. Under forced colours a selected toggle of any style\n// is filled `Highlight`, as IconButton's is. The page gives text no pair, so\n// a text button given those props stays a plain one.\n//\n// **The corner is a shape the button morphs between**, from the page's size\n// token sets. `round` rests at half the container's height, which is the pill\n// for a label on one line, and `square` at the size's square corner: 12dp up\n// to the page's S, 16dp at M and 28dp above. A press tightens either to the\n// size's pressed corner, 8dp, 12dp or 16dp, and a toggle trades its shape for\n// the other once selected — a round one for the square corner, a square one\n// for the round. The corner eases over the motion tokens' short duration, as\n// the container, label and rule colours and the shadow do between states, and\n// all of them move at once for a reader who asks for reduced motion.\n//\n// The round corner is a length rather than the pill token's 9999px, because\n// the browser draws a corner no larger than half the box and eases the value\n// as written. From 9999px a press spent all but the last frame or two of its\n// 150ms above the 20dp a medium button can show, so the corner held round and\n// then jumped. From half the height every frame of the ease is one the eye\n// can see. A label that wraps makes a button taller than that, and its ends a\n// little less than round, as a connected ButtonGroup's already are.\n//\n// What every button does past its own styles — the ripple, the link and\n// toggle forms, the pending ring and `aria-busy`, a parent's disabled state\n// — is `src/button`'s, shared with IconButton.\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 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 kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n kHjlTd: \"xj0a0fe\",\n kVAEAm: \"x1n2onr6\",\n k9WMMc: \"x2b8uid\",\n kybGjl: \"x1hl2dhg\",\n kIyJzY: \"x4ukx00 x12w9bfk\",\n k1ekBW: \"xidvh3d\",\n kAMwcw: \"xmg88ys\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kGVxlE: \"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 elevatedToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n filled: {\n kWkggS: \"xnety89\",\n kGVxlE: \"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 filledToggle: {\n kWkggS: \"x1mjdul6\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n icon: {\n kGNEyG: \"x6s0dn4\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n $$css: true\n },\n lg: {\n kMv6JI: \"x46eyla\",\n kGuDYH: \"x5ehqhr\",\n k63SB2: \"xrf6cl6\",\n kb6lSQ: \"x1g135zh\",\n kLWn49: \"x1ggk5va\",\n kAzted: \"xdovgog\",\n k8WAf4: \"x1uvvd8r\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n },\n md: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"xun2zgk\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n kAzted: \"x1cio8j0\",\n k8WAf4: \"x1cmllll\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n outlined: {\n kWkggS: \"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 outlinedToggleSelected: {\n kWkggS: \"x1c5gpgi x1jzqe4\",\n kVAM5u: \"x9r1u3d x1n2ykn\",\n kMwMTN: \"x1girmi0 x1k5gbb1\",\n $$css: true\n },\n pending: {\n kkrTdU: \"x19v85br\",\n $$css: true\n },\n text: {\n kWkggS: \"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: \"x15dekr4\",\n kGVxlE: \"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 tonalToggleSelected: {\n kWkggS: \"x167r6xl x1jzqe4\",\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n xl: {\n kMv6JI: \"x1fz0g89\",\n kGuDYH: \"xkb6epg\",\n k63SB2: \"x76yrz5\",\n kOIVth: \"x1gka490\",\n kb6lSQ: \"x1s1qhaa\",\n kLWn49: \"x1voeury\",\n kAzted: \"x112cvos\",\n k8WAf4: \"xny1cbh\",\n kg3NbH: \"x1sdxjpb\",\n $$css: true\n },\n xs: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"xun2zgk\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kOIVth: \"xzoy561\",\n kAzted: \"xlzjxrf\",\n k8WAf4: \"xmqoko8\",\n kg3NbH: \"x18fpw6u\",\n $$css: true\n },\n xxl: {\n kMv6JI: \"x1vsmgmf\",\n kGuDYH: \"xh9c4x\",\n k63SB2: \"x1y15vu6\",\n kOIVth: \"xxj4525\",\n kb6lSQ: \"xoqu3bc\",\n kLWn49: \"x10x9d6x\",\n kAzted: \"xldltni\",\n k8WAf4: \"x1lrxzt4\",\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 OUTLINE_WIDTHS = {\n lg: '1px',\n md: '1px',\n xl: '2px',\n xs: '1px',\n xxl: '3px'\n} as const;\n\n// The outlined button draws its rule inside the width the other variants\n// take, as the page's buttons do: the padding gives up what the border takes,\n// so an outlined and a filled button with one label are one width, and a\n// group mixing them lines up. The height needs nothing, since it is a floor\n// the border already counts towards.\nconst outlinedSizes = {\n lg: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"xfeiziq\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"x1uvede8\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n kg3NbH: \"xrhf21y\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n kg3NbH: \"x9t8nta\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n kg3NbH: \"x1wz3vkj\",\n $$css: true\n }\n};\n\n// The icon each size draws, from the page's size token sets: 20dp for the\n// two small sizes, then 24, 32 and 40. The gap before it is the size's own,\n// which `base`, `xl` and `xxl` already set as the page gives them.\nconst iconSizes = {\n lg: {\n kGuDYH: \"x1pvqxga\",\n $$css: true\n },\n md: {\n kGuDYH: \"xwsyq91\",\n $$css: true\n },\n xl: {\n kGuDYH: \"x1s3cmhv\",\n $$css: true\n },\n xs: {\n kGuDYH: \"xwsyq91\",\n $$css: true\n },\n xxl: {\n kGuDYH: \"x1tgwohi\",\n $$css: true\n }\n};\n\n// Each size's inline padding again, for the one place it is read at runtime:\n// a standard ButtonGroup widening a pressed button by adding to it. The size\n// styles above write the same values, and an outlined button's border comes\n// off them here as it does in `outlinedSizes`.\nconst PADDINGS = {\n lg: spacing.xl,\n md: spacing.lg,\n xl: '48px',\n xs: spacing.md,\n xxl: '64px'\n};\n\n// The padding a standard group sets while it widens or narrows the button.\nconst shifted = {\n padding: (value: string) => [{\n kg3NbH: value != null ? \"x30g6up\" : value,\n $$css: true\n }, {\n \"--x-paddingInline\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(value)\n }]\n};\n\n// The round corner each size rests at, and a square toggle once selected:\n// half the container's height — see the header for why not the pill's\n// 9999px. `min()` leaves the pill token in charge below that, so a scheme\n// that sets `--kui-radius-pill` small still draws round buttons at its corner.\nconst roundShapes = {\n lg: {\n kaIpWk: \"x1j5kmnq\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1y5wlyh\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x39tcx0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"xcslhsm\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xjy9rn5\",\n $$css: true\n }\n};\n\n// The square corner each size rests at, and a round toggle once selected.\nconst squareShapes = {\n lg: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n md: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x19pkqky\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"x19pkqky\",\n $$css: true\n }\n};\n\n// The corner each size presses to, whatever its shape. Applied after the\n// resting and selected shapes, so a press is felt whichever the button rests\n// at.\nconst pressedShapes = {\n lg: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n }\n};\n\n// The interaction state layers, one style per variant for each state, applied\n// from React Aria's render state — see the header for why that and not the\n// pseudo-classes. In the order they are applied, so where two hold the later\n// wins, as the page draws one layer at a time: focus over hover, and a press\n// over both. Hover lifts filled and tonal off the page and raises elevated a\n// level, and a press brings each back to where it rests.\n//\n// A toggle's containers carry a layer of their own, each the label colour\n// over that container, applied after the variant's so the variant still\n// decides the shadow. A selected toggle's keeps its forced-colours\n// `Highlight`, since a later style replaces the property whole.\nconst hovered = {\n elevated: {\n kWkggS: \"xltxkvm\",\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"xo1ct44\",\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"xtxe0ya\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1hxzsxp x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1fctxn6\",\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12r95rf x1jzqe4\",\n $$css: true\n }\n};\nconst focused = {\n elevated: {\n kWkggS: \"xcn1wy9\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"xhodiby\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1ppcb1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"xn4e5mw x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x16tkg7c x1jzqe4\",\n $$css: true\n }\n};\n\n// The pressed layer of a button whose ripple is off, drawn in the ripple's\n// place — see the header. Its shadow is the variant's resting one, which the\n// hover's lift no longer covers while the button is pressed.\nconst pressed = {\n elevated: {\n kWkggS: \"x1d33wxb\",\n $$css: true\n },\n elevatedToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n filled: {\n kWkggS: \"x7b25lv\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1qdfkg1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x167cdfs x1jzqe4\",\n $$css: true\n },\n text: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12o6fnv x1jzqe4\",\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};\n\n// Which container a toggle draws, selected and not, by its name in the\n// tables above. Three of the eight are the plain button's own: an unselected\n// tonal, elevated or outlined toggle is the tonal, elevated or outlined\n// button.\nconst toggleContainers = {\n elevated: {\n selected: 'elevatedToggleSelected',\n unselected: 'elevated'\n },\n filled: {\n selected: 'filledToggleSelected',\n unselected: 'filledToggle'\n },\n outlined: {\n selected: 'outlinedToggleSelected',\n unselected: 'outlined'\n },\n tonal: {\n selected: 'tonalToggleSelected',\n unselected: 'tonal'\n }\n} as const;\ntype ButtonProps = ButtonDOMProps & (ButtonLinkForm | ButtonPressForm | (ButtonToggleForm & {\n /**\n * A toggle takes any variant but `text`, which the page gives no\n * selected colours.\n */\n variant?: Exclude<ButtonVariant, 'text'>;\n})) & {\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. A press then draws its layer as a background\n * instead, at the same pressed opacity, so the button reads the same\n * either way. The hover and focus layers are unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, at the page's icon size for the button's size:\n * 20px at `xs` and `md`, 24px at `lg`, 32px at `xl` and 40px at `xxl`. Draw\n * it `1em` square in `currentColor`, as every icon here is, and it follows.\n * Hidden with the label while the button is pending.\n */\n icon?: ReactNode;\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. Left out, it is\n * the word for it in the I18nProvider's locale — \"Loading\" in English.\n */\n pendingLabel?: string;\n /**\n * The corner the button rests at: `round` is the pill, `square` the\n * page's rounded rectangle, 12px up to `md`, 16px at `lg` and 28px above.\n * Either tightens while pressed, and a toggle trades one for the other\n * once selected.\n * @default 'round'\n */\n shape?: ButtonShape;\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 /**\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};\ntype ButtonShape = 'round' | 'square';\ntype ButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\ntype ButtonVariant = 'elevated' | 'filled' | 'outlined' | 'text' | 'tonal';\n\n// The four styles the page gives a toggle's colour pairs; see the header.\ntype ToggleVariant = keyof typeof toggleContainers;\n\n/**\n * The design's button, at five emphasis levels and five control heights,\n * round or square. Given `href` it is a link with the same appearance. Every\n * `aria-*` prop is forwarded to the element; React Aria alone would keep only\n * the labelling ones.\n *\n * Given `isSelected`, `defaultSelected` or `onChange` it is a toggle, which\n * reports its state through `aria-pressed` and draws the page's second pair\n * of colour roles for its variant. The three forms are exclusive, so a toggle\n * given `href` does not compile, and nor does a `text` toggle, which the page\n * gives no selected colours — a `text` button in a selecting `ButtonGroup`\n * is the one that toggles, for the group's sake. A toggle may be pending,\n * for a state saved somewhere slow: the ring replaces its label and a press\n * changes nothing until it clears.\n *\n * ```tsx\n * <Button defaultSelected variant=\"tonal\">\n * Label\n * </Button>\n * ```\n */\nfunction Button({\n children,\n defaultSelected,\n href,\n icon,\n isPending,\n isSelected,\n onChange,\n pendingLabel,\n rel,\n shape = 'round',\n size: ownSize,\n target,\n variant = 'filled',\n ...props\n}: ButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n // A ButtonGroup or a SplitButton around the button hands it a size, its\n // shape at the group's inner edges and the press interaction; see\n // src/button/context.ts. A size named here still wins.\n const group = useContext(ButtonGroupItemContext);\n const size = ownSize ?? group?.size ?? 'md';\n // A group that selects is React Aria's ToggleButtonGroup, whose buttons\n // have to be toggles to take part in its selection.\n const inSelectingGroup = useContext(ToggleGroupStateContext) !== null;\n const grouped = groupPressHandlers(group, props.onPressStart, props.onPressEnd);\n const onPressEnd = grouped.onPressEnd ?? props.onPressEnd;\n const onPressStart = grouped.onPressStart ?? props.onPressStart;\n const selection = useSelection({\n defaultSelected,\n isSelected,\n onChange\n });\n // Whether a key holds the button down, which the ripple does not draw\n // until the key is released, so the pressed layer draws in its place.\n const [keyHeld, setKeyHeld] = useState(false);\n const press = {\n onPressEnd: (event: PressEvent) => {\n setKeyHeld(false);\n onPressEnd?.(event);\n },\n onPressStart: (event: PressEvent) => {\n setKeyHeld(event.pointerType === 'keyboard');\n onPressStart?.(event);\n }\n };\n const ripples = props.disableRipple !== true && !keyHeld;\n\n // The icon goes in with the label, inside what ButtonBase hides while the\n // button is pending, so the ring takes the place of both.\n const content = icon === undefined ? children : <>\n <span {...stylex.props(styles.icon, iconSizes[size])}>{icon}</span>\n {children}\n </>;\n\n // A selecting ButtonGroup around it makes it React Aria's ToggleButton, to\n // take part in the group's selection — a text button too, which draws its\n // selection by nothing but the group's shape. Whether a button sits in one\n // does not change from one render to the next.\n if (inSelectingGroup) {\n return <ToggleButtonBase {...props} {...press} classes={variant === 'text' ? buttonClasses(shape, size, variant, group, ripples) : toggleClasses(shape, size, variant, group, ripples)} isPending={isPending}>\n {content}\n </ToggleButtonBase>;\n }\n\n // The three props that make this a toggle on its own, read as IconButton\n // reads them, and on the same component as the plain button so a toggle\n // whose `isSelected` is still loading stays one element when it arrives.\n // The types keep them off a `text` button; the check here keeps a call\n // site that slipped past them a plain button, as it always was.\n const isToggle = variant !== 'text' && (defaultSelected !== undefined || isSelected !== undefined || onChange !== undefined);\n return <ButtonBase {...props} {...press} classes={isToggle ? toggleClasses(shape, size, variant, group, ripples) : buttonClasses(shape, size, variant, group, ripples)} href={href} isPending={isPending} isSelected={isToggle ? selection.selected : undefined} onPress={isToggle ? pressThen(props.onPress, selection.toggle) : props.onPress} pendingLabel={pendingLabel} rel={rel} target={target}>\n {content}\n </ButtonBase>;\n}\n\n// The button's own classes, from React Aria's render state — see the header\n// for why that and not the pseudo-classes, and for why a press drops the\n// hover layer and draws its own only where the ripple does not. Built by a\n// call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction buttonClasses(shape: ButtonShape, size: ButtonSize, variant: ButtonVariant, group: ButtonGroupItem | null, ripples: boolean) {\n return (state: ButtonClassesState) => stylex.props(styles.base, focus.ring, styles[variant], styles[size], shape === 'square' ? squareShapes[size] : roundShapes[size], variant === 'outlined' && outlinedSizes[size], state.isHovered && !state.isPressed && hovered[variant], state.isFocusVisible && focused[variant], state.isPressed && !ripples && pressed[variant], state.isPressed && pressedShapes[size], groupStyles(group, size, variant, state), state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]);\n}\n\n// What a group lays over the button: its own styles for the button's state,\n// and the standard group's widening or narrowing as extra inline padding,\n// half of the shift on either side.\nfunction groupStyles(group: ButtonGroupItem | null, size: ButtonSize, variant: ButtonVariant, state: ButtonState) {\n if (group === null) {\n return null;\n }\n const border = variant === 'outlined' ? OUTLINE_WIDTHS[size] : '0px';\n return [group.styles?.(state), group.shift !== 0 && shifted.padding(`calc(${PADDINGS[size]} - ${border} + ${group.shift / 2}px)`)];\n}\n\n// A toggle's classes: the plain button's, with the container and its layers\n// swapped for the toggle's pair, and the selected shape between the resting\n// and the pressed one. The variant's own style and layers still go first, for\n// the shadow and the rule they carry. Built by a call for the reason\n// `buttonClasses` is.\nfunction toggleClasses(shape: ButtonShape, size: ButtonSize, variant: ToggleVariant, group: ButtonGroupItem | null, ripples: boolean) {\n return (state: ButtonClassesState) => {\n const isSelected = state.isSelected === true;\n const container = toggleContainers[variant][isSelected ? 'selected' : 'unselected'];\n return stylex.props(styles.base, focus.ring, styles[variant], styles[container], styles[size], shape === 'square' ? squareShapes[size] : roundShapes[size], isSelected && (shape === 'square' ? roundShapes[size] : squareShapes[size]), variant === 'outlined' && outlinedSizes[size], state.isHovered && !state.isPressed && hovered[variant], state.isHovered && !state.isPressed && hovered[container], state.isFocusVisible && focused[variant], state.isFocusVisible && focused[container], state.isPressed && !ripples && pressed[variant], state.isPressed && !ripples && pressed[container], state.isPressed && pressedShapes[size], groupStyles(group, size, variant, state), state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && disabledStyles[variant]);\n };\n}\nexport type { ButtonDOMProps, ButtonProps, ButtonShape, ButtonSize, ButtonState, ButtonVariant };\nexport default Button;"],"mappings":";;;;;;;;;;;;;;AAkJA,MAAMW,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,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,UAAU;EACRlB,QAAQ;EACRiB,OAAO;CACT;CACAE,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,kBAAkB;EAChBH,QAAQ;EACRxB,QAAQ;EACRyB,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAO,wBAAwB;EACtBJ,QAAQ;EACRE,QAAQ;EACRL,OAAO;CACT;CACAQ,QAAQ;EACNL,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAS,gBAAgB;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MM,cAAc/H,OAAOyB,UAAUgG,MAAMM,cAAcpD,eAAeI,QAAQ;CACtxB;AACF"}
|
|
@@ -48,5 +48,4 @@ type ButtonGroupVariant = 'connected' | 'standard';
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
declare function ButtonGroup({ children, className, ref, selectionMode, shape, size, style, variant, ...props }: ButtonGroupProps): import("react").JSX.Element;
|
|
51
|
-
export { type ButtonGroupProps, type ButtonGroupVariant, ButtonGroup as default };
|
|
52
|
-
//# sourceMappingURL=index.d.ts.map
|
|
51
|
+
export { type ButtonGroupProps, type ButtonGroupVariant, ButtonGroup as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","CSSProperties","ReactNode","RefAttributes","ToggleButtonGroupProps","RACToggleButtonGroupProps","stylex","Children","isValidElement","useCallback","useState","ButtonContext","Group","RACGroup","ToggleButtonGroup","RACToggleButtonGroup","ButtonState","ButtonGroupItem","GroupSize","ButtonShape","ButtonSize","ButtonGroupItemContext","mergeStyles","radii","sizing","spacing","EXPANDED_RATIO","DISABLED","isDisabled","styles","group","kGNEyG","kB7OPa","k1xSpc","kwnvtZ","$$css","minimum","k7Eaqz","gaps","connected","kOIVth","lg","md","xl","xs","xxl","corners","shape","start","end","kT0f0o","kVL7Gh","kfmiAY","krdFHd","val","undefined","INNER","sm","ROUND","controlLg","controlSm","controlXl","controlXs","controlXxl","INNER_PRESSED","ButtonGroupProps","Omit","HTMLDivElement","children","className","selectionMode","size","style","variant","ButtonGroupVariant","Press","delta","index","ButtonGroup","t0","$","props","ref","t1","t2","press","setPress","groupProps","t3","items","toArray","filter","sized","t4","t5","Symbol","for","endPress","map","child","key","itemFor","count","length","content","t6","t7","connectedStyles","state","outer","inner","isPressed","isSelected","shift","onPressEnd","onPressStart","width","shiftFor","Math","abs","atEnd","_c","props","stylex.props","RACToggleButtonGroup","RACGroup"],"sources":["../../../src/components/button-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode, RefAttributes } from 'react';\nimport type { ToggleButtonGroupProps as RACToggleButtonGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, isValidElement, useCallback, useState } from 'react';\nimport { ButtonContext, Group as RACGroup, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { ButtonState } from '../../button';\nimport type { ButtonGroupItem, GroupSize } from '../../button/context';\nimport type { ButtonShape, ButtonSize } from '../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, sizing, spacing } from '../../tokens/design.tokens.stylex';\n\n// The button groups page's two groups, around Buttons and IconButtons placed\n// inside: the standard group, buttons set apart by the page's 18dp, 12dp, 8dp,\n// 8dp and 8dp across the sizes, and the connected group, buttons 2dp apart\n// whose inner corners square off — 4dp, 8dp, 8dp, 16dp and 20dp — while the\n// group's two ends keep the buttons' own round. A square connected group\n// takes the same corner at its ends. The group draws nothing itself; it\n// hands each button its size, its corners and its part in the press\n// interaction through src/button/context.ts.\n//\n// **A press is felt across a standard group.** The pressed button widens by\n// 15% of its width — the share Material Design's own group widens it by —\n// and its neighbours narrow to make the room, so the group's width holds:\n// both neighbours by half the gain each, or the one neighbour of a button at\n// the group's end by all of it. Button takes the change as inline padding\n// and IconButton as width, and both ease it over the motion tokens' short\n// duration.\n//\n// **A connected group answers a press and a selection in the corner\n// instead.** Its buttons stay where they are; a pressed one's inner corners\n// tighten, and a selected one's round off entirely. The page gives the\n// pressed corner for its small group alone, 4dp against the 8dp it rests at;\n// the other sizes press to half their resting corner the same way. The page\n// also gives XS and S buttons in a connected group a 48dp minimum width,\n// which is their touch target.\n//\n// Given `selectionMode` the group is React Aria's `ToggleButtonGroup`, which\n// makes every button in it a toggle and reports the selection by the\n// buttons' `id`s: a radio group for `single`, a toolbar for `multiple`.\n// Without it the group is React Aria's plain `Group`.\n\n// The press interaction's share, from Material Design's own button group.\nconst EXPANDED_RATIO = 0.15;\nconst DISABLED = {\n isDisabled: true\n};\nconst styles = {\n group: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kwnvtZ: \"xozqiw3\",\n $$css: true\n },\n minimum: {\n k7Eaqz: \"x900493\",\n $$css: true\n }\n};\n\n// The space between buttons, by variant and size. The standard group's 18dp\n// at XS falls between two steps of the spacing scale and is written out.\nconst gaps = {\n connected: {\n kOIVth: \"x14qo01y\",\n $$css: true\n },\n lg: {\n kOIVth: \"x126z3so\",\n $$css: true\n },\n md: {\n kOIVth: \"x1gka490\",\n $$css: true\n },\n xl: {\n kOIVth: \"x126z3so\",\n $$css: true\n },\n xs: {\n kOIVth: \"xaobbuh\",\n $$css: true\n },\n xxl: {\n kOIVth: \"x126z3so\",\n $$css: true\n }\n};\n\n// A connected button's corners on each side, set from the button's place in\n// the group and its state.\nconst corners = {\n shape: (start: string, end: string) => [{\n kT0f0o: end != null ? \"x1wsjk4f\" : end,\n kVL7Gh: start != null ? \"x1oq9ryg\" : start,\n kfmiAY: end != null ? \"xbsomw4\" : end,\n krdFHd: start != null ? \"x6pmj1i\" : start,\n $$css: true\n }, {\n \"--x-borderEndEndRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-borderEndStartRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start),\n \"--x-borderStartEndRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-borderStartStartRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start)\n }]\n};\n\n// The inner corner each size rests at, and the corner it presses to. The 20dp\n// at XL falls between two steps of the radius scale, and the two halves that\n// are not steps of it are written out too.\nconst INNER = {\n lg: radii.sm,\n md: radii.sm,\n xl: radii.lg,\n xs: radii.xs,\n xxl: '20px'\n};\n\n// The round end at each size: half the button's height. Not the pill's\n// 9999px: CSS scales every corner of a box down together when two on one\n// side add up to more than the side is long, so a 9999px end beside an 8px\n// inner corner shrank the inner one to nothing. Half the height fits as\n// written. A label that wraps makes a button taller than this, and its ends\n// a little less than round.\nconst ROUND = {\n lg: `calc(${sizing.controlLg} / 2)`,\n md: `calc(${sizing.controlSm} / 2)`,\n xl: `calc(${sizing.controlXl} / 2)`,\n xs: `calc(${sizing.controlXs} / 2)`,\n xxl: `calc(${sizing.controlXxl} / 2)`\n};\nconst INNER_PRESSED = {\n lg: radii.xs,\n md: radii.xs,\n xl: radii.sm,\n xs: '2px',\n xxl: '10px'\n};\ntype ButtonGroupProps = Omit<RACToggleButtonGroupProps, 'children' | 'className' | 'selectionMode' | 'style'> & RefAttributes<HTMLDivElement> & {\n /** The buttons: Buttons and IconButtons, each with an `id` in a group that selects. */\n children?: ReactNode;\n /** The class for the group's own element. */\n className?: string;\n /**\n * Makes the group select, as React Aria's `ToggleButtonGroup`: `single`\n * for one at a time, `multiple` for any number. Left out, the group's\n * buttons are plain buttons.\n */\n selectionMode?: RACToggleButtonGroupProps['selectionMode'];\n /**\n * The shape a connected group gives its two ends: `round`, the pill, or\n * `square`, the size's corner, which its inner corners take as well.\n * @default 'round'\n */\n shape?: ButtonShape;\n /**\n * The size every button in the group takes, unless it names its own, and\n * the size the group spaces and shapes them for.\n * @default 'md'\n */\n size?: ButtonSize;\n /** The style for the group's own element. */\n style?: CSSProperties;\n /**\n * `standard` sets the buttons apart and widens a pressed one; `connected`\n * sets them 2dp apart with square inner corners.\n * @default 'standard'\n */\n variant?: ButtonGroupVariant;\n};\ntype ButtonGroupVariant = 'connected' | 'standard';\ntype Press = {\n delta: number;\n index: number;\n};\n\n/**\n * A row of Buttons and IconButtons drawn as the button groups page's\n * standard or connected group. Given `selectionMode`, its buttons are\n * toggles whose selection the group keeps, by their `id`s.\n *\n * ```tsx\n * <ButtonGroup aria-label=\"Label\" selectionMode=\"single\" variant=\"connected\">\n * <Button id=\"first\">First item</Button>\n * <Button id=\"second\">Second item</Button>\n * <Button id=\"third\">Third item</Button>\n * </ButtonGroup>\n * ```\n */\nfunction ButtonGroup({\n children,\n className,\n ref,\n selectionMode,\n shape = 'round',\n size,\n style,\n variant = 'standard',\n ...props\n}: ButtonGroupProps) {\n const [press, setPress] = useState<null | Press>(null);\n const items = Children.toArray(children).filter(isValidElement);\n const sized = size ?? 'md';\n const groupProps = mergeStyles(stylex.props(styles.group, variant === 'connected' ? gaps.connected : gaps[sized]), {\n className,\n style\n });\n const endPress = useCallback(() => {\n setPress(null);\n }, []);\n const content = items.map((child, index) => <ButtonGroupItemContext key={child.key ?? index} value={itemFor({\n count: items.length,\n endPress,\n index,\n press,\n setPress,\n shape,\n size,\n variant\n })}>\n {child}\n </ButtonGroupItemContext>);\n if (selectionMode !== undefined) {\n return <RACToggleButtonGroup ref={ref} selectionMode={selectionMode} {...props} {...groupProps}>\n {content}\n </RACToggleButtonGroup>;\n }\n\n // A plain group disables its buttons through React Aria's own context,\n // which Button and IconButton read; a selecting one does it itself.\n return <RACGroup aria-label={props['aria-label']} aria-labelledby={props['aria-labelledby']} ref={ref} {...groupProps}>\n {props.isDisabled === true ? <ButtonContext value={DISABLED}>{content}</ButtonContext> : content}\n </RACGroup>;\n}\n\n// A connected button's corners: the group's ends keep the outer shape, and\n// every edge it shares with a neighbour takes the inner corner, tighter while\n// pressed and round once selected — a press wins over a selection.\nfunction connectedStyles(index: number, count: number, size: GroupSize, shape: ButtonShape, state: ButtonState) {\n const outer = shape === 'square' ? INNER[size] : ROUND[size];\n const inner = state.isPressed ? INNER_PRESSED[size] : state.isSelected === true ? ROUND[size] : INNER[size];\n const start = index === 0 ? outer : inner;\n const end = index === count - 1 ? outer : inner;\n return [corners.shape(start, end), (size === 'xs' || size === 'md') && styles.minimum];\n}\n\n// One button's part in the group: its size, its corners in a connected\n// group, and its share of a press in a standard one.\nfunction itemFor({\n count,\n endPress,\n index,\n press,\n setPress,\n shape,\n size,\n variant\n}: {\n count: number;\n endPress: () => void;\n index: number;\n press: null | Press;\n setPress: (press: Press) => void;\n shape: ButtonShape;\n size: GroupSize | undefined;\n variant: ButtonGroupVariant;\n}): ButtonGroupItem {\n const sized = size ?? 'md';\n if (variant === 'connected') {\n return {\n shift: 0,\n size,\n styles: (state: ButtonState) => connectedStyles(index, count, sized, shape, state)\n };\n }\n return {\n onPressEnd: endPress,\n onPressStart: (width: number) => {\n setPress({\n delta: width * EXPANDED_RATIO,\n index\n });\n },\n shift: shiftFor(index, count, press),\n size\n };\n}\n\n// How far a standard group moves one button's width while a press is held:\n// the pressed button gains the whole share, and its neighbours give it up —\n// half each, or all of it from the one neighbour of a button at an end.\nfunction shiftFor(index: number, count: number, press: null | Press) {\n if (press === null) {\n return 0;\n }\n if (index === press.index) {\n return press.delta;\n }\n if (Math.abs(index - press.index) !== 1) {\n return 0;\n }\n const atEnd = press.index === 0 || press.index === count - 1;\n return -(atEnd ? press.delta : press.delta / 2);\n}\nexport type { ButtonGroupProps, ButtonGroupVariant };\nexport default ButtonGroup;"],"mappings":";;;;;;;;;;AA8CA,MAAM2B,iBAAiB;AACvB,MAAMC,WAAW,EACfC,YAAY,KACd;AACA,MAAMC,SAAS;CACbC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,SAAS;EACPC,QAAQ;EACRF,OAAO;CACT;AACF;AAIA,MAAMG,OAAO;CACXC,WAAW;EACTC,QAAQ;EACRL,OAAO;CACT;CACAM,IAAI;EACFD,QAAQ;EACRL,OAAO;CACT;CACAO,IAAI;EACFF,QAAQ;EACRL,OAAO;CACT;CACAQ,IAAI;EACFH,QAAQ;EACRL,OAAO;CACT;CACAS,IAAI;EACFJ,QAAQ;EACRL,OAAO;CACT;CACAU,KAAK;EACHL,QAAQ;EACRL,OAAO;CACT;AACF;AAIA,MAAMW,UAAU,EACdC,QAAQC,OAAeC,QAAgB,CAAC;CACtCC,QAAQD,OAAO,OAAO,aAAaA;CACnCE,QAAQH,S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,EACfC,OACAL,UACApB,OACAQ,OACAC,UACAvC,OACAwB,MACAE,WAUkB;CAClB,MAAMmB,QAAQrB,QAAQ;CACtB,IAAIE,YAAY,aACd,OAAO;EACLwC,OAAO;EACP1C;EACA1C,SAAS+E,UAAuBD,gBAAgB9B,OAAOyB,OAAOV,OAAO7C,OAAO6D,KAAK;CACnF;CAEF,OAAO;EACLM,YAAYjB;EACZkB,eAAeC,UAAkB;GAC/B9B,SAAS;IACPV,OAAOwC,QAAQ1F;IACfmD;GACF,CAAC;EACH;EACAoC,OAAOI,SAASxC,OAAOyB,OAAOjB,KAAK;EACnCd;CACF;AACF;AAKA,SAAS8C,SAASxC,OAAeyB,OAAejB,OAAqB;CACnE,IAAIA,UAAU,MACZ,OAAO;CAET,IAAIR,UAAUQ,MAAMR,OAClB,OAAOQ,MAAMT;CAEf,IAAI0C,KAAKC,IAAI1C,QAAQQ,MAAMR,KAAK,MAAM,GACpC,OAAO;CAGT,OAAO,EADOQ,MAAMR,UAAU,KAAKQ,MAAMR,UAAUyB,QAAQ,IAC1CjB,MAAMT,QAAQS,MAAMT,QAAQ;AAC/C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","Children","isValidElement","useState","mergeStyles","radii","sizing","EXPANDED_RATIO","DISABLED","isDisabled","styles","group","kGNEyG","kB7OPa","k1xSpc","kwnvtZ","$$css","minimum","k7Eaqz","gaps","connected","kOIVth","lg","md","xl","xs","xxl","corners","shape","start","end","kT0f0o","kVL7Gh","kfmiAY","krdFHd","val","undefined","INNER","sm","ROUND","controlLg","controlSm","controlXl","controlXs","controlXxl","INNER_PRESSED","children","className","selectionMode","size","style","variant","delta","index","ButtonGroup","t0","$","props","ref","t1","t2","press","setPress","groupProps","t3","items","toArray","filter","sized","t4","t5","Symbol","for","endPress","map","child","key","itemFor","count","length","content","t6","t7","connectedStyles","state","outer","inner","isPressed","isSelected","shift","onPressEnd","onPressStart","width","shiftFor","Math","abs","RACToggleButtonGroup","RACGroup"],"sources":["../../../src/components/button-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode, RefAttributes } from 'react';\nimport type { ToggleButtonGroupProps as RACToggleButtonGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Children, isValidElement, useCallback, useState } from 'react';\nimport { ButtonContext, Group as RACGroup, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { ButtonState } from '../../button';\nimport type { ButtonGroupItem, GroupSize } from '../../button/context';\nimport type { ButtonShape, ButtonSize } from '../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, sizing, spacing } from '../../tokens/design.tokens.stylex';\n\n// The button groups page's two groups, around Buttons and IconButtons placed\n// inside: the standard group, buttons set apart by the page's 18dp, 12dp, 8dp,\n// 8dp and 8dp across the sizes, and the connected group, buttons 2dp apart\n// whose inner corners square off — 4dp, 8dp, 8dp, 16dp and 20dp — while the\n// group's two ends keep the buttons' own round. A square connected group\n// takes the same corner at its ends. The group draws nothing itself; it\n// hands each button its size, its corners and its part in the press\n// interaction through src/button/context.ts.\n//\n// **A press is felt across a standard group.** The pressed button widens by\n// 15% of its width — the share Material Design's own group widens it by —\n// and its neighbours narrow to make the room, so the group's width holds:\n// both neighbours by half the gain each, or the one neighbour of a button at\n// the group's end by all of it. Button takes the change as inline padding\n// and IconButton as width, and both ease it over the motion tokens' short\n// duration.\n//\n// **A connected group answers a press and a selection in the corner\n// instead.** Its buttons stay where they are; a pressed one's inner corners\n// tighten, and a selected one's round off entirely. The page gives the\n// pressed corner for its small group alone, 4dp against the 8dp it rests at;\n// the other sizes press to half their resting corner the same way. The page\n// also gives XS and S buttons in a connected group a 48dp minimum width,\n// which is their touch target.\n//\n// Given `selectionMode` the group is React Aria's `ToggleButtonGroup`, which\n// makes every button in it a toggle and reports the selection by the\n// buttons' `id`s: a radio group for `single`, a toolbar for `multiple`.\n// Without it the group is React Aria's plain `Group`.\n\n// The press interaction's share, from Material Design's own button group.\nconst EXPANDED_RATIO = 0.15;\nconst DISABLED = {\n isDisabled: true\n};\nconst styles = {\n group: {\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x3nfvp2\",\n kwnvtZ: \"xozqiw3\",\n $$css: true\n },\n minimum: {\n k7Eaqz: \"x900493\",\n $$css: true\n }\n};\n\n// The space between buttons, by variant and size. The standard group's 18dp\n// at XS falls between two steps of the spacing scale and is written out.\nconst gaps = {\n connected: {\n kOIVth: \"x14qo01y\",\n $$css: true\n },\n lg: {\n kOIVth: \"x126z3so\",\n $$css: true\n },\n md: {\n kOIVth: \"x1gka490\",\n $$css: true\n },\n xl: {\n kOIVth: \"x126z3so\",\n $$css: true\n },\n xs: {\n kOIVth: \"xaobbuh\",\n $$css: true\n },\n xxl: {\n kOIVth: \"x126z3so\",\n $$css: true\n }\n};\n\n// A connected button's corners on each side, set from the button's place in\n// the group and its state.\nconst corners = {\n shape: (start: string, end: string) => [{\n kT0f0o: end != null ? \"x1wsjk4f\" : end,\n kVL7Gh: start != null ? \"x1oq9ryg\" : start,\n kfmiAY: end != null ? \"xbsomw4\" : end,\n krdFHd: start != null ? \"x6pmj1i\" : start,\n $$css: true\n }, {\n \"--x-borderEndEndRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-borderEndStartRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start),\n \"--x-borderStartEndRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(end),\n \"--x-borderStartStartRadius\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(start)\n }]\n};\n\n// The inner corner each size rests at, and the corner it presses to. The 20dp\n// at XL falls between two steps of the radius scale, and the two halves that\n// are not steps of it are written out too.\nconst INNER = {\n lg: radii.sm,\n md: radii.sm,\n xl: radii.lg,\n xs: radii.xs,\n xxl: '20px'\n};\n\n// The round end at each size: half the button's height. Not the pill's\n// 9999px: CSS scales every corner of a box down together when two on one\n// side add up to more than the side is long, so a 9999px end beside an 8px\n// inner corner shrank the inner one to nothing. Half the height fits as\n// written. A label that wraps makes a button taller than this, and its ends\n// a little less than round.\nconst ROUND = {\n lg: `calc(${sizing.controlLg} / 2)`,\n md: `calc(${sizing.controlSm} / 2)`,\n xl: `calc(${sizing.controlXl} / 2)`,\n xs: `calc(${sizing.controlXs} / 2)`,\n xxl: `calc(${sizing.controlXxl} / 2)`\n};\nconst INNER_PRESSED = {\n lg: radii.xs,\n md: radii.xs,\n xl: radii.sm,\n xs: '2px',\n xxl: '10px'\n};\ntype ButtonGroupProps = Omit<RACToggleButtonGroupProps, 'children' | 'className' | 'selectionMode' | 'style'> & RefAttributes<HTMLDivElement> & {\n /** The buttons: Buttons and IconButtons, each with an `id` in a group that selects. */\n children?: ReactNode;\n /** The class for the group's own element. */\n className?: string;\n /**\n * Makes the group select, as React Aria's `ToggleButtonGroup`: `single`\n * for one at a time, `multiple` for any number. Left out, the group's\n * buttons are plain buttons.\n */\n selectionMode?: RACToggleButtonGroupProps['selectionMode'];\n /**\n * The shape a connected group gives its two ends: `round`, the pill, or\n * `square`, the size's corner, which its inner corners take as well.\n * @default 'round'\n */\n shape?: ButtonShape;\n /**\n * The size every button in the group takes, unless it names its own, and\n * the size the group spaces and shapes them for.\n * @default 'md'\n */\n size?: ButtonSize;\n /** The style for the group's own element. */\n style?: CSSProperties;\n /**\n * `standard` sets the buttons apart and widens a pressed one; `connected`\n * sets them 2dp apart with square inner corners.\n * @default 'standard'\n */\n variant?: ButtonGroupVariant;\n};\ntype ButtonGroupVariant = 'connected' | 'standard';\ntype Press = {\n delta: number;\n index: number;\n};\n\n/**\n * A row of Buttons and IconButtons drawn as the button groups page's\n * standard or connected group. Given `selectionMode`, its buttons are\n * toggles whose selection the group keeps, by their `id`s.\n *\n * ```tsx\n * <ButtonGroup aria-label=\"Label\" selectionMode=\"single\" variant=\"connected\">\n * <Button id=\"first\">First item</Button>\n * <Button id=\"second\">Second item</Button>\n * <Button id=\"third\">Third item</Button>\n * </ButtonGroup>\n * ```\n */\nfunction ButtonGroup({\n children,\n className,\n ref,\n selectionMode,\n shape = 'round',\n size,\n style,\n variant = 'standard',\n ...props\n}: ButtonGroupProps) {\n const [press, setPress] = useState<null | Press>(null);\n const items = Children.toArray(children).filter(isValidElement);\n const sized = size ?? 'md';\n const groupProps = mergeStyles(stylex.props(styles.group, variant === 'connected' ? gaps.connected : gaps[sized]), {\n className,\n style\n });\n const endPress = useCallback(() => {\n setPress(null);\n }, []);\n const content = items.map((child, index) => <ButtonGroupItemContext key={child.key ?? index} value={itemFor({\n count: items.length,\n endPress,\n index,\n press,\n setPress,\n shape,\n size,\n variant\n })}>\n {child}\n </ButtonGroupItemContext>);\n if (selectionMode !== undefined) {\n return <RACToggleButtonGroup ref={ref} selectionMode={selectionMode} {...props} {...groupProps}>\n {content}\n </RACToggleButtonGroup>;\n }\n\n // A plain group disables its buttons through React Aria's own context,\n // which Button and IconButton read; a selecting one does it itself.\n return <RACGroup aria-label={props['aria-label']} aria-labelledby={props['aria-labelledby']} ref={ref} {...groupProps}>\n {props.isDisabled === true ? <ButtonContext value={DISABLED}>{content}</ButtonContext> : content}\n </RACGroup>;\n}\n\n// A connected button's corners: the group's ends keep the outer shape, and\n// every edge it shares with a neighbour takes the inner corner, tighter while\n// pressed and round once selected — a press wins over a selection.\nfunction connectedStyles(index: number, count: number, size: GroupSize, shape: ButtonShape, state: ButtonState) {\n const outer = shape === 'square' ? INNER[size] : ROUND[size];\n const inner = state.isPressed ? INNER_PRESSED[size] : state.isSelected === true ? ROUND[size] : INNER[size];\n const start = index === 0 ? outer : inner;\n const end = index === count - 1 ? outer : inner;\n return [corners.shape(start, end), (size === 'xs' || size === 'md') && styles.minimum];\n}\n\n// One button's part in the group: its size, its corners in a connected\n// group, and its share of a press in a standard one.\nfunction itemFor({\n count,\n endPress,\n index,\n press,\n setPress,\n shape,\n size,\n variant\n}: {\n count: number;\n endPress: () => void;\n index: number;\n press: null | Press;\n setPress: (press: Press) => void;\n shape: ButtonShape;\n size: GroupSize | undefined;\n variant: ButtonGroupVariant;\n}): ButtonGroupItem {\n const sized = size ?? 'md';\n if (variant === 'connected') {\n return {\n shift: 0,\n size,\n styles: (state: ButtonState) => connectedStyles(index, count, sized, shape, state)\n };\n }\n return {\n onPressEnd: endPress,\n onPressStart: (width: number) => {\n setPress({\n delta: width * EXPANDED_RATIO,\n index\n });\n },\n shift: shiftFor(index, count, press),\n size\n };\n}\n\n// How far a standard group moves one button's width while a press is held:\n// the pressed button gains the whole share, and its neighbours give it up —\n// half each, or all of it from the one neighbour of a button at an end.\nfunction shiftFor(index: number, count: number, press: null | Press) {\n if (press === null) {\n return 0;\n }\n if (index === press.index) {\n return press.delta;\n }\n if (Math.abs(index - press.index) !== 1) {\n return 0;\n }\n const atEnd = press.index === 0 || press.index === count - 1;\n return -(atEnd ? press.delta : press.delta / 2);\n}\nexport type { ButtonGroupProps, ButtonGroupVariant };\nexport default ButtonGroup;"],"mappings":";;;;;;;;;;AA8CA,MAAMQ,iBAAiB;AACvB,MAAMC,WAAW,EACfC,YAAY,KACd;AACA,MAAMC,SAAS;CACbC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,SAAS;EACPC,QAAQ;EACRF,OAAO;CACT;AACF;AAIA,MAAMG,OAAO;CACXC,WAAW;EACTC,QAAQ;EACRL,OAAO;CACT;CACAM,IAAI;EACFD,QAAQ;EACRL,OAAO;CACT;CACAO,IAAI;EACFF,QAAQ;EACRL,OAAO;CACT;CACAQ,IAAI;EACFH,QAAQ;EACRL,OAAO;CACT;CACAS,IAAI;EACFJ,QAAQ;EACRL,OAAO;CACT;CACAU,KAAK;EACHL,QAAQ;EACRL,OAAO;CACT;AACF;AAIA,MAAMW,UAAU,EACdC,QAAQC,OAAeC,QAAgB,CAAC;CACtC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ACvF;AAIA,SAAS4D,QAAQ,EACfC,OACAL,UACApB,OACAQ,OACAC,UACAlC,OACAqB,MACAE,WAUkB;CAClB,MAAMiB,QAAQnB,QAAQ;CACtB,IAAIE,YAAY,aACd,OAAO;EACLsC,OAAO;EACPxC;EACAvC,SAAS0E,UAAuBD,gBAAgB9B,OAAOyB,OAAOV,OAAOxC,OAAOwD,KAAK;CACnF;CAEF,OAAO;EACLM,YAAYjB;EACZkB,eAAeC,UAAkB;GAC/B9B,SAAS;IACPV,OAAOwC,QAAQrF;IACf8C;GACF,CAAC;EACH;EACAoC,OAAOI,SAASxC,OAAOyB,OAAOjB,KAAK;EACnCZ;CACF;AACF;AAKA,SAAS4C,SAASxC,OAAeyB,OAAejB,OAAqB;CACnE,IAAIA,UAAU,MACZ,OAAO;CAET,IAAIR,UAAUQ,MAAMR,OAClB,OAAOQ,MAAMT;CAEf,IAAI0C,KAAKC,IAAI1C,QAAQQ,MAAMR,KAAK,MAAM,GACpC,OAAO;CAGT,OAAO,EADOQ,MAAMR,UAAU,KAAKQ,MAAMR,UAAUyB,QAAQ,IAC1CjB,MAAMT,QAAQS,MAAMT,QAAQ;AAC/C"}
|
|
@@ -49,5 +49,4 @@ type CalendarProps$1<T extends DateValue = DateValue> = {
|
|
|
49
49
|
* element a layout positions.
|
|
50
50
|
*/
|
|
51
51
|
declare function Calendar$1<T extends DateValue>({ error, showMonthYearMenus, ...props }: CalendarProps$1<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
52
|
-
export { type CalendarProps$1 as CalendarProps, Calendar$1 as default };
|
|
53
|
-
//# sourceMappingURL=index.d.ts.map
|
|
52
|
+
export { type CalendarProps$1 as CalendarProps, Calendar$1 as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","CalendarDate","ReactElement","RefAttributes","CalendarCellRenderProps","CalendarRenderProps","DateValue","CalendarProps","RACCalendarProps","isSameDay","stylex","useContext","CalendarStateContext","Calendar","RACCalendar","CalendarCell","RACCalendarCell","Text","RACText","CalendarFrame","CalendarMonths","calendarStyles","dateLayers","invalidFrom","fieldChromeStyles","focus","mergeStatefulStyles","className","T","error","showMonthYearMenus","style","Omit","CalendarStates","isHeldWhileDisabled","isReadOnly","t0","$","T0","props","t1","t2","t3","t4","t5","t6","undefined","root","visibleDuration","months","isInvalid","gridCell","message","messageError","cellClassName","state","calendar","cell","ring","isToday","cellToday","isSelected","cellSelected","cellInvalid","cellReadOnly","isHovered","hoveredLayer","isPressed","pressedLayer","isUnavailable","cellUnavailable","isDisabled","cellDisabled","isOutsideMonth","cellSelectedDisabled","cellClassNameIn","DateCell","date","holds","value","held","some","entry","plainHovered","invalidHovered","selectedHovered","plainPressed","invalidPressed","selectedPressed","Calendar","_c","props","RACCalendar","stylex.props","RACText","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 { CalendarCellRenderProps, CalendarRenderProps, DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport { isSameDay } from '@internationalized/date';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CalendarStateContext, Calendar as RACCalendar, CalendarCell as RACCalendarCell, Text as RACText } from 'react-aria-components';\nimport { CalendarFrame, CalendarMonths } from '../../calendar';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { invalidFrom } from '../../field/root';\nimport { fieldChromeStyles } from '../../field/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// `showMonthYearMenus` draws the page's docked header instead of one heading:\n// the month's menu button between the chevrons that step it and the year's\n// after them, each opening its list where the grid was. The parts are in\n// `src/calendar`, shared with RangeCalendar.\n//\n// The calendar's own disabled, read-only and invalid states are drawn on its\n// dates, from React Aria's calendar state rather than each date's, since\n// that is the one place all three are known:\n//\n// - **Disabled** fades every date, the weekday row, the chevrons and the\n// menu buttons to the page's 38%, and keeps the date it holds as a\n// disabled filled circle — React Aria stops calling a disabled date\n// selected, which left the calendar looking empty.\n// - **Read-only** keeps every date at full strength, since it still reports\n// a value, but drops the pointer and the state layers from the dates, which\n// a press no longer changes. The chevrons and the menus still move the\n// month, so they keep theirs.\n// - **Invalid** draws the date held in the error container roles, and\n// `error` writes the reason under the months in the field's supporting\n// type and error colour. Each date React Aria marks invalid points\n// `aria-describedby` at it, so a screen reader hears why as well as that.\n//\n// Five things are this component's own.\n//\n// **The year menu has no chevrons of its own.** The page draws a pair either\n// side of it that step a year, which would need two names React Aria has no\n// message for — the library writes a word of its own only behind a prop that\n// can replace it, and it would take a pair on four components. The year list\n// reaches any year within a century of the one shown in one press, or any\n// the bounds allow where they are closer, and Shift with Page Up or Page\n// Down steps a year from the keyboard.\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 circle is the element, centred in a 48dp column and a 48dp\n// row — the pitch Compose lays its days at — and a transparent box reaching\n// the 4dp past it on every side makes the whole square the press target,\n// rather than a 48dp box with a 40dp box inside it. The chevrons and the\n// month and year menu buttons reach a 48dp target the same way.\n//\n// **It narrows to its container.** The page's docked calendar is 360dp, and\n// a compact window leaves 328dp between its margins, so the calendar is 360\n// at most and the columns share whatever is left below that. Under about\n// 304dp of content a column is narrower than its 40dp circle, and the\n// circles of neighbouring dates meet.\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> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /**\n * The message shown under the months, which also marks the calendar\n * invalid: the date it holds turns to the error container colours, and\n * React Aria points that date's description at the message. `isInvalid`\n * on its own marks the date with no message.\n */\n error?: string;\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as the docked date picker's\n * header does, rather than one heading between the chevrons. For a date\n * far from the one shown, such as a date of birth: the year list runs a\n * century either side of the year shown, or to `minValue` and `maxValue`\n * where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n} & Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n/** What a date's classes read off the calendar around it. */\ntype CalendarStates = {\n /**\n * Whether this date is the one a disabled calendar holds, inside its\n * bounds. A copy of it in a neighbouring month's grid is told apart by\n * React Aria's own `isOutsideMonth`.\n */\n isHeldWhileDisabled: boolean;\n isReadOnly: boolean;\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, stacked below the expanded breakpoint with each month named over\n * its grid. 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>({\n error,\n showMonthYearMenus = false,\n ...props\n}: CalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACCalendar<T> isInvalid={invalidFrom(error)} {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n {({\n isInvalid\n }: CalendarRenderProps) => <>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <CalendarMonths months={props.visibleDuration?.months ?? 1}>\n {gridCell}\n </CalendarMonths>\n </CalendarFrame>\n {/*\n * Through React Aria's error slot, which gives it the id an\n * invalid date's `aria-describedby` names. Drawn only while the\n * calendar is invalid: React Aria looks for the element when\n * `isInvalid` changes, which is when this appears and goes.\n */}\n {isInvalid && error !== undefined ? <RACText slot=\"errorMessage\" {...stylex.props(fieldChromeStyles.message, fieldChromeStyles.messageError)}>\n {error}\n </RACText> : null}\n </>}\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state and the calendar's.\n// StyleX cannot target `[data-selected]` on the element it is styling, so the\n// state comes from 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 — and `invalid` after `selected`,\n// which it repaints. The hover and pressed layers come next, over whichever\n// ground the date has, a press over a hover. A read-only calendar takes no\n// hover layer, and React Aria reports no press there to draw one for.\n// `unavailable` and `disabled` come last, and StyleX replaces a property\n// whole, so they take the layers with them; the date a disabled calendar\n// holds then puts its disabled circle back.\nfunction cellClassName(state: CalendarCellRenderProps, calendar: CalendarStates) {\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isSelected && state.isInvalid && calendarStyles.cellInvalid, calendar.isReadOnly && calendarStyles.cellReadOnly, !calendar.isReadOnly && state.isHovered && hoveredLayer(state), state.isPressed && pressedLayer(state), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled, calendar.isHeldWhileDisabled && !state.isOutsideMonth && calendarStyles.cellSelectedDisabled).className ?? '';\n}\n\n// The calendar's part of a date's classes, bound once per date. Built by a\n// call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after.\nfunction cellClassNameIn(calendar: CalendarStates) {\n return (state: CalendarCellRenderProps) => cellClassName(state, calendar);\n}\n\n/**\n * One date. React Aria's cell, with what its classes need from the calendar\n * read from React Aria's calendar state: whether it is read-only, and the\n * date it holds, which React Aria hides from the cell itself once the\n * calendar is disabled.\n *\n * Held means what React Aria would have called selected with the calendar\n * enabled: the value, inside the bounds, and in its own month's grid rather\n * than a neighbour's, which the classes check.\n */\nfunction DateCell({\n date\n}: {\n date: CalendarDate;\n}): ReactElement {\n const calendar = useContext(CalendarStateContext);\n const isHeldWhileDisabled = calendar !== null && calendar.isDisabled && !calendar.isInvalid(date) && holds(calendar.value, date);\n return <RACCalendarCell className={cellClassNameIn({\n isHeldWhileDisabled,\n isReadOnly: calendar?.isReadOnly ?? false\n })} date={date} />;\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <DateCell date={date} />;\n}\n\n// Whether a calendar's value includes a date: one date, or several where the\n// calendar takes more than one.\nfunction holds(value: CalendarDate | null | readonly (CalendarDate | null)[], date: CalendarDate) {\n const held = value !== null && 'length' in value ? value : [value];\n return held.some(entry => entry !== null && isSameDay(entry, date));\n}\nfunction hoveredLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainHovered;\n }\n return state.isInvalid ? dateLayers.invalidHovered : dateLayers.selectedHovered;\n}\nfunction pressedLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainPressed;\n }\n return state.isInvalid ? dateLayers.invalidPressed : dateLayers.selectedPressed;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwJA,SAAAc,WAAAuB,IAAA;CAAA,MAAAC,IAAArC,EAAA,EAAA;CAAA,IAAAsC;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAuC,MAAA,EAAAP,OAAAc,IAAAb,oBAAAc,IAAA,GAAAC,OAAAT;EAAAP,QAAAc;EAAAJ,UAAAM;EAErCf,qBAAAc,OAAAE,KAAAA,IAAA,QAAAF;EAGQN,KAAAxB;EAAW,IAAAuB,EAAA,OAAAR,OAAA;GAAeW,KAAAjB,YAAYM,KAAK;GAACQ,EAAA,KAAAR;GAAAQ,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAME,KAAAA;EAAWG,KAAAhB,oBAAoBhB,MAAaW,eAAc0B,IAAK,GAAGR,OAAK;EAACF,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAR;EAAAQ,EAAA,KAAAE;EAAAF,EAAA,KAAAP;EAAAO,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAA;EAAAJ,KAAAD,EAAA;EAAAR,QAAAQ,EAAA;EAAAE,UAAAF,EAAA;EAAAP,qBAAAO,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;EAAAK,KAAAL,EAAA;CAAA;CAAA,IAAAM;CAAA,IAAAN,EAAA,QAAAR,SAAAQ,EAAA,QAAAE,QAAAS,iBAA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AAC,UAAD,EAAgBA,KAAK,CAAA;AAC9B;AAIA,SAASC,MAAMC,OAA+DF,MAAoB;CAEhG,QADaE,UAAU,QAAQ,YAAYA,QAAQA,QAAQ,CAACA,KAAK,EAAA,CACrDE,MAAKC,UAASA,UAAU,QAAQzE,UAAUyE,OAAOL,IAAI,CAAC;AACpE;AACA,SAASX,aAAaX,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAOvC,WAAW6D;CAEpB,OAAO5B,MAAML,YAAY5B,WAAW8D,iBAAiB9D,WAAW+D;AAClE;AACA,SAASjB,aAAab,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAOvC,WAAWgE;CAEpB,OAAO/B,MAAML,YAAY5B,WAAWiE,iBAAiBjE,WAAWkE;AAClE"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","isSameDay","stylex","useContext","CalendarStateContext","Calendar","RACCalendar","RACCalendarCell","calendarStyles","dateLayers","invalidFrom","fieldChromeStyles","focus","mergeStatefulStyles","className","error","showMonthYearMenus","isHeldWhileDisabled","isReadOnly","t0","$","T0","props","t1","t2","t3","t4","t5","t6","undefined","root","visibleDuration","months","isInvalid","gridCell","message","messageError","cellClassName","state","calendar","cell","ring","isToday","cellToday","isSelected","cellSelected","cellInvalid","cellReadOnly","isHovered","hoveredLayer","isPressed","pressedLayer","isUnavailable","cellUnavailable","isDisabled","cellDisabled","isOutsideMonth","cellSelectedDisabled","cellClassNameIn","DateCell","date","holds","value","some","entry","plainHovered","invalidHovered","selectedHovered","plainPressed","invalidPressed","selectedPressed","RACText"],"sources":["../../../src/components/calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { CalendarCellRenderProps, CalendarRenderProps, DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport { isSameDay } from '@internationalized/date';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CalendarStateContext, Calendar as RACCalendar, CalendarCell as RACCalendarCell, Text as RACText } from 'react-aria-components';\nimport { CalendarFrame, CalendarMonths } from '../../calendar';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { invalidFrom } from '../../field/root';\nimport { fieldChromeStyles } from '../../field/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// `showMonthYearMenus` draws the page's docked header instead of one heading:\n// the month's menu button between the chevrons that step it and the year's\n// after them, each opening its list where the grid was. The parts are in\n// `src/calendar`, shared with RangeCalendar.\n//\n// The calendar's own disabled, read-only and invalid states are drawn on its\n// dates, from React Aria's calendar state rather than each date's, since\n// that is the one place all three are known:\n//\n// - **Disabled** fades every date, the weekday row, the chevrons and the\n// menu buttons to the page's 38%, and keeps the date it holds as a\n// disabled filled circle — React Aria stops calling a disabled date\n// selected, which left the calendar looking empty.\n// - **Read-only** keeps every date at full strength, since it still reports\n// a value, but drops the pointer and the state layers from the dates, which\n// a press no longer changes. The chevrons and the menus still move the\n// month, so they keep theirs.\n// - **Invalid** draws the date held in the error container roles, and\n// `error` writes the reason under the months in the field's supporting\n// type and error colour. Each date React Aria marks invalid points\n// `aria-describedby` at it, so a screen reader hears why as well as that.\n//\n// Five things are this component's own.\n//\n// **The year menu has no chevrons of its own.** The page draws a pair either\n// side of it that step a year, which would need two names React Aria has no\n// message for — the library writes a word of its own only behind a prop that\n// can replace it, and it would take a pair on four components. The year list\n// reaches any year within a century of the one shown in one press, or any\n// the bounds allow where they are closer, and Shift with Page Up or Page\n// Down steps a year from the keyboard.\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 circle is the element, centred in a 48dp column and a 48dp\n// row — the pitch Compose lays its days at — and a transparent box reaching\n// the 4dp past it on every side makes the whole square the press target,\n// rather than a 48dp box with a 40dp box inside it. The chevrons and the\n// month and year menu buttons reach a 48dp target the same way.\n//\n// **It narrows to its container.** The page's docked calendar is 360dp, and\n// a compact window leaves 328dp between its margins, so the calendar is 360\n// at most and the columns share whatever is left below that. Under about\n// 304dp of content a column is narrower than its 40dp circle, and the\n// circles of neighbouring dates meet.\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> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /**\n * The message shown under the months, which also marks the calendar\n * invalid: the date it holds turns to the error container colours, and\n * React Aria points that date's description at the message. `isInvalid`\n * on its own marks the date with no message.\n */\n error?: string;\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as the docked date picker's\n * header does, rather than one heading between the chevrons. For a date\n * far from the one shown, such as a date of birth: the year list runs a\n * century either side of the year shown, or to `minValue` and `maxValue`\n * where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n} & Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n/** What a date's classes read off the calendar around it. */\ntype CalendarStates = {\n /**\n * Whether this date is the one a disabled calendar holds, inside its\n * bounds. A copy of it in a neighbouring month's grid is told apart by\n * React Aria's own `isOutsideMonth`.\n */\n isHeldWhileDisabled: boolean;\n isReadOnly: boolean;\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, stacked below the expanded breakpoint with each month named over\n * its grid. 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>({\n error,\n showMonthYearMenus = false,\n ...props\n}: CalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACCalendar<T> isInvalid={invalidFrom(error)} {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n {({\n isInvalid\n }: CalendarRenderProps) => <>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <CalendarMonths months={props.visibleDuration?.months ?? 1}>\n {gridCell}\n </CalendarMonths>\n </CalendarFrame>\n {/*\n * Through React Aria's error slot, which gives it the id an\n * invalid date's `aria-describedby` names. Drawn only while the\n * calendar is invalid: React Aria looks for the element when\n * `isInvalid` changes, which is when this appears and goes.\n */}\n {isInvalid && error !== undefined ? <RACText slot=\"errorMessage\" {...stylex.props(fieldChromeStyles.message, fieldChromeStyles.messageError)}>\n {error}\n </RACText> : null}\n </>}\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state and the calendar's.\n// StyleX cannot target `[data-selected]` on the element it is styling, so the\n// state comes from 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 — and `invalid` after `selected`,\n// which it repaints. The hover and pressed layers come next, over whichever\n// ground the date has, a press over a hover. A read-only calendar takes no\n// hover layer, and React Aria reports no press there to draw one for.\n// `unavailable` and `disabled` come last, and StyleX replaces a property\n// whole, so they take the layers with them; the date a disabled calendar\n// holds then puts its disabled circle back.\nfunction cellClassName(state: CalendarCellRenderProps, calendar: CalendarStates) {\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isSelected && state.isInvalid && calendarStyles.cellInvalid, calendar.isReadOnly && calendarStyles.cellReadOnly, !calendar.isReadOnly && state.isHovered && hoveredLayer(state), state.isPressed && pressedLayer(state), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled, calendar.isHeldWhileDisabled && !state.isOutsideMonth && calendarStyles.cellSelectedDisabled).className ?? '';\n}\n\n// The calendar's part of a date's classes, bound once per date. Built by a\n// call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after.\nfunction cellClassNameIn(calendar: CalendarStates) {\n return (state: CalendarCellRenderProps) => cellClassName(state, calendar);\n}\n\n/**\n * One date. React Aria's cell, with what its classes need from the calendar\n * read from React Aria's calendar state: whether it is read-only, and the\n * date it holds, which React Aria hides from the cell itself once the\n * calendar is disabled.\n *\n * Held means what React Aria would have called selected with the calendar\n * enabled: the value, inside the bounds, and in its own month's grid rather\n * than a neighbour's, which the classes check.\n */\nfunction DateCell({\n date\n}: {\n date: CalendarDate;\n}): ReactElement {\n const calendar = useContext(CalendarStateContext);\n const isHeldWhileDisabled = calendar !== null && calendar.isDisabled && !calendar.isInvalid(date) && holds(calendar.value, date);\n return <RACCalendarCell className={cellClassNameIn({\n isHeldWhileDisabled,\n isReadOnly: calendar?.isReadOnly ?? false\n })} date={date} />;\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <DateCell date={date} />;\n}\n\n// Whether a calendar's value includes a date: one date, or several where the\n// calendar takes more than one.\nfunction holds(value: CalendarDate | null | readonly (CalendarDate | null)[], date: CalendarDate) {\n const held = value !== null && 'length' in value ? value : [value];\n return held.some(entry => entry !== null && isSameDay(entry, date));\n}\nfunction hoveredLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainHovered;\n }\n return state.isInvalid ? dateLayers.invalidHovered : dateLayers.selectedHovered;\n}\nfunction pressedLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainPressed;\n }\n return state.isInvalid ? dateLayers.invalidPressed : dateLayers.selectedPressed;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwJA,SAAAK,WAAAc,IAAA;CAAA,MAAAC,IAAApB,EAAA,EAAA;CAAA,IAAAqB;CAAA,IAAAN;CAAA,IAAAO;CAAA,IAAAN;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAuC,MAAA,EAAAJ,OAAAW,IAAAV,oBAAAW,IAAA,GAAAC,OAAAT;EAAAJ,QAAAW;EAAAJ,UAAAM;EAErCZ,qBAAAW,OAAAE,KAAAA,IAAA,QAAAF;EAGQN,KAAAf;EAAW,IAAAc,EAAA,OAAAL,OAAA;GAAeQ,KAAAb,YAAYK,KAAK;GAACK,EAAA,KAAAL;GAAAK,EAAA,KAAAG;EAAA,OAAAA,KAAAH,EAAA;EAAME,KAAAA;EAAWG,KA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AAnB,EAAA,KAAAwC;EAAAxC,EAAA,KAAAC;EAAAD,EAAA,KAAAG;CAAA,OAAA;EAAAF,KAAAD,EAAA;EAAAG,KAAAH,EAAA;CAAA;CAAA,IAAAI;CAAA,IAAAJ,EAAA,OAAAC,MAAAD,EAAA,OAAAwC,QAAAxC,EAAA,OAAAG,IAAA;EAHKC,KAAA,oBAAC,IAAD;GAA4B,WAAAD;GAGzBqC;EAAI,CAAA;EAAIxC,EAAA,KAAAC;EAAAD,EAAA,KAAAwC;EAAAxC,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAHXI;AAGW;AAEpB,SAASU,SAAS0B,MAAkC;CAClD,OAAO,oBAAC,UAAD,EAAgBA,KAAK,CAAA;AAC9B;AAIA,SAASC,MAAMC,OAA+DF,MAAoB;CAEhG,QADaE,UAAU,QAAQ,YAAYA,QAAQA,QAAQ,CAACA,KAAK,EAAA,CACrDC,MAAKC,UAASA,UAAU,QAAQ/D,UAAU+D,OAAOJ,IAAI,CAAC;AACpE;AACA,SAASX,aAAaX,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAOnC,WAAWwD;CAEpB,OAAO3B,MAAML,YAAYxB,WAAWyD,iBAAiBzD,WAAW0D;AAClE;AACA,SAAShB,aAAab,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAOnC,WAAW2D;CAEpB,OAAO9B,MAAML,YAAYxB,WAAW4D,iBAAiB5D,WAAW6D;AAClE"}
|
|
@@ -54,5 +54,4 @@ type CardVariant = 'elevated' | 'filled' | 'outlined';
|
|
|
54
54
|
* navigates.
|
|
55
55
|
*/
|
|
56
56
|
declare function Card({ children, interactive, isDisabled, onClick, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, padding, render, variant, ...props }: CardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
57
|
-
export { type CardProps, type CardVariant, Card as default };
|
|
58
|
-
//# sourceMappingURL=index.d.ts.map
|
|
57
|
+
export { type CardProps, type CardVariant, Card as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","MouseEvent","stylex","cloneElement","isValidElement","RenderComponentProps","useRipple","useRender","focus","mergeStyles","colors","motion","radii","shadows","spacing","stateLayerOpacity","FORCED_COLORS","styles","base","kaIpWk","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kVQacm","kHjlTd","kVAEAm","kybGjl","$$css","content","kAzted","disabled","kVAM5u","kkrTdU","disabledContent","kSiTet","disabledElevated","kWkggS","kGVxlE","disabledFilled","disabledOutlined","elevated","filled","interactive","kVVagm","kzqmXN","k9WMMc","kIyJzY","k1ekBW","kAMwcw","interactiveBoundary","ksu8eU","outlined","paddingDefault","kmVPX3","paddingNone","HOVER_CAPABLE","interactionStyles","focusColors","kjBf7l","CardProps","isDisabled","padding","variant","CardVariant","Card","t0","$","children","t1","t2","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","t3","render","t4","props","undefined","t5","t6","ripple","padded","t7","t8","type","t9","handlers","t10","disabledAttributes","t11","0","className","1","t12","surface","t13","ring","disabledStyles","t14","t15","withoutActivation","t16","defaultTagName","preventDefault","event","Record","href","tabIndex","_c","props","stylex.props"],"sources":["../../../src/components/card/index.tsx"],"sourcesContent":["'use client';\n\nimport type { MouseEvent } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { cloneElement, isValidElement } from 'react';\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, motion, 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.\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 kaIpWk: \"x62ce2h\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n k1xSpc: \"x1lliihq\",\n kVQacm: \"x7giv3\",\n kHjlTd: \"xj0a0fe\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n content: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x1lliihq\",\n kAzted: \"x1us19tq\",\n $$css: true\n },\n disabled: {\n kVAM5u: \"xmnqt3w\",\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n disabledContent: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n },\n disabledElevated: {\n kWkggS: \"x1jfv5e4\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n disabledFilled: {\n kWkggS: \"x6mg230\",\n $$css: true\n },\n disabledOutlined: {\n kVAM5u: \"x1y3ic1l xmnqt3w\",\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 kIyJzY: \"x1iuyhda x12w9bfk\",\n k1ekBW: \"x106061f\",\n kAMwcw: \"x1g6yzlr\",\n $$css: true\n },\n interactiveBoundary: {\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\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};\n\n// A pointer that can hover: a mouse or a trackpad, not a finger. An\n// interactive card is a plain element React Aria does not host, so it has no\n// `isHovered` to draw its hover layer from, and Chromium leaves `:hover` on\n// whatever a touch last tapped — a card tapped and then navigated back to\n// stayed lifted. Inside this query a touch screen draws no hover at all. A\n// touchscreen laptop still matches it for its trackpad, which is the limit of\n// asking the device rather than the event.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The state layers, from pseudo-classes, since the card has no render state\n// to read — see `HOVER_CAPABLE`.\n// `:active` is written twice, bare for a touch and again inside the query.\n// StyleX orders a rule by the sum of its conditions, so a hover inside the\n// query would otherwise come after a bare press and win while both held.\n//\n// Each variant also lifts one level on hover and comes back down on a press,\n// to the container elevations the cards page gives: the elevated card from\n// level 1 to 2, and the filled and outlined cards from level 0 to 1.\nconst interactionStyles = {\n elevated: {\n kWkggS: \"xu5m21g x17zbzf9 x1ru19e0 x1vnz5z6\",\n kGVxlE: \"x1g60mc1 x14zlms8 xqmo4o3 x19efjv6\",\n $$css: true\n },\n filled: {\n kWkggS: \"x1w49kxs x10l1pcx xt0lj0h x1rrhr5q\",\n kGVxlE: \"xpk4wdd x1xzfgx1 x1jblvwk\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x1jqfdmz x1ie1ydn x1dau0i7 x14s9m32\",\n kGVxlE: \"xpk4wdd x1xzfgx1 x1jblvwk\",\n $$css: true\n }\n};\n\n// The cards page's focus indicator, in secondary on the elevated and filled\n// cards and in on surface on the outlined one, where the shared ring takes\n// primary. Only the colour is the card's: the width, the offset and the\n// `:focus-visible` are the shared ring's, which this is applied over. Under\n// forced colours the mode repaints the outline in a system colour, as it does\n// every ring's.\nconst focusColors = {\n elevated: {\n kjBf7l: \"xat36cu\",\n $$css: true\n },\n filled: {\n kjBf7l: \"xat36cu\",\n $$css: true\n },\n outlined: {\n kjBf7l: \"xnzrtil\",\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. A\n * button holds phrasing content only, so its children are spans, which a\n * `Text` is, laid out through StyleX; for block content, `render` gives it\n * an anchor or another element. Leave it off for a card that merely holds\n * content, including one containing its own buttons.\n * @default false\n */\n interactive?: boolean;\n /**\n * Turns an interactive card off: it fades as the cards page draws a\n * disabled card, stops rippling and lifting, and takes no press. The\n * default `<button>` is disabled outright. An element of the call site's\n * own through `render` is marked `aria-disabled`, and an element handed in\n * directly loses its `href`, `tabIndex` and `onClick`, so a link card can\n * neither be followed nor focused. Has no effect on a card that is not\n * `interactive`, which cannot be pressed to begin with.\n * @default false\n */\n isDisabled?: 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 * ```tsx\n * <Card interactive render={<a href=\"#first\" />}>\n * <Text variant=\"titleMedium\">Headline</Text>\n * </Card>\n * ```\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 isDisabled = 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 disabled = interactive && isDisabled;\n const ripple = useRipple(interactive && !disabled, {\n onClick: disabled ? undefined : 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 // After the ripple's handlers, whose click it replaces while disabled.\n ...disabledAttributes(disabled, render),\n children: <>\n {interactive ? <span {...{\n 0: {\n className: \"x9f619 x1lliihq x1us19tq\"\n },\n 1: {\n className: \"x9f619 x1lliihq x1us19tq x1ppv7y9\"\n }\n }[!!disabled << 0]}>\n {children}\n </span> : children}\n {ripple.surface}\n </>,\n ...mergeStyles(stylex.props(styles.base, styles[variant], padded, interactive && styles.interactive, interactive && variant !== 'outlined' && styles.interactiveBoundary, interactive && !disabled && focus.ring, interactive && !disabled && focusColors[variant], interactive && !disabled && interactionStyles[variant], disabled && styles.disabled, disabled && disabledStyles[variant]), props)\n },\n render: disabled ? withoutActivation(render) : render\n });\n}\nconst disabledStyles = {\n elevated: styles.disabledElevated,\n filled: styles.disabledFilled,\n outlined: styles.disabledOutlined\n};\n\n// How a disabled card says so, by the element it renders. The default\n// <button> takes the native `disabled`, which removes it from the tab order\n// and fires nothing on a press. Any other element has no such attribute, so\n// it is marked `aria-disabled` for assistive technology, and a click on it\n// has its default prevented, which is what would follow a link — the click\n// a function passed as `render` wires up is its own, and runs first.\nfunction disabledAttributes(disabled: boolean, render: CardProps['render']) {\n if (!disabled) {\n return undefined;\n }\n if (render === undefined) {\n return {\n disabled: true\n };\n }\n return {\n 'aria-disabled': true,\n onClick: preventDefault\n };\n}\nfunction preventDefault(event: MouseEvent) {\n event.preventDefault();\n}\n\n// An element handed in as `render`, without what would still activate it: an\n// element's own props win over the card's, so an <a href> stays a link the\n// card cannot switch off from outside. Without an `href` it is neither\n// followed nor focusable, and without its `tabIndex` it is not focusable\n// either. Its `onClick` is replaced rather than removed, since a key the\n// element carries wins even when its value is undefined, and would drop the\n// card's own prevented click along with it.\nfunction withoutActivation(render: CardProps['render']): CardProps['render'] {\n if (!isValidElement<Record<string, unknown>>(render)) {\n return render;\n }\n return cloneElement(render, {\n href: undefined,\n onClick: preventDefault,\n tabIndex: undefined\n });\n}\nexport type { CardProps, CardVariant };\nexport default Card;"],"mappings":";;;;;;;;;;AA4BA,MAAMkB,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,SAAS;EACPR,QAAQ;EACRE,QAAQ;EACRO,QAAQ;EACRF,OAAO;CACT;CACAG,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,iBAAiB;EACfC,QAAQ;EACRP,OAAO;CACT;CACAQ,kBAAkB;EAChBC,QAAQ;EACRC,QAAQ;EACRV,OAAO;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AAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","cloneElement","isValidElement","useRipple","useRender","focus","mergeStyles","styles","base","kaIpWk","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kVQacm","kHjlTd","kVAEAm","kybGjl","$$css","content","kAzted","disabled","kVAM5u","kkrTdU","disabledContent","kSiTet","disabledElevated","kWkggS","kGVxlE","disabledFilled","disabledOutlined","elevated","filled","interactive","kVVagm","kzqmXN","k9WMMc","kIyJzY","k1ekBW","kAMwcw","interactiveBoundary","ksu8eU","outlined","paddingDefault","kmVPX3","paddingNone","interactionStyles","focusColors","kjBf7l","isDisabled","padding","variant","Card","t0","$","children","t1","t2","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","t3","render","t4","props","undefined","t5","t6","ripple","padded","t7","t8","type","t9","handlers","t10","disabledAttributes","t11","0","className","1","t12","surface","t13","ring","disabledStyles","t14","t15","withoutActivation","t16","defaultTagName","preventDefault","event","href","tabIndex"],"sources":["../../../src/components/card/index.tsx"],"sourcesContent":["'use client';\n\nimport type { MouseEvent } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { cloneElement, isValidElement } from 'react';\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, motion, 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.\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 kaIpWk: \"x62ce2h\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n k1xSpc: \"x1lliihq\",\n kVQacm: \"x7giv3\",\n kHjlTd: \"xj0a0fe\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n $$css: true\n },\n content: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x1lliihq\",\n kAzted: \"x1us19tq\",\n $$css: true\n },\n disabled: {\n kVAM5u: \"xmnqt3w\",\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n disabledContent: {\n kSiTet: \"x1ppv7y9\",\n $$css: true\n },\n disabledElevated: {\n kWkggS: \"x1jfv5e4\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n disabledFilled: {\n kWkggS: \"x6mg230\",\n $$css: true\n },\n disabledOutlined: {\n kVAM5u: \"x1y3ic1l xmnqt3w\",\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 kIyJzY: \"x1iuyhda x12w9bfk\",\n k1ekBW: \"x106061f\",\n kAMwcw: \"x1g6yzlr\",\n $$css: true\n },\n interactiveBoundary: {\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\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};\n\n// A pointer that can hover: a mouse or a trackpad, not a finger. An\n// interactive card is a plain element React Aria does not host, so it has no\n// `isHovered` to draw its hover layer from, and Chromium leaves `:hover` on\n// whatever a touch last tapped — a card tapped and then navigated back to\n// stayed lifted. Inside this query a touch screen draws no hover at all. A\n// touchscreen laptop still matches it for its trackpad, which is the limit of\n// asking the device rather than the event.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The state layers, from pseudo-classes, since the card has no render state\n// to read — see `HOVER_CAPABLE`.\n// `:active` is written twice, bare for a touch and again inside the query.\n// StyleX orders a rule by the sum of its conditions, so a hover inside the\n// query would otherwise come after a bare press and win while both held.\n//\n// Each variant also lifts one level on hover and comes back down on a press,\n// to the container elevations the cards page gives: the elevated card from\n// level 1 to 2, and the filled and outlined cards from level 0 to 1.\nconst interactionStyles = {\n elevated: {\n kWkggS: \"xu5m21g x17zbzf9 x1ru19e0 x1vnz5z6\",\n kGVxlE: \"x1g60mc1 x14zlms8 xqmo4o3 x19efjv6\",\n $$css: true\n },\n filled: {\n kWkggS: \"x1w49kxs x10l1pcx xt0lj0h x1rrhr5q\",\n kGVxlE: \"xpk4wdd x1xzfgx1 x1jblvwk\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x1jqfdmz x1ie1ydn x1dau0i7 x14s9m32\",\n kGVxlE: \"xpk4wdd x1xzfgx1 x1jblvwk\",\n $$css: true\n }\n};\n\n// The cards page's focus indicator, in secondary on the elevated and filled\n// cards and in on surface on the outlined one, where the shared ring takes\n// primary. Only the colour is the card's: the width, the offset and the\n// `:focus-visible` are the shared ring's, which this is applied over. Under\n// forced colours the mode repaints the outline in a system colour, as it does\n// every ring's.\nconst focusColors = {\n elevated: {\n kjBf7l: \"xat36cu\",\n $$css: true\n },\n filled: {\n kjBf7l: \"xat36cu\",\n $$css: true\n },\n outlined: {\n kjBf7l: \"xnzrtil\",\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. A\n * button holds phrasing content only, so its children are spans, which a\n * `Text` is, laid out through StyleX; for block content, `render` gives it\n * an anchor or another element. Leave it off for a card that merely holds\n * content, including one containing its own buttons.\n * @default false\n */\n interactive?: boolean;\n /**\n * Turns an interactive card off: it fades as the cards page draws a\n * disabled card, stops rippling and lifting, and takes no press. The\n * default `<button>` is disabled outright. An element of the call site's\n * own through `render` is marked `aria-disabled`, and an element handed in\n * directly loses its `href`, `tabIndex` and `onClick`, so a link card can\n * neither be followed nor focused. Has no effect on a card that is not\n * `interactive`, which cannot be pressed to begin with.\n * @default false\n */\n isDisabled?: 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 * ```tsx\n * <Card interactive render={<a href=\"#first\" />}>\n * <Text variant=\"titleMedium\">Headline</Text>\n * </Card>\n * ```\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 isDisabled = 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 disabled = interactive && isDisabled;\n const ripple = useRipple(interactive && !disabled, {\n onClick: disabled ? undefined : 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 // After the ripple's handlers, whose click it replaces while disabled.\n ...disabledAttributes(disabled, render),\n children: <>\n {interactive ? <span {...{\n 0: {\n className: \"x9f619 x1lliihq x1us19tq\"\n },\n 1: {\n className: \"x9f619 x1lliihq x1us19tq x1ppv7y9\"\n }\n }[!!disabled << 0]}>\n {children}\n </span> : children}\n {ripple.surface}\n </>,\n ...mergeStyles(stylex.props(styles.base, styles[variant], padded, interactive && styles.interactive, interactive && variant !== 'outlined' && styles.interactiveBoundary, interactive && !disabled && focus.ring, interactive && !disabled && focusColors[variant], interactive && !disabled && interactionStyles[variant], disabled && styles.disabled, disabled && disabledStyles[variant]), props)\n },\n render: disabled ? withoutActivation(render) : render\n });\n}\nconst disabledStyles = {\n elevated: styles.disabledElevated,\n filled: styles.disabledFilled,\n outlined: styles.disabledOutlined\n};\n\n// How a disabled card says so, by the element it renders. The default\n// <button> takes the native `disabled`, which removes it from the tab order\n// and fires nothing on a press. Any other element has no such attribute, so\n// it is marked `aria-disabled` for assistive technology, and a click on it\n// has its default prevented, which is what would follow a link — the click\n// a function passed as `render` wires up is its own, and runs first.\nfunction disabledAttributes(disabled: boolean, render: CardProps['render']) {\n if (!disabled) {\n return undefined;\n }\n if (render === undefined) {\n return {\n disabled: true\n };\n }\n return {\n 'aria-disabled': true,\n onClick: preventDefault\n };\n}\nfunction preventDefault(event: MouseEvent) {\n event.preventDefault();\n}\n\n// An element handed in as `render`, without what would still activate it: an\n// element's own props win over the card's, so an <a href> stays a link the\n// card cannot switch off from outside. Without an `href` it is neither\n// followed nor focusable, and without its `tabIndex` it is not focusable\n// either. Its `onClick` is replaced rather than removed, since a key the\n// element carries wins even when its value is undefined, and would drop the\n// card's own prevented click along with it.\nfunction withoutActivation(render: CardProps['render']): CardProps['render'] {\n if (!isValidElement<Record<string, unknown>>(render)) {\n return render;\n }\n return cloneElement(render, {\n href: undefined,\n onClick: preventDefault,\n tabIndex: undefined\n });\n}\nexport type { CardProps, CardVariant };\nexport default Card;"],"mappings":";;;;;;;;;;AA4BA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,SAAS;EACPR,QAAQ;EACRE,QAAQ;EACRO,QAAQ;EACRF,OAAO;CACT;CACAG,UAAU;EACRC,QAAQ;EACRC,QAAQ;EACRL,OAAO;CACT;CACAM,iBAAiB;EACfC,QAAQ;EACRP,OAAO;CACT;CACAQ,kBAAkB;EAChBC,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,gBAAgB;EACdF,QAAQ;EACRT,OAAO;CACT;CACAY,kBAAkB;EAChBR,QAAQ;EACRJ,OAAO;CACT;CACAa,UAAU;EACRJ,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;CACAc,QAAQ;EACNL,QAA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A,MAAAnC,EAAA;CAAA,IAAAoC;CAAA,IAAApC,EAAA,QAAAjC,YAAAiC,EAAA,QAAAW,QAAA;EACOyB,MAAArE,WAAWsE,kBAAkB1B,MAAe,IAA5CA;EAA6CX,EAAA,MAAAjC;EAAAiC,EAAA,MAAAW;EAAAX,EAAA,MAAAoC;CAAA,OAAAA,MAAApC,EAAA;CAAA,IAAAsC;CAAA,IAAAtC,EAAA,QAAAmC,OAAAnC,EAAA,QAAAoC,OAAApC,EAAA,QAAAmB,IAAA;EA7BtCmB,MAAA;GAAAC,gBACCpB;GAA8BN,OACvCsB;GA0BNxB,QACOyB;EACV;EAACpC,EAAA,MAAAmC;EAAAnC,EAAA,MAAAoC;EAAApC,EAAA,MAAAmB;EAAAnB,EAAA,MAAAsC;CAAA,OAAAA,MAAAtC,EAAA;CAAA,OA9BMlD,UAAUwF,GA8BhB;AAAC;AAEJ,MAAMJ,iBAAiB;CACrBzD,UAAUxB,OAAOmB;CACjBM,QAAQzB,OAAOsB;CACfa,UAAUnC,OAAOuB;AACnB;AAQA,SAASiD,mBAAmB1D,UAAmB4C,QAA6B;CAC1E,IAAI,CAAC5C,UACH;CAEF,IAAI4C,WAAWG,KAAAA,GACb,OAAO,EACL/C,UAAU,KACZ;CAEF,OAAO;EACL,iBAAiB;EACjBqC,SAASoC;CACX;AACF;AACA,SAASA,eAAeC,OAAmB;CACzCA,MAAMD,eAAe;AACvB;AASA,SAASH,kBAAkB1B,QAAkD;CAC3E,IAAI,CAAC/D,eAAwC+D,MAAM,GACjD,OAAOA;CAET,OAAOhE,aAAagE,QAAQ;EAC1B+B,MAAM5B,KAAAA;EACNV,SAASoC;EACTG,UAAU7B,KAAAA;CACZ,CAAC;AACH"}
|
|
@@ -81,5 +81,4 @@ declare namespace Carousel {
|
|
|
81
81
|
* The call site's `className` and `style` land on the item.
|
|
82
82
|
*/
|
|
83
83
|
declare function CarouselItem({ children, ref, ...props }: CarouselItemProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
84
|
-
export { CarouselItem, type CarouselItemProps, type CarouselItemRenderProps, type CarouselLayout, type CarouselProps, Carousel as default };
|
|
85
|
-
//# sourceMappingURL=index.d.ts.map
|
|
84
|
+
export { CarouselItem, type CarouselItemProps, type CarouselItemRenderProps, type CarouselLayout, type CarouselProps, Carousel as default };
|