@kanso-labs/kanso-ui 0.40.2 → 0.40.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chip/styles.js +2 -2
- package/dist/chip/styles.js.map +1 -1
- package/dist/components/app-bar/index.js +5 -2
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/card/index.js +7 -1
- package/dist/components/card/index.js.map +1 -1
- package/dist/components/checkbox/index.js +3 -3
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +1 -1
- package/dist/components/chip-group/index.js +1 -1
- package/dist/components/dialog/index.d.ts +5 -0
- package/dist/components/dialog/index.js +5 -0
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/menu/index.js +4 -1
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/popover/index.js +310 -93
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/progress-indicator/index.js +6 -6
- package/dist/components/progress-indicator/index.js.map +1 -1
- package/dist/components/radio-group/index.js +27 -38
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/segmented-button/index.d.ts +3 -1
- package/dist/components/segmented-button/index.js +33 -17
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.js +1 -0
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +5 -0
- package/dist/components/sheet/index.js +6 -1
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/snackbar/index.js +1 -1
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/control/index.js +54 -1
- package/dist/control/index.js.map +1 -1
- package/dist/control/styles.js +1 -1
- package/dist/control/styles.js.map +1 -1
- package/dist/field/index.js +183 -131
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +25 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/indicator/styles.js +2 -2
- package/dist/indicator/styles.js.map +1 -1
- package/dist/mark/styles.js +3 -0
- package/dist/mark/styles.js.map +1 -1
- package/dist/navigation/styles.js +1 -1
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/styles.js +1 -1
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/overlay.js +1 -0
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles.css +17 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","RadioGroupProps","RACRadioGroupProps","RadioButtonRenderProps","RadioFieldProps","RadioGroupRenderProps","stylex","RadioGroup","RACRadioGroup","RadioButton","RadioField","ControlLabel","controlStyles","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","fieldGroupStyles","useRipple","focus","mergeStatefulStyles","colors","motion","radii","spacing","stateLayerOpacity","FORCED_COLORS","styles","control","kMwMTN","$$css","toneActive","toneDisabled","toneSelected","hoverLayers","selected","kWkggS","unselected","focusLayers","pressedLayers","children","description","error","label","Omit","RadioProps","Ripple","ReturnType","HTMLSpanElement","buttonContent","ripple","state","interactive","isDisabled","isReadOnly","tone","isSelected","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","className","surface","groupContent","horizontal","isRequired","Radio","t0","$","T0","t1","field","t2","t3","t4","Symbol","for","messages","t5","t6","orientation","undefined","validationBehavior","root","stylex.props","_c","props","RadioGroup","RACRadioGroup","fieldGroupStyles"],"sources":["../../../src/components/radio-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { RadioGroupProps as RACRadioGroupProps, RadioButtonRenderProps, RadioFieldProps, RadioGroupRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { RadioGroup as RACRadioGroup, RadioButton, RadioField } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles as fieldGroupStyles } from '../../field/styles';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The radio button page: a 20dp ring inside a 40dp state layer, with a 48dp\n// target. Unselected, the ring is 2dp of on surface variant that turns on\n// surface while hovered, pressed or focused; selected, the ring and the 10dp\n// dot inside it are primary. Disabled is on surface at the disabled opacity\n// for both. The state layer is on surface over an unselected button and\n// primary over a selected one while hovered, and the two swap once pressed.\n// The page draws no error state for the button itself: an invalid group\n// says so through its label and message, and the buttons keep their colours.\n//\n// Two components from one module, since neither means anything without the\n// other: a radio button is a member of a group, and the group is what holds\n// the value. React Aria's `RadioGroup` is the group, a div with the label,\n// description and error slots; `RadioField` is one button's root, a div with\n// its description slot; and `RadioButton` is the label around the visually\n// hidden input, whose children draw the button from the render state React\n// Aria hands them. The field is the same two-column grid Checkbox uses, with\n// the label `display: contents` so the description lines up under the text.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the button is selected.\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 control: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n toneActive: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n toneDisabled: {\n kMwMTN: \"x1gpw424\",\n $$css: true\n },\n toneSelected: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n }\n};\n\n// The state layer follows the button: on surface over an unselected one and\n// primary over a selected one while hovered, the two swapped once pressed.\nconst hoverLayers = {\n selected: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unselected: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n selected: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n selected: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unselected: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype RadioGroupProps = {\n /** The radio buttons, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the label's colour and\n * `aria-invalid` on the group all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a set of radio\n * buttons with no name is a set a screen reader cannot introduce.\n */\n label: string;\n} & Omit<RACRadioGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype RadioProps = Omit<RadioFieldProps, 'children'> & {\n /**\n * The label, beside the button. A button that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /** A hint under the label, read with the button. */\n description?: string;\n};\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the button can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple) {\n return (state: RadioButtonRenderProps) => {\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone = state.isSelected ? 'selected' : 'unselected';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isSelected && styles.toneSelected, !state.isSelected && interactive && active && styles.toneActive, state.isDisabled && styles.toneDisabled, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span className=\"x12w9bfk x6s0dn4 x1qx5ct2 x1r7ld26 x16fbrrb x1y0btm7 xdh2fpr x9f619 x78zum5 xw4jnvo xl56j7k x1qno0dh xshfolx xpc4ca7\">\n {state.isSelected ? <span {...{\n 0: {\n className: \"xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl\"\n },\n 1: {\n className: \"x170jfvy x16fbrrb x1fsd2vl xtwfq29 x1o55y2u\"\n }\n }[!!state.isDisabled << 0]} /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n// The group's parts, from its render state: the label's colour follows\n// disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined, horizontal: boolean) {\n return (state: RadioGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...{\n 0: {\n className: \"x78zum5 xdt5ytf\"\n },\n 1: {\n className: \"x78zum5 xpamuu5 x1q0g3np x1a02dak\"\n }\n }[!!horizontal << 0]}>\n {children}\n </div>\n <FieldMessage description={description} error={error} inset={false} />\n </>;\n}\n\n/**\n * One option of a `RadioGroup`, with its label and optionally a description\n * under it. It names the entry it stands for with `value`; the selection is\n * the group's. Rendered on its own, outside a group, it has no state to\n * belong to.\n *\n * The call site's `className` and `style` land on the option as a whole,\n * which is the element a layout positions.\n */\nfunction Radio({\n children,\n description,\n ...props\n}: RadioProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n return <RadioField {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <RadioButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </RadioButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} inset={false} />\n </div>\n </RadioField>;\n}\n\n/**\n * A labelled set of radio buttons with one selected value between them. The\n * value is React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Radio` inside\n * names the entry it stands for. Arrow keys move the selection; disabled,\n * read-only and the error state reach every button from here, and\n * `orientation=\"horizontal\"` lays the buttons along a line.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction RadioGroup({\n children,\n description,\n error,\n label,\n orientation = 'vertical',\n ...props\n}: RadioGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACRadioGroup isInvalid={invalidFrom(error)} orientation={orientation} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldGroupStyles.root), props)}>\n {groupContent(label, children, description, error, orientation === 'horizontal')}\n </RACRadioGroup>;\n}\nexport type { RadioGroupProps, RadioProps };\nexport { Radio };\nexport default RadioGroup;"],"mappings":";;;;;;;;;;;;;;AA2CA,MAAM+B,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVF,QAAQ;EACRC,OAAO;CACT;CACAE,cAAc;EACZH,QAAQ;EACRC,OAAO;CACT;CACAG,cAAc;EACZJ,QAAQ;EACRC,OAAO;CACT;AACF;AAIA,MAAMI,cAAc;CAClBC,UAAU;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,YAAY;EACVD,QAAQ;EACRN,OAAO;CACT;AACF;AAGA,MAAMQ,cAAc;CAClBH,UAAU;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,YAAY;EACVD,QAAQ;EACRN,OAAO;CACT;AACF;AACA,MAAMS,gBAAgB;CACpBJ,UAAU;EACRC,QAAQ;EACRN,OAAO;CACT;CACAO,YAAY;EACVD,QAAQ;EAC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EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAC,MAAAD,EAAA,OAAAY,eAAAZ,EAAA,QAAAZ,WAAAY,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAU,MAAAV,EAAA,QAAAc,oBAAA;EAD7EH,KAAA,oBAAC,IAAD;GAA0B,WAAAP;GAAiCQ;GAAiCE;GAAkB,GAAM1B;GAAK,GAAMiB;GACjIK,UAAAA;EADgB,CAAA;EAEHV,EAAA,KAAAC;EAAAD,EAAA,KAAAY;EAAAZ,EAAA,MAAAZ;EAAAY,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAU;EAAAV,EAAA,MAAAc;EAAAd,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAFXW;AAEW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","RadioGroupProps","RACRadioGroupProps","RadioButtonRenderProps","RadioFieldProps","RadioGroupRenderProps","stylex","RadioGroup","RACRadioGroup","RadioButton","RadioField","ControlDescription","ControlLabel","controlStyles","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","fieldGroupStyles","useRipple","focus","mergeStatefulStyles","colors","motion","radii","spacing","stateLayerOpacity","FORCED_COLORS","styles","control","kMwMTN","$$css","toneActive","toneDisabled","toneSelected","hoverLayers","selected","kWkggS","unselected","focusLayers","pressedLayers","children","description","error","label","Omit","RadioProps","Ripple","ReturnType","HTMLSpanElement","buttonContent","ripple","state","interactive","isDisabled","isReadOnly","tone","isSelected","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","className","surface","groupContent","horizontal","isRequired","Radio","t0","$","T0","t1","field","t2","t3","t4","t5","orientation","undefined","validationBehavior","root","t6","stylex.props","_c","props","RadioGroup","RACRadioGroup","fieldGroupStyles"],"sources":["../../../src/components/radio-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { RadioGroupProps as RACRadioGroupProps, RadioButtonRenderProps, RadioFieldProps, RadioGroupRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { RadioGroup as RACRadioGroup, RadioButton, RadioField } from 'react-aria-components';\nimport { ControlDescription, ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles as fieldGroupStyles } from '../../field/styles';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The radio button page: a 20dp ring inside a 40dp state layer, with a 48dp\n// target. Unselected, the ring is 2dp of on surface variant that turns on\n// surface while hovered, pressed or focused; selected, the ring and the 10dp\n// dot inside it are primary. Disabled is on surface at the disabled opacity\n// for both. The state layer is on surface over an unselected button and\n// primary over a selected one while hovered, and the two swap once pressed.\n// The page draws no error state for the button itself: an invalid group\n// says so through its label and message, and the buttons keep their colours.\n//\n// Two components from one module, since neither means anything without the\n// other: a radio button is a member of a group, and the group is what holds\n// the value. React Aria's `RadioGroup` is the group, a div with the label,\n// description and error slots; `RadioField` is one button's root, a div with\n// its description slot; and `RadioButton` is the label around the visually\n// hidden input, whose children draw the button from the render state React\n// Aria hands them. The field is the same two-column grid Checkbox uses, with\n// the label `display: contents` so the description lines up under the text.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the button is selected.\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 control: {\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n toneActive: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n toneDisabled: {\n kMwMTN: \"x1gpw424 x1bhcspo\",\n $$css: true\n },\n toneSelected: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n }\n};\n\n// The state layer follows the button: on surface over an unselected one and\n// primary over a selected one while hovered, the two swapped once pressed.\nconst hoverLayers = {\n selected: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unselected: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n selected: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n selected: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unselected: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype RadioGroupProps = {\n /** The radio buttons, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the label's colour and\n * `aria-invalid` on the group all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a set of radio\n * buttons with no name is a set a screen reader cannot introduce.\n */\n label: string;\n} & Omit<RACRadioGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype RadioProps = Omit<RadioFieldProps, 'children'> & {\n /**\n * The label, beside the button. A button that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /** A hint under the label, read with the button. */\n description?: string;\n};\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the button can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple) {\n return (state: RadioButtonRenderProps) => {\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone = state.isSelected ? 'selected' : 'unselected';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isSelected && styles.toneSelected, !state.isSelected && interactive && active && styles.toneActive, state.isDisabled && styles.toneDisabled, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span className=\"x12w9bfk x6s0dn4 x1qx5ct2 x1r7ld26 x16fbrrb x1y0btm7 xdh2fpr x9f619 x78zum5 xw4jnvo xl56j7k x1qno0dh xshfolx xpc4ca7\">\n {state.isSelected ? <span {...{\n 0: {\n className: \"xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl\"\n },\n 1: {\n className: \"x170jfvy x16fbrrb x1fsd2vl xtwfq29 x1o55y2u\"\n }\n }[!!state.isDisabled << 0]} /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n// The group's parts, from its render state: the label's colour follows\n// disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined, horizontal: boolean) {\n return (state: RadioGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...{\n 0: {\n className: \"x78zum5 xdt5ytf\"\n },\n 1: {\n className: \"x78zum5 xpamuu5 x1q0g3np x1a02dak\"\n }\n }[!!horizontal << 0]}>\n {children}\n </div>\n <FieldMessage description={description} error={error} inset={false} />\n </>;\n}\n\n/**\n * One option of a `RadioGroup`, with its label and optionally a description\n * under it. It names the entry it stands for with `value`; the selection is\n * the group's. Rendered on its own, outside a group, it has no state to\n * belong to.\n *\n * The call site's `className` and `style` land on the option as a whole,\n * which is the element a layout positions.\n */\nfunction Radio({\n children,\n description,\n ...props\n}: RadioProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n return <RadioField {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <RadioButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </RadioButton>\n <ControlDescription>{description}</ControlDescription>\n </RadioField>;\n}\n\n/**\n * A labelled set of radio buttons with one selected value between them. The\n * value is React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Radio` inside\n * names the entry it stands for. Arrow keys move the selection; disabled,\n * read-only and the error state reach every button from here, and\n * `orientation=\"horizontal\"` lays the buttons along a line.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction RadioGroup({\n children,\n description,\n error,\n label,\n orientation = 'vertical',\n ...props\n}: RadioGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACRadioGroup isInvalid={invalidFrom(error)} orientation={orientation} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldGroupStyles.root), props)}>\n {groupContent(label, children, description, error, orientation === 'horizontal')}\n </RACRadioGroup>;\n}\nexport type { RadioGroupProps, RadioProps };\nexport { Radio };\nexport default RadioGroup;"],"mappings":";;;;;;;;;;;;;;AA2CA,MAAMgC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,YAAY;EACVF,QAAQ;EACRC,OAAO;CACT;CACAE,cAAc;EACZH,QAAQ;EACRC,OAAO;CACT;CACAG,cAAc;EACZJ,QAAQ;EACR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AOsC,EAA4B;EAACN,EAAA,KAAAlC;EAAAkC,EAAA,KAAAjC;EAAAiC,EAAA,KAAAhC;EAAAgC,EAAA,KAAA/B;EAAA+B,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAY;CAAA,IAAAZ,EAAA,OAAAC,MAAAD,EAAA,OAAAQ,eAAAR,EAAA,QAAAZ,WAAAY,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAO,MAAAP,EAAA,QAAAU,oBAAA;EAD7EE,KAAA,oBAAC,IAAD;GAA0B,WAAAR;GAAiCI;GAAiCE;GAAkB,GAAMtB;GAAK,GAAMiB;GACjIE,UAAAA;EADgB,CAAA;EAEHP,EAAA,KAAAC;EAAAD,EAAA,KAAAQ;EAAAR,EAAA,MAAAZ;EAAAY,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAU;EAAAV,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAFXY;AAEW"}
|
|
@@ -6,7 +6,9 @@ type SegmentedButtonProps = Omit<ToggleButtonGroupProps, 'className' | 'orientat
|
|
|
6
6
|
className?: ToggleButtonGroupProps['className'];
|
|
7
7
|
/**
|
|
8
8
|
* Whether a chosen segment draws a check before its label, as the page
|
|
9
|
-
* has it. `false` leaves the segment's own icon in place while selected
|
|
9
|
+
* has it. `false` leaves the segment's own icon in place while selected,
|
|
10
|
+
* and draws the chosen segment on the stronger secondary container, since
|
|
11
|
+
* the page's own is too faint to say which is chosen by itself.
|
|
10
12
|
* @default true
|
|
11
13
|
*/
|
|
12
14
|
showSelectedIcon?: boolean;
|
|
@@ -28,6 +28,10 @@ const styles = {
|
|
|
28
28
|
khDVqt: "xuxw1ft",
|
|
29
29
|
$$css: true
|
|
30
30
|
},
|
|
31
|
+
labelChosen: {
|
|
32
|
+
kAXs8y: "x1g12otp",
|
|
33
|
+
$$css: true
|
|
34
|
+
},
|
|
31
35
|
labelReserved: {
|
|
32
36
|
k71WvV: "x184gv5z",
|
|
33
37
|
keTefX: "x1mjqfaz",
|
|
@@ -77,12 +81,16 @@ const styles = {
|
|
|
77
81
|
},
|
|
78
82
|
segmentDisabled: {
|
|
79
83
|
kVAM5u: "xrh88j3",
|
|
80
|
-
kMwMTN: "x1xj74d8",
|
|
84
|
+
kMwMTN: "x1xj74d8 x1bhcspo",
|
|
81
85
|
kkrTdU: "x1h6gzvc",
|
|
82
86
|
$$css: true
|
|
83
87
|
},
|
|
84
88
|
segmentSelected: {
|
|
85
|
-
kMwMTN: "x1sawysd",
|
|
89
|
+
kMwMTN: "x1sawysd x1k5gbb1",
|
|
90
|
+
$$css: true
|
|
91
|
+
},
|
|
92
|
+
segmentSelectedUnmarked: {
|
|
93
|
+
kMwMTN: "x1lba3jz x1k5gbb1",
|
|
86
94
|
$$css: true
|
|
87
95
|
},
|
|
88
96
|
segmentUnselected: {
|
|
@@ -101,24 +109,32 @@ function glyphFor(state, icon, showSelectedIcon) {
|
|
|
101
109
|
if (state.isSelected && showSelectedIcon) return /* @__PURE__ */ jsx(CheckGlyph, { className: "x5yr21d x2lah0s x1xp8n7a" });
|
|
102
110
|
return icon ?? null;
|
|
103
111
|
}
|
|
104
|
-
function indicatorClassName(isDisabled, selectionMode) {
|
|
112
|
+
function indicatorClassName(isDisabled, selectionMode, showSelectedIcon) {
|
|
105
113
|
return (state) => ({
|
|
106
|
-
0: { className: "x15dekr4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd" },
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
0: { className: "x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd" },
|
|
115
|
+
8: { className: "x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7" },
|
|
116
|
+
4: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4" },
|
|
117
|
+
12: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4" },
|
|
118
|
+
2: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1" },
|
|
119
|
+
10: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1" },
|
|
120
|
+
6: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1" },
|
|
121
|
+
14: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1" },
|
|
122
|
+
1: { className: "x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk" },
|
|
123
|
+
9: { className: "x15dekr4 x1jzqe4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk" },
|
|
124
|
+
5: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd x167r6xl x1jzqe4 xg01cxk" },
|
|
125
|
+
13: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 x167r6xl x1jzqe4 xg01cxk" },
|
|
126
|
+
3: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk" },
|
|
127
|
+
11: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk" },
|
|
128
|
+
7: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk" },
|
|
129
|
+
15: { className: "xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg x9yvj25 xmnqt3w xx61lck x2h6xq1 xg01cxk" }
|
|
130
|
+
})[!!(selectionMode === "multiple") << 3 | !!!showSelectedIcon << 2 | !!isDisabled << 1 | !!(state.isEntering || state.isExiting) << 0].className ?? "";
|
|
115
131
|
}
|
|
116
132
|
function segmentContent(children, icon, ripple, selectionMode, showSelectedIcon) {
|
|
117
133
|
const reserves = showSelectedIcon || icon !== void 0;
|
|
118
134
|
return (state) => {
|
|
119
135
|
const glyph = glyphFor(state, icon, showSelectedIcon);
|
|
120
136
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
121
|
-
/* @__PURE__ */ jsx(SelectionIndicator, { className: indicatorClassName(state.isDisabled, selectionMode) }),
|
|
137
|
+
/* @__PURE__ */ jsx(SelectionIndicator, { className: indicatorClassName(state.isDisabled, selectionMode, showSelectedIcon) }),
|
|
122
138
|
/* @__PURE__ */ jsx("span", { ...{
|
|
123
139
|
0: { className: "x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi xg01cxk x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4" },
|
|
124
140
|
4: { className: "x12w9bfk xtwfq29 x1pjcqnp x9f619 x1jz8bvi x47corl x10l6tqk x1qno0dh x19991ni xpc4ca7 x8knxv4 xe2qvxb" },
|
|
@@ -137,7 +153,7 @@ function segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)
|
|
|
137
153
|
children: glyph
|
|
138
154
|
}),
|
|
139
155
|
/* @__PURE__ */ jsx("span", {
|
|
140
|
-
...props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted)),
|
|
156
|
+
...props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted), state.isSelected && !state.isDisabled && styles.labelChosen),
|
|
141
157
|
children
|
|
142
158
|
}),
|
|
143
159
|
ripple.surface
|
|
@@ -285,7 +301,7 @@ function SegmentedButtonSegment(t0) {
|
|
|
285
301
|
const T0 = ToggleButton;
|
|
286
302
|
const t3 = toggleButtonRenderer(element, render);
|
|
287
303
|
const t4 = ripple.handlers;
|
|
288
|
-
const t5 = mergeStatefulStyles(segmentStyles, props);
|
|
304
|
+
const t5 = mergeStatefulStyles(segmentStyles(showSelectedIcon), props);
|
|
289
305
|
let t6;
|
|
290
306
|
if ($[7] !== children || $[8] !== icon || $[9] !== ripple || $[10] !== selectionMode || $[11] !== showSelectedIcon) {
|
|
291
307
|
t6 = segmentContent(children, icon, ripple, selectionMode, showSelectedIcon);
|
|
@@ -315,8 +331,8 @@ function SegmentedButtonSegment(t0) {
|
|
|
315
331
|
} else t7 = $[19];
|
|
316
332
|
return t7;
|
|
317
333
|
}
|
|
318
|
-
function segmentStyles(
|
|
319
|
-
return props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isDisabled && styles.segmentDisabled);
|
|
334
|
+
function segmentStyles(showSelectedIcon) {
|
|
335
|
+
return (state) => props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !showSelectedIcon && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);
|
|
320
336
|
}
|
|
321
337
|
SegmentedButton.Segment = SegmentedButtonSegment;
|
|
322
338
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","FocusableElement","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","stylex","createContext","useContext","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","Ripple","ReturnType","NonNullable","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","styles","label","k6CgDc","k7Eaqz","kVQacm","kg5iWk","kIyJzY","k1ekBW","kAMwcw","khDVqt","$$css","labelReserved","k71WvV","keTefX","labelShifted","segment","kgeoSG","kGOzcv","kpsdNU","kEoFBp","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k8WAf4","kg3NbH","kVAEAm","segmentDisabled","kMwMTN","segmentSelected","segmentUnselected","SegmentedButtonProps","Omit","className","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","glyphFor","state","isSelected","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","reserves","undefined","glyph","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","render","element","aria","disabledByGroup","id","handlers","segmentStyles","ring","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\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// 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// That slot is drawn out of flow, and every segment that could ever use it\n// keeps room for it whether or not it is drawing one. Laid out in flow it\n// was part of the segment's content size, so the widest segment was\n// whichever one was chosen and the whole track changed width with the\n// 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 is absolute at the leading padding\n// edge and opens from 0 to 18dp, and the label's own margins open the space\n// it lands in, both over `durationShort2`. Two things here are not theirs.\n// The room is a margin on the label rather than padding on the segment,\n// because padding would be part of the content size the equal columns are\n// measured from — which is the thing being fixed. And it is split across\n// both of the label's sides while nothing is drawn, so a bare label stays\n// centred; Angular Material has no such case, since its toggles are sized\n// by their own content rather than by the widest of them.\n//\n// The cost is that a track able to draw a check is 26dp per segment wider\n// than its labels alone would ask for. It is not wider than it used to\n// get, though, and that falls out rather than being arranged: the reserve\n// puts every column at the widest label plus the room, which is exactly\n// what the widest column already measured while its own segment was the\n// chosen one. What changes is that the track is always that, instead of\n// only while the longest label is the one chosen.\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 Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\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)`;\nconst styles = {\n label: {\n k6CgDc: \"x12w9bfk\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1ve1rmq\",\n kAMwcw: \"xpc4ca7\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n labelReserved: {\n k71WvV: \"x184gv5z\",\n keTefX: \"x1mjqfaz\",\n $$css: true\n },\n labelShifted: {\n k71WvV: \"x14z9mp\",\n keTefX: \"x1c5lys2\",\n $$css: true\n },\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: \"x18fpw6u\",\n kVAEAm: \"x1n2onr6\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xt3l3uh\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n segmentDisabled: {\n kVAM5u: \"xrh88j3\",\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n segmentSelected: {\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n segmentUnselected: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\ntype SegmentedButtonProps = Omit<RACToggleButtonGroupProps, 'className' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\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 * @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' | '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 icon?: ReactNode;\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, showSelectedIcon: boolean): ReactNode {\n if (state.isSelected && showSelectedIcon) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\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): (state: SharedElementRenderProps) => string {\n return state => ({\n 0: {\n className: \"x15dekr4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd\"\n },\n 4: {\n className: \"x15dekr4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7\"\n },\n 2: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg\"\n },\n 6: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg\"\n },\n 1: {\n className: \"x15dekr4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xg01cxk\"\n },\n 5: {\n className: \"x15dekr4 xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xg01cxk\"\n },\n 3: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk xioksi3 x1c42kcb x1seskgd xepofeg xg01cxk\"\n },\n 7: {\n className: \"xrldhhw x12tjb6f x1g25zgg xleywy5 x9f619 x1jz8bvi x47corl x10l6tqk x8knxv4 x12w9bfk x1qno0dh x19991ni xpc4ca7 xepofeg xg01cxk\"\n }\n })[!!(selectionMode === 'multiple') << 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, showSelectedIcon: boolean) {\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 = showSelectedIcon || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, showSelectedIcon);\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode)} />\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 {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xnalus7 xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7 x1xp8n7a\"\n }\n }[!!(glyph !== null) << 0]}>\n {glyph}\n </span>}\n <span {...stylex.props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted))}>\n {children}\n </span>\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` — nothing here labels\n * it for you, and a set with no name is a group a screen reader cannot\n * 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 * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} 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 const showSelectedIcon = useContext(ShowSelectedIconContext);\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 render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles, props)}>\n {segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)}\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.\nfunction segmentStyles(state: ToggleButtonRenderProps) {\n return stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isDisabled && styles.segmentDisabled);\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default SegmentedButton;"],"mappings":";;;;;;;;;;;;;;AA2HA,MAAMkC,0BAA0BtB,cAAc,IAAI;AAKlD,MAAMuB,uBAAuBvB,cAA6B,QAAQ;AAS5C,GAAwBmB,QAAQW;AAC3B,GAAyBX,QAAQW;AAC5D,MAAME,SAAS;CACbC,OAAO;EACLC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,eAAe;EACbC,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAI,cAAc;EACZF,QAAQ;EACRC,QAAQ;EACRH,OAAO;CACT;CACAK,SAAS;EACP,kCAAkC;EAClC,oCAAoC;EACpCC,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ClK;AACA+B,gBAAgB+B,UAAUjB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","FocusableElement","ToggleButtonGroupProps","RACToggleButtonGroupProps","ToggleButtonProps","RACToggleButtonProps","SharedElementRenderProps","ToggleButtonRenderProps","stylex","createContext","useContext","SelectionIndicator","RACSelectionIndicator","ToggleButton","RACToggleButton","ToggleButtonGroup","RACToggleButtonGroup","CheckGlyph","useRipple","useToggleGroupDisabled","ariaAttributesOf","toggleButtonRenderer","focus","mergeStatefulStyles","colors","motion","radii","sizing","spacing","stateLayerOpacity","typography","ShowSelectedIconContext","SelectionModeContext","SelectionMode","Ripple","ReturnType","NonNullable","GLYPH_SIZE","GLYPH_RESERVE","sm","GLYPH_RESERVE_HALF","FORCED_COLORS","styles","label","k6CgDc","k7Eaqz","kVQacm","kg5iWk","kIyJzY","k1ekBW","kAMwcw","khDVqt","$$css","labelChosen","kAXs8y","labelReserved","k71WvV","keTefX","labelShifted","segment","kgeoSG","kGOzcv","kpsdNU","kEoFBp","kGNEyG","kWkggS","kZKoxP","kVAM5u","kT0f0o","kVL7Gh","k2ei4v","kfmiAY","krdFHd","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kMv6JI","kGuDYH","k63SB2","kjj79g","kb6lSQ","kLWn49","k8WAf4","kg3NbH","kVAEAm","segmentDisabled","kMwMTN","segmentSelected","segmentSelectedUnmarked","segmentUnselected","SegmentedButtonProps","Omit","className","showSelectedIcon","style","SegmentedButtonSegmentProps","children","disableRipple","icon","glyphFor","state","isSelected","indicatorClassName","isDisabled","selectionMode","isEntering","isExiting","segmentContent","ripple","reserves","undefined","glyph","isHovered","isFocusVisible","isPressed","props","surface","SegmentedButton","t0","$","T0","T1","T2","t1","t2","t3","t4","t5","t6","t7","t8","SegmentedButtonSegment","onClick","onContextMenu","onKeyDown","onKeyUp","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","render","element","aria","disabledByGroup","id","handlers","segmentStyles","ring","Segment","RACSelectionIndicator","stylex.props","_c","RACToggleButtonGroup","RACToggleButton"],"sources":["../../../src/components/segmented-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, ToggleButtonGroupProps as RACToggleButtonGroupProps, ToggleButtonProps as RACToggleButtonProps, SharedElementRenderProps, ToggleButtonRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { SelectionIndicator as RACSelectionIndicator, ToggleButton as RACToggleButton, ToggleButtonGroup as RACToggleButtonGroup } from 'react-aria-components';\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// 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// 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// That slot is drawn out of flow, and every segment that could ever use it\n// keeps room for it whether or not it is drawing one. Laid out in flow it\n// was part of the segment's content size, so the widest segment was\n// whichever one was chosen and the whole track changed width with the\n// 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 is absolute at the leading padding\n// edge and opens from 0 to 18dp, and the label's own margins open the space\n// it lands in, both over `durationShort2`. Two things here are not theirs.\n// The room is a margin on the label rather than padding on the segment,\n// because padding would be part of the content size the equal columns are\n// measured from — which is the thing being fixed. And it is split across\n// both of the label's sides while nothing is drawn, so a bare label stays\n// centred; Angular Material has no such case, since its toggles are sized\n// by their own content rather than by the widest of them.\n//\n// The cost is that a track able to draw a check is 26dp per segment wider\n// than its labels alone would ask for. It is not wider than it used to\n// get, though, and that falls out rather than being arranged: the reserve\n// puts every column at the widest label plus the room, which is exactly\n// what the widest column already measured while its own segment was the\n// chosen one. What changes is that the track is always that, instead of\n// only while the longest label is the one chosen.\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 Ripple = ReturnType<typeof useRipple<FocusableElement>>;\ntype SelectionMode = NonNullable<RACToggleButtonGroupProps['selectionMode']>;\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// 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 label: {\n k6CgDc: \"x12w9bfk\",\n k7Eaqz: \"xeuugli\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1ve1rmq\",\n kAMwcw: \"xpc4ca7\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n labelChosen: {\n kAXs8y: \"x1g12otp\",\n $$css: true\n },\n labelReserved: {\n k71WvV: \"x184gv5z\",\n keTefX: \"x1mjqfaz\",\n $$css: true\n },\n labelShifted: {\n k71WvV: \"x14z9mp\",\n keTefX: \"x1c5lys2\",\n $$css: true\n },\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: \"x18fpw6u\",\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};\ntype SegmentedButtonProps = Omit<RACToggleButtonGroupProps, 'className' | 'orientation' | 'style'> & {\n /** A function may compute the class from the set's render state. */\n className?: RACToggleButtonGroupProps['className'];\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' | '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 icon?: ReactNode;\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, showSelectedIcon: boolean): ReactNode {\n if (state.isSelected && showSelectedIcon) {\n return <CheckGlyph className=\"x5yr21d x2lah0s x1xp8n7a\" />;\n }\n return icon ?? null;\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, showSelectedIcon: 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 | !!!showSelectedIcon << 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, showSelectedIcon: boolean) {\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 = showSelectedIcon || icon !== undefined;\n return (state: ToggleButtonRenderProps) => {\n const glyph = glyphFor(state, icon, showSelectedIcon);\n return <>\n <RACSelectionIndicator className={indicatorClassName(state.isDisabled, selectionMode, showSelectedIcon)} />\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 {reserves && <span {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xnalus7 xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xmix8c7 x3nfvp2 xosj86m xwa60dl x2xyl1b xl56j7k xb3r6kr x47corl x10l6tqk xmzmy3r x1qno0dh x1j4rzew xpc4ca7 x1xp8n7a\"\n }\n }[!!(glyph !== null) << 0]}>\n {glyph}\n </span>}\n <span {...stylex.props(styles.label, reserves && (glyph === null ? styles.labelReserved : styles.labelShifted), state.isSelected && !state.isDisabled && styles.labelChosen)}>\n {children}\n </span>\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` — nothing here labels\n * it for you, and a set with no name is a group a screen reader cannot\n * 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 * The call site's `className` and `style` land on the track, which is the\n * element a layout positions.\n */\nfunction SegmentedButton({\n selectionMode = 'single',\n showSelectedIcon = true,\n ...props\n}: RefAttributes<HTMLDivElement> & SegmentedButtonProps) {\n return <ShowSelectedIconContext value={showSelectedIcon}>\n <SelectionModeContext value={selectionMode}>\n <RACToggleButtonGroup {...props} 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 const showSelectedIcon = useContext(ShowSelectedIconContext);\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 render={toggleButtonRenderer(element, render)} {...ripple.handlers} {...props} {...mergeStatefulStyles(segmentStyles(showSelectedIcon), props)}>\n {segmentContent(children, icon, ripple, selectionMode, showSelectedIcon)}\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(showSelectedIcon: boolean) {\n return (state: ToggleButtonRenderProps) => stylex.props(styles.segment, focus.ring, state.isSelected ? styles.segmentSelected : styles.segmentUnselected, state.isSelected && !showSelectedIcon && styles.segmentSelectedUnmarked, state.isDisabled && styles.segmentDisabled);\n}\nSegmentedButton.Segment = SegmentedButtonSegment;\nexport type { SegmentedButtonProps, SegmentedButtonSegmentProps };\nexport { SegmentedButtonSegment };\nexport default Seg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UAAAW,EAAA,QAAAf,iBAAAe,EAAA,QAAA1B,kBAAA;EACjKmC,KAAArB,eAAeX,UAAUE,MAAMU,QAAQJ,eAAeX,gBAAgB;EAAC0B,EAAA,KAAAvB;EAAAuB,EAAA,KAAArB;EAAAqB,EAAA,KAAAX;EAAAW,EAAA,MAAAf;EAAAe,EAAA,MAAA1B;EAAA0B,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,QAAAC,MAAAD,EAAA,QAAAJ,SAAAI,EAAA,QAAAX,OAAAqC,YAAA1B,EAAA,QAAAM,MAAAN,EAAA,QAAAQ,MAAAR,EAAA,QAAAS,IAAA;EADrEC,KAAA,oBAAC,IAAD;GAAyB,QAAAJ;GAAqC,GAAMC;GAAe,GAAMX;GAAK,GAAMY;GACtGC,UAAAA;EADkB,CAAA;EAEHT,EAAA,MAAAC;EAAAD,EAAA,MAAAJ;EAAAI,EAAA,MAAAX,OAAAqC;EAAA1B,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAFbU;AAEa;AAQtB,SAASiB,cAAcrD,kBAA2B;CAChD,QAAQO,UAAmC9F,MAAakC,OAAOiB,SAASrC,MAAM+H,MAAM/C,MAAMC,aAAa7D,OAAO+C,kBAAkB/C,OAAOiD,mBAAmBW,MAAMC,cAAc,CAACR,oBAAoBrD,OAAOgD,yBAAyBY,MAAMG,cAAc/D,OAAO6C,eAAe;AAC/Q;AACAgC,gBAAgB+B,UAAUjB"}
|
|
@@ -113,6 +113,7 @@ function selectContent(label, leadingIcon, floatingLabel, variant, description,
|
|
|
113
113
|
/* @__PURE__ */ jsx(FieldBox, {
|
|
114
114
|
floatingLabel,
|
|
115
115
|
isDisabled: state.isDisabled,
|
|
116
|
+
isFocused: state.isOpen,
|
|
116
117
|
isInvalid: state.isInvalid,
|
|
117
118
|
isRequired: state.isRequired,
|
|
118
119
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","RefObject","PopoverRenderProps","SelectProps","RACSelectProps","SelectRenderProps","stylex","useContext","useRef","Popover","RACPopover","Select","RACSelect","SelectValue","RACSelectValue","SelectStateContext","FieldVariant","FieldBox","FieldMessage","FieldTrigger","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","mergeStatefulStyles","overlay","popupOrigin","colors","motion","radii","spacing","ListBox","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","HTMLDivElement","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","stylex.props","Select","_c","props","RACSelect","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field 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.\n//\n// The state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\nexport type { SelectProps };\nexport default Select;"],"mappings":";;;;;;;;;;;;;AAiDA,MAAMoC,UAAU,oBAAC,cAAD,CAAa,CAAA;AAC7B,SAASC,WAAWC,QAAiB;CACnC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDC,WAAW,6DACb;EACA,GAAG,EACDA,WAAW,4DACb;CACF,EAAE,CAAC,CAACD,UAAU,GAAG,CAAA;AACnB;AAKA,SAASE,cAAcC,OAA2B;CAChD,OAAOhC,MAAaoB,QAAQc,OAAOC,OAAOC,MAAMf,YAAYW,MAAMK,SAAS,CAAC,CAAC,CAACP,aAAa;AAC7F;AACA,MAAMK,SAAS,EACbC,MAAM;CACJE,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;CACPC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAAzC,SAAAqD,IAAA;CAAA,MAAAC,IAAAnE,EAAA,EAAA;CAA2C,MAAA,EAAAuD,WAAAE,aAAAC,OAAAC,eAAAS,IAAAC,YAAAC,IAAAV,OAAAC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IAAAG;CAAA,IAAAH,EAAA,OAAAkB,aAAAlB,EAAA,OAAAoB,eAAA;EADfjB,KAAA,oBAAC,YAAD;GAAuBe;GAA0BE;GACpDnB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAkB;EAAAlB,EAAA,KAAAoB;EAAApB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","RefObject","PopoverRenderProps","SelectProps","RACSelectProps","SelectRenderProps","stylex","useContext","useRef","Popover","RACPopover","Select","RACSelect","SelectValue","RACSelectValue","SelectStateContext","FieldVariant","FieldBox","FieldMessage","FieldTrigger","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","mergeStatefulStyles","overlay","popupOrigin","colors","motion","radii","spacing","ListBox","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","HTMLDivElement","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","stylex.props","Select","_c","props","RACSelect","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field 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.\n//\n// The state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled}\n // Opening the list moves focus into it, out of the box, so the box\n // is told it is focused while the list is open — otherwise its label\n // fell back onto the placeholder the select still shows.\n isFocused={state.isOpen} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\nexport type { SelectProps };\nexport default Select;"],"mappings":";;;;;;;;;;;;;AAiDA,MAAMoC,UAAU,oBAAC,cAAD,CAAa,CAAA;AAC7B,SAASC,WAAWC,QAAiB;CACnC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDC,WAAW,6DACb;EACA,GAAG,EACDA,WAAW,4DACb;CACF,EAAE,CAAC,CAACD,UAAU,GAAG,CAAA;AACnB;AAKA,SAASE,cAAcC,OAA2B;CAChD,OAAOhC,MAAaoB,QAAQc,OAAOC,OAAOC,MAAMf,YAAYW,MAAMK,SAAS,CAAC,CAAC,CAACP,aAAa;AAC7F;AACA,MAAMK,SAAS,EACbC,MAAM;CAC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,IAAA;CAAA,MAAAC,IAAAnE,EAAA,CAAA;CAAuB,MAAA,EAAAqF,cAAAnB;CAMrB,MAAAqB,iBADc9E,WAAWQ,kBACFuB,CAAK,EAAAgD,iBAA+BC,aAAKC,QAAzC,OAAoD;CAAE,IAAAtB;CAAA,IAAAD,EAAA,OAAAwB,OAAAC,IAAA,2BAAA,GAAA;EAEzExB,KAAA,oBAACgC,aAAD,CAAe,CAAA;EAAGjC,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAkB,aAAAlB,EAAA,OAAAoB,eAAA;EADfjB,KAAA,oBAAC,YAAD;GAAuBe;GAA0BE;GACpDnB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAkB;EAAAlB,EAAA,KAAAoB;EAAApB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
|
|
@@ -46,6 +46,11 @@ declare function SheetBody({ ref: callerRef, ...props }: HTMLAttributes<HTMLDivE
|
|
|
46
46
|
* trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and
|
|
47
47
|
* a `slot="close"` button, Escape and the scrim all report through
|
|
48
48
|
* `onOpenChange`, as they would to `Sheet`.
|
|
49
|
+
*
|
|
50
|
+
* The scrim draws at `z-index: 900`, over any page content layered below
|
|
51
|
+
* that, such as a sticky header, and the panel draws inside it. A
|
|
52
|
+
* `Snackbar` draws at 1000, so a toast raised from inside the sheet is read
|
|
53
|
+
* over it, and React Aria's popovers and menus draw above both.
|
|
49
54
|
*/
|
|
50
55
|
declare function SheetContent({ children, className, container, defaultOpen, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, style, ...props }: RefAttributes<HTMLDivElement> & SheetContentProps): import("react").JSX.Element;
|
|
51
56
|
declare function SheetFooter(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
@@ -108,6 +108,11 @@ function SheetBody(t0) {
|
|
|
108
108
|
* trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and
|
|
109
109
|
* a `slot="close"` button, Escape and the scrim all report through
|
|
110
110
|
* `onOpenChange`, as they would to `Sheet`.
|
|
111
|
+
*
|
|
112
|
+
* The scrim draws at `z-index: 900`, over any page content layered below
|
|
113
|
+
* that, such as a sticky header, and the panel draws inside it. A
|
|
114
|
+
* `Snackbar` draws at 1000, so a toast raised from inside the sheet is read
|
|
115
|
+
* over it, and React Aria's popovers and menus draw above both.
|
|
111
116
|
*/
|
|
112
117
|
function SheetContent(t0) {
|
|
113
118
|
const $ = c(32);
|
|
@@ -259,7 +264,7 @@ function SheetHandle(props) {
|
|
|
259
264
|
} else t0 = $[1];
|
|
260
265
|
let t1;
|
|
261
266
|
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
262
|
-
t1 = /* @__PURE__ */ jsx("span", { className: "x1ccu2yh xqu0tyb x1dkaolv x9f619 x1td3qas" });
|
|
267
|
+
t1 = /* @__PURE__ */ jsx("span", { className: "x1ccu2yh xwvh9j7 xqu0tyb x1dkaolv x9f619 x1g12otp x1td3qas" });
|
|
263
268
|
$[2] = t1;
|
|
264
269
|
} else t1 = $[2];
|
|
265
270
|
let t2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","ClassNameOrFunction","DialogProps","DialogTriggerProps","HeadingProps","ModalOverlayProps","ModalRenderProps","StyleOrFunction","stylex","useMemo","useRef","Dialog","DialogTrigger","Heading","Modal","ModalOverlay","useScrollable","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","colors","media","motion","radii","shadows","spacing","typography","FORCED_COLORS","slideInFromEnd","slideInFromStart","slideInFromBottom","styles","body","kB7OPa","k1xSpc","kXwgrk","kzQI83","kOIVth","kORKVm","k8WAf4","kg3NbH","$$css","SheetProps","Omit","children","Sheet","t0","$","props","t1","SheetBody","ref","callerRef","scrollable","undefined","t2","merged","t3","t4","modalBodyRing","t5","SheetContent","className","container","defaultOpen","isKeyboardDismissDisabled","isOpen","onOpenChange","style","isDismissable","Symbol","for","scrim","modalDialog","t6","t7","SheetFooter","SheetHandle","SheetHeader","SheetTitle","Body","Content","Footer","Handle","Header","Title","SheetContentProps","Pick","Element","SheetTitleProps","_c","props","stylex.props"],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useMemo, useRef } from 'react';\nimport { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from 'react-aria-components';\nimport { useScrollable } from '../../hooks/useScrollable';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\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)';\n\n// One component, two presentations. Above the medium breakpoint it is a side\n// sheet pinned to the inline end of the viewport; below it, the same panel\n// becomes a bottom sheet. That is the pairing the Material Design pages draw\n// rather than two components: a sheet that stayed on the right at 375px would\n// be a drawer covering the whole screen.\n//\n// The two differ in five things and no more: which edges they are pinned to,\n// which two corners are rounded, which axis they arrive along, how much of\n// the viewport they may take, and the drag handle, which is the bottom\n// sheets page's element alone. Everything inside the panel — the 24 of start\n// and end padding, the 12 between the header's elements, the actions area —\n// comes from the side sheets page and is drawn the same in both.\n\n// The side sheet arrives along the inline axis, and it takes two keyframes to\n// do that rather than one. Which edge the panel rests against is logical —\n// `insetInlineEnd` puts it on the right under a left-to-right document and on\n// the left under a right-to-left one — but `translateX` is physical and flips\n// with nothing. One keyframe would therefore have the panel arrive from the\n// far side of where it comes to rest under one of the two.\nconst slideInFromEnd = \"x17cjob-B\";\nconst slideInFromStart = \"x18x3npg-B\";\nconst slideInFromBottom = \"x15b941j-B\";\n\n// Entry only, so there is no exit animation to wait for and closing is\n// immediate: React Aria keeps a closing panel mounted only while an animation\n// is running on it, and finds none. See the comment on `SheetContent` for why\n// that is a design call rather than a limit of StyleX.\n//\n// React Aria's overlay is three nested elements — the scrim, the panel, and\n// the dialog inside it — so the styles are split the same way: the overlay\n// module's scrim on the first, `content` on the panel, its modal dialog style\n// on the element that carries the role. The scrim and that dialog style are\n// shared with every modal overlay; the panel is the sheet's own, since which\n// edge it is pinned to is what makes it a sheet.\nconst styles = {\n body: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"xxj4525\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"xp6hjv6\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n }\n};\ntype SheetProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n};\n\n/**\n * A modal panel that arrives from the edge of the screen — a side sheet on a\n * wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:\n * pass `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it\n * keep its own.\n *\n * Composed rather than configured by props, because a sheet's header, body,\n * and footer all take arbitrary content — the parts are `Sheet.Content`,\n * `Sheet.Header`, `Sheet.Title`, `Sheet.Body`, and `Sheet.Footer`. A\n * `Button` or `IconButton` placed directly inside `Sheet` opens it, and one\n * given `slot=\"close\"` anywhere inside the content closes it; neither needs\n * a part of its own.\n *\n * `Sheet` is the trigger's half, so a sheet nothing on the page opens — one\n * a route shows, or a menu item raises — leaves it out and passes `isOpen`\n * and `onOpenChange` to `Sheet.Content` instead. Wrapped in `Sheet` with no\n * button inside it, React Aria warns that its press responder found nothing\n * to press.\n */\nfunction Sheet({\n children,\n ...props\n}: SheetProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\nfunction SheetBody({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const ref = useRef<HTMLDivElement>(null);\n // A body its content runs past is a tab stop, so a keyboard can scroll it\n // when nothing inside it takes focus; a call site's own tabIndex still\n // wins. See useScrollable.\n const scrollable = useScrollable(ref);\n // The body measures itself through its own ref, and the call site's lands\n // on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scroll container with nothing focusable inside is otherwise out of a keyboard's reach, which axe's scrollable-region-focusable reports\n tabIndex={scrollable ? 0 : undefined} {...props} ref={merged} {...mergeStyles(stylex.props(styles.body, overlay.modalBodyRing), props)} />;\n}\n\n/**\n * The panel itself, and the scrim behind it. Everything the sheet shows goes\n * in here; the trigger stays outside it, since the trigger lives in the page\n * while this is portalled out to the end of the body.\n *\n * A press on the scrim closes the sheet unless `isDismissable` says\n * otherwise — React Aria's own default is the reverse, and a sheet that\n * ignores a tap outside it reads as stuck.\n *\n * Inside `Sheet`, the open state is the trigger's. On its own, with no\n * trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and\n * a `slot=\"close\"` button, Escape and the scrim all report through\n * `onOpenChange`, as they would to `Sheet`.\n */\nfunction SheetContent({\n children,\n className,\n container,\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled,\n isOpen,\n onOpenChange,\n ref,\n style,\n ...props\n}: RefAttributes<HTMLDivElement> & SheetContentProps) {\n return <ModalOverlay defaultOpen={defaultOpen} isDismissable={isDismissable} isKeyboardDismissDisabled={isKeyboardDismissDisabled} isOpen={isOpen} onOpenChange={onOpenChange}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.scrim)}>\n <Modal\n // The panel, where the call site's class and style land, rather than\n // the dialog inside it, which takes the rest of the props.\n ref={ref} {...mergeStatefulStyles({\n className: \"x1n1nwrg x1u6grsq x1ioi8j8 xu2fq7p x18ihq2d x16dv9tl x1vnz5z6 x19dwuzr xuz63mn x1lym3mf xkducg2 xrzall9 xb0nsol xjslfuv x1gbqego x1cfajip xjg5lhu x1a37zkv xys6ro8 x6xk272 x9t1vth x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x1l2rt3b xwvxfow x1ey2m1c x13vifvy xmpip4z xtijo5x xhi6v0a x1upgybz x7ab17h x11ijow0 xb3r6kr x1a148e8 x1mrd0q x5ubeis x1lodr2j x1uhho1l x19b5e0v xg4bq00 xg4jtgg xsds98l xixxii4\"\n }, {\n className,\n style\n })}>\n <Dialog {...props} {...stylex.props(overlay.modalDialog)}>\n {children}\n </Dialog>\n </Modal>\n </ModalOverlay>;\n}\nfunction SheetFooter(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x12smttz x13fuv20 x178xt8z x9f619 x78zum5 x2lah0s x126z3so x1nhvcw1 x1qafhyn x8i8c5o x1clyivc xg0ps1x\"\n }, props)} />;\n}\n\n/**\n * The bottom sheets page's drag handle: a short bar above the sheet's\n * content, saying the panel is a bottom sheet. Place it first inside\n * `Sheet.Content`; above the medium breakpoint the panel is a side sheet and\n * this draws nothing.\n *\n * It is decoration rather than a control, and hidden from assistive\n * technology. Material's own handle drags a sheet between a collapsed and an\n * expanded height and dismisses it from the collapsed one; this panel has\n * one height and cannot be dragged, so a control that only looked draggable\n * would promise what it cannot do. Closing is already the scrim, Escape, and\n * any button given `slot=\"close\"`.\n */\nfunction SheetHandle(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div aria-hidden=\"true\" {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x1s85apg x37i4ze x2lah0s xl56j7k x1xg6qyv\"\n }, props)}>\n <span className=\"x1ccu2yh xqu0tyb x1dkaolv x9f619 x1td3qas\" />\n </div>;\n}\nfunction SheetHeader(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x6s0dn4 x1j6faob x1q0q8m5 xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib x1cmllll xg0ps1x\"\n }, props)} />;\n}\n\n/**\n * Names the sheet. Rendered through React Aria's title slot, which is what\n * points the dialog's `aria-labelledby` at it — a sheet without one announces\n * itself as an unnamed dialog.\n */\nfunction SheetTitle(props: RefAttributes<HTMLHeadingElement> & SheetTitleProps) {\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xdy5w5q xete2z3 x14ijtet xug9e1u x2divse x1ghz6dp\"\n }, props)} />;\n}\nSheet.Body = SheetBody;\nSheet.Content = SheetContent;\nSheet.Footer = SheetFooter;\nSheet.Handle = SheetHandle;\nSheet.Header = SheetHeader;\nSheet.Title = SheetTitle;\n\n// The dialog's own props, plus the scrim's open state and dismissal settings\n// and the panel's styling. A call site has no reason to know there are three\n// elements: `className` and `style` reach the panel, which is the one worth\n// restyling and positioning, the open state and the dismissal settings reach\n// the scrim, and everything else lands on the dialog.\n//\n// `isDismissable` is declared here rather than picked with its siblings,\n// since the picked one carries React Aria's documentation, whose default is\n// the reverse of this component's.\ntype SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'> & {\n /** A function may compute the class from the panel's render state. */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Where to portal the panel and scrim. Defaults to the container of the\n * `ThemeScope` around it, which keeps the sheet on that scope's tokens, or\n * to the end of `<body>` where there is none. A subtree themed through the\n * `themeScope` class has no container of its own, so point this inside it,\n * or the sheet renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Whether a press on the scrim, outside the panel, closes the sheet.\n * `true` here where React Aria's own default is `false`, since a sheet\n * that ignores a tap outside it reads as stuck. Escape is\n * `isKeyboardDismissDisabled`'s, and this says nothing about it.\n * @default true\n */\n isDismissable?: boolean;\n /** A function may compute the style from the panel's render state. */\n style?: StyleOrFunction<ModalRenderProps>;\n};\ntype SheetTitleProps = HeadingProps;\nexport type { SheetContentProps, SheetProps, SheetTitleProps };\nexport { SheetBody, SheetContent, SheetFooter, SheetHandle, SheetHeader, SheetTitle };\nexport default Sheet;"],"mappings":";;;;;;;;;;;AAsDA,MAAMoC,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;;;;;;;;;;;;;;;;;;;;AAwBA,SAAAI,MAAAC,IAAA;CAAA,MAAAC,IAAAnD,EAAA,CAAA;CAAA,IAAAgD;CAAA,IAAAI;CAAA,IAAAD,EAAA,OAAAD,IAAA;EAAe,CAAA,CAAAF,UAAA,GAAAI,SAAAF;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAC;CAAA,OAAA;EAAAJ,WAAAG,EAAA;EAAAC,QAAAD,EAAA;CAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAH,YAAAG,EAAA,OAAAC,OAAA;EACJC,KAAA,oBAAC,eAAD;GAAc,GAAKD;GAAQJ;EAAb,CAAA;EAAsCG,EAAA,KAAAH;EAAAG,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAApDE;AAAoD;AAE7D,SAAAC,UAAAJ,IAAA;CAAA,MAAAC,IAAAnD,EAAA,CAAA;CAAmB,MAAA,EAAAuD,KAAAC,WAAA,GAAAJ,YAAAF;CAIjB,MA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E;AAEM;;;;;;AAQf,SAAA8B,WAAA/B,OAAA;CAAA,MAAAD,IAAAnD,EAAA,CAAA;CAAA,IAAAkD;CAAA,IAAAC,EAAA,OAAAC,OAAA;EAC8CF,KAAA5B,YAAY,EAAA4C,WAC3C,oEACb,GAAGd,KAAK;EAACD,EAAA,KAAAC;EAAAD,EAAA,KAAAD;CAAA,OAAAA,KAAAC,EAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAC,SAAAD,EAAA,OAAAD,IAAA;EAFFG,KAAA,oBAAC,SAAD;GAAc,MAAA;GAAO,GAAKD;GAAK,GAAMF;EAEnC,CAAA;EAAIC,EAAA,KAAAC;EAAAD,EAAA,KAAAD;EAAAC,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAFNE;AAEM;AAEfJ,MAAMmC,OAAO9B;AACbL,MAAMoC,UAAUpB;AAChBhB,MAAMqC,SAASN;AACf/B,MAAMsC,SAASN;AACfhC,MAAMuC,SAASN;AACfjC,MAAMwC,QAAQN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","ClassNameOrFunction","DialogProps","DialogTriggerProps","HeadingProps","ModalOverlayProps","ModalRenderProps","StyleOrFunction","stylex","useMemo","useRef","Dialog","DialogTrigger","Heading","Modal","ModalOverlay","useScrollable","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","colors","media","motion","radii","shadows","spacing","typography","FORCED_COLORS","slideInFromEnd","slideInFromStart","slideInFromBottom","styles","body","kB7OPa","k1xSpc","kXwgrk","kzQI83","kOIVth","kORKVm","k8WAf4","kg3NbH","$$css","SheetProps","Omit","children","Sheet","t0","$","props","t1","SheetBody","ref","callerRef","scrollable","undefined","t2","merged","t3","t4","modalBodyRing","t5","SheetContent","className","container","defaultOpen","isKeyboardDismissDisabled","isOpen","onOpenChange","style","isDismissable","Symbol","for","scrim","modalDialog","t6","t7","SheetFooter","SheetHandle","SheetHeader","SheetTitle","Body","Content","Footer","Handle","Header","Title","SheetContentProps","Pick","Element","SheetTitleProps","_c","props","stylex.props"],"sources":["../../../src/components/sheet/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, ModalOverlayProps, ModalRenderProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useMemo, useRef } from 'react';\nimport { Dialog, DialogTrigger, Heading, Modal, ModalOverlay } from 'react-aria-components';\nimport { useScrollable } from '../../hooks/useScrollable';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, media, motion, radii, shadows, spacing, typography } from '../../tokens/design.tokens.stylex';\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)';\n\n// One component, two presentations. Above the medium breakpoint it is a side\n// sheet pinned to the inline end of the viewport; below it, the same panel\n// becomes a bottom sheet. That is the pairing the Material Design pages draw\n// rather than two components: a sheet that stayed on the right at 375px would\n// be a drawer covering the whole screen.\n//\n// The two differ in five things and no more: which edges they are pinned to,\n// which two corners are rounded, which axis they arrive along, how much of\n// the viewport they may take, and the drag handle, which is the bottom\n// sheets page's element alone. Everything inside the panel — the 24 of start\n// and end padding, the 12 between the header's elements, the actions area —\n// comes from the side sheets page and is drawn the same in both.\n\n// The side sheet arrives along the inline axis, and it takes two keyframes to\n// do that rather than one. Which edge the panel rests against is logical —\n// `insetInlineEnd` puts it on the right under a left-to-right document and on\n// the left under a right-to-left one — but `translateX` is physical and flips\n// with nothing. One keyframe would therefore have the panel arrive from the\n// far side of where it comes to rest under one of the two.\nconst slideInFromEnd = \"x17cjob-B\";\nconst slideInFromStart = \"x18x3npg-B\";\nconst slideInFromBottom = \"x15b941j-B\";\n\n// Entry only, so there is no exit animation to wait for and closing is\n// immediate: React Aria keeps a closing panel mounted only while an animation\n// is running on it, and finds none. See the comment on `SheetContent` for why\n// that is a design call rather than a limit of StyleX.\n//\n// React Aria's overlay is three nested elements — the scrim, the panel, and\n// the dialog inside it — so the styles are split the same way: the overlay\n// module's scrim on the first, `content` on the panel, its modal dialog style\n// on the element that carries the role. The scrim and that dialog style are\n// shared with every modal overlay; the panel is the sheet's own, since which\n// edge it is pinned to is what makes it a sheet.\nconst styles = {\n body: {\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kXwgrk: \"xdt5ytf\",\n kzQI83: \"x1iyjqo2\",\n kOIVth: \"xxj4525\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"xp6hjv6\",\n kg3NbH: \"xg0ps1x\",\n $$css: true\n }\n};\ntype SheetProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n};\n\n/**\n * A modal panel that arrives from the edge of the screen — a side sheet on a\n * wide viewport, a bottom sheet on a narrow one. Open state is React Aria's:\n * pass `isOpen` with `onOpenChange` to control it, or `defaultOpen` to let it\n * keep its own.\n *\n * Composed rather than configured by props, because a sheet's header, body,\n * and footer all take arbitrary content — the parts are `Sheet.Content`,\n * `Sheet.Header`, `Sheet.Title`, `Sheet.Body`, and `Sheet.Footer`. A\n * `Button` or `IconButton` placed directly inside `Sheet` opens it, and one\n * given `slot=\"close\"` anywhere inside the content closes it; neither needs\n * a part of its own.\n *\n * `Sheet` is the trigger's half, so a sheet nothing on the page opens — one\n * a route shows, or a menu item raises — leaves it out and passes `isOpen`\n * and `onOpenChange` to `Sheet.Content` instead. Wrapped in `Sheet` with no\n * button inside it, React Aria warns that its press responder found nothing\n * to press.\n */\nfunction Sheet({\n children,\n ...props\n}: SheetProps) {\n return <DialogTrigger {...props}>{children}</DialogTrigger>;\n}\nfunction SheetBody({\n ref: callerRef,\n ...props\n}: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n const ref = useRef<HTMLDivElement>(null);\n // A body its content runs past is a tab stop, so a keyboard can scroll it\n // when nothing inside it takes focus; a call site's own tabIndex still\n // wins. See useScrollable.\n const scrollable = useScrollable(ref);\n // The body measures itself through its own ref, and the call site's lands\n // on the same element.\n const merged = useMemo(() => mergeRefs(ref, callerRef ?? undefined), [callerRef]);\n return <div\n // oxlint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- a scroll container with nothing focusable inside is otherwise out of a keyboard's reach, which axe's scrollable-region-focusable reports\n tabIndex={scrollable ? 0 : undefined} {...props} ref={merged} {...mergeStyles(stylex.props(styles.body, overlay.modalBodyRing), props)} />;\n}\n\n/**\n * The panel itself, and the scrim behind it. Everything the sheet shows goes\n * in here; the trigger stays outside it, since the trigger lives in the page\n * while this is portalled out to the end of the body.\n *\n * A press on the scrim closes the sheet unless `isDismissable` says\n * otherwise — React Aria's own default is the reverse, and a sheet that\n * ignores a tap outside it reads as stuck.\n *\n * Inside `Sheet`, the open state is the trigger's. On its own, with no\n * trigger, it is this part's: `isOpen` with `onOpenChange` controls it, and\n * a `slot=\"close\"` button, Escape and the scrim all report through\n * `onOpenChange`, as they would to `Sheet`.\n *\n * The scrim draws at `z-index: 900`, over any page content layered below\n * that, such as a sticky header, and the panel draws inside it. A\n * `Snackbar` draws at 1000, so a toast raised from inside the sheet is read\n * over it, and React Aria's popovers and menus draw above both.\n */\nfunction SheetContent({\n children,\n className,\n container,\n defaultOpen,\n isDismissable = true,\n isKeyboardDismissDisabled,\n isOpen,\n onOpenChange,\n ref,\n style,\n ...props\n}: RefAttributes<HTMLDivElement> & SheetContentProps) {\n return <ModalOverlay defaultOpen={defaultOpen} isDismissable={isDismissable} isKeyboardDismissDisabled={isKeyboardDismissDisabled} isOpen={isOpen} onOpenChange={onOpenChange}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...stylex.props(overlay.scrim)}>\n <Modal\n // The panel, where the call site's class and style land, rather than\n // the dialog inside it, which takes the rest of the props.\n ref={ref} {...mergeStatefulStyles({\n className: \"x1n1nwrg x1u6grsq x1ioi8j8 xu2fq7p x18ihq2d x16dv9tl x1vnz5z6 x19dwuzr xuz63mn x1lym3mf xkducg2 xrzall9 xb0nsol xjslfuv x1gbqego x1cfajip xjg5lhu x1a37zkv xys6ro8 x6xk272 x9t1vth x19efjv6 x9f619 x139gbkf x78zum5 xdt5ytf x1l2rt3b xwvxfow x1ey2m1c x13vifvy xmpip4z xtijo5x xhi6v0a x1upgybz x7ab17h x11ijow0 xb3r6kr x1a148e8 x1mrd0q x5ubeis x1lodr2j x1uhho1l x19b5e0v xg4bq00 xg4jtgg xsds98l xixxii4\"\n }, {\n className,\n style\n })}>\n <Dialog {...props} {...stylex.props(overlay.modalDialog)}>\n {children}\n </Dialog>\n </Modal>\n </ModalOverlay>;\n}\nfunction SheetFooter(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x12smttz x13fuv20 x178xt8z x9f619 x78zum5 x2lah0s x126z3so x1nhvcw1 x1qafhyn x8i8c5o x1clyivc xg0ps1x\"\n }, props)} />;\n}\n\n/**\n * The bottom sheets page's drag handle: a short bar above the sheet's\n * content, saying the panel is a bottom sheet. Place it first inside\n * `Sheet.Content`; above the medium breakpoint the panel is a side sheet and\n * this draws nothing.\n *\n * It is decoration rather than a control, and hidden from assistive\n * technology. Material's own handle drags a sheet between a collapsed and an\n * expanded height and dismisses it from the collapsed one; this panel has\n * one height and cannot be dragged, so a control that only looked draggable\n * would promise what it cannot do. Closing is already the scrim, Escape, and\n * any button given `slot=\"close\"`.\n */\nfunction SheetHandle(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div aria-hidden=\"true\" {...props} {...mergeStyles({\n className: \"x6s0dn4 x9f619 x1s85apg x37i4ze x2lah0s xl56j7k x1xg6qyv\"\n }, props)}>\n <span className=\"x1ccu2yh xwvh9j7 xqu0tyb x1dkaolv x9f619 x1g12otp x1td3qas\" />\n </div>;\n}\nfunction SheetHeader(props: HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>) {\n return <div {...props} {...mergeStyles({\n className: \"x6s0dn4 x1j6faob x1q0q8m5 xso031l x9f619 x78zum5 x2lah0s x1gka490 x1qughib x1cmllll xg0ps1x\"\n }, props)} />;\n}\n\n/**\n * Names the sheet. Rendered through React Aria's title slot, which is what\n * points the dialog's `aria-labelledby` at it — a sheet without one announces\n * itself as an unnamed dialog.\n */\nfunction SheetTitle(props: RefAttributes<HTMLHeadingElement> & SheetTitleProps) {\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xdy5w5q xete2z3 x14ijtet xug9e1u x2divse x1ghz6dp\"\n }, props)} />;\n}\nSheet.Body = SheetBody;\nSheet.Content = SheetContent;\nSheet.Footer = SheetFooter;\nSheet.Handle = SheetHandle;\nSheet.Header = SheetHeader;\nSheet.Title = SheetTitle;\n\n// The dialog's own props, plus the scrim's open state and dismissal settings\n// and the panel's styling. A call site has no reason to know there are three\n// elements: `className` and `style` reach the panel, which is the one worth\n// restyling and positioning, the open state and the dismissal settings reach\n// the scrim, and everything else lands on the dialog.\n//\n// `isDismissable` is declared here rather than picked with its siblings,\n// since the picked one carries React Aria's documentation, whose default is\n// the reverse of this component's.\ntype SheetContentProps = Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'> & {\n /** A function may compute the class from the panel's render state. */\n className?: ClassNameOrFunction<ModalRenderProps>;\n /**\n * Where to portal the panel and scrim. Defaults to the container of the\n * `ThemeScope` around it, which keeps the sheet on that scope's tokens, or\n * to the end of `<body>` where there is none. A subtree themed through the\n * `themeScope` class has no container of its own, so point this inside it,\n * or the sheet renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Whether a press on the scrim, outside the panel, closes the sheet.\n * `true` here where React Aria's own default is `false`, since a sheet\n * that ignores a tap outside it reads as stuck. Escape is\n * `isKeyboardDismissDisabled`'s, and this says nothing about it.\n * @default true\n */\n isDismissable?: boolean;\n /** A function may compute the style from the panel's render state. */\n style?: StyleOrFunction<ModalRenderProps>;\n};\ntype SheetTitleProps = HeadingProps;\nexport type { SheetContentProps, SheetProps, SheetTitleProps };\nexport { SheetBody, SheetContent, SheetFooter, SheetHandle, SheetHeader, SheetTitle };\nexport default Sheet;"],"mappings":";;;;;;;;;;;AAsDA,MAAMoC,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;;;;;;;;;;;;;;;;;;;;AAwBA,SAAAI,MAAAC,IAAA;CAAA,MAAAC,IAAAnD,EAAA,CAAA;CAAA,IAAAgD;CAAA,IAAAI;CAAA,IAAAD,EAAA,OAAAD,IAAA;EAAe,CAAA,CAAAF,UAAA,GAAAI,SAAAF;EAGFC,EAAA,KAAAD;EAAAC,EAAA,KAAAH;EAAAG,EAAA,KAAAC;CAAA,OAAA;EAAAJ,WAAAG,EAAA;EAAAC,QAAAD,EAAA;CAAA;CAAA,IAAAE;CAAA,IAAAF,EAAA,OAAAH,YAAAG,EAAA,OAAAC,OAAA;EACJC,KAAA,oBAAC,eAAD;GAAc,GAAKD;GAAQJ;EAAb,CAAA;EAAsCG,EAAA,KAAAH;EAAAG,EAAA,KAAAC;EAAAD,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAApDE;AAAoD;AAE7D,SAAAC,UAAAJ,IAAA;CAAA,MAAAC,IAAAnD,EAAA,CAAA;CAAmB,MAAA,EAAAuD,KAAAC,WAAA,GAAAJ,YAAAF;CAIjB,MA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