@kanso-labs/kanso-ui 0.45.20 → 0.45.22
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/calendar/index.js +119 -11
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/styles.js +19 -1
- package/dist/calendar/styles.js.map +1 -1
- package/dist/components/app-bar/index.d.ts +8 -2
- package/dist/components/app-bar/index.js +123 -73
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +3 -3
- package/dist/components/calendar/index.js +8 -19
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/carousel/index.d.ts +22 -3
- package/dist/components/carousel/index.js +26 -14
- package/dist/components/carousel/index.js.map +1 -1
- package/dist/components/chip-group/index.js +3 -0
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-picker/index.js +64 -46
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-swatch/index.js +20 -16
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/copy-field/index.js +1 -0
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/date-range-picker/index.js +165 -81
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -2
- package/dist/components/popover/index.js +14 -4
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/range-calendar/index.js +53 -80
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/segmented-button/index.js +261 -145
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/sheet/index.js +149 -82
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/table/index.js +251 -123
- package/dist/components/table/index.js.map +1 -1
- package/dist/hooks/useRipple.js +3 -2
- package/dist/hooks/useRipple.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/segments/index.js +2 -1
- package/dist/segments/index.js.map +1 -1
- package/dist/segments/styles.js +5 -1
- package/dist/segments/styles.js.map +1 -1
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles.css +40 -8
- package/dist/swatch/index.js +19 -0
- package/dist/swatch/index.js.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","KeyboardEventHandler","ReactNode","RefAttributes","FocusableElement","Key","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","ToggleGroupState","stylex","createContext","createElement","useContext","useLayoutEffect","useState","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","LabelledByAttribute","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","GroupRender","Ripple","ReturnType","NonNullable","keyOf","segment","HTMLElement","written","dataset","key","undefined","JSON","parse","radioGroupRenderer","render","domProps","renderProps","merged","onKeyDownCapture","radioKeys","state","toolbar","HTMLDivElement","event","group","currentTarget","segments","querySelectorAll","filter","closest","from","findIndex","target","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","to","length","setSelected","rtl","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","PADDING_GIVE","md","FORCED_COLORS","styles","kgeoSG","kGOzcv","kpsdNU","kEoFBp","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k7Eaqz","k8WAf4","kg3NbH","kVAEAm","kIyJzY","k1ekBW","kAMwcw","$$css","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","spacer","kmuXW","kzqmXN","spacerHalf","spacerHolding","spacerIcon","SegmentedButtonProps","Omit","className","disallowEmptySelection","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","id","glyphFor","marked","isSelected","hasLabel","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","labelRef","element","HTMLSpanElement","labelTitle","labelled","reserves","glyph","drawn","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","t9","single","t10","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","label","setLabel","useTruncatedText","aria","disabledByGroup","stringify","handlers","segmentStyles","ring","text","setText","measure","cut","scrollWidth","clientWidth","textContent","resize","ResizeObserver","observe","relabel","MutationObserver","characterData","childList","subtree","disconnect","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps, ToggleGroupState } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, createElement, useContext, useLayoutEffect, useState } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { LabelledByAttribute } from '../../render/name';\nimport { CheckGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useToggleGroupDisabled } from '../../hooks/useToggleGroupDisabled';\nimport { ariaAttributesOf, toggleButtonRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The segmented buttons page's outlined segmented button: two to five\n// segments joined into one outlined track, of which one or several are\n// chosen. A segment is Button's default size and type role — a 40dp\n// container with a label-large label — which is what that page gives too.\n//\n// What a screen reader hears follows the selection mode, and React Aria\n// decides it rather than this component. Choosing one of the segments is a\n// radio group, so the track is a `radiogroup` and each segment a `radio`\n// reporting `aria-checked`; choosing several is a `toolbar` of buttons each\n// reporting `aria-pressed`. That is the right mapping for both, and it is\n// why the mode is a word on the group rather than two components.\n//\n// React Aria stops at the name, though: its single mode is announced as a\n// radio group and behaves as a toolbar. So that mode takes the rest of the\n// radio group pattern from the ARIA Authoring Practices, a deliberate\n// departure from React Aria's `ToggleButtonGroup`, in two parts. The chosen\n// segment cannot be pressed off, since a radio group always holds a choice\n// and the page's single-select set always keeps one segment chosen;\n// `disallowEmptySelection={false}` gives React Aria's default back. And the\n// arrow keys choose as they move, wrapping at either end, with Home and End\n// choosing the first and last segment. Under React Aria the arrows moved\n// focus alone and stopped at the ends, so a screen reader reached each radio\n// without it being checked, and choosing one took a separate Space. Choosing\n// several keeps React Aria's toolbar keys, where the arrows only move between\n// buttons and Space toggles one.\n//\n// Six things are this component's own.\n//\n// **The segments are one track, not a row of buttons.** Every segment\n// carries the page's 1dp outline, and each one after the first drops its\n// leading edge so neighbours share a single rule rather than drawing two\n// against each other. The outer ends are the page's fully rounded shape and\n// the inner joins are square.\n//\n// **Every segment is the same width.** The page gives the segment width as\n// the container's divided by their number, so the track is a grid of equal\n// columns; the container itself is still as wide as its widest label asks,\n// plus the room described next.\n//\n// **A chosen segment says so with a check.** The page draws it in the icon\n// slot, so a segment given an `icon` shows the icon while unselected and the\n// check once chosen. `showSelectedIcon` turns it off for a set whose labels\n// already read as chosen or not.\n//\n// Without the check, the page's chosen container is the only cue, and it is\n// about 1.2:1 against the page in the light theme, with the same label\n// colour either way — under WCAG's 3:1 for a state. So a set with the check\n// off draws its chosen segment on the secondary role instead, with the label\n// on it, which clears that comfortably. A departure from the page, taken\n// only where the page's own cue has been turned off; with the check drawn,\n// the chosen segment is the page's.\n//\n// A segment with an `icon` and no label is drawn that way whatever the set\n// says. It keeps its icon when chosen, since the icon is all that tells it\n// from its neighbours, and a check in its place would hide which of them is\n// the chosen one.\n//\n// Under forced colours a fill is painted in the page's own `Canvas`, so the\n// chosen container is `Highlight` with its label in `HighlightText` — the\n// pair the mode gives whatever is chosen — and a disabled chosen one keeps\n// a `GrayText` ring rather than a fill, which leaves its `GrayText` label\n// readable.\n//\n// Every segment that could ever draw that slot keeps room for it whether\n// or not it is drawing one. Sized by what it drew, the slot made the widest\n// segment whichever one was chosen, and the whole track changed width with\n// the choice — moving every label, and moving the ground under the chosen\n// container while it was sliding across it. The mechanism is Angular\n// Material's button toggle: the slot opens from 0 to 18dp and the space it\n// lands in opens beside it, both over `durationShort2`. Here that space is\n// two spacers either side of the label, which trade it between them: half\n// on each side while nothing is drawn, so a bare label stays centred, and\n// all of it on the leading side, where the slot sits, once something is.\n// Their total never changes, so neither does the segment's width. Angular\n// Material has no case of the first kind, since its toggles are sized by\n// their own content rather than by the widest of them.\n//\n// That room gives way before the label does. A track with room to spare is\n// the widest label plus 26dp per segment, which is what the widest column\n// already measured while its own segment was the chosen one. A track\n// squeezed below that — long labels on a phone — gives the reserve back\n// first, then the 4dp of the page's 12dp padding beyond the 8dp a segment\n// always keeps, and only then cuts a label short, with an ellipsis and a\n// `title` that shows it whole. A segment drawing a glyph keeps the glyph and\n// its 8dp gap, so the chosen label is the first to be cut. A label shows\n// whole in a segment 16dp wider than it, or 42dp while a glyph is drawn\n// beside it, plus the segment's rule. The track's width still never depends\n// on the choice: squeezed, its columns are the container's, shared equally.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\ntype GroupRender = RACToggleButtonGroupProps['render'];\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\n\n// A segment's key, back from the attribute `SegmentedButtonSegment` writes\n// it into. JSON rather than the key as written, so a numeric key comes back\n// a number and matches the one React Aria's selection holds.\nfunction keyOf(segment: HTMLElement): Key | null {\n const written = segment.dataset.key;\n if (written === undefined) {\n return null;\n }\n const key: unknown = JSON.parse(written);\n return typeof key === 'string' || typeof key === 'number' ? key : null;\n}\n\n// The group's element, with `radioKeys` in place of React Aria's keyboard\n// handler, then handed to the call site's own `render` if it passed one.\nfunction radioGroupRenderer(render: GroupRender): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to a segment\n// and choose it, wrapping at the ends and passing over a disabled segment,\n// which is what the toolbar's own handler would otherwise do with focus\n// alone. Everything else — Tab, and an arrow held with a modifier the\n// browser may want — is handed to the toolbar as before.\nfunction radioKeys(state: ToggleGroupState, toolbar: KeyboardEventHandler<HTMLDivElement> | undefined): KeyboardEventHandler<HTMLDivElement> {\n return event => {\n const group = event.currentTarget;\n const segments = [...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])')].filter(segment => segment.closest('[role=\"radiogroup\"]') === group);\n const from = segments.findIndex(segment => segment === event.target);\n const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === 'rtl');\n if (from === -1 || step === null) {\n toolbar?.(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const to = step === 'first' ? 0 : step === 'last' ? segments.length - 1 : (from + step + segments.length) % segments.length;\n const segment = segments[to];\n const key = keyOf(segment);\n if (key === null) {\n return;\n }\n segment.focus();\n state.setSelected(key, true);\n };\n}\n\n// Where a key moves the choice in a radio group: one segment on, one back,\n// or to either end. Right and left follow the direction the track is drawn\n// in, read off the track itself rather than the locale, so a `dir` on a\n// wrapper turns them over as it turns the track over; up and down, and Home\n// and End, follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown':\n {\n return 1;\n }\n case 'ArrowLeft':\n {\n return rtl ? 1 : -1;\n }\n case 'ArrowRight':\n {\n return rtl ? -1 : 1;\n }\n case 'ArrowUp':\n {\n return -1;\n }\n case 'End':\n {\n return 'last';\n }\n case 'Home':\n {\n return 'first';\n }\n default:\n {\n return null;\n }\n }\n}\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// plus the gap between it and the label. Half of that room sits on each side\n// of the label while nothing is drawn, which is what keeps a bare label\n// centred; see `labelReserved`.\nconst GLYPH_SIZE = '18px';\nconst GLYPH_RESERVE = `calc(${GLYPH_SIZE} + ${spacing.sm})`;\nconst GLYPH_RESERVE_HALF = `calc((${GLYPH_SIZE} + ${spacing.sm}) / 2)`;\n\n// The part of the page's 12dp padding a segment gives back on a narrow\n// track: the padding is 8dp, and the rest sits in the spacers, which shrink.\nconst PADDING_GIVE = `calc(${spacing.md} - ${spacing.sm})`;\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 segment: {\n \"--segment-indicator-radius-end\": \"x32u3vw x111hk5a\",\n \"--segment-indicator-radius-start\": \"xatjrgw x1syycwj\",\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x17kqlg\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kVAM5u: \"x1fwvt7v\",\n kT0f0o: \"x1fougng xkducg2\",\n kVL7Gh: \"x1prwiuu x1uwupfv\",\n k2ei4v: \"x120dh57 x14e42zd\",\n kfmiAY: \"x17hb1p4 x1a37zkv\",\n krdFHd: \"xwfph4i xb01x1j\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k7Eaqz: \"xeuugli\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xt3l3uh\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n segmentDisabled: {\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n segmentSelected: {\n kMwMTN: \"x1sawysd x1k5gbb1\",\n $$css: true\n },\n segmentSelectedUnmarked: {\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n segmentUnselected: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n spacer: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"xs83m0k\",\n kzqmXN: \"xbraz1g\",\n kjj79g: \"x13a6bvl\",\n k7Eaqz: \"xeuugli\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1pha8k4\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n spacerHalf: {\n kzqmXN: \"x154zo0h\",\n $$css: true\n },\n spacerHolding: {\n kzqmXN: \"x1n85vuq\",\n k7Eaqz: \"x36sgg7\",\n $$css: true\n },\n spacerIcon: {\n kzqmXN: \"x1iuy3mw\",\n k7Eaqz: \"x16xo4sp\",\n $$css: true\n }\n};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | 'disallowEmptySelection' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\n /**\n * Whether the chosen segment stays chosen when it is pressed again. On\n * by default while one is chosen, since a radio group always holds a\n * choice; `false` lets a press clear it, as React Aria's own default\n * does. Off by default while several may be, where any of them can be\n * turned off.\n * @default true while one is chosen, false while several may be\n */\n disallowEmptySelection?: boolean;\n /**\n * Whether a chosen segment draws a check before its label, as the page\n * has it. `false` leaves the segment's own icon in place while selected,\n * and draws the chosen segment on the stronger secondary container, since\n * the page's own is too faint to say which is chosen by itself.\n * @default true\n */\n showSelectedIcon?: boolean;\n /** A function may compute the style from the set's render state. */\n style?: RACToggleButtonGroupProps['style'];\n};\ntype SegmentedButtonSegmentProps = Omit<RACToggleButtonProps, 'children' | 'className' | 'id' | 'style'> & {\n /** The segment's label. */\n children?: ReactNode;\n /** A function may compute the class from the segment's render state. */\n className?: RACToggleButtonProps['className'];\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, in the page's 18dp size. Replaced by the check\n * while the segment is chosen, unless the set turns that off. An icon drawn\n * in `em` takes that size from the slot.\n *\n * Given with no label, the icon is the segment, centred in it and kept\n * while chosen; name the segment with `aria-label` then.\n */\n icon?: ReactNode;\n /**\n * The key selection is reported by. Required, because React Aria joins a\n * toggle to its group's selection by this key alone: a segment without one\n * keeps a pressed state of its own, so a set where one is chosen could hold\n * two, and it is announced as a pressed button rather than a radio.\n */\n id: Key;\n /** A function may compute the style from the segment's render state. */\n style?: RACToggleButtonProps['style'];\n};\n\n/**\n * What the glyph slot draws: the check on a chosen segment, or the segment's\n * own icon. `null` for a segment with neither, which leaves the slot empty\n * and closed rather than unrendered. Returns a node rather than letting the\n * type be inferred, since `ReactNode` is a union that includes a promise and\n * an inferred one has to be `async`.\n */\nfunction glyphFor(state: ToggleButtonRenderProps, icon: ReactNode, marked: boolean): ReactNode {\n if (state.isSelected && marked) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\n}\n\n// Whether a segment has a label, rather than an icon alone. An empty string\n// and a `false` from a condition at the call site are no label either.\nfunction hasLabel(children: ReactNode) {\n return children !== undefined && children !== null && children !== false && children !== '';\n}\n\n// The chosen container's class, from the segment's own state and the shared\n// element's. A function, because React Aria hands the indicator the entering\n// and leaving states the fade is drawn from, and those are the only two the\n// element knows about itself.\nfunction indicatorClassName(isDisabled: boolean, selectionMode: SelectionMode, marked: boolean): (state: SharedElementRenderProps) => string {\n return state => ({\n 0: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd\"\n },\n 8: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7\"\n },\n 4: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4\"\n },\n 12: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4\"\n },\n 2: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 10: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 6: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 14: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 1: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk\"\n },\n 9: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk\"\n },\n 5: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4 xg01cxk\"\n },\n 13: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4 xg01cxk\"\n },\n 3: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 11: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 7: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 15: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n }\n })[!!(selectionMode === 'multiple') << 3 | !!!marked << 2 | !!isDisabled << 1 | !!(state.isEntering || state.isExiting) << 0].className ?? '';\n}\n\n// What a segment draws, from React Aria's render state. Built by a call\n// 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\n// on its inputs.\nfunction segmentContent(children: ReactNode, icon: ReactNode, ripple: Ripple, selectionMode: SelectionMode, marked: boolean, labelRef: (element: HTMLSpanElement | null) => void, labelTitle: string | undefined) {\n const labelled = hasLabel(children);\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track.\n const reserves = marked || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, marked);\n const drawn = glyph !== null;\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, marked)} />\n <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi xg01cxk x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4\"\n },\n 4: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xe2qvxb\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 6: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 1: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 5: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 3: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 7: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n }\n }[!!state.isHovered << 2 | !!state.isFocusVisible << 1 | !!state.isPressed << 0]} />\n <span {...stylex.props(styles.spacer, reserves && (drawn ? labelled ? styles.spacerHolding : styles.spacerIcon : styles.spacerHalf))}>\n {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1nsf9p3\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a x1nsf9p3\"\n }\n }[!!drawn << 1 | !!(drawn && labelled) << 0]}>\n {glyph}\n </span>}\n </span>\n {labelled && <span ref={labelRef} title={labelTitle} {...{\n 0: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft\"\n },\n 2: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8\"\n },\n 1: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1g12otp\"\n },\n 3: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8 x1g12otp\"\n }\n }[!!drawn << 1 | !!(state.isSelected && !state.isDisabled) << 0]}>\n {children}\n </span>}\n <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k xbraz1g x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7 x154zo0h\"\n }\n }[!!(reserves && !drawn) << 0]} />\n {ripple.surface}\n </>;\n };\n}\n\n/**\n * A row of two to five joined segments, of which one — or with\n * `selectionMode=\"multiple\"`, several — is chosen. Selection is React Aria's:\n * pass `selectedKeys` with `onSelectionChange` to control it, or\n * `defaultSelectedKeys` to let it keep its own. Give every segment an `id`,\n * which is the key selection is reported by.\n *\n * ```tsx\n * <SegmentedButton aria-label=\"Label\" defaultSelectedKeys={['first']}>\n * <SegmentedButton.Segment id=\"first\">First item</SegmentedButton.Segment>\n * <SegmentedButton.Segment id=\"second\">Second item</SegmentedButton.Segment>\n * </SegmentedButton>\n * ```\n *\n * Name the set with `aria-label` or `aria-labelledby`, one of which the\n * props require — nothing here labels it for you, and a set with no name is\n * a group a screen reader cannot announce. What it is announced as follows the selection mode: choosing one\n * is a radio group, choosing several a toolbar of two-state buttons. So does\n * how the chosen container moves: it slides between segments while one is\n * chosen, and fades in place while several may be.\n *\n * Choosing one behaves as a radio group too, which React Aria's\n * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is\n * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys\n * move to a segment and choose it, wrapping at either end, and Home and End\n * choose the first and last. Choosing several keeps React Aria's keys: the\n * arrows move between segments, and Space or Enter toggles the focused one.\n *\n * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n disallowEmptySelection,\n render,\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n const single = selectionMode === 'single';\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} disallowEmptySelection={disallowEmptySelection ?? single} render={single ? radioGroupRenderer(render) : render} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n // Whether this segment draws the check when chosen: the set's choice,\n // unless the segment has no label — see the header.\n const marked = useContext(ShowSelectedIconContext) && hasLabel(children);\n const [label, setLabel] = useState<HTMLSpanElement | null>(null);\n const labelTitle = useTruncatedText(label);\n // The `aria-*` props React Aria would drop and the keyboard handlers it\n // would wrap go on the element itself, as they do on Chip, Button and\n // IconButton; see src/render/aria.tsx.\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n // Off while disabled, as in Button: a control that cannot be pressed\n // should not answer a press with an animation. A disabled set disables\n // its segments through React Aria's group state rather than their props,\n // so the group is read as well.\n const disabledByGroup = useToggleGroupDisabled(props.id);\n // The call site's pointer handlers go through the ripple, which calls\n // them after its own. Spread beside the ripple's, one of the two sets\n // would write over the other.\n const ripple = useRipple<FocusableElement>(!disableRipple && props.isDisabled !== true && !disabledByGroup, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n return <RACToggleButton\n // The key the radio group's arrow keys choose this segment by; see\n // `radioKeys`. React Aria keeps a segment's key off its element.\n data-key={selectionMode === 'single' ? JSON.stringify(props.id) : undefined} render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(marked), props)}>\n {segmentContent(children, icon, ripple, selectionMode, marked, setLabel, labelTitle)}\n </RACToggleButton>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// segment's state comes from the render state React Aria hands its\n// className. `disabled` is applied last so its label colour wins over both\n// of the others. Built by a call, since a set that draws no check labels its\n// chosen segment for the container it draws instead.\nfunction segmentStyles(marked: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !marked && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\n\n// The text of a label its segment is cutting short, for a `title` that shows\n// it whole; undefined while it fits. Measured again whenever the label's box\n// or its text changes, which is when it can start or stop being cut.\nfunction useTruncatedText(label: HTMLElement | null): string | undefined {\n const [text, setText] = useState<string | undefined>(undefined);\n useLayoutEffect(() => {\n if (label === null) {\n return undefined;\n }\n const measure = () => {\n const cut = label.scrollWidth > label.clientWidth;\n setText(cut && label.textContent !== '' ? label.textContent : undefined);\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(label);\n const relabel = new MutationObserver(measure);\n relabel.observe(label, {\n characterData: true,\n childList: true,\n subtree: true\n });\n return () => {\n resize.disconnect();\n relabel.disconnect();\n };\n }, [label]);\n return text;\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default SegmentedButton;"],"mappings":";;;;;;;;;;;;;;AA+JA,MAAMyC,0BAA0B1B,cAAc,IAAI;AAKlD,MAAM2B,uBAAuB3B,cAA6B,QAAQ;AAQlE,SAASiC,MAAMC,SAAkC;CAC/C,MAAME,UAAUF,QAAQG,QAAQC;CAChC,IAAIF,YAAYG,KAAAA,GACd,OAAO;CAET,MAAMD,MAAeE,KAAKC,MAAML,OAAO;CACvC,OAAO,OAAOE,QAAQ,YAAY,OAAOA,QAAQ,WAAWA,MAAM;AACpE;AAIA,SAASI,mBAAmBC,QAA+C;CACzE,QAAQC,UAAUC,gBAAgB;EAChC,MAAMC,SAAS;GACb,GAAGF;GACHG,kBAAkBC,UAAUH,YAAYI,OAAOL,SAASG,gBAAgB;EAC1E;EACA,OAAOJ,WAAWJ,KAAAA,IAAYtC,cAAc,OAAO6C,MAAM,IAAIH,OAAOG,QAAQD,WAAW;CACzF;AACF;AAQA,SAASG,UAAUC,OAAyBC,SAAiG;CAC3I,QAAOE,UAAS;EACd,MAAMC,QAAQD,MAAME;EACpB,MAAMC,WAAW,CAAC,GAAGF,MAAMG,i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,MAAKa,cAAeb,MAAKc;IACrCJ,QAAQE,OAAOZ,MAAKe,gBAAiB,KAAKf,MAAKe,cAAvCpK,KAAAA,CAA+D;GAAC;GAE1EgK,QAAQ;GACR,MAAAK,SAAe,IAAIC,eAAeN,OAAO;GACzCK,OAAME,QAASlB,KAAK;GACpB,MAAAmB,UAAgB,IAAIC,iBAAiBT,OAAO;GAC5CQ,QAAOD,QAASlB,OAAO;IAAAqB,eACN;IAAIC,WACR;IAAIC,SACN;GACX,CAAC;GAAC,aACK;IACLP,OAAMQ,WAAY;IAClBL,QAAOK,WAAY;GAAC;EACrB;EACA5C,KAAA,CAACoB,KAAK;EAACxB,EAAA,KAAAwB;EAAAxB,EAAA,KAAAD;EAAAC,EAAA,KAAAI;CAAA,OAAA;EAAAL,KAAAC,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CArBVjK,gBAAgBgK,IAqBbK,EAAO;CAAC,OACJ6B;AAAI;AAEbnC,gBAAgBmD,UAAUlC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","KeyboardEventHandler","ReactNode","RefAttributes","FocusableElement","Key","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","ToggleGroupState","stylex","createContext","createElement","useCallback","useContext","useEffect","useLayoutEffect","useMemo","useState","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","LabelledByAttribute","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","CrowdingContext","Crowding","crowded","report","undefined","key","GroupRender","Ripple","ReturnType","NonNullable","keyOf","segment","HTMLElement","written","dataset","JSON","parse","radioGroupRenderer","render","domProps","renderProps","merged","onKeyDownCapture","radioKeys","state","toolbar","HTMLDivElement","event","group","currentTarget","segments","querySelectorAll","filter","closest","from","findIndex","target","step","altKey","ctrlKey","metaKey","stepOf","getComputedStyle","direction","preventDefault","stopPropagation","to","length","setSelected","rtl","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","PADDING_GIVE","md","FORCED_COLORS","styles","kgeoSG","kGOzcv","kpsdNU","kEoFBp","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k7Eaqz","k8WAf4","kg3NbH","kVAEAm","kIyJzY","k1ekBW","kAMwcw","$$css","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","spacer","kmuXW","kzqmXN","spacerHalf","spacerHolding","spacerIcon","SegmentedButtonProps","Omit","className","disallowEmptySelection","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","id","glyphFor","marked","isSelected","hasLabel","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","labelRef","element","HTMLSpanElement","labelTitle","labelled","reserves","checks","shown","glyph","drawn","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","t1","t2","single","crowding","setCrowding","NONE_CROWDED","t3","Symbol","for","crowds","current","has","next","Set","add","delete","size","t4","crowdingValue","T0","T1","T2","T3","t5","t6","t7","t8","t9","t10","t11","ReadonlySet","LabelFit","title","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","label","setLabel","fit","useLabelFit","aria","disabledByGroup","stringify","handlers","segmentStyles","ring","setFit","FITS","parentElement","measure","cut","scrollWidth","clientWidth","textContent","textWidthOf","Number","parseFloat","scrollMarginInlineStart","contentWidthOf","resize","ResizeObserver","observe","relabel","MutationObserver","characterData","childList","subtree","document","fonts","addEventListener","disconnect","removeEventListener","getBoundingClientRect","width","borderInlineStartWidth","borderInlineEndWidth","paddingInlineStart","paddingInlineEnd","reduce","sum","range","createRange","selectNodeContents","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { KeyboardEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, Key, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps, ToggleGroupState } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, createElement, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\nimport type { LabelledByAttribute } from '../../render/name';\nimport { CheckGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { useToggleGroupDisabled } from '../../hooks/useToggleGroupDisabled';\nimport { ariaAttributesOf, toggleButtonRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\n\n// The segmented buttons page's outlined segmented button: two to five\n// segments joined into one outlined track, of which one or several are\n// chosen. A segment is Button's default size and type role — a 40dp\n// container with a label-large label — which is what that page gives too.\n//\n// What a screen reader hears follows the selection mode, and React Aria\n// decides it rather than this component. Choosing one of the segments is a\n// radio group, so the track is a `radiogroup` and each segment a `radio`\n// reporting `aria-checked`; choosing several is a `toolbar` of buttons each\n// reporting `aria-pressed`. That is the right mapping for both, and it is\n// why the mode is a word on the group rather than two components.\n//\n// React Aria stops at the name, though: its single mode is announced as a\n// radio group and behaves as a toolbar. So that mode takes the rest of the\n// radio group pattern from the ARIA Authoring Practices, a deliberate\n// departure from React Aria's `ToggleButtonGroup`, in two parts. The chosen\n// segment cannot be pressed off, since a radio group always holds a choice\n// and the page's single-select set always keeps one segment chosen;\n// `disallowEmptySelection={false}` gives React Aria's default back. And the\n// arrow keys choose as they move, wrapping at either end, with Home and End\n// choosing the first and last segment. Under React Aria the arrows moved\n// focus alone and stopped at the ends, so a screen reader reached each radio\n// without it being checked, and choosing one took a separate Space. Choosing\n// several keeps React Aria's toolbar keys, where the arrows only move between\n// buttons and Space toggles one.\n//\n// Six things are this component's own.\n//\n// **The segments are one track, not a row of buttons.** Every segment\n// carries the page's 1dp outline, and each one after the first drops its\n// leading edge so neighbours share a single rule rather than drawing two\n// against each other. The outer ends are the page's fully rounded shape and\n// the inner joins are square.\n//\n// **Every segment is the same width.** The page gives the segment width as\n// the container's divided by their number, so the track is a grid of equal\n// columns; the container itself is still as wide as its widest label asks,\n// plus the room described next.\n//\n// **A chosen segment says so with a check.** The page draws it in the icon\n// slot, so a segment given an `icon` shows the icon while unselected and the\n// check once chosen. `showSelectedIcon` turns it off for a set whose labels\n// already read as chosen or not.\n//\n// Without the check, the page's chosen container is the only cue, and it is\n// about 1.2:1 against the page in the light theme, with the same label\n// colour either way — under WCAG's 3:1 for a state. So a set with the check\n// off draws its chosen segment on the secondary role instead, with the label\n// on it, which clears that comfortably. A departure from the page, taken\n// only where the page's own cue has been turned off; with the check drawn,\n// the chosen segment is the page's.\n//\n// A segment with an `icon` and no label is drawn that way whatever the set\n// says. It keeps its icon when chosen, since the icon is all that tells it\n// from its neighbours, and a check in its place would hide which of them is\n// the chosen one.\n//\n// Under forced colours a fill is painted in the page's own `Canvas`, so the\n// chosen container is `Highlight` with its label in `HighlightText` — the\n// pair the mode gives whatever is chosen — and a disabled chosen one keeps\n// a `GrayText` ring rather than a fill, which leaves its `GrayText` label\n// readable.\n//\n// Every segment that could ever draw that slot keeps room for it whether\n// or not it is drawing one. Sized by what it drew, the slot made the widest\n// segment whichever one was chosen, and the whole track changed width with\n// the choice — moving every label, and moving the ground under the chosen\n// container while it was sliding across it. The mechanism is Angular\n// Material's button toggle: the slot opens from 0 to 18dp and the space it\n// lands in opens beside it, both over `durationShort2`. Here that space is\n// two spacers either side of the label, which trade it between them: half\n// on each side while nothing is drawn, so a bare label stays centred, and\n// all of it on the leading side, where the slot sits, once something is.\n// Their total never changes, so neither does the segment's width. Angular\n// Material has no case of the first kind, since its toggles are sized by\n// their own content rather than by the widest of them.\n//\n// That room gives way before the label does. A track with room to spare is\n// the widest label plus 26dp per segment, which is what the widest column\n// already measured while its own segment was the chosen one. A track\n// squeezed below that — long labels on a phone — gives the reserve back\n// first, then the 4dp of the page's 12dp padding beyond the 8dp a segment\n// always keeps, and then the glyphs themselves. A label shows whole in a\n// segment 16dp wider than it, or 42dp while a glyph is drawn beside it, plus\n// the segment's rule, so on a phone a check or an icon is what cuts a label\n// that would otherwise fit. Once any segment's label would be cut beside its\n// glyph, the whole set stops drawing them: no check and no icons, and the\n// chosen segment on the stronger container a set without a check draws, so\n// the choice still reads. The whole set rather than the one segment, since a\n// set choosing several would otherwise draw one chosen segment one way and\n// the next another. And any segment rather than the chosen one, since a\n// check that would cut a label only once its segment is chosen is the same\n// cut a moment later, and choosing should not turn the glyphs off or on.\n// Only past that is a label cut short, with an ellipsis\n// and a `title` that shows it whole. The track's width still never depends\n// on the choice: squeezed, its columns are the container's, shared equally,\n// and the glyphs giving way frees room inside them without moving them.\n//\n// Angular Material delays the check's own transition by 45ms so the space\n// opens before the glyph arrives. That is dropped rather than carried as a\n// literal: there is no motion token for it, and the slot here opens from its\n// centre rather than its leading edge, so the check and the label never\n// cross even when the two run together.\n//\n// **The chosen container is an element of its own, and it moves.** It is\n// React Aria's `SelectionIndicator`, a shared element rendered inside every\n// segment and drawn in the chosen one: on a change it keeps the old one\n// until it has finished moving, so two exist while it slides. No\n// `SharedElementTransition` is rendered here, because `ToggleButtonGroup`\n// wraps its children in one already — worth saying, since the primitive\n// throws outside a scope wherever else it is used.\n//\n// It is the page's chosen container rather than a smaller pill: it covers\n// the segment, which is the box a background painted, so the fill is all\n// that travels. Three things follow. It is drawn behind the segments rather\n// than inside one, or a container crossing a neighbour would pass over that\n// neighbour's label and the rule beside it. Its corners have to match\n// whichever segment it is in, which the segment hands down as a custom\n// property, because a child cannot read its own parent's place in the track.\n// And the state layers move onto a layer of their own above it, since a\n// container that slides away would otherwise take the hover with it and off\n// the segment under the pointer.\n//\n// **Choosing several animates differently, rather than the same way twice.**\n// A shared element is one element: it can move between segments, but with\n// several chosen there is no single segment for it to be at. So\n// `selectionMode=\"multiple\"` names only `opacity` in the transition, nothing\n// positional is snapshotted, and each container fades in and out where it\n// is; `single` names `translate` and `border-radius` as well, and the one\n// container travels between segments.\n//\n// **Two of the page's values are the library's instead**, both for\n// consistency with the controls beside them: the focus ring, which is\n// primary at 2dp offset 2dp everywhere here rather than the page's secondary\n// at 3dp, and the press, which is the library's ripple rather than a flat\n// state layer. The page names a ripple as the pressed state, so the second\n// is a departure only in how it is drawn.\n//\n// **The density steps are not drawn.** The page removes 4dp of height per\n// step down, for denser interfaces; nothing else in the library takes a\n// density, and one component that did would be the odd one out. A shorter\n// track is a `className` away.\n//\n// Vertical is React Aria's and is not passed through, since the page draws\n// one row and a column of joined segments is a different shape — the outer\n// corners, the shared rule and the equal columns would all have to mean\n// something else.\n\n// Whether a chosen segment draws the check. A context rather than a prop on\n// each segment, since it is the set's decision and repeating it on every\n// segment is how the two drift.\nconst ShowSelectedIconContext = createContext(true);\n\n// Which of the two animations the chosen container plays. Read from a\n// context for the same reason, and because React Aria's own state context\n// holds the mode in a shape this would have to narrow before using.\nconst SelectionModeContext = createContext<SelectionMode>('single');\n\n// Whether the set has stopped drawing glyphs because one would cut a label,\n// and how a segment says whether its own would. The segments measure, since\n// each holds its own label; the set decides, since the decision is the whole\n// set's. See the header.\nconst CrowdingContext = createContext<Crowding>({\n crowded: false,\n report: () => undefined\n});\ninterface Crowding {\n crowded: boolean;\n report: (key: Key, crowded: boolean) => void;\n}\ntype GroupRender = RACToggleButtonGroupProps['render'];\ntype Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\n\n// A segment's key, back from the attribute `SegmentedButtonSegment` writes\n// it into. JSON rather than the key as written, so a numeric key comes back\n// a number and matches the one React Aria's selection holds.\nfunction keyOf(segment: HTMLElement): Key | null {\n const written = segment.dataset.key;\n if (written === undefined) {\n return null;\n }\n const key: unknown = JSON.parse(written);\n return typeof key === 'string' || typeof key === 'number' ? key : null;\n}\n\n// The group's element, with `radioKeys` in place of React Aria's keyboard\n// handler, then handed to the call site's own `render` if it passed one.\nfunction radioGroupRenderer(render: GroupRender): NonNullable<GroupRender> {\n return (domProps, renderProps) => {\n const merged = {\n ...domProps,\n onKeyDownCapture: radioKeys(renderProps.state, domProps.onKeyDownCapture)\n };\n return render === undefined ? createElement('div', merged) : render(merged, renderProps);\n };\n}\n\n// The radio group's keys, taken ahead of React Aria's toolbar ones on the\n// same capture listener: the arrows, Home and End move focus to a segment\n// and choose it, wrapping at the ends and passing over a disabled segment,\n// which is what the toolbar's own handler would otherwise do with focus\n// alone. Everything else — Tab, and an arrow held with a modifier the\n// browser may want — is handed to the toolbar as before.\nfunction radioKeys(state: ToggleGroupState, toolbar: KeyboardEventHandler<HTMLDivElement> | undefined): KeyboardEventHandler<HTMLDivElement> {\n return event => {\n const group = event.currentTarget;\n const segments = [...group.querySelectorAll<HTMLElement>('[data-key]:not([data-disabled])')].filter(segment => segment.closest('[role=\"radiogroup\"]') === group);\n const from = segments.findIndex(segment => segment === event.target);\n const step = event.altKey || event.ctrlKey || event.metaKey ? null : stepOf(event.key, getComputedStyle(group).direction === 'rtl');\n if (from === -1 || step === null) {\n toolbar?.(event);\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n const to = step === 'first' ? 0 : step === 'last' ? segments.length - 1 : (from + step + segments.length) % segments.length;\n const segment = segments[to];\n const key = keyOf(segment);\n if (key === null) {\n return;\n }\n segment.focus();\n state.setSelected(key, true);\n };\n}\n\n// Where a key moves the choice in a radio group: one segment on, one back,\n// or to either end. Right and left follow the direction the track is drawn\n// in, read off the track itself rather than the locale, so a `dir` on a\n// wrapper turns them over as it turns the track over; up and down, and Home\n// and End, follow the document order whatever the direction.\nfunction stepOf(key: string, rtl: boolean): -1 | 1 | 'first' | 'last' | null {\n switch (key) {\n case 'ArrowDown':\n {\n return 1;\n }\n case 'ArrowLeft':\n {\n return rtl ? 1 : -1;\n }\n case 'ArrowRight':\n {\n return rtl ? -1 : 1;\n }\n case 'ArrowUp':\n {\n return -1;\n }\n case 'End':\n {\n return 'last';\n }\n case 'Home':\n {\n return 'first';\n }\n default:\n {\n return null;\n }\n }\n}\n\n// The page's 18dp icon slot, and the room a segment keeps for it: the slot\n// plus the gap between it and the label. Half of that room sits on each side\n// of the label while nothing is drawn, which is what keeps a bare label\n// centred; see `labelReserved`.\nconst GLYPH_SIZE = '18px';\nconst GLYPH_RESERVE = `calc(${GLYPH_SIZE} + ${spacing.sm})`;\nconst GLYPH_RESERVE_HALF = `calc((${GLYPH_SIZE} + ${spacing.sm}) / 2)`;\n\n// The part of the page's 12dp padding a segment gives back on a narrow\n// track: the padding is 8dp, and the rest sits in the spacers, which shrink.\nconst PADDING_GIVE = `calc(${spacing.md} - ${spacing.sm})`;\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 segment: {\n \"--segment-indicator-radius-end\": \"x32u3vw x111hk5a\",\n \"--segment-indicator-radius-start\": \"xatjrgw x1syycwj\",\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x17kqlg\",\n kpsdNU: \"xm4btww\",\n kEoFBp: \"x1hmns74\",\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1rv7mn0\",\n kVAM5u: \"x1fwvt7v\",\n kT0f0o: \"x1fougng xkducg2\",\n kVL7Gh: \"x1prwiuu x1uwupfv\",\n k2ei4v: \"x120dh57 x14e42zd\",\n kfmiAY: \"x17hb1p4 x1a37zkv\",\n krdFHd: \"xwfph4i xb01x1j\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kjj79g: \"xl56j7k\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n k7Eaqz: \"xeuugli\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"xn60lsn\",\n kVAEAm: \"x1n2onr6\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xt3l3uh\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n segmentDisabled: {\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n segmentSelected: {\n kMwMTN: \"x1sawysd x1k5gbb1\",\n $$css: true\n },\n segmentSelectedUnmarked: {\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n segmentUnselected: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n spacer: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kmuXW: \"xs83m0k\",\n kzqmXN: \"xbraz1g\",\n kjj79g: \"x13a6bvl\",\n k7Eaqz: \"xeuugli\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1pha8k4\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n spacerHalf: {\n kzqmXN: \"x154zo0h\",\n $$css: true\n },\n spacerHolding: {\n kzqmXN: \"x1n85vuq\",\n k7Eaqz: \"x36sgg7\",\n $$css: true\n },\n spacerIcon: {\n kzqmXN: \"x1iuy3mw\",\n k7Eaqz: \"x16xo4sp\",\n $$css: true\n }\n};\ntype SegmentedButtonProps = LabelledByAttribute & Omit<RACToggleButtonGroupProps, 'className' | 'disallowEmptySelection' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\n /**\n * Whether the chosen segment stays chosen when it is pressed again. On\n * by default while one is chosen, since a radio group always holds a\n * choice; `false` lets a press clear it, as React Aria's own default\n * does. Off by default while several may be, where any of them can be\n * turned off.\n * @default true while one is chosen, false while several may be\n */\n disallowEmptySelection?: boolean;\n /**\n * Whether a chosen segment draws a check before its label, as the page\n * has it. `false` leaves the segment's own icon in place while selected,\n * and draws the chosen segment on the stronger secondary container, since\n * the page's own is too faint to say which is chosen by itself.\n * @default true\n */\n showSelectedIcon?: boolean;\n /** A function may compute the style from the set's render state. */\n style?: RACToggleButtonGroupProps['style'];\n};\ntype SegmentedButtonSegmentProps = Omit<RACToggleButtonProps, 'children' | 'className' | 'id' | 'style'> & {\n /** The segment's label. */\n children?: ReactNode;\n /** A function may compute the class from the segment's render state. */\n className?: RACToggleButtonProps['className'];\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * An icon before the label, in the page's 18dp size. Replaced by the check\n * while the segment is chosen, unless the set turns that off. An icon drawn\n * in `em` takes that size from the slot.\n *\n * Given with no label, the icon is the segment, centred in it and kept\n * while chosen; name the segment with `aria-label` then.\n */\n icon?: ReactNode;\n /**\n * The key selection is reported by. Required, because React Aria joins a\n * toggle to its group's selection by this key alone: a segment without one\n * keeps a pressed state of its own, so a set where one is chosen could hold\n * two, and it is announced as a pressed button rather than a radio.\n */\n id: Key;\n /** A function may compute the style from the segment's render state. */\n style?: RACToggleButtonProps['style'];\n};\n\n/**\n * What the glyph slot draws: the check on a chosen segment, or the segment's\n * own icon. `null` for a segment with neither, which leaves the slot empty\n * and closed rather than unrendered. Returns a node rather than letting the\n * type be inferred, since `ReactNode` is a union that includes a promise and\n * an inferred one has to be `async`.\n */\nfunction glyphFor(state: ToggleButtonRenderProps, icon: ReactNode, marked: boolean): ReactNode {\n if (state.isSelected && marked) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\n}\n\n// Whether a segment has a label, rather than an icon alone. An empty string\n// and a `false` from a condition at the call site are no label either.\nfunction hasLabel(children: ReactNode) {\n return children !== undefined && children !== null && children !== false && children !== '';\n}\n\n// The chosen container's class, from the segment's own state and the shared\n// element's. A function, because React Aria hands the indicator the entering\n// and leaving states the fade is drawn from, and those are the only two the\n// element knows about itself.\nfunction indicatorClassName(isDisabled: boolean, selectionMode: SelectionMode, marked: boolean): (state: SharedElementRenderProps) => string {\n return state => ({\n 0: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd\"\n },\n 8: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7\"\n },\n 4: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4\"\n },\n 12: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4\"\n },\n 2: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 10: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 6: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 14: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1\"\n },\n 1: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk\"\n },\n 9: {\n className: \"x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk\"\n },\n 5: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4 xg01cxk\"\n },\n 13: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4 xg01cxk\"\n },\n 3: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 11: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 7: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n },\n 15: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk\"\n }\n })[!!(selectionMode === 'multiple') << 3 | !!!marked << 2 | !!isDisabled << 1 | !!(state.isEntering || state.isExiting) << 0].className ?? '';\n}\n\n// What a segment draws, from React Aria's render state. Built by a call\n// 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\n// on its inputs.\nfunction segmentContent(children: ReactNode, icon: ReactNode, ripple: Ripple, selectionMode: SelectionMode, marked: boolean, crowded: boolean, labelRef: (element: HTMLSpanElement | null) => void, labelTitle: string | undefined) {\n const labelled = hasLabel(children);\n // Whether this segment can ever draw a glyph, and so whether it keeps room\n // for one. A set that draws no check and a segment with no icon of its own\n // never needs the slot, and reserving it there would be dead space in\n // every segment of the track. Read from the set's choice rather than from\n // what is drawn now, so a crowded set keeps the same reserve to give back.\n const reserves = marked || icon !== undefined;\n // A crowded set draws no glyph beside a label, and its chosen container is\n // the one a set without a check draws. An icon alone is untouched.\n const checks = marked && !crowded;\n const shown = crowded && labelled ? undefined : icon;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, shown, checks);\n const drawn = glyph !== null;\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, checks)} />\n <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi xg01cxk x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4\"\n },\n 4: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xe2qvxb\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 6: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xcl2av\"\n },\n 1: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 5: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 3: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n },\n 7: {\n className: \"x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xjg27g\"\n }\n }[!!state.isHovered << 2 | !!state.isFocusVisible << 1 | !!state.isPressed << 0]} />\n <span {...stylex.props(styles.spacer, reserves && (drawn ? labelled ? styles.spacerHolding : styles.spacerIcon : styles.spacerHalf))}>\n {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xnalus7 xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1nsf9p3\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x9f619 x3nfvp2 x2lah0s xosj86m xl56j7k xb3r6kr x47corl x1qno0dh x1gcwfje xpc4ca7 x1xp8n7a x1nsf9p3\"\n }\n }[!!drawn << 1 | !!(drawn && labelled) << 0]}>\n {glyph}\n </span>}\n </span>\n {labelled && <span ref={labelRef} title={labelTitle} {...{\n 0: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft\"\n },\n 2: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8\"\n },\n 1: {\n className: \"x12w9bfk x2lah0s x193iq5w xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1g12otp\"\n },\n 3: {\n className: \"x12w9bfk x2lah0s xeuugli xb3r6kr x37ujze xlyipyv x1qno0dh xrtqwew xpc4ca7 xuxw1ft x1tpxo8 x1g12otp\"\n }\n }[!!drawn << 1 | !!(state.isSelected && !state.isDisabled) << 0]}>\n {children}\n </span>}\n <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k xbraz1g x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 x9f619 x78zum5 xs83m0k x13a6bvl xeuugli x1qno0dh x1pha8k4 xpc4ca7 x154zo0h\"\n }\n }[!!(reserves && !drawn) << 0]} />\n {ripple.surface}\n </>;\n };\n}\n\n/**\n * A row of two to five joined segments, of which one — or with\n * `selectionMode=\"multiple\"`, several — is chosen. Selection is React Aria's:\n * pass `selectedKeys` with `onSelectionChange` to control it, or\n * `defaultSelectedKeys` to let it keep its own. Give every segment an `id`,\n * which is the key selection is reported by.\n *\n * ```tsx\n * <SegmentedButton aria-label=\"Label\" defaultSelectedKeys={['first']}>\n * <SegmentedButton.Segment id=\"first\">First item</SegmentedButton.Segment>\n * <SegmentedButton.Segment id=\"second\">Second item</SegmentedButton.Segment>\n * </SegmentedButton>\n * ```\n *\n * Name the set with `aria-label` or `aria-labelledby`, one of which the\n * props require — nothing here labels it for you, and a set with no name is\n * a group a screen reader cannot announce. What it is announced as follows the selection mode: choosing one\n * is a radio group, choosing several a toolbar of two-state buttons. So does\n * how the chosen container moves: it slides between segments while one is\n * chosen, and fades in place while several may be.\n *\n * Choosing one behaves as a radio group too, which React Aria's\n * `ToggleButtonGroup` does not. The chosen segment stays chosen when it is\n * pressed again, unless `disallowEmptySelection` is `false`. The arrow keys\n * move to a segment and choose it, wrapping at either end, and Home and End\n * choose the first and last. Choosing several keeps React Aria's keys: the\n * arrows move between segments, and Space or Enter toggles the focused one.\n *\n * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n disallowEmptySelection,\n render,\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n const single = selectionMode === 'single';\n // The segments whose label a glyph would cut, by key. The set is crowded\n // while it holds any.\n const [crowding, setCrowding] = useState<ReadonlySet<Key>>(NONE_CROWDED);\n // Kept the same across renders, so a segment's report does not run again\n // each time the set's answer changes.\n const report = useCallback((key: Key, crowds: boolean) => {\n setCrowding(current => {\n if (current.has(key) === crowds) {\n return current;\n }\n const next = new Set(current);\n if (crowds) {\n next.add(key);\n } else {\n next.delete(key);\n }\n return next;\n });\n }, []);\n const crowded = crowding.size > 0;\n const crowdingValue = useMemo(() => ({\n crowded,\n report\n }), [crowded, report]);\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <CrowdingContext value={crowdingValue}>\n <RACToggleButtonGroup {...props} disallowEmptySelection={disallowEmptySelection ?? single} render={single ? radioGroupRenderer(render) : render} selectionMode={selectionMode} {...mergeStatefulStyles({\n className: \"x9f619 xwz0xwf xu6a5m6 x1mt1orb xc8icb0\"\n }, props)} />\n </CrowdingContext>\n </SelectionModeContext>\n </ShowSelectedIconContext>;\n}\nconst NONE_CROWDED: ReadonlySet<Key> = new Set();\ninterface LabelFit {\n crowds: boolean;\n title: string | undefined;\n}\n\n/**\n * One segment. Its `id` is what selection is reported by, and its label is\n * what names it. A chosen segment draws a check before the label; an\n * unchosen one draws whatever `icon` holds, if anything.\n */\nfunction SegmentedButtonSegment({\n children,\n disableRipple = false,\n icon,\n onClick,\n onContextMenu,\n onKeyDown,\n onKeyUp,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n render,\n ...props\n}: RefAttributes<HTMLButtonElement> & SegmentedButtonSegmentProps) {\n const selectionMode = useContext(SelectionModeContext);\n // Whether this segment draws the check when chosen: the set's choice,\n // unless the segment has no label — see the header.\n const marked = useContext(ShowSelectedIconContext) && hasLabel(children);\n const [label, setLabel] = useState<HTMLSpanElement | null>(null);\n const fit = useLabelFit(label);\n const {\n crowded,\n report\n } = useContext(CrowdingContext);\n // Each segment tells the set whether its own glyph would cut its label,\n // and takes the answer back for the whole set. Only a segment that could\n // ever draw one says so: a long label beside a slot it never fills is not\n // a reason for its neighbours to drop theirs. Withdrawn as the segment\n // goes, so a set that loses its one crowded segment draws glyphs again.\n const crowds = fit.crowds && (marked || icon !== undefined);\n useEffect(() => {\n report(props.id, crowds);\n return () => {\n report(props.id, false);\n };\n }, [crowds, props.id, report]);\n // The `aria-*` props React Aria would drop and the keyboard handlers it\n // would wrap go on the element itself, as they do on Chip, Button and\n // IconButton; see src/render/aria.tsx.\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n // Off while disabled, as in Button: a control that cannot be pressed\n // should not answer a press with an animation. A disabled set disables\n // its segments through React Aria's group state rather than their props,\n // so the group is read as well.\n const disabledByGroup = useToggleGroupDisabled(props.id);\n // The call site's pointer handlers go through the ripple, which calls\n // them after its own. Spread beside the ripple's, one of the two sets\n // would write over the other.\n const ripple = useRipple<FocusableElement>(!disableRipple && props.isDisabled !== true && !disabledByGroup, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n return <RACToggleButton\n // The key the radio group's arrow keys choose this segment by; see\n // `radioKeys`. React Aria keeps a segment's key off its element.\n data-key={selectionMode === 'single' ? JSON.stringify(props.id) : undefined} render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(marked && !crowded), props)}>\n {segmentContent(children, icon, ripple, selectionMode, marked, crowded, setLabel, fit.title)}\n </RACToggleButton>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// segment's state comes from the render state React Aria hands its\n// className. `disabled` is applied last so its label colour wins over both\n// of the others. Built by a call, since a set that draws no check labels its\n// chosen segment for the container it draws instead.\nfunction segmentStyles(marked: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !marked && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\n\n// Two readings of a label against its segment. `title` is the label's text\n// while the segment is cutting it short, for a `title` that shows it whole,\n// and undefined while it fits. `crowds` is whether the label would be cut\n// beside a glyph, which is what the set stops drawing glyphs for.\n//\n// `crowds` compares the label's own width with the segment's content box\n// less the glyph's room, and neither of those depends on whether a glyph is\n// drawn, so the set dropping its glyphs cannot flip the answer back. The\n// label's width is read off a range over its text rather than its\n// `scrollWidth`, which rounds up to a whole pixel and would call a label\n// that fits by a fraction cut.\n//\n// Measured again whenever the label's box, the segment's box or the label's\n// text changes, and once the fonts arrive, since a label still held at the\n// segment's width keeps its box while its text grows or shrinks inside it.\nfunction useLabelFit(label: HTMLElement | null): LabelFit {\n const [fit, setFit] = useState<LabelFit>(FITS);\n useLayoutEffect(() => {\n const segment = label?.parentElement;\n if (label === null || segment === null || segment === undefined) {\n return undefined;\n }\n const measure = () => {\n const cut = label.scrollWidth > label.clientWidth;\n const title = cut && label.textContent !== '' ? label.textContent : undefined;\n const crowds = textWidthOf(label) + Number.parseFloat(getComputedStyle(label).scrollMarginInlineStart) > contentWidthOf(segment);\n setFit(current => current.title === title && current.crowds === crowds ? current : {\n crowds,\n title\n });\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(label);\n resize.observe(segment);\n const relabel = new MutationObserver(measure);\n relabel.observe(label, {\n characterData: true,\n childList: true,\n subtree: true\n });\n document.fonts.addEventListener('loadingdone', measure);\n return () => {\n resize.disconnect();\n relabel.disconnect();\n document.fonts.removeEventListener('loadingdone', measure);\n };\n }, [label]);\n return fit;\n}\nconst FITS: LabelFit = {\n crowds: false,\n title: undefined\n};\n\n// The width a segment lays its label out in: its box less its rule and its\n// padding, the box the label's `100%` resolves against.\nfunction contentWidthOf(segment: HTMLElement) {\n const style = getComputedStyle(segment);\n return segment.getBoundingClientRect().width - [style.borderInlineStartWidth, style.borderInlineEndWidth, style.paddingInlineStart, style.paddingInlineEnd].reduce((sum, length) => sum + Number.parseFloat(length), 0);\n}\n\n// How wide a label's text is laid out, whether or not the label shows it\n// all: a range measures the text's own boxes, which run on past a label\n// that clips them.\nfunction textWidthOf(label: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(label);\n return range.getBoundingClientRect().width;\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default S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,OAAO;GACtB,MAAAuM,UAAgB,IAAIC,iBAAiBd,OAAO;GAC5Ca,QAAOD,QAASzB,OAAO;IAAA4B,eACN;IAAIC,WACR;IAAIC,SACN;GACX,CAAC;GACDC,SAAQC,MAAMC,iBAAkB,eAAepB,OAAO;GAAC,aAChD;IACLU,OAAMW,WAAY;IAClBR,QAAOQ,WAAY;IACnBH,SAAQC,MAAMG,oBAAqB,eAAetB,OAAO;GAAC;EAC3D;EACAvD,KAAA,CAAC0C,KAAK;EAAC3C,EAAA,KAAA2C;EAAA3C,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAA;EAAAF,KAAAC,EAAA;EAAAC,KAAAD,EAAA;CAAA;CA9BVxK,gBAAgBuK,IA8BbE,EAAO;CAAC,OACJ4C;AAAG;AAEZ,MAAMS,OAAiB;CACrB5C,QAAQ;CACRuB,OAAO1K,KAAAA;AACT;AAIA,SAAS0M,eAAenM,SAAsB;CAC5C,MAAMgG,QAAQjE,iBAAiB/B,OAAO;CACtC,OAAOA,QAAQiN,sBAAsB,CAAC,CAACC,QAAQ;EAAClH,MAAMmH;EAAwBnH,MAAMoH;EAAsBpH,MAAMqH;EAAoBrH,MAAMsH;CAAgB,CAAC,CAACC,QAAQC,KAAKpL,WAAWoL,MAAMxB,OAAOC,WAAW7J,MAAM,GAAG,CAAC;AACxN;AAKA,SAAS2J,YAAYlB,OAAoB;CACvC,MAAM4C,QAAQb,SAASc,YAAY;CACnCD,MAAME,mBAAmB9C,KAAK;CAC9B,OAAO4C,MAAMR,sBAAsB,CAAC,CAACC;AACvC;AACAlF,gBAAgB4F,UAAUxD"}
|
|
@@ -121,6 +121,69 @@ function escapeKeyOn(escape, state, render) {
|
|
|
121
121
|
return render === void 0 ? /* @__PURE__ */ jsx("section", { ...next }) : render(next, renderProps);
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
+
function hasSize(element) {
|
|
125
|
+
return element.clientWidth > 0 && element.clientHeight > 0;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Puts a panel against the edge it rests on, without the smooth scroll an
|
|
129
|
+
* arrival takes: a bottom sheet, or a sheet on the right, at the end of its
|
|
130
|
+
* scroller, and a sheet on the left at the start. React Aria stamps the edge
|
|
131
|
+
* it resolved, by the writing direction, on the layer.
|
|
132
|
+
*/
|
|
133
|
+
function restAtEdge(layer, scroller) {
|
|
134
|
+
const edge = layer.dataset.position;
|
|
135
|
+
if (edge === "bottom") scroller.scrollTo({ top: scroller.scrollHeight });
|
|
136
|
+
else scroller.scrollTo({ left: edge === "left" ? 0 : scroller.scrollWidth });
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Rests a panel that opened before it could be laid out, once it can be.
|
|
140
|
+
*
|
|
141
|
+
* React Aria brings a panel in by scrolling its scroller to where it rests,
|
|
142
|
+
* and counts the panel as arriving until that scroll ends. A scroller with no
|
|
143
|
+
* size scrolls nowhere and never ends a scroll, which is what a sheet opened
|
|
144
|
+
* inside something hidden has — a `container` in a tab panel or a route not
|
|
145
|
+
* shown yet. Shown later, the panel was laid out where the scroll left it,
|
|
146
|
+
* off the window, with its scrim over the page, and React Aria went on
|
|
147
|
+
* waiting: focus never moved in, and a press on the trigger behind it closed
|
|
148
|
+
* a sheet nobody had seen.
|
|
149
|
+
*
|
|
150
|
+
* So a layer whose scroller has no size as it mounts is watched until the
|
|
151
|
+
* scroller first has one, and the panel is then put where it opens, which
|
|
152
|
+
* ends the scroll React Aria is waiting on. A scroller with a size from the
|
|
153
|
+
* start is left to React Aria, and nothing here runs again: a panel being
|
|
154
|
+
* dragged or arriving always has a size. A ref callback rather than an
|
|
155
|
+
* effect, since the layer mounts with the sheet's opening, which the trigger
|
|
156
|
+
* rather than this part decides.
|
|
157
|
+
*/
|
|
158
|
+
function restOnceLaidOut(layer) {
|
|
159
|
+
const scroller = layer?.querySelector("[data-sheet-scroll]");
|
|
160
|
+
if (!(layer instanceof HTMLElement && scroller instanceof HTMLElement) || hasSize(scroller)) return;
|
|
161
|
+
const observer = new ResizeObserver(() => {
|
|
162
|
+
if (!hasSize(scroller)) return;
|
|
163
|
+
observer.disconnect();
|
|
164
|
+
restWhereItOpens(layer, scroller);
|
|
165
|
+
});
|
|
166
|
+
observer.observe(scroller);
|
|
167
|
+
return () => {
|
|
168
|
+
observer.disconnect();
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Puts a panel where it opens, as React Aria's arrival does: at its first
|
|
173
|
+
* snap point where it has them, which React Aria marks inside the panel, and
|
|
174
|
+
* otherwise against its edge. Only a bottom sheet takes snap points, and the
|
|
175
|
+
* marker's top edge, less its scroll margin, is what React Aria lines up with
|
|
176
|
+
* the top of the scroller.
|
|
177
|
+
*/
|
|
178
|
+
function restWhereItOpens(layer, scroller) {
|
|
179
|
+
const first = layer.querySelector("[data-sheet-initial]");
|
|
180
|
+
if (!(first instanceof HTMLElement)) {
|
|
181
|
+
restAtEdge(layer, scroller);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const margin = Number.parseFloat(getComputedStyle(first).scrollMarginTop) || 0;
|
|
185
|
+
scroller.scrollTo({ top: first.getBoundingClientRect().top - scroller.getBoundingClientRect().top + scroller.scrollTop - margin });
|
|
186
|
+
}
|
|
124
187
|
/**
|
|
125
188
|
* A modal panel that arrives from the edge of the screen — a side sheet on a
|
|
126
189
|
* wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:
|
|
@@ -253,21 +316,21 @@ function SheetBody(t0) {
|
|
|
253
316
|
* positioned element holds the sheet to that element instead.
|
|
254
317
|
*/
|
|
255
318
|
function SheetContent$1(t0) {
|
|
256
|
-
const $ = c(
|
|
319
|
+
const $ = c(43);
|
|
257
320
|
let children;
|
|
258
321
|
let className;
|
|
259
322
|
let container;
|
|
260
323
|
let defaultOpen;
|
|
261
324
|
let isOpen;
|
|
262
325
|
let onOpenChange;
|
|
263
|
-
let props$
|
|
326
|
+
let props$3;
|
|
264
327
|
let ref;
|
|
265
328
|
let snapPoints;
|
|
266
329
|
let style;
|
|
267
330
|
let t1;
|
|
268
331
|
let t2;
|
|
269
332
|
if ($[0] !== t0) {
|
|
270
|
-
({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled: t2, isOpen, onOpenChange, ref, snapPoints, style, ...props$
|
|
333
|
+
({children, className, container, defaultOpen, isDismissable: t1, isKeyboardDismissDisabled: t2, isOpen, onOpenChange, ref, snapPoints, style, ...props$3} = t0);
|
|
271
334
|
$[0] = t0;
|
|
272
335
|
$[1] = children;
|
|
273
336
|
$[2] = className;
|
|
@@ -275,7 +338,7 @@ function SheetContent$1(t0) {
|
|
|
275
338
|
$[4] = defaultOpen;
|
|
276
339
|
$[5] = isOpen;
|
|
277
340
|
$[6] = onOpenChange;
|
|
278
|
-
$[7] = props$
|
|
341
|
+
$[7] = props$3;
|
|
279
342
|
$[8] = ref;
|
|
280
343
|
$[9] = snapPoints;
|
|
281
344
|
$[10] = style;
|
|
@@ -288,7 +351,7 @@ function SheetContent$1(t0) {
|
|
|
288
351
|
defaultOpen = $[4];
|
|
289
352
|
isOpen = $[5];
|
|
290
353
|
onOpenChange = $[6];
|
|
291
|
-
props$
|
|
354
|
+
props$3 = $[7];
|
|
292
355
|
ref = $[8];
|
|
293
356
|
snapPoints = $[9];
|
|
294
357
|
style = $[10];
|
|
@@ -302,117 +365,123 @@ function SheetContent$1(t0) {
|
|
|
302
365
|
const position = isBottom ? "bottom" : "end";
|
|
303
366
|
const heights = isBottom && snapPoints !== void 0 && snapPoints.length > 0 ? snapPoints : void 0;
|
|
304
367
|
const overlayRef = useRef(null);
|
|
368
|
+
let t3;
|
|
369
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
370
|
+
t3 = mergeRefs(overlayRef, restOnceLaidOut);
|
|
371
|
+
$[13] = t3;
|
|
372
|
+
} else t3 = $[13];
|
|
373
|
+
const layerRef = t3;
|
|
305
374
|
useRestOnTurn(overlayRef, position);
|
|
306
375
|
let escape;
|
|
307
|
-
if ($[
|
|
376
|
+
if ($[14] !== isDismissable || $[15] !== isKeyboardDismissDisabled) {
|
|
308
377
|
if (isDismissable === isKeyboardDismissDisabled) escape = isKeyboardDismissDisabled ? "hold" : "close";
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else escape = $[
|
|
313
|
-
const
|
|
314
|
-
const
|
|
315
|
-
const
|
|
316
|
-
let t6;
|
|
317
|
-
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
318
|
-
t6 = props(overlay.backdrop);
|
|
319
|
-
$[16] = t6;
|
|
320
|
-
} else t6 = $[16];
|
|
378
|
+
$[14] = isDismissable;
|
|
379
|
+
$[15] = isKeyboardDismissDisabled;
|
|
380
|
+
$[16] = escape;
|
|
381
|
+
} else escape = $[16];
|
|
382
|
+
const t4 = !isDismissable;
|
|
383
|
+
const t5 = isReduced ? void 0 : scrimIn;
|
|
384
|
+
const t6 = heights === void 0 ? void 0 : TO_THE_FIRST_SNAP_POINT;
|
|
321
385
|
let t7;
|
|
322
|
-
if ($[17]
|
|
323
|
-
t7 =
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
386
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
387
|
+
t7 = props(overlay.backdrop);
|
|
388
|
+
$[17] = t7;
|
|
389
|
+
} else t7 = $[17];
|
|
390
|
+
let t8;
|
|
391
|
+
if ($[18] !== t5 || $[19] !== t6) {
|
|
392
|
+
t8 = /* @__PURE__ */ jsx(SheetBackdrop, {
|
|
393
|
+
swipeAnimation: t5,
|
|
394
|
+
swipeAnimationRange: t6,
|
|
395
|
+
...t7
|
|
327
396
|
});
|
|
328
|
-
$[17] = t4;
|
|
329
397
|
$[18] = t5;
|
|
330
|
-
$[19] =
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
398
|
+
$[19] = t6;
|
|
399
|
+
$[20] = t8;
|
|
400
|
+
} else t8 = $[20];
|
|
401
|
+
let t9;
|
|
402
|
+
if ($[21] !== className || $[22] !== style) {
|
|
403
|
+
t9 = mergeStatefulStyles(panelStyles, {
|
|
335
404
|
className,
|
|
336
405
|
style
|
|
337
406
|
});
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
} else
|
|
342
|
-
let
|
|
343
|
-
if ($[
|
|
344
|
-
|
|
345
|
-
const { isExpanded } =
|
|
407
|
+
$[21] = className;
|
|
408
|
+
$[22] = style;
|
|
409
|
+
$[23] = t9;
|
|
410
|
+
} else t9 = $[23];
|
|
411
|
+
let t10;
|
|
412
|
+
if ($[24] !== children || $[25] !== escape || $[26] !== heights || $[27] !== props$3) {
|
|
413
|
+
t10 = (t11) => {
|
|
414
|
+
const { isExpanded } = t11;
|
|
346
415
|
let snap = null;
|
|
347
416
|
if (heights !== void 0) snap = isExpanded ? "expanded" : "collapsed";
|
|
348
417
|
return /* @__PURE__ */ jsx(SnapContext, {
|
|
349
418
|
value: snap,
|
|
350
419
|
children: /* @__PURE__ */ jsx(SheetDialog, {
|
|
351
420
|
escape,
|
|
352
|
-
...props$
|
|
421
|
+
...props$3,
|
|
353
422
|
children
|
|
354
423
|
})
|
|
355
424
|
});
|
|
356
425
|
};
|
|
357
|
-
$[
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
$[
|
|
361
|
-
$[
|
|
362
|
-
} else
|
|
363
|
-
let
|
|
364
|
-
if ($[
|
|
365
|
-
|
|
426
|
+
$[24] = children;
|
|
427
|
+
$[25] = escape;
|
|
428
|
+
$[26] = heights;
|
|
429
|
+
$[27] = props$3;
|
|
430
|
+
$[28] = t10;
|
|
431
|
+
} else t10 = $[28];
|
|
432
|
+
let t11;
|
|
433
|
+
if ($[29] !== ref || $[30] !== t10 || $[31] !== t9) {
|
|
434
|
+
t11 = /* @__PURE__ */ jsx(Sheet, {
|
|
366
435
|
ref,
|
|
367
|
-
...
|
|
368
|
-
children:
|
|
436
|
+
...t9,
|
|
437
|
+
children: t10
|
|
369
438
|
});
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
373
|
-
$[
|
|
374
|
-
} else
|
|
375
|
-
let
|
|
376
|
-
if ($[
|
|
377
|
-
|
|
439
|
+
$[29] = ref;
|
|
440
|
+
$[30] = t10;
|
|
441
|
+
$[31] = t9;
|
|
442
|
+
$[32] = t11;
|
|
443
|
+
} else t11 = $[32];
|
|
444
|
+
let t12;
|
|
445
|
+
if ($[33] !== container || $[34] !== defaultOpen || $[35] !== heights || $[36] !== isOpen || $[37] !== onOpenChange || $[38] !== position || $[39] !== t11 || $[40] !== t4 || $[41] !== t8) {
|
|
446
|
+
t12 = /* @__PURE__ */ jsx(OverlayScope, { children: /* @__PURE__ */ jsxs(SheetOverlay, {
|
|
378
447
|
defaultOpen,
|
|
379
448
|
isOpen,
|
|
380
449
|
onOpenChange,
|
|
381
450
|
position,
|
|
382
|
-
preventDismissal:
|
|
383
|
-
ref:
|
|
451
|
+
preventDismissal: t4,
|
|
452
|
+
ref: layerRef,
|
|
384
453
|
snapPoints: heights,
|
|
385
454
|
UNSTABLE_portalContainer: container,
|
|
386
455
|
className: "x9f619 x125h2g0",
|
|
387
|
-
children: [
|
|
456
|
+
children: [t8, t11]
|
|
388
457
|
}) });
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
399
|
-
} else
|
|
400
|
-
return
|
|
458
|
+
$[33] = container;
|
|
459
|
+
$[34] = defaultOpen;
|
|
460
|
+
$[35] = heights;
|
|
461
|
+
$[36] = isOpen;
|
|
462
|
+
$[37] = onOpenChange;
|
|
463
|
+
$[38] = position;
|
|
464
|
+
$[39] = t11;
|
|
465
|
+
$[40] = t4;
|
|
466
|
+
$[41] = t8;
|
|
467
|
+
$[42] = t12;
|
|
468
|
+
} else t12 = $[42];
|
|
469
|
+
return t12;
|
|
401
470
|
}
|
|
402
471
|
function SheetDialog(t0) {
|
|
403
472
|
const $ = c(12);
|
|
404
473
|
let escape;
|
|
405
|
-
let props$
|
|
474
|
+
let props$1;
|
|
406
475
|
let render;
|
|
407
476
|
if ($[0] !== t0) {
|
|
408
|
-
({escape, render, ...props$
|
|
477
|
+
({escape, render, ...props$1} = t0);
|
|
409
478
|
$[0] = t0;
|
|
410
479
|
$[1] = escape;
|
|
411
|
-
$[2] = props$
|
|
480
|
+
$[2] = props$1;
|
|
412
481
|
$[3] = render;
|
|
413
482
|
} else {
|
|
414
483
|
escape = $[1];
|
|
415
|
-
props$
|
|
484
|
+
props$1 = $[2];
|
|
416
485
|
render = $[3];
|
|
417
486
|
}
|
|
418
487
|
const state = useContext(OverlayTriggerStateContext);
|
|
@@ -430,13 +499,13 @@ function SheetDialog(t0) {
|
|
|
430
499
|
$[8] = t2;
|
|
431
500
|
} else t2 = $[8];
|
|
432
501
|
let t3;
|
|
433
|
-
if ($[9] !== props$
|
|
502
|
+
if ($[9] !== props$1 || $[10] !== t1) {
|
|
434
503
|
t3 = /* @__PURE__ */ jsx(SheetContent, {
|
|
435
|
-
...props$
|
|
504
|
+
...props$1,
|
|
436
505
|
render: t1,
|
|
437
506
|
...t2
|
|
438
507
|
});
|
|
439
|
-
$[9] = props$
|
|
508
|
+
$[9] = props$1;
|
|
440
509
|
$[10] = t1;
|
|
441
510
|
$[11] = t3;
|
|
442
511
|
} else t3 = $[11];
|
|
@@ -617,9 +686,7 @@ function useRestOnTurn(overlayRef, position) {
|
|
|
617
686
|
const layer = overlayRef.current;
|
|
618
687
|
const scroller = layer?.querySelector("[data-sheet-scroll]");
|
|
619
688
|
if (!(layer instanceof HTMLElement && scroller instanceof HTMLElement)) return;
|
|
620
|
-
|
|
621
|
-
if (edge === "bottom") scroller.scrollTo({ top: scroller.scrollHeight });
|
|
622
|
-
else scroller.scrollTo({ left: edge === "left" ? 0 : scroller.scrollWidth });
|
|
689
|
+
restAtEdge(layer, scroller);
|
|
623
690
|
};
|
|
624
691
|
t1 = [overlayRef, position];
|
|
625
692
|
$[0] = overlayRef;
|