@kanso-labs/kanso-ui 0.47.4 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/hooks.js +35 -1
- package/dist/button/hooks.js.map +1 -1
- package/dist/button/index.js +78 -65
- package/dist/button/index.js.map +1 -1
- package/dist/calendar/styles.js +5 -5
- package/dist/calendar/styles.js.map +1 -1
- package/dist/chip/styles.js +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/collection/context.js +6 -0
- package/dist/collection/context.js.map +1 -0
- package/dist/collection/styles.js +29 -6
- package/dist/collection/styles.js.map +1 -1
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.js +7 -0
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/checkbox/index.js +10 -7
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.js +2 -1
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip-group/index.js +69 -66
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.js +1 -0
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/combo-box/index.js +5 -1
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/drop-zone/styles.js +11 -11
- package/dist/components/drop-zone/styles.js.map +1 -1
- package/dist/components/fab-menu/index.js +3 -3
- package/dist/components/fab-menu/index.js.map +1 -1
- package/dist/components/icon-button/index.js.map +1 -1
- package/dist/components/list/index.js +58 -11
- package/dist/components/list/index.js.map +1 -1
- package/dist/components/list-box/index.js +82 -103
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/navigation-rail/index.js +4 -4
- package/dist/components/navigation-rail/index.js.map +1 -1
- package/dist/components/number-field/index.js +3 -3
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.js +3 -3
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio-group/index.js +12 -11
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.js +4 -4
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.js +5 -1
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/sheet/index.js +1 -1
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/snackbar/index.js +3 -3
- package/dist/components/snackbar/index.js.map +1 -1
- package/dist/components/split-button/index.js +53 -41
- package/dist/components/split-button/index.js.map +1 -1
- package/dist/components/table/index.js +58 -45
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.js +81 -30
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/time-picker/index.js +5 -5
- package/dist/components/time-picker/index.js.map +1 -1
- package/dist/components/tree/index.js +78 -21
- package/dist/components/tree/index.js.map +1 -1
- package/dist/field/index.js +103 -104
- package/dist/field/index.js.map +1 -1
- package/dist/field/styles.js +1 -1
- package/dist/field/styles.js.map +1 -1
- package/dist/hooks/useScrollEdges.js +73 -0
- package/dist/hooks/useScrollEdges.js.map +1 -0
- package/dist/navigation/styles.js +5 -5
- package/dist/navigation/styles.js.map +1 -1
- package/dist/row/styles.js +7 -7
- package/dist/row/styles.js.map +1 -1
- package/dist/styles/color.js +16 -16
- package/dist/styles/color.js.map +1 -1
- package/dist/styles/focus.js +4 -4
- package/dist/styles/focus.js.map +1 -1
- package/dist/styles/overlay.js +3 -3
- package/dist/styles/overlay.js.map +1 -1
- package/dist/styles/scroll-fade.js +33 -0
- package/dist/styles/scroll-fade.js.map +1 -0
- package/dist/styles.css +61 -20
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","NumberField","RACNumberField","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","sizing","spacing","typography","sm","bodySmallLineHeight","bodyLargeLineHeight","lg","controlXs","STACKED_INSET","INLINE_INSET","md","END_INSETS","horizontal","none","undefined","vertical","styles","stepper","k6CgDc","kGNEyG","kWkggS","kZKoxP","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kzqmXN","kjj79g","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kIyJzY","k1ekBW","kAMwcw","$$css","stepperBottomOutlined","kT0f0o","stepperDisabled","stepperFocused","stepperHovered","stepperOutlined","stepperPressed","stepperTop","kfmiAY","decrementLabel","description","error","floatingLabel","incrementLabel","inputRef","isWheelDisabled","label","numeric","steppers","variant","t0","$","t1","isDisabled","t2","t3","t4","t5","t6","props","inline","validationBehavior","T0","t7","t8","root","t9","t10","0","className","1","2","3","t11","isRequired","t12","t13","StackedStepper","children","outlined","slot","stepperStyles","top","state","isHovered","isPressed","isFocusVisible","RACButton"],"sources":["../../../src/components/number-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, Ref, RefAttributes } from 'react';\nimport type { ButtonRenderProps, NumberFieldProps as RACNumberFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, NumberField as RACNumberField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { MinusGlyph, PlusGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// The text fields page's field, holding a number: the same box, floating\n// label, underline and message as TextField, with the value in the mono\n// face and tabular figures by default, since a number is what those are\n// for, and two steppers at the trailing end.\n//\n// The steppers come in two layouts. Stacked, the plus over the minus, they\n// are a column flush with the box's top, end and bottom, each half of the\n// box's 56dp and 32dp wide, drawn here since the smallest icon button is\n// 32dp and two of those do not fit; the glyph is the icon buttons page's\n// 20dp for that size, and the hover, pressed, focus and disabled treatments\n// are the standard icon button's. Side by side, they are extra-small icon\n// buttons, the page's trailing icons in the library's own control, 12dp\n// from the end where the page puts a field's icons — the box's 16dp of\n// padding less the 4dp they pull back.\n//\n// **The stacked pair is the one control here that does not reach the 48dp\n// target**, and it is the layout rather than an oversight. Every other small\n// control in the library draws that target out of flow, over whatever sits\n// beside it — src/control/styles.ts carries the decision. These two have only\n// each other beside them: the column is 56dp tall in total, so two 48dp\n// targets inside it would overlap across most of their height, and the half\n// of a press that landed in the overlap would go to whichever box was\n// uppermost rather than to the glyph under the finger. Incrementing when a\n// reader meant to decrement is worse than a target that is short, so the\n// stacked layout keeps its 32 by 28 and the reader who needs the larger one\n// has `steppers=\"horizontal\"`, where each is an extra-small icon button and\n// gets the target from there — with the gap that keeps those two targets off\n// each other, which is the room the column has none of.\n//\n// A value that is typed rather than stepped — an amount, a year, an\n// identifier — can leave the steppers out with `steppers=\"none\"`. The box is\n// then a text field's, the input running to the box's own end padding, and\n// the arrow keys and Page Up and Page Down still step the value.\n//\n// React Aria's `NumberField` is the root and the box is its `Group`, which\n// is what names the box and the two steppers as one control; the steppers\n// are its increment and decrement buttons through context, disabled at the\n// ends of the range and kept out of the tab order, and the formatting is its\n// `formatOptions`.\n// Half the box, spelled from the same tokens the box derives its height\n// from rather than as the 28 that half of 56 comes to. A theme with a longer\n// body line makes the box taller — `Editorial` in kanso-ui-core's themes does\n// — and a stated half leaves the pair short of the bottom edge they are\n// flush with.\n//\n// Written here rather than imported from src/field/styles.ts, which spells\n// the same two expressions: the StyleX compiler resolves a constant across\n// files only out of a `.stylex.ts` module, the same reason that file gives\n// for re-declaring the forced-colours query. The two have to move together.\nconst BOX_HALF = `calc((2 * ${spacing.sm} + ${typography.bodySmallLineHeight} + ${typography.bodyLargeLineHeight}) / 2)`;\nconst BOX_OUTLINED_HALF = `calc((2 * ${spacing.lg} + ${typography.bodyLargeLineHeight}) / 2)`;\n\n// How much of the end of the box's column the steppers take, with the 8dp\n// between them and the input, which the label stops short of — FieldBox's\n// `endInset`. Without it the label ran the column's width, under the\n// steppers, and a long one was cut short beneath them. Each is the input's\n// own end, so the label ends where the value does.\n//\n// Stacked, the 32dp column less the 16dp of the box's padding it reaches\n// into; side by side, the two extra-small buttons and the 8dp between them,\n// less the 4dp they reach into the padding.\n// How far a side-by-side stepper reaches past the control's line above and\n// below it: a negative margin, half the difference between the two.\nconst STEPPER_REACH = `calc((${typography.bodyLargeLineHeight} - ${sizing.controlXs}) / 2)`;\nconst STACKED_INSET = `calc(32px - ${spacing.lg} + ${spacing.sm})`;\nconst INLINE_INSET = `calc(2 * ${sizing.controlXs} + ${spacing.sm} + ${spacing.md} - ${spacing.lg} + ${spacing.sm})`;\n\n// Each layout's inset, keyed by the prop. With no steppers there is nothing\n// for the label to stop short of, so the box's own default holds.\nconst END_INSETS = {\n horizontal: INLINE_INSET,\n none: undefined,\n vertical: STACKED_INSET\n} as const;\nconst styles = {\n stepper: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1viytl0\",\n kaIpWk: \"x2u8bby\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1td3qas\",\n kjj79g: \"xl56j7k\",\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xs2xxs2\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n stepperBottomOutlined: {\n kT0f0o: \"x4gcak0\",\n $$css: true\n },\n stepperDisabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n stepperFocused: {\n k3XXqK: \"xaatb59\",\n $$css: true\n },\n stepperHovered: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n stepperOutlined: {\n kZKoxP: \"x1o675yb\",\n $$css: true\n },\n stepperPressed: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n stepperTop: {\n kfmiAY: \"xirz1nw\",\n $$css: true\n }\n};\ntype NumberFieldProps = {\n /**\n * The name of the stepper that lowers the value, for a screen reader. Left\n * out, React Aria names it in the reader's locale, followed by the field's\n * own label — \"Decrease Quantity\" in English.\n */\n decrementLabel?: string;\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 holds a value, as the text fields page draws it.\n * `false` keeps it small at the top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * The name of the stepper that raises the value, for a screen reader. Left\n * out, React Aria names it in the reader's locale, followed by the field's\n * own label — \"Increase Quantity\" in English.\n */\n incrementLabel?: string;\n /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * Whether the mouse wheel and a trackpad's scroll leave the value alone.\n * React Aria steps a focused number field's value with the wheel, so a\n * reader scrolling a long form past a field they had left focused changed\n * its value instead of moving the page. Stepping from the wheel is the\n * call site's to ask for, with `false`.\n * @default true\n */\n isWheelDisabled?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * Renders the value in the mono face with tabular figures, for amounts and\n * other numbers meant to be compared down a column. On by default, since a\n * number field holds nothing else.\n * @default true\n */\n numeric?: boolean;\n /**\n * How the two steppers sit at the end of the box: stacked, the plus over\n * the minus, flush with the box's edge, or side by side as extra-small\n * icon buttons. `'none'` draws neither, for a value that is typed rather\n * than stepped; the keyboard still steps it.\n * @default 'vertical'\n */\n steppers?: 'horizontal' | 'none' | 'vertical';\n /**\n * The filled box, or the outlined one: no fill, an outline that thickens\n * and takes the primary role while focused, and the label cutting it once\n * it floats — the text fields page's two fields.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACNumberFieldProps, 'children' | 'isInvalid' | 'isWheelDisabled' | 'validationBehavior'>;\n\n/**\n * A labelled number input with steppers. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own — and `onChange` is handed the number, `NaN` while the field is\n * empty. `minValue`, `maxValue` and `step` shape it, and `formatOptions`\n * says how it reads, in the locale the page is in: a currency, a percentage,\n * a unit. The arrow keys and Page Up and Page Down step the value by one\n * `step` each. Given a `minValue`, Home sets the value to it, and given a\n * `maxValue`, End sets it to the last step that does not pass it.\n * The mouse wheel scrolls the page past it rather than stepping it, unless\n * `isWheelDisabled` is `false`.\n *\n * ```tsx\n * <NumberField defaultValue={1} label=\"Label\" minValue={0} />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The box, label, input and message\n * are the field chrome in `src/field`, shared with every other field.\n */\nfunction NumberField({\n decrementLabel,\n description,\n error,\n floatingLabel = true,\n incrementLabel,\n inputRef,\n isDisabled = false,\n isWheelDisabled = true,\n label,\n numeric = true,\n steppers = 'vertical',\n variant = 'filled',\n ...props\n}: NumberFieldProps & RefAttributes<HTMLDivElement>) {\n const inline = steppers === 'horizontal';\n const validationBehavior = useFieldValidationBehavior();\n return <RACNumberField isDisabled={isDisabled} isInvalid={invalidFrom(error)} isWheelDisabled={isWheelDisabled} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox endInset={END_INSETS[steppers]} floatingLabel={floatingLabel} isRequired={props.isRequired} label={label} variant={variant}>\n {steppers === 'none' ? <FieldInput numeric={numeric} ref={inputRef} /> : <div {...{\n 0: {\n className: \"x1cy8zhl x9f619 x78zum5 x126z3so\"\n },\n 1: {\n className: \"x9f619 x78zum5 x126z3so x6s0dn4\"\n }\n }[!!inline << 0]}>\n <FieldInput numeric={numeric} ref={inputRef} />\n <div {...{\n 0: {\n className: \"x9f619 x78zum5 xdt5ytf x2lah0s x1motrhk xk4mfur\"\n },\n 2: {\n className: \"x9f619 x78zum5 x2lah0s x1q0g3np x126z3so x1jblbm6 x6rec7h x1tn5xpv\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x2lah0s xk4mfur x17v9ssf\"\n },\n 3: {\n className: \"x9f619 x78zum5 x2lah0s x1q0g3np x126z3so x1jblbm6 x1tn5xpv x17v9ssf\"\n }\n }[!!inline << 1 | !!(!inline && variant === 'outlined') << 0]}>\n {inline ? <>\n <IconButton aria-label={decrementLabel} size=\"xs\" slot=\"decrement\">\n <MinusGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>\n <IconButton aria-label={incrementLabel} size=\"xs\" slot=\"increment\">\n <PlusGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>\n </> : <>\n <StackedStepper label={incrementLabel} outlined={variant === 'outlined'} slot=\"increment\">\n <PlusGlyph className=\"x1qx5ct2 x1lliihq xw4jnvo\" />\n </StackedStepper>\n <StackedStepper label={decrementLabel} outlined={variant === 'outlined'} slot=\"decrement\">\n <MinusGlyph className=\"x1qx5ct2 x1lliihq xw4jnvo\" />\n </StackedStepper>\n </>}\n </div>\n </div>}\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACNumberField>;\n}\nfunction StackedStepper({\n children,\n label,\n outlined,\n slot\n}: {\n children: ReactNode;\n label: string | undefined;\n outlined: boolean;\n slot: 'decrement' | 'increment';\n}) {\n return <RACButton aria-label={label} slot={slot} {...mergeStatefulStyles(stepperStyles(slot === 'increment', outlined), {})}>\n {children}\n </RACButton>;\n}\n\n// A stacked stepper: React Aria's button with the slot the field's context\n// looks for, drawn from its render state. Built by a call rather than\n// written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after.\nfunction stepperStyles(top: boolean, outlined: boolean) {\n return (state: ButtonRenderProps) => stylex.props(styles.stepper, outlined && styles.stepperOutlined, top && styles.stepperTop, !top && outlined && styles.stepperBottomOutlined, state.isHovered && !state.isDisabled && styles.stepperHovered, state.isPressed && !state.isDisabled && styles.stepperPressed, state.isFocusVisible && styles.stepperFocused, state.isDisabled && styles.stepperDisabled);\n}\nexport type { NumberFieldProps };\nexport default NumberField;"],"mappings":";;;;;;;;;;;;AAgEiB,GAAaS,QAAQE,KAAQD,WAAWE,sBAAyBF,WAAWG;AACnE,GAAaJ,QAAQK,KAAQJ,WAAWG;AAa5C,GAASH,WAAWG,sBAAyBL,OAAOO;AAC1E,MAAMC,gBAAgB,eAAeP,QAAQK,GAAE,KAAML,QAAQE,GAAE;AAK/D,MAAMQ,aAAa;CACjBC,YAAYH,YALmBT,OAAOO,UAAS,KAAMN,QAAQE,GAAE,KAAMF,QAAQS,GAAE,KAAMT,QAAQK,GAAE,KAAML,QAAQE,GAAE;CAM/GU,MAAMC,KAAAA;CACNC,UAAUP;AACZ;AACA,MAAMQ,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,uBAAuB;EACrBC,QAAQ;EACRF,OAAO;CACT;CACAG,iBAAiB;EACfhB,QAAQ;EACRC,QAAQ;EACRY,OAAO;CACT;CACAI,gBAAgB;EACdV,QAAQ;EACRM,OAAO;CACT;CACAK,gBAAgB;EACdvB,QAAQ;EACRkB,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eAAe;AAC3Y"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","NumberField","RACNumberField","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","sizing","spacing","typography","sm","bodySmallLineHeight","bodyLargeLineHeight","lg","controlXs","STACKED_INSET","INLINE_INSET","md","END_INSETS","horizontal","none","undefined","vertical","styles","stepper","k6CgDc","kGNEyG","kWkggS","kZKoxP","kaIpWk","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kzqmXN","kjj79g","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kIyJzY","k1ekBW","kAMwcw","$$css","stepperBottomOutlined","kT0f0o","stepperDisabled","stepperFocused","stepperHovered","stepperOutlined","stepperPressed","stepperTop","kfmiAY","decrementLabel","description","error","floatingLabel","incrementLabel","inputRef","isWheelDisabled","label","numeric","steppers","variant","t0","$","t1","isDisabled","t2","t3","t4","t5","t6","props","inline","validationBehavior","T0","t7","t8","root","t9","t10","0","className","1","2","3","t11","isRequired","t12","t13","StackedStepper","children","outlined","slot","stepperStyles","top","state","isHovered","isPressed","isFocusVisible","RACButton"],"sources":["../../../src/components/number-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, Ref, RefAttributes } from 'react';\nimport type { ButtonRenderProps, NumberFieldProps as RACNumberFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, NumberField as RACNumberField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { MinusGlyph, PlusGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity, typography } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\n\n// The text fields page's field, holding a number: the same box, floating\n// label, underline and message as TextField, with the value in the mono\n// face and tabular figures by default, since a number is what those are\n// for, and two steppers at the trailing end.\n//\n// The steppers come in two layouts. Stacked, the plus over the minus, they\n// are a column flush with the box's top, end and bottom, each half of the\n// box's 56dp and 32dp wide, drawn here since the smallest icon button is\n// 32dp and two of those do not fit; the glyph is the icon buttons page's\n// 20dp for that size, and the hover, pressed, focus and disabled treatments\n// are the standard icon button's. Side by side, they are extra-small icon\n// buttons, the page's trailing icons in the library's own control, 12dp\n// from the end where the page puts a field's icons — the box's 16dp of\n// padding less the 4dp they pull back.\n//\n// **The stacked pair is the one control here that does not reach the 48dp\n// target**, and it is the layout rather than an oversight. Every other small\n// control in the library draws that target out of flow, over whatever sits\n// beside it — src/control/styles.ts carries the decision. These two have only\n// each other beside them: the column is 56dp tall in total, so two 48dp\n// targets inside it would overlap across most of their height, and the half\n// of a press that landed in the overlap would go to whichever box was\n// uppermost rather than to the glyph under the finger. Incrementing when a\n// reader meant to decrement is worse than a target that is short, so the\n// stacked layout keeps its 32 by 28 and the reader who needs the larger one\n// has `steppers=\"horizontal\"`, where each is an extra-small icon button and\n// gets the target from there — with the gap that keeps those two targets off\n// each other, which is the room the column has none of.\n//\n// A value that is typed rather than stepped — an amount, a year, an\n// identifier — can leave the steppers out with `steppers=\"none\"`. The box is\n// then a text field's, the input running to the box's own end padding, and\n// the arrow keys and Page Up and Page Down still step the value.\n//\n// React Aria's `NumberField` is the root and the box is its `Group`, which\n// is what names the box and the two steppers as one control; the steppers\n// are its increment and decrement buttons through context, disabled at the\n// ends of the range and kept out of the tab order, and the formatting is its\n// `formatOptions`.\n// Half the box, spelled from the same tokens the box derives its height\n// from rather than as the 28 that half of 56 comes to. A theme with a longer\n// body line makes the box taller — `Editorial` in kanso-ui-core's themes does\n// — and a stated half leaves the pair short of the bottom edge they are\n// flush with.\n//\n// Written here rather than imported from src/field/styles.ts, which spells\n// the same two expressions: the StyleX compiler resolves a constant across\n// files only out of a `.stylex.ts` module, the same reason that file gives\n// for re-declaring the forced-colours query. The two have to move together.\nconst BOX_HALF = `calc((2 * ${spacing.sm} + ${typography.bodySmallLineHeight} + ${typography.bodyLargeLineHeight}) / 2)`;\nconst BOX_OUTLINED_HALF = `calc((2 * ${spacing.lg} + ${typography.bodyLargeLineHeight}) / 2)`;\n\n// How much of the end of the box's column the steppers take, with the 8dp\n// between them and the input, which the label stops short of — FieldBox's\n// `endInset`. Without it the label ran the column's width, under the\n// steppers, and a long one was cut short beneath them. Each is the input's\n// own end, so the label ends where the value does.\n//\n// Stacked, the 32dp column less the 16dp of the box's padding it reaches\n// into; side by side, the two extra-small buttons and the 8dp between them,\n// less the 4dp they reach into the padding.\n// How far a side-by-side stepper reaches past the control's line above and\n// below it: a negative margin, half the difference between the two.\nconst STEPPER_REACH = `calc((${typography.bodyLargeLineHeight} - ${sizing.controlXs}) / 2)`;\nconst STACKED_INSET = `calc(32px - ${spacing.lg} + ${spacing.sm})`;\nconst INLINE_INSET = `calc(2 * ${sizing.controlXs} + ${spacing.sm} + ${spacing.md} - ${spacing.lg} + ${spacing.sm})`;\n\n// Each layout's inset, keyed by the prop. With no steppers there is nothing\n// for the label to stop short of, so the box's own default holds.\nconst END_INSETS = {\n horizontal: INLINE_INSET,\n none: undefined,\n vertical: STACKED_INSET\n} as const;\nconst styles = {\n stepper: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"x1viytl0\",\n kaIpWk: \"x2u8bby\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1td3qas\",\n kjj79g: \"xl56j7k\",\n kjBf7l: \"xat36cu\",\n kInvED: \"x1v57pqu\",\n k3XXqK: \"x1t137rt\",\n kMeerF: \"x1s780dp\",\n kmVPX3: \"x1717udv\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xs2xxs2\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n stepperBottomOutlined: {\n kT0f0o: \"x4gcak0\",\n $$css: true\n },\n stepperDisabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n stepperFocused: {\n k3XXqK: \"xaatb59\",\n $$css: true\n },\n stepperHovered: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n stepperOutlined: {\n kZKoxP: \"x1o675yb\",\n $$css: true\n },\n stepperPressed: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n stepperTop: {\n kfmiAY: \"xirz1nw\",\n $$css: true\n }\n};\ntype NumberFieldProps = {\n /**\n * The name of the stepper that lowers the value, for a screen reader. Left\n * out, React Aria names it in the reader's locale, followed by the field's\n * own label — \"Decrease Quantity\" in English.\n */\n decrementLabel?: string;\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 holds a value, as the text fields page draws it.\n * `false` keeps it small at the top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * The name of the stepper that raises the value, for a screen reader. Left\n * out, React Aria names it in the reader's locale, followed by the field's\n * own label — \"Increase Quantity\" in English.\n */\n incrementLabel?: string;\n /**\n * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * Whether the mouse wheel and a trackpad's scroll leave the value alone.\n * React Aria steps a focused number field's value with the wheel, so a\n * reader scrolling a long form past a field they had left focused changed\n * its value instead of moving the page. Stepping from the wheel is the\n * call site's to ask for, with `false`.\n * @default true\n */\n isWheelDisabled?: boolean;\n /**\n * What the field is for. Required rather than optional: a field with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * Renders the value in the mono face with tabular figures, for amounts and\n * other numbers meant to be compared down a column. On by default, since a\n * number field holds nothing else.\n * @default true\n */\n numeric?: boolean;\n /**\n * How the two steppers sit at the end of the box: stacked, the plus over\n * the minus, flush with the box's edge, or side by side as extra-small\n * icon buttons. `'none'` draws neither, for a value that is typed rather\n * than stepped; the keyboard still steps it.\n * @default 'vertical'\n */\n steppers?: 'horizontal' | 'none' | 'vertical';\n /**\n * The filled box, or the outlined one: no fill, an outline that thickens\n * and takes the primary role while focused, and the label cutting it once\n * it floats — the text fields page's two fields.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACNumberFieldProps, 'children' | 'isInvalid' | 'isWheelDisabled' | 'validationBehavior'>;\n\n/**\n * A labelled number input with steppers. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own — and `onChange` is handed the number, `NaN` while the field is\n * empty. `minValue`, `maxValue` and `step` shape it, and `formatOptions`\n * says how it reads, in the locale the page is in: a currency, a percentage,\n * a unit. The arrow keys and Page Up and Page Down step the value by one\n * `step` each. Given a `minValue`, Home sets the value to it, and given a\n * `maxValue`, End sets it to the last step that does not pass it.\n * The mouse wheel scrolls the page past it rather than stepping it, unless\n * `isWheelDisabled` is `false`.\n *\n * ```tsx\n * <NumberField defaultValue={1} label=\"Label\" minValue={0} />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The box, label, input and message\n * are the field chrome in `src/field`, shared with every other field.\n */\nfunction NumberField({\n decrementLabel,\n description,\n error,\n floatingLabel = true,\n incrementLabel,\n inputRef,\n isDisabled = false,\n isWheelDisabled = true,\n label,\n numeric = true,\n steppers = 'vertical',\n variant = 'filled',\n ...props\n}: NumberFieldProps & RefAttributes<HTMLDivElement>) {\n const inline = steppers === 'horizontal';\n const validationBehavior = useFieldValidationBehavior();\n return <RACNumberField isDisabled={isDisabled} isInvalid={invalidFrom(error)} isWheelDisabled={isWheelDisabled} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox endInset={END_INSETS[steppers]} floatingLabel={floatingLabel} isRequired={props.isRequired} label={label} variant={variant}>\n {steppers === 'none' ? <FieldInput numeric={numeric} ref={inputRef} /> : <div {...{\n 0: {\n className: \"x1cy8zhl x9f619 x78zum5 x126z3so\"\n },\n 1: {\n className: \"x9f619 x78zum5 x126z3so x6s0dn4\"\n }\n }[!!inline << 0]}>\n <FieldInput numeric={numeric} ref={inputRef} />\n <div {...{\n 0: {\n className: \"x9f619 x78zum5 xdt5ytf x2lah0s x1motrhk xk4mfur\"\n },\n 2: {\n className: \"x9f619 x78zum5 x2lah0s x1q0g3np x126z3so x1jblbm6 x6rec7h x1tn5xpv\"\n },\n 1: {\n className: \"x9f619 x78zum5 xdt5ytf x2lah0s xk4mfur x17v9ssf\"\n },\n 3: {\n className: \"x9f619 x78zum5 x2lah0s x1q0g3np x126z3so x1jblbm6 x1tn5xpv x17v9ssf\"\n }\n }[!!inline << 1 | !!(!inline && variant === 'outlined') << 0]}>\n {inline ? <>\n <IconButton aria-label={decrementLabel} size=\"xs\" slot=\"decrement\">\n <MinusGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>\n <IconButton aria-label={incrementLabel} size=\"xs\" slot=\"increment\">\n <PlusGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>\n </> : <>\n <StackedStepper label={incrementLabel} outlined={variant === 'outlined'} slot=\"increment\">\n <PlusGlyph className=\"x1qx5ct2 x1lliihq xw4jnvo\" />\n </StackedStepper>\n <StackedStepper label={decrementLabel} outlined={variant === 'outlined'} slot=\"decrement\">\n <MinusGlyph className=\"x1qx5ct2 x1lliihq xw4jnvo\" />\n </StackedStepper>\n </>}\n </div>\n </div>}\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACNumberField>;\n}\nfunction StackedStepper({\n children,\n label,\n outlined,\n slot\n}: {\n children: ReactNode;\n label: string | undefined;\n outlined: boolean;\n slot: 'decrement' | 'increment';\n}) {\n return <RACButton aria-label={label} slot={slot} {...mergeStatefulStyles(stepperStyles(slot === 'increment', outlined), {})}>\n {children}\n </RACButton>;\n}\n\n// A stacked stepper: React Aria's button with the slot the field's context\n// looks for, drawn from its render state. Built by a call rather than\n// written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after.\nfunction stepperStyles(top: boolean, outlined: boolean) {\n return (state: ButtonRenderProps) => stylex.props(styles.stepper, outlined && styles.stepperOutlined, top && styles.stepperTop, !top && outlined && styles.stepperBottomOutlined, state.isHovered && !state.isDisabled && styles.stepperHovered, state.isPressed && !state.isDisabled && styles.stepperPressed, state.isFocusVisible && styles.stepperFocused, state.isDisabled && styles.stepperDisabled);\n}\nexport type { NumberFieldProps };\nexport default NumberField;"],"mappings":";;;;;;;;;;;;AAgEiB,GAAaS,QAAQE,KAAQD,WAAWE,sBAAyBF,WAAWG;AACnE,GAAaJ,QAAQK,KAAQJ,WAAWG;AAa5C,GAASH,WAAWG,sBAAyBL,OAAOO;AAC1E,MAAMC,gBAAgB,eAAeP,QAAQK,GAAE,KAAML,QAAQE,GAAE;AAK/D,MAAMQ,aAAa;CACjBC,YAAYH,YALmBT,OAAOO,UAAS,KAAMN,QAAQE,GAAE,KAAMF,QAAQS,GAAE,KAAMT,QAAQK,GAAE,KAAML,QAAQE,GAAE;CAM/GU,MAAMC,KAAAA;CACNC,UAAUP;AACZ;AACA,MAAMQ,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QA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AAY,CAAC6C,OAAOH,YAAYxE,OAAOuB,uBAAuBqD,MAAMC,aAAa,CAACD,MAAM9B,cAAc9C,OAAO2B,gBAAgBiD,MAAME,aAAa,CAACF,MAAM9B,cAAc9C,OAAO6B,gBAAgB+C,MAAMG,kBAAkB/E,OAAO0B,gBAAgBkD,MAAM9B,cAAc9C,OAAOyB,eAAe;AAC3Y"}
|
|
@@ -34,10 +34,10 @@ const styles = {
|
|
|
34
34
|
$$css: true
|
|
35
35
|
},
|
|
36
36
|
dialogRing: {
|
|
37
|
-
kjBf7l: "
|
|
38
|
-
kInvED: "
|
|
37
|
+
kjBf7l: "xat36cu",
|
|
38
|
+
kInvED: "x1v57pqu",
|
|
39
39
|
k3XXqK: "xbrmr3i x1t137rt",
|
|
40
|
-
kMeerF: "
|
|
40
|
+
kMeerF: "x1s780dp",
|
|
41
41
|
$$css: true
|
|
42
42
|
},
|
|
43
43
|
md: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","useEffect","useId","useRef","useState","useFocusVisible","useInteractOutside","DEFAULT_SLOT","DialogContext","OverlayTriggerStateContext","Popover","PopoverContext","RACPopoverContext","useSlottedContext","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","placementOf","popupOrigin","DEFAULT_SIDE_OFFSET","styles","content","kGO01o","kLKAdn","kg3NbH","$$css","description","kB7OPa","kMwMTN","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","kogj98","dialog","k3XXqK","dialogRing","kjBf7l","kInvED","kMeerF","md","ks0D6T","sm","title","DEFAULT_HOVER_DELAY","DEFAULT_HOVER_CLOSE_DELAY","modal","size","DescriptionContext","id","TitleContext","TEXT_SLOTS","slots","children","closeDelay","delay","trigger","PanelDialog","t0","$","labelledBy","onPressWithin","props","slot","t1","t2","t3","t4","render","_render","t5","t6","ref","state","triggerOf","pressed","undefined","titleId","titled","setTitled","Symbol","for","registerTitle","level","headings","onPress","close","t7","t8","buttons","t10","t9","element","current","contains","document","activeElement","focus","preventScroll","t11","t12","t13","t14","popupDialog","t15","t16","t17","t18","context","PopoverContent","alignOffset","className","container","style","triggerRef","align","side","sideOffset","handed","panel","merged","pressedWithin","markPressWithin","own","triggers","fromTrigger","isOutsideTrigger","isOpen","event","target","Element","isDisabled","onInteractOutside","onInteractOutsideStart","descriptions","setDescriptions","ids","ids_0","at","indexOf","slice","registerDescription","length","Set","join","describedBy","isFocusVisible","t19","t20","popup","placement","t21","t22","t23","PopoverDescription","register","generated","PopoverTitle","Content","Description","Title","RACPopover"],"sources":["../../../src/components/popover/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, PopoverRenderProps, StyleOrFunction, TextProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { useFocusVisible, useInteractOutside } from 'react-aria';\nimport { ButtonContext, DEFAULT_SLOT, Dialog, DialogContext, DialogTrigger, Heading, HeadingContext, OverlayTriggerStateContext, PreviewTrigger, Popover as RACPopover, PopoverContext as RACPopoverContext, Text, TextContext, useSlottedContext } from 'react-aria-components';\nimport type { OverlayAlign, OverlaySide } from '../../styles/overlay';\nimport { OverlayScope } from '../../overlay';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay, placementOf, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The gap between the anchor and the panel, matching `spacing.sm`'s default.\n// A number rather than the token, because React Aria computes the position in\n// JavaScript and so cannot read a CSS custom property — this is the one place\n// in the component where a step of the spacing scale is spelled out. React\n// Aria's own default is 8 as well, but the value is this component's decision\n// rather than an inherited one.\nconst DEFAULT_SIDE_OFFSET = 8;\n\n// The surface and its entry are the overlay module's, shared with every\n// anchored overlay; what is here is Popover's own — its inset, its two\n// widths, the type of its title and description, and where the dialog's\n// focus ring is drawn.\n//\n// Popover has no page of its own, so the inset and the type follow the rich\n// tooltip, the nearest thing the Material Design pages draw: a plain rounded\n// panel offset from its anchor, with no caret drawn between the two, holding\n// a subhead over supporting text.\n//\n// React Aria's popover is two elements — the positioned panel and the dialog\n// inside it — so the styles are split the same way: the surface, `content`,\n// a size and the dialog's focus ring on the panel, the dialog style on the\n// element that carries the role.\nconst styles = {\n content: {\n kGO01o: \"xqf7pud\",\n kLKAdn: \"x6gmt8y\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n description: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n dialog: {\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n dialogRing: {\n kjBf7l: \"xrgy624\",\n kInvED: \"x2ssjo2\",\n k3XXqK: \"xbrmr3i x1t137rt\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n md: {\n ks0D6T: \"x10u2fgw\",\n $$css: true\n },\n sm: {\n ks0D6T: \"xjjheoa\",\n $$css: true\n },\n title: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xrgwony\",\n kGuDYH: \"x12s497w\",\n k63SB2: \"x1szcwkt\",\n kb6lSQ: \"xo803ec\",\n kLWn49: \"xyl1r0q\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n }\n};\n\n// How long a pointer rests on the trigger before a hovered popover opens,\n// and how long it has to leave before it closes. React Aria's own defaults,\n// spelled out because they are the whole feel of a hover trigger and worth\n// finding in the component rather than in a changelog.\nconst DEFAULT_HOVER_DELAY = 600;\nconst DEFAULT_HOVER_CLOSE_DELAY = 200;\n\n// The overlay module's, since which side a surface opens on is the same\n// question for every anchored overlay. Aliased rather than re-declared so\n// the names a call site imports stay this component's.\ntype PopoverAlign = OverlayAlign;\ntype PopoverSide = OverlaySide;\ntype PopoverSize = 'md' | 'sm';\n\n// `size` and `modal` are declared on the root, where a reader expects to set\n// the shape of the whole popover, but it is `Popover.Content` that has to\n// apply them. Through context rather than making the call site repeat them —\n// the same arrangement Sheet uses, and worth keeping identical between the\n// two panels a consumer is most likely to reach for in the same afternoon.\nconst PopoverContext = createContext<{\n modal: boolean;\n size: PopoverSize;\n}>({\n modal: false,\n size: 'md'\n});\n\n// React Aria points a dialog's `aria-describedby` at its description slot\n// only for an alert dialog, on the grounds that an ordinary dialog's content\n// is read anyway. A popover's description names what the panel is for, so it\n// is pointed at here: each description reports the id it renders while it is\n// mounted, and the dialog follows those ids, since an `aria-describedby` with\n// nothing at the other end is an invalid reference rather than a harmless one.\n// The id is the one the element carries, a call site's own included, and each\n// description has one of its own, so a second description adds its id rather\n// than sharing the first's, and unmounting either leaves the other.\nconst DescriptionContext = createContext<(id: string) => () => void>(() => () => {});\n\n// The same for the title, which the non-modal panel names itself by — see\n// PanelDialog. React Aria's own Dialog finds its title by looking for it;\n// the panel here is told it is there.\nconst TitleContext = createContext<() => () => void>(() => () => {});\n\n// The text slot the description fills, with the default beside it so a\n// plain `Text` still renders. Hoisted, since it never changes.\nconst TEXT_SLOTS = {\n slots: {\n [DEFAULT_SLOT]: {},\n description: {}\n }\n};\ntype PopoverProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n /**\n * How long the pointer has to leave a hovered popover before it closes, in\n * milliseconds. Ignored by a pressed one.\n * @default 200\n */\n closeDelay?: number;\n /**\n * How long the pointer has to rest on the trigger before a hovered popover\n * opens, in milliseconds. Ignored by a pressed one.\n * @default 600\n */\n delay?: number;\n /**\n * Blocks the page behind the panel while it is open, as a dialog would.\n * Off by default: a popover leaves the page interactive, which is the\n * difference from `Sheet`.\n * @default false\n */\n modal?: boolean;\n /**\n * Panel width: `sm` caps at 240px, `md` at 320px. Either way the panel is\n * only as wide as its contents, and never wider than the viewport.\n * @default 'md'\n */\n size?: PopoverSize;\n /**\n * What opens the panel: a press, or a pointer resting on the trigger.\n * `hover` is the tooltips page's rich tooltip — it opens on hover, focus\n * or a long press, and stays open while the pointer is inside it, so the\n * panel's own buttons and links can be reached.\n * @default 'press'\n */\n trigger?: PopoverTrigger;\n};\ntype PopoverTrigger = 'hover' | 'press';\n\n/**\n * The element that carries the dialog role in a non-modal popover: what\n * React Aria's `Dialog` gives a modal one — the role, the name from the\n * title, the description, and the close slot — without the two things that\n * make `Dialog` a modal's.\n *\n * `Dialog` moves focus into itself as it mounts, whatever opened it, and\n * holds focus inside the overlay until it closes. A hover popover therefore\n * took focus from wherever the reader was typing the moment a pointer\n * rested on its trigger, and Tab in an open popover went round its own\n * controls forever, though the page behind a non-modal popover is meant to\n * stay in reach. Here a pressed popover still takes focus as it opens, since\n * a press asked for the panel, but a hovered one leaves it where it is, and\n * Tab past the panel's last control carries on from the trigger in the\n * page. React Aria's popover sees a dialog inside it and so adds no role or\n * focus handling of its own.\n */\nfunction PanelDialog({\n 'aria-labelledby': labelledBy,\n children,\n id,\n onPressWithin,\n // React Aria's render prop is the one part of a dialog's props this\n // element cannot honour, being an element of its own rather than React\n // Aria's; left out rather than spread onto the DOM.\n render: _render,\n slot,\n ...props\n}: Omit<PopoverContentProps, 'align' | 'alignOffset' | 'className' | 'container' | 'side' | 'sideOffset' | 'style' | 'triggerRef'> & {\n /**\n * Called when a press starts anywhere inside the panel in React's tree,\n * which takes in what an overlay opened from the panel draws elsewhere in\n * the document — see `PopoverContent`.\n */\n onPressWithin: () => void;\n}) {\n const ref = useRef<HTMLElement>(null);\n const state = useContext(OverlayTriggerStateContext);\n // What the trigger hands its overlay: the id the trigger's\n // `aria-controls` points at, and the trigger itself as the name of a\n // panel with no title. A hover trigger hands nothing, and is a hover\n // trigger for exactly that reason.\n const trigger = triggerOf(useContext(DialogContext));\n const pressed = trigger !== undefined;\n const titleId = useId();\n const [titled, setTitled] = useState(false);\n const registerTitle = useCallback(() => {\n setTitled(true);\n return () => {\n setTitled(false);\n };\n }, []);\n const headings = useMemo(() => ({\n slots: {\n [DEFAULT_SLOT]: {},\n title: {\n id: titleId,\n level: 2\n }\n }\n }), [titleId]);\n const buttons = useMemo(() => ({\n slots: {\n close: {\n onPress: () => {\n state?.close();\n }\n },\n [DEFAULT_SLOT]: {}\n }\n }), [state]);\n useEffect(() => {\n const element = ref.current;\n if (pressed && element !== null && !element.contains(document.activeElement)) {\n element.focus({\n preventScroll: true\n });\n }\n }, [pressed]);\n return (\n // A section with the role, as React Aria's own dialog is: a `<dialog>`\n // element brings the browser's own positioning, border, padding and top\n // layer, all of which the panel around it already decides.\n <section {...props} aria-labelledby={labelledBy ?? (titled ? titleId : trigger?.labelledBy)} id={id ?? trigger?.id} onPointerDownCapture={onPressWithin} ref={ref}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a `<dialog>` element would bring the browser's own positioning and top layer, which the panel around it already decides\n role=\"dialog\" slot={slot ?? undefined} tabIndex={-1} {...stylex.props(overlay.popupDialog, styles.dialog)}>\n <HeadingContext value={headings}>\n <TextContext value={TEXT_SLOTS}>\n <ButtonContext value={buttons}>\n <TitleContext value={registerTitle}>{children}</TitleContext>\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </section>\n );\n}\n\n/**\n * A panel anchored to the control that opened it. 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 * Non-modal by design — the page behind stays scrollable and clickable, which\n * is the difference from `Sheet`. Pass `modal` to change that. Escape, a press\n * anywhere outside the panel and a button given `slot=\"close\"` close it, and\n * a press on its trigger toggles it. Inside a dialog, a press on the scrim\n * closes the popover first and the dialog on the next, as a menu does.\n *\n * Composed rather than configured by props, because a popover's contents are\n * arbitrary — the parts are `Popover.Content`, `Popover.Title`, and\n * `Popover.Description`. A `Button` or `IconButton` placed directly inside\n * `Popover` opens it, and one given `slot=\"close\"` inside the content closes\n * it; neither needs a part of its own. Where the panel sits against its\n * trigger is `Popover.Content`'s `side` and `align`.\n *\n * ```tsx\n * <Popover>\n * <Button>Open</Button>\n * <Popover.Content side=\"end\">\n * <Popover.Title>Headline</Popover.Title>\n * <Popover.Description>Supporting line</Popover.Description>\n * <Button slot=\"close\" variant=\"text\">\n * Dismiss\n * </Button>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nfunction Popover({\n children,\n closeDelay = DEFAULT_HOVER_CLOSE_DELAY,\n delay = DEFAULT_HOVER_DELAY,\n modal = false,\n size = 'md',\n trigger = 'press',\n ...props\n}: PopoverProps) {\n // A hovered popover is React Aria's preview trigger, which is a different\n // element around the same parts rather than a mode of the pressed one: it\n // opens from hover, focus or a long press, and it is always non-modal,\n // since a panel that blocked the page while the pointer merely rested on\n // something would be a trap. `modal` is ignored there rather than\n // refused, so the content draws the non-modal panel whatever it says.\n const context = useMemo(() => ({\n modal: modal && trigger !== 'hover',\n size\n }), [modal, size, trigger]);\n if (trigger === 'hover') {\n return <PopoverContext value={context}>\n <PreviewTrigger closeDelay={closeDelay} delay={delay} {...props}>\n {children}\n </PreviewTrigger>\n </PopoverContext>;\n }\n return <PopoverContext value={context}>\n <DialogTrigger {...props}>{children}</DialogTrigger>\n </PopoverContext>;\n}\n\n/**\n * The panel itself. Everything the popover shows goes in here; the trigger\n * stays outside it, since the trigger lives in the page while this is\n * portalled out to the end of the body.\n *\n * Placement is React Aria's anchor positioning, so the panel flips to the\n * opposite side and shifts along the edge of the viewport on its own rather\n * than being clipped by it.\n */\nfunction PopoverContent({\n align = 'center',\n alignOffset,\n children,\n className,\n container,\n ref,\n side = 'bottom',\n sideOffset = DEFAULT_SIDE_OFFSET,\n style,\n triggerRef,\n ...props\n}: PopoverContentProps & RefAttributes<HTMLElement>) {\n const {\n modal,\n size\n } = useContext(PopoverContext);\n const state = useContext(OverlayTriggerStateContext);\n // The trigger React Aria hands its popover, for a content part given no\n // `triggerRef` of its own.\n const handed = useSlottedContext(RACPopoverContext)?.triggerRef;\n\n // A non-modal popover is one React Aria closes on blur alone: a press on\n // blank page left it open, and a press on its own trigger closed it as\n // focus left the panel and opened it again on the same press. Here a\n // press anywhere outside the panel closes it, and a press on the trigger\n // is left to the trigger, which toggles it.\n //\n // What an overlay opened from inside the panel draws — a select's list, a\n // menu — is portalled elsewhere in the document, so a press there is\n // outside the panel's element though it is within the panel's tree. React\n // carries the press up that tree, and the panel marks it as within before\n // the press ends; the outside press is read on its end, so the mark is\n // there to read. Each press outside clears it as it starts.\n const panel = useRef<HTMLElement>(null);\n const merged = useMemo(() => mergeRefs(panel, ref ?? undefined), [ref]);\n const pressedWithin = useRef(false);\n const markPressWithin = useCallback(() => {\n pressedWithin.current = true;\n }, []);\n // The two refs the trigger may come through, kept where a callback can\n // read them at the moment of a press rather than as dependencies, which a\n // ref is not.\n const triggers = useRef({\n handed,\n own: triggerRef\n });\n useEffect(() => {\n triggers.current = {\n handed,\n own: triggerRef\n };\n });\n const isOutsideTrigger = useCallback((element: Element) => {\n const {\n handed: fromTrigger,\n own\n } = triggers.current;\n const trigger = own?.current ?? fromTrigger?.current;\n return !(trigger?.contains(element) ?? false);\n }, []);\n useInteractOutside({\n isDisabled: modal || state === null || !state.isOpen,\n onInteractOutside: event => {\n if (pressedWithin.current) {\n pressedWithin.current = false;\n return;\n }\n if (event.target instanceof Element && !isOutsideTrigger(event.target)) {\n return;\n }\n state?.close();\n },\n onInteractOutsideStart: () => {\n pressedWithin.current = false;\n },\n ref: panel\n });\n\n // The ids of the descriptions mounted in the panel, one entry per\n // description, in the order they mounted.\n const [descriptions, setDescriptions] = useState<readonly string[]>([]);\n const registerDescription = useCallback((id: string) => {\n setDescriptions(ids => [...ids, id]);\n return () => {\n setDescriptions(ids => {\n const at = ids.indexOf(id);\n return at === -1 ? ids : [...ids.slice(0, at), ...ids.slice(at + 1)];\n });\n };\n }, []);\n const describedBy = descriptions.length > 0 ? [...new Set(descriptions)].join(' ') : undefined;\n\n // Whether React Aria reads the input in use as anything but a pointer: a\n // press on the trigger reads as one, Enter on it as a keyboard. The ring\n // waits on this as well as on the dialog's `:focus-visible`, which the\n // browser matches to the focus the panel moves into its dialog however it\n // was opened. React Aria takes an input it has not seen yet for a\n // keyboard, as it does for every ring it draws, so a panel open before\n // anything was pressed still shows the ring.\n const {\n isFocusVisible\n } = useFocusVisible();\n return <OverlayScope>\n <RACPopover crossOffset={alignOffset} isNonModal={!modal} offset={sideOffset} placement={placementOf(side, align)}\n // The surface, 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={merged}\n // Focus leaving for the trigger closes nothing: the trigger's own\n // press toggles the panel, and closing it first reopened it.\n shouldCloseOnInteractOutside={modal ? undefined : isOutsideTrigger} triggerRef={triggerRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles((render: PopoverRenderProps) => stylex.props(overlay.popup, styles.content, isFocusVisible && styles.dialogRing, styles[size], popupOrigin(render.placement)), {\n className,\n style\n })}>\n {modal ? <Dialog aria-describedby={describedBy} {...props} {...stylex.props(overlay.popupDialog, styles.dialog)}>\n <DescriptionContext value={registerDescription}>\n {children}\n </DescriptionContext>\n </Dialog> : <PanelDialog aria-describedby={describedBy} onPressWithin={markPressWithin} {...props}>\n <DescriptionContext value={registerDescription}>\n {children}\n </DescriptionContext>\n </PanelDialog>}\n </RACPopover>\n </OverlayScope>;\n}\n\n/**\n * Supporting copy under the title. The panel's `aria-describedby` points at\n * it — see DescriptionContext for why that is this component's doing.\n */\nfunction PopoverDescription(props: PopoverDescriptionProps & RefAttributes<HTMLElement>) {\n const register = useContext(DescriptionContext);\n const generated = useId();\n const id = props.id ?? generated;\n useEffect(() => register(id), [id, register]);\n return <Text slot=\"description\" {...props} id={id} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xpo2rfv x193rfdd x1hews6w xn43zvd xv61bfh x1ghz6dp\"\n }, props)} />;\n}\n\n/**\n * Names the popover. Rendered through React Aria's title slot, which is what\n * points the panel's `aria-labelledby` at it — a popover without one announces\n * itself unnamed.\n */\nfunction PopoverTitle(props: PopoverTitleProps & RefAttributes<HTMLHeadingElement>) {\n const register = useContext(TitleContext);\n useEffect(() => register(), [register]);\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q x1ghz6dp\"\n }, props)} />;\n}\n\n/**\n * What a pressed trigger hands the overlay it opens: the id its\n * `aria-controls` points at, and its own id to name a panel with no title.\n * Read field by field, since the context's type also admits a slotted\n * value; a hover trigger hands nothing.\n */\nfunction triggerOf(context: unknown) {\n if (typeof context !== 'object' || context === null || 'slots' in context) {\n return undefined;\n }\n return {\n id: 'id' in context && typeof context.id === 'string' ? context.id : undefined,\n labelledBy: 'aria-labelledby' in context && typeof context['aria-labelledby'] === 'string' ? context['aria-labelledby'] : undefined\n };\n}\nPopover.Content = PopoverContent;\nPopover.Description = PopoverDescription;\nPopover.Title = PopoverTitle;\n\n// The dialog's own props, plus the four that place the panel and its\n// styling. Those belong to the positioned panel rather than to the dialog,\n// but a call site has no reason to know there are two elements — `className`\n// and `style` reach the panel, which is the one worth restyling, and\n// everything else lands on the dialog.\ntype PopoverContentProps = Omit<DialogProps, 'children' | 'className' | 'style'> & {\n /**\n * Where the panel sits along the side it opens on.\n * @default 'center'\n */\n align?: PopoverAlign;\n /** Moves the panel along that side, in pixels. */\n alignOffset?: number;\n children?: ReactNode;\n /** A function may compute the class from the panel's render state. */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * Where to portal the panel. Defaults to the container of the `ThemeScope`\n * around it, which keeps the popover 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 popover\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Which side of the trigger the panel opens on. It flips to the opposite\n * side when there is no room. `start` and `end` follow the writing\n * direction, so `end` is the right in English and the left in Arabic;\n * `left` and `right` stay put in either.\n * @default 'bottom'\n */\n side?: PopoverSide;\n /**\n * The gap between the trigger and the panel, in pixels.\n * @default 8\n */\n sideOffset?: number;\n /** A function may compute the style from the panel's render state. */\n style?: StyleOrFunction<PopoverRenderProps>;\n /**\n * An element to anchor the panel to other than the trigger that opened it.\n */\n triggerRef?: RefObject<Element | null>;\n};\ntype PopoverDescriptionProps = TextProps;\ntype PopoverTitleProps = HeadingProps;\nexport type { PopoverAlign, PopoverContentProps, PopoverDescriptionProps, PopoverProps, PopoverSide, PopoverSize, PopoverTitleProps, PopoverTrigger };\nexport { PopoverContent, PopoverDescription, PopoverTitle };\nexport default Popover;"],"mappings":";;;;;;;;;;;;AAsBA,MAAMuB,sBAAsB;AAgB5B,MAAMC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,aAAa;EACXC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRT,OAAO;CACT;CACAU,QAAQ;EACNC,QAAQ;EACRX,OAAO;CACT;CACAY,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRH,QAAQ;EACRI,QAAQ;EACRf,OAAO;CACT;CACAgB,IAAI;EACFC,QAAQ;EACRjB,OAAO;CACT;CACAkB,IAAI;EACFD,QAAQ;EACRjB,OAAO;CACT;CACAmB,OAAO;EACLjB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRT,OAAO;CACT;AACF;AAMA,MAAMoB,sBAAsB;AAC5B,MAAMC,4BAA4B;AAclC,MAAMpC,iBAAiBZ,cAGpB;CACDiD,OAAO;CACPC,MA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,GAAKJ;GAAK,GAAMG;EAEnC,CAAA;EAAIN,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAFNO;AAEM;;;;;;;AASf,SAASQ,UAAUkC,SAAkB;CACnC,IAAI,OAAOA,YAAY,YAAYA,YAAY,QAAQ,WAAWA,SAChE;CAEF,OAAO;EACL3D,IAAI,QAAQ2D,WAAW,OAAOA,QAAQ3D,OAAO,WAAW2D,QAAQ3D,KAAK2B,KAAAA;EACrEhB,YAAY,qBAAqBgD,WAAW,OAAOA,QAAQ,uBAAuB,WAAWA,QAAQ,qBAAqBhC,KAAAA;CAC5H;AACF;AACApE,QAAQsJ,UAAUjD;AAClBrG,QAAQuJ,cAAcL;AACtBlJ,QAAQwJ,QAAQH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","useEffect","useId","useRef","useState","useFocusVisible","useInteractOutside","DEFAULT_SLOT","DialogContext","OverlayTriggerStateContext","Popover","PopoverContext","RACPopoverContext","useSlottedContext","mergeRefs","mergeStatefulStyles","mergeStyles","overlay","placementOf","popupOrigin","DEFAULT_SIDE_OFFSET","styles","content","kGO01o","kLKAdn","kg3NbH","$$css","description","kB7OPa","kMwMTN","kMv6JI","kGuDYH","k63SB2","kb6lSQ","kLWn49","kogj98","dialog","k3XXqK","dialogRing","kjBf7l","kInvED","kMeerF","md","ks0D6T","sm","title","DEFAULT_HOVER_DELAY","DEFAULT_HOVER_CLOSE_DELAY","modal","size","DescriptionContext","id","TitleContext","TEXT_SLOTS","slots","children","closeDelay","delay","trigger","PanelDialog","t0","$","labelledBy","onPressWithin","props","slot","t1","t2","t3","t4","render","_render","t5","t6","ref","state","triggerOf","pressed","undefined","titleId","titled","setTitled","Symbol","for","registerTitle","level","headings","onPress","close","t7","t8","buttons","t10","t9","element","current","contains","document","activeElement","focus","preventScroll","t11","t12","t13","t14","popupDialog","t15","t16","t17","t18","context","PopoverContent","alignOffset","className","container","style","triggerRef","align","side","sideOffset","handed","panel","merged","pressedWithin","markPressWithin","own","triggers","fromTrigger","isOutsideTrigger","isOpen","event","target","Element","isDisabled","onInteractOutside","onInteractOutsideStart","descriptions","setDescriptions","ids","ids_0","at","indexOf","slice","registerDescription","length","Set","join","describedBy","isFocusVisible","t19","t20","popup","placement","t21","t22","t23","PopoverDescription","register","generated","PopoverTitle","Content","Description","Title","RACPopover"],"sources":["../../../src/components/popover/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, PopoverRenderProps, StyleOrFunction, TextProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from 'react';\nimport { useFocusVisible, useInteractOutside } from 'react-aria';\nimport { ButtonContext, DEFAULT_SLOT, Dialog, DialogContext, DialogTrigger, Heading, HeadingContext, OverlayTriggerStateContext, PreviewTrigger, Popover as RACPopover, PopoverContext as RACPopoverContext, Text, TextContext, useSlottedContext } from 'react-aria-components';\nimport type { OverlayAlign, OverlaySide } from '../../styles/overlay';\nimport { OverlayScope } from '../../overlay';\nimport { mergeRefs } from '../../render/ref';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport { overlay, placementOf, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing, typography } from '../../tokens/design.tokens.stylex';\n\n// The gap between the anchor and the panel, matching `spacing.sm`'s default.\n// A number rather than the token, because React Aria computes the position in\n// JavaScript and so cannot read a CSS custom property — this is the one place\n// in the component where a step of the spacing scale is spelled out. React\n// Aria's own default is 8 as well, but the value is this component's decision\n// rather than an inherited one.\nconst DEFAULT_SIDE_OFFSET = 8;\n\n// The surface and its entry are the overlay module's, shared with every\n// anchored overlay; what is here is Popover's own — its inset, its two\n// widths, the type of its title and description, and where the dialog's\n// focus ring is drawn.\n//\n// Popover has no page of its own, so the inset and the type follow the rich\n// tooltip, the nearest thing the Material Design pages draw: a plain rounded\n// panel offset from its anchor, with no caret drawn between the two, holding\n// a subhead over supporting text.\n//\n// React Aria's popover is two elements — the positioned panel and the dialog\n// inside it — so the styles are split the same way: the surface, `content`,\n// a size and the dialog's focus ring on the panel, the dialog style on the\n// element that carries the role.\nconst styles = {\n content: {\n kGO01o: \"xqf7pud\",\n kLKAdn: \"x6gmt8y\",\n kg3NbH: \"x790zyz\",\n $$css: true\n },\n description: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xpo2rfv\",\n kGuDYH: \"x193rfdd\",\n k63SB2: \"x1hews6w\",\n kb6lSQ: \"xn43zvd\",\n kLWn49: \"xv61bfh\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n dialog: {\n k3XXqK: \"x1t137rt\",\n $$css: true\n },\n dialogRing: {\n kjBf7l: \"xat36cu\",\n kInvED: \"x1v57pqu\",\n k3XXqK: \"xbrmr3i x1t137rt\",\n kMeerF: \"x1s780dp\",\n $$css: true\n },\n md: {\n ks0D6T: \"x10u2fgw\",\n $$css: true\n },\n sm: {\n ks0D6T: \"xjjheoa\",\n $$css: true\n },\n title: {\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1w5n3ug\",\n kMv6JI: \"xrgwony\",\n kGuDYH: \"x12s497w\",\n k63SB2: \"x1szcwkt\",\n kb6lSQ: \"xo803ec\",\n kLWn49: \"xyl1r0q\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n }\n};\n\n// How long a pointer rests on the trigger before a hovered popover opens,\n// and how long it has to leave before it closes. React Aria's own defaults,\n// spelled out because they are the whole feel of a hover trigger and worth\n// finding in the component rather than in a changelog.\nconst DEFAULT_HOVER_DELAY = 600;\nconst DEFAULT_HOVER_CLOSE_DELAY = 200;\n\n// The overlay module's, since which side a surface opens on is the same\n// question for every anchored overlay. Aliased rather than re-declared so\n// the names a call site imports stay this component's.\ntype PopoverAlign = OverlayAlign;\ntype PopoverSide = OverlaySide;\ntype PopoverSize = 'md' | 'sm';\n\n// `size` and `modal` are declared on the root, where a reader expects to set\n// the shape of the whole popover, but it is `Popover.Content` that has to\n// apply them. Through context rather than making the call site repeat them —\n// the same arrangement Sheet uses, and worth keeping identical between the\n// two panels a consumer is most likely to reach for in the same afternoon.\nconst PopoverContext = createContext<{\n modal: boolean;\n size: PopoverSize;\n}>({\n modal: false,\n size: 'md'\n});\n\n// React Aria points a dialog's `aria-describedby` at its description slot\n// only for an alert dialog, on the grounds that an ordinary dialog's content\n// is read anyway. A popover's description names what the panel is for, so it\n// is pointed at here: each description reports the id it renders while it is\n// mounted, and the dialog follows those ids, since an `aria-describedby` with\n// nothing at the other end is an invalid reference rather than a harmless one.\n// The id is the one the element carries, a call site's own included, and each\n// description has one of its own, so a second description adds its id rather\n// than sharing the first's, and unmounting either leaves the other.\nconst DescriptionContext = createContext<(id: string) => () => void>(() => () => {});\n\n// The same for the title, which the non-modal panel names itself by — see\n// PanelDialog. React Aria's own Dialog finds its title by looking for it;\n// the panel here is told it is there.\nconst TitleContext = createContext<() => () => void>(() => () => {});\n\n// The text slot the description fills, with the default beside it so a\n// plain `Text` still renders. Hoisted, since it never changes.\nconst TEXT_SLOTS = {\n slots: {\n [DEFAULT_SLOT]: {},\n description: {}\n }\n};\ntype PopoverProps = Omit<DialogTriggerProps, 'children'> & {\n children?: ReactNode;\n /**\n * How long the pointer has to leave a hovered popover before it closes, in\n * milliseconds. Ignored by a pressed one.\n * @default 200\n */\n closeDelay?: number;\n /**\n * How long the pointer has to rest on the trigger before a hovered popover\n * opens, in milliseconds. Ignored by a pressed one.\n * @default 600\n */\n delay?: number;\n /**\n * Blocks the page behind the panel while it is open, as a dialog would.\n * Off by default: a popover leaves the page interactive, which is the\n * difference from `Sheet`.\n * @default false\n */\n modal?: boolean;\n /**\n * Panel width: `sm` caps at 240px, `md` at 320px. Either way the panel is\n * only as wide as its contents, and never wider than the viewport.\n * @default 'md'\n */\n size?: PopoverSize;\n /**\n * What opens the panel: a press, or a pointer resting on the trigger.\n * `hover` is the tooltips page's rich tooltip — it opens on hover, focus\n * or a long press, and stays open while the pointer is inside it, so the\n * panel's own buttons and links can be reached.\n * @default 'press'\n */\n trigger?: PopoverTrigger;\n};\ntype PopoverTrigger = 'hover' | 'press';\n\n/**\n * The element that carries the dialog role in a non-modal popover: what\n * React Aria's `Dialog` gives a modal one — the role, the name from the\n * title, the description, and the close slot — without the two things that\n * make `Dialog` a modal's.\n *\n * `Dialog` moves focus into itself as it mounts, whatever opened it, and\n * holds focus inside the overlay until it closes. A hover popover therefore\n * took focus from wherever the reader was typing the moment a pointer\n * rested on its trigger, and Tab in an open popover went round its own\n * controls forever, though the page behind a non-modal popover is meant to\n * stay in reach. Here a pressed popover still takes focus as it opens, since\n * a press asked for the panel, but a hovered one leaves it where it is, and\n * Tab past the panel's last control carries on from the trigger in the\n * page. React Aria's popover sees a dialog inside it and so adds no role or\n * focus handling of its own.\n */\nfunction PanelDialog({\n 'aria-labelledby': labelledBy,\n children,\n id,\n onPressWithin,\n // React Aria's render prop is the one part of a dialog's props this\n // element cannot honour, being an element of its own rather than React\n // Aria's; left out rather than spread onto the DOM.\n render: _render,\n slot,\n ...props\n}: Omit<PopoverContentProps, 'align' | 'alignOffset' | 'className' | 'container' | 'side' | 'sideOffset' | 'style' | 'triggerRef'> & {\n /**\n * Called when a press starts anywhere inside the panel in React's tree,\n * which takes in what an overlay opened from the panel draws elsewhere in\n * the document — see `PopoverContent`.\n */\n onPressWithin: () => void;\n}) {\n const ref = useRef<HTMLElement>(null);\n const state = useContext(OverlayTriggerStateContext);\n // What the trigger hands its overlay: the id the trigger's\n // `aria-controls` points at, and the trigger itself as the name of a\n // panel with no title. A hover trigger hands nothing, and is a hover\n // trigger for exactly that reason.\n const trigger = triggerOf(useContext(DialogContext));\n const pressed = trigger !== undefined;\n const titleId = useId();\n const [titled, setTitled] = useState(false);\n const registerTitle = useCallback(() => {\n setTitled(true);\n return () => {\n setTitled(false);\n };\n }, []);\n const headings = useMemo(() => ({\n slots: {\n [DEFAULT_SLOT]: {},\n title: {\n id: titleId,\n level: 2\n }\n }\n }), [titleId]);\n const buttons = useMemo(() => ({\n slots: {\n close: {\n onPress: () => {\n state?.close();\n }\n },\n [DEFAULT_SLOT]: {}\n }\n }), [state]);\n useEffect(() => {\n const element = ref.current;\n if (pressed && element !== null && !element.contains(document.activeElement)) {\n element.focus({\n preventScroll: true\n });\n }\n }, [pressed]);\n return (\n // A section with the role, as React Aria's own dialog is: a `<dialog>`\n // element brings the browser's own positioning, border, padding and top\n // layer, all of which the panel around it already decides.\n <section {...props} aria-labelledby={labelledBy ?? (titled ? titleId : trigger?.labelledBy)} id={id ?? trigger?.id} onPointerDownCapture={onPressWithin} ref={ref}\n // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a `<dialog>` element would bring the browser's own positioning and top layer, which the panel around it already decides\n role=\"dialog\" slot={slot ?? undefined} tabIndex={-1} {...stylex.props(overlay.popupDialog, styles.dialog)}>\n <HeadingContext value={headings}>\n <TextContext value={TEXT_SLOTS}>\n <ButtonContext value={buttons}>\n <TitleContext value={registerTitle}>{children}</TitleContext>\n </ButtonContext>\n </TextContext>\n </HeadingContext>\n </section>\n );\n}\n\n/**\n * A panel anchored to the control that opened it. 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 * Non-modal by design — the page behind stays scrollable and clickable, which\n * is the difference from `Sheet`. Pass `modal` to change that. Escape, a press\n * anywhere outside the panel and a button given `slot=\"close\"` close it, and\n * a press on its trigger toggles it. Inside a dialog, a press on the scrim\n * closes the popover first and the dialog on the next, as a menu does.\n *\n * Composed rather than configured by props, because a popover's contents are\n * arbitrary — the parts are `Popover.Content`, `Popover.Title`, and\n * `Popover.Description`. A `Button` or `IconButton` placed directly inside\n * `Popover` opens it, and one given `slot=\"close\"` inside the content closes\n * it; neither needs a part of its own. Where the panel sits against its\n * trigger is `Popover.Content`'s `side` and `align`.\n *\n * ```tsx\n * <Popover>\n * <Button>Open</Button>\n * <Popover.Content side=\"end\">\n * <Popover.Title>Headline</Popover.Title>\n * <Popover.Description>Supporting line</Popover.Description>\n * <Button slot=\"close\" variant=\"text\">\n * Dismiss\n * </Button>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nfunction Popover({\n children,\n closeDelay = DEFAULT_HOVER_CLOSE_DELAY,\n delay = DEFAULT_HOVER_DELAY,\n modal = false,\n size = 'md',\n trigger = 'press',\n ...props\n}: PopoverProps) {\n // A hovered popover is React Aria's preview trigger, which is a different\n // element around the same parts rather than a mode of the pressed one: it\n // opens from hover, focus or a long press, and it is always non-modal,\n // since a panel that blocked the page while the pointer merely rested on\n // something would be a trap. `modal` is ignored there rather than\n // refused, so the content draws the non-modal panel whatever it says.\n const context = useMemo(() => ({\n modal: modal && trigger !== 'hover',\n size\n }), [modal, size, trigger]);\n if (trigger === 'hover') {\n return <PopoverContext value={context}>\n <PreviewTrigger closeDelay={closeDelay} delay={delay} {...props}>\n {children}\n </PreviewTrigger>\n </PopoverContext>;\n }\n return <PopoverContext value={context}>\n <DialogTrigger {...props}>{children}</DialogTrigger>\n </PopoverContext>;\n}\n\n/**\n * The panel itself. Everything the popover shows goes in here; the trigger\n * stays outside it, since the trigger lives in the page while this is\n * portalled out to the end of the body.\n *\n * Placement is React Aria's anchor positioning, so the panel flips to the\n * opposite side and shifts along the edge of the viewport on its own rather\n * than being clipped by it.\n */\nfunction PopoverContent({\n align = 'center',\n alignOffset,\n children,\n className,\n container,\n ref,\n side = 'bottom',\n sideOffset = DEFAULT_SIDE_OFFSET,\n style,\n triggerRef,\n ...props\n}: PopoverContentProps & RefAttributes<HTMLElement>) {\n const {\n modal,\n size\n } = useContext(PopoverContext);\n const state = useContext(OverlayTriggerStateContext);\n // The trigger React Aria hands its popover, for a content part given no\n // `triggerRef` of its own.\n const handed = useSlottedContext(RACPopoverContext)?.triggerRef;\n\n // A non-modal popover is one React Aria closes on blur alone: a press on\n // blank page left it open, and a press on its own trigger closed it as\n // focus left the panel and opened it again on the same press. Here a\n // press anywhere outside the panel closes it, and a press on the trigger\n // is left to the trigger, which toggles it.\n //\n // What an overlay opened from inside the panel draws — a select's list, a\n // menu — is portalled elsewhere in the document, so a press there is\n // outside the panel's element though it is within the panel's tree. React\n // carries the press up that tree, and the panel marks it as within before\n // the press ends; the outside press is read on its end, so the mark is\n // there to read. Each press outside clears it as it starts.\n const panel = useRef<HTMLElement>(null);\n const merged = useMemo(() => mergeRefs(panel, ref ?? undefined), [ref]);\n const pressedWithin = useRef(false);\n const markPressWithin = useCallback(() => {\n pressedWithin.current = true;\n }, []);\n // The two refs the trigger may come through, kept where a callback can\n // read them at the moment of a press rather than as dependencies, which a\n // ref is not.\n const triggers = useRef({\n handed,\n own: triggerRef\n });\n useEffect(() => {\n triggers.current = {\n handed,\n own: triggerRef\n };\n });\n const isOutsideTrigger = useCallback((element: Element) => {\n const {\n handed: fromTrigger,\n own\n } = triggers.current;\n const trigger = own?.current ?? fromTrigger?.current;\n return !(trigger?.contains(element) ?? false);\n }, []);\n useInteractOutside({\n isDisabled: modal || state === null || !state.isOpen,\n onInteractOutside: event => {\n if (pressedWithin.current) {\n pressedWithin.current = false;\n return;\n }\n if (event.target instanceof Element && !isOutsideTrigger(event.target)) {\n return;\n }\n state?.close();\n },\n onInteractOutsideStart: () => {\n pressedWithin.current = false;\n },\n ref: panel\n });\n\n // The ids of the descriptions mounted in the panel, one entry per\n // description, in the order they mounted.\n const [descriptions, setDescriptions] = useState<readonly string[]>([]);\n const registerDescription = useCallback((id: string) => {\n setDescriptions(ids => [...ids, id]);\n return () => {\n setDescriptions(ids => {\n const at = ids.indexOf(id);\n return at === -1 ? ids : [...ids.slice(0, at), ...ids.slice(at + 1)];\n });\n };\n }, []);\n const describedBy = descriptions.length > 0 ? [...new Set(descriptions)].join(' ') : undefined;\n\n // Whether React Aria reads the input in use as anything but a pointer: a\n // press on the trigger reads as one, Enter on it as a keyboard. The ring\n // waits on this as well as on the dialog's `:focus-visible`, which the\n // browser matches to the focus the panel moves into its dialog however it\n // was opened. React Aria takes an input it has not seen yet for a\n // keyboard, as it does for every ring it draws, so a panel open before\n // anything was pressed still shows the ring.\n const {\n isFocusVisible\n } = useFocusVisible();\n return <OverlayScope>\n <RACPopover crossOffset={alignOffset} isNonModal={!modal} offset={sideOffset} placement={placementOf(side, align)}\n // The surface, 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={merged}\n // Focus leaving for the trigger closes nothing: the trigger's own\n // press toggles the panel, and closing it first reopened it.\n shouldCloseOnInteractOutside={modal ? undefined : isOutsideTrigger} triggerRef={triggerRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container} {...mergeStatefulStyles((render: PopoverRenderProps) => stylex.props(overlay.popup, styles.content, isFocusVisible && styles.dialogRing, styles[size], popupOrigin(render.placement)), {\n className,\n style\n })}>\n {modal ? <Dialog aria-describedby={describedBy} {...props} {...stylex.props(overlay.popupDialog, styles.dialog)}>\n <DescriptionContext value={registerDescription}>\n {children}\n </DescriptionContext>\n </Dialog> : <PanelDialog aria-describedby={describedBy} onPressWithin={markPressWithin} {...props}>\n <DescriptionContext value={registerDescription}>\n {children}\n </DescriptionContext>\n </PanelDialog>}\n </RACPopover>\n </OverlayScope>;\n}\n\n/**\n * Supporting copy under the title. The panel's `aria-describedby` points at\n * it — see DescriptionContext for why that is this component's doing.\n */\nfunction PopoverDescription(props: PopoverDescriptionProps & RefAttributes<HTMLElement>) {\n const register = useContext(DescriptionContext);\n const generated = useId();\n const id = props.id ?? generated;\n useEffect(() => register(id), [id, register]);\n return <Text slot=\"description\" {...props} id={id} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xpo2rfv x193rfdd x1hews6w xn43zvd xv61bfh x1ghz6dp\"\n }, props)} />;\n}\n\n/**\n * Names the popover. Rendered through React Aria's title slot, which is what\n * points the panel's `aria-labelledby` at it — a popover without one announces\n * itself unnamed.\n */\nfunction PopoverTitle(props: PopoverTitleProps & RefAttributes<HTMLHeadingElement>) {\n const register = useContext(TitleContext);\n useEffect(() => register(), [register]);\n return <Heading slot=\"title\" {...props} {...mergeStyles({\n className: \"x9f619 x1w5n3ug xrgwony x12s497w x1szcwkt xo803ec xyl1r0q x1ghz6dp\"\n }, props)} />;\n}\n\n/**\n * What a pressed trigger hands the overlay it opens: the id its\n * `aria-controls` points at, and its own id to name a panel with no title.\n * Read field by field, since the context's type also admits a slotted\n * value; a hover trigger hands nothing.\n */\nfunction triggerOf(context: unknown) {\n if (typeof context !== 'object' || context === null || 'slots' in context) {\n return undefined;\n }\n return {\n id: 'id' in context && typeof context.id === 'string' ? context.id : undefined,\n labelledBy: 'aria-labelledby' in context && typeof context['aria-labelledby'] === 'string' ? context['aria-labelledby'] : undefined\n };\n}\nPopover.Content = PopoverContent;\nPopover.Description = PopoverDescription;\nPopover.Title = PopoverTitle;\n\n// The dialog's own props, plus the four that place the panel and its\n// styling. Those belong to the positioned panel rather than to the dialog,\n// but a call site has no reason to know there are two elements — `className`\n// and `style` reach the panel, which is the one worth restyling, and\n// everything else lands on the dialog.\ntype PopoverContentProps = Omit<DialogProps, 'children' | 'className' | 'style'> & {\n /**\n * Where the panel sits along the side it opens on.\n * @default 'center'\n */\n align?: PopoverAlign;\n /** Moves the panel along that side, in pixels. */\n alignOffset?: number;\n children?: ReactNode;\n /** A function may compute the class from the panel's render state. */\n className?: ClassNameOrFunction<PopoverRenderProps>;\n /**\n * Where to portal the panel. Defaults to the container of the `ThemeScope`\n * around it, which keeps the popover 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 popover\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * Which side of the trigger the panel opens on. It flips to the opposite\n * side when there is no room. `start` and `end` follow the writing\n * direction, so `end` is the right in English and the left in Arabic;\n * `left` and `right` stay put in either.\n * @default 'bottom'\n */\n side?: PopoverSide;\n /**\n * The gap between the trigger and the panel, in pixels.\n * @default 8\n */\n sideOffset?: number;\n /** A function may compute the style from the panel's render state. */\n style?: StyleOrFunction<PopoverRenderProps>;\n /**\n * An element to anchor the panel to other than the trigger that opened it.\n */\n triggerRef?: RefObject<Element | null>;\n};\ntype PopoverDescriptionProps = TextProps;\ntype PopoverTitleProps = HeadingProps;\nexport type { PopoverAlign, PopoverContentProps, PopoverDescriptionProps, PopoverProps, PopoverSide, PopoverSize, PopoverTitleProps, PopoverTrigger };\nexport { PopoverContent, PopoverDescription, PopoverTitle };\nexport default Popover;"],"mappings":";;;;;;;;;;;;AAsBA,MAAMuB,sBAAsB;AAgB5B,MAAMC,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,aAAa;EACXC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRT,OAAO;CACT;CACAU,QAAQ;EACNC,QAAQ;EACRX,OAAO;CACT;CACAY,YAAY;EACVC,QAAQ;EACRC,QAAQ;EACRH,QAAQ;EACRI,QAAQ;EACRf,OAAO;CACT;CACAgB,IAAI;EACFC,QAAQ;EACRjB,OAAO;CACT;CACAkB,IAAI;EACFD,QAAQ;EACRjB,OAAO;CACT;CACAmB,OAAO;EACLjB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRT,OAAO;CACT;AACF;AAMA,MAAMoB,sBAAsB;AAC5B,MAAMC,4BAA4B;AAclC,MAAMpC,iBAAiBZ,cAGpB;CACDiD,OAAO;CACPC,MAAM;AACR,CAAC;AAWD,MAAMC,qBAAqBnD,0BAAsD,CAAC,CAAC;AAKnF,MAAMqD,eAAerD,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N,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAFNO;AAEM;;;;;;;AASf,SAASQ,UAAUkC,SAAkB;CACnC,IAAI,OAAOA,YAAY,YAAYA,YAAY,QAAQ,WAAWA,SAChE;CAEF,OAAO;EACL3D,IAAI,QAAQ2D,WAAW,OAAOA,QAAQ3D,OAAO,WAAW2D,QAAQ3D,KAAK2B,KAAAA;EACrEhB,YAAY,qBAAqBgD,WAAW,OAAOA,QAAQ,uBAAuB,WAAWA,QAAQ,qBAAqBhC,KAAAA;CAC5H;AACF;AACApE,QAAQsJ,UAAUjD;AAClBrG,QAAQuJ,cAAcL;AACtBlJ,QAAQwJ,QAAQH"}
|
|
@@ -92,8 +92,9 @@ function buttonContent(children, ripple) {
|
|
|
92
92
|
function groupContent(label, children, description, error, horizontal) {
|
|
93
93
|
return (state) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
94
|
/* @__PURE__ */ jsx(FieldLabel, {
|
|
95
|
+
isDisabled: state.isDisabled,
|
|
96
|
+
isInvalid: state.isInvalid,
|
|
95
97
|
isRequired: state.isRequired,
|
|
96
|
-
state,
|
|
97
98
|
variant: "group",
|
|
98
99
|
children: label
|
|
99
100
|
}),
|
|
@@ -126,10 +127,10 @@ function optionContent(button, description) {
|
|
|
126
127
|
*/
|
|
127
128
|
function Radio(t0) {
|
|
128
129
|
const $ = c(13);
|
|
129
|
-
const { children, description, ...props$
|
|
130
|
+
const { children, description, ...props$1 } = t0;
|
|
130
131
|
const ripple = useRipple();
|
|
131
132
|
const T0 = RadioField;
|
|
132
|
-
const t1 = mergeStatefulStyles(props(controlStyles.field), props$
|
|
133
|
+
const t1 = mergeStatefulStyles(props(controlStyles.field), props$1);
|
|
133
134
|
let t2;
|
|
134
135
|
if ($[0] !== children || $[1] !== ripple) {
|
|
135
136
|
t2 = buttonContent(children, ripple);
|
|
@@ -154,14 +155,14 @@ function Radio(t0) {
|
|
|
154
155
|
$[7] = t4;
|
|
155
156
|
} else t4 = $[7];
|
|
156
157
|
let t5;
|
|
157
|
-
if ($[8] !== T0 || $[9] !== props$
|
|
158
|
+
if ($[8] !== T0 || $[9] !== props$1 || $[10] !== t1 || $[11] !== t4) {
|
|
158
159
|
t5 = /* @__PURE__ */ jsx(T0, {
|
|
159
|
-
...props$
|
|
160
|
+
...props$1,
|
|
160
161
|
...t1,
|
|
161
162
|
children: t4
|
|
162
163
|
});
|
|
163
164
|
$[8] = T0;
|
|
164
|
-
$[9] = props$
|
|
165
|
+
$[9] = props$1;
|
|
165
166
|
$[10] = t1;
|
|
166
167
|
$[11] = t4;
|
|
167
168
|
$[12] = t5;
|
|
@@ -188,7 +189,7 @@ function Radio(t0) {
|
|
|
188
189
|
*/
|
|
189
190
|
function RadioGroup(t0) {
|
|
190
191
|
const $ = c(16);
|
|
191
|
-
const { children, description, error, label, orientation: t1, ...props$
|
|
192
|
+
const { children, description, error, label, orientation: t1, ...props$2 } = t0;
|
|
192
193
|
const orientation = t1 === void 0 ? "vertical" : t1;
|
|
193
194
|
const validationBehavior = useFieldValidationBehavior();
|
|
194
195
|
const T0 = RadioGroup$1;
|
|
@@ -198,7 +199,7 @@ function RadioGroup(t0) {
|
|
|
198
199
|
$[0] = error;
|
|
199
200
|
$[1] = t2;
|
|
200
201
|
} else t2 = $[1];
|
|
201
|
-
const t3 = mergeStatefulStyles(props(groupStyles.root), props$
|
|
202
|
+
const t3 = mergeStatefulStyles(props(groupStyles.root), props$2);
|
|
202
203
|
const t4 = orientation === "horizontal";
|
|
203
204
|
let t5;
|
|
204
205
|
if ($[2] !== children || $[3] !== description || $[4] !== error || $[5] !== label || $[6] !== t4) {
|
|
@@ -211,18 +212,18 @@ function RadioGroup(t0) {
|
|
|
211
212
|
$[7] = t5;
|
|
212
213
|
} else t5 = $[7];
|
|
213
214
|
let t6;
|
|
214
|
-
if ($[8] !== T0 || $[9] !== orientation || $[10] !== props$
|
|
215
|
+
if ($[8] !== T0 || $[9] !== orientation || $[10] !== props$2 || $[11] !== t2 || $[12] !== t3 || $[13] !== t5 || $[14] !== validationBehavior) {
|
|
215
216
|
t6 = /* @__PURE__ */ jsx(T0, {
|
|
216
217
|
isInvalid: t2,
|
|
217
218
|
orientation,
|
|
218
219
|
validationBehavior,
|
|
219
|
-
...props$
|
|
220
|
+
...props$2,
|
|
220
221
|
...t3,
|
|
221
222
|
children: t5
|
|
222
223
|
});
|
|
223
224
|
$[8] = T0;
|
|
224
225
|
$[9] = orientation;
|
|
225
|
-
$[10] = props$
|
|
226
|
+
$[10] = props$2;
|
|
226
227
|
$[11] = t2;
|
|
227
228
|
$[12] = t3;
|
|
228
229
|
$[13] = t5;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","RadioGroup","RACRadioGroup","RadioField","controlStyles","invalidFrom","useFieldValidationBehavior","fieldGroupStyles","useRipple","focus","mergeStatefulStyles","styles","control","kMwMTN","$$css","itemsHorizontal","k1C7PZ","kXwgrk","kwnvtZ","toneActive","toneDisabled","toneSelected","hoverLayers","selected","kWkggS","unselected","focusLayers","pressedLayers","children","description","error","label","buttonContent","ripple","state","interactive","isDisabled","isReadOnly","tone","isSelected","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","className","surface","groupContent","horizontal","isRequired","stack","optionContent","button","Radio","t0","$","T0","t1","field","t2","t3","t4","t5","orientation","undefined","validationBehavior","root","t6"],"sources":["../../../src/components/radio-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { RadioGroupProps as RACRadioGroupProps, RadioButtonRenderProps, RadioFieldProps, RadioFieldRenderProps, 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// A change of selection moves together: the ring's colour fades, and the dot\n// grows in from nothing or shrinks away, over the same duration and curve.\n// The dot is always drawn, at no size while the button is not 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 itemsHorizontal: {\n k1C7PZ: \"xpamuu5\",\n kXwgrk: \"x1q0g3np\",\n kwnvtZ: \"x1a02dak\",\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 * A link or a button in it acts on its own, as in a native label, and\n * leaves the selection as it was. A press anywhere else in the label\n * selects this option.\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 <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl x1f85oc2 x1qno0dh xuo13n2 xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl x1qno0dh xuo13n2 xpc4ca7 x3oybdh\"\n },\n 1: {\n className: \"x12w9bfk x170jfvy x16fbrrb x1fsd2vl x1f85oc2 x1qno0dh xuo13n2 xpc4ca7 xtwfq29 x1o55y2u\"\n },\n 3: {\n className: \"x12w9bfk x170jfvy x16fbrrb x1fsd2vl x1qno0dh xuo13n2 xpc4ca7 x3oybdh xtwfq29 x1o55y2u\"\n }\n }[!!state.isSelected << 1 | !!state.isDisabled << 0]} />\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 {...stylex.props(controlStyles.stack, horizontal && styles.itemsHorizontal)}>\n {children}\n </div>\n <FieldMessage description={description} error={error} inset={false} isDisabled={state.isDisabled} />\n </>;\n}\n\n// The option's button and its description, from the option's render state:\n// the description fades with the option whether the option is disabled by\n// itself or by its group, as its label does.\nfunction optionContent(button: ReactNode, description: string | undefined) {\n return ({\n isDisabled\n }: RadioFieldRenderProps) => <>\n {button}\n <ControlDescription isDisabled={isDisabled}>\n {description}\n </ControlDescription>\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 {optionContent(<RadioButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </RadioButton>, description)}\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 * ```tsx\n * <RadioGroup defaultValue=\"first\" label=\"Label\">\n * <Radio value=\"first\">First item</Radio>\n * <Radio value=\"second\">Second item</Radio>\n * </RadioGroup>\n * ```\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":";;;;;;;;;;;;;;AA+CA,MAAMY,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,iBAAiB;EACfC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,YAAY;EACVN,QAAQ;EACRC,OAAO;CACT;CACAM,cAAc;EACZP,QAAQ;EACRC,OAAO;CACT;CACAO,cAAc;EACZR,QAAQ;EACRC,OAAO;CACT;AACF;AAIA,MAAMQ,cAAc;CAClBC,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AAGA,MAAMY,cAAc;CAClBH,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AACA,MAAMa,gBAAgB;CACpBJ,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AA8CA,SAASkB,cAAcJ,UAAqBK,QAAgB;CAC1D,QAAQC,UAAkC;EACxC,MAAMC,cAAc,CAACD,MAAME,cAAc,CAACF,MAAMG;EAChD,MAAMC,OAAOJ,MAAMK,aAAa,aAAa;EAC7C,MAAMC,SAASN,MAAMO,aAAaP,MAAMQ,aAAaR,MAAMS;EAC3D,OAAO,qBAAA,UAAA,EAAA,UAAA,CACH,qBAAC,QAAD;GAAM,GAAIR,cAAcF,OAAOW,WAAW,CAAC;GAAG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AA;EAEHP,EAAA,KAAAC;EAAAD,EAAA,KAAAQ;EAAAR,EAAA,MAAAf;EAAAe,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAU;EAAAV,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAFXY;AAEW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","RadioGroup","RACRadioGroup","RadioField","controlStyles","invalidFrom","useFieldValidationBehavior","fieldGroupStyles","useRipple","focus","mergeStatefulStyles","styles","control","kMwMTN","$$css","itemsHorizontal","k1C7PZ","kXwgrk","kwnvtZ","toneActive","toneDisabled","toneSelected","hoverLayers","selected","kWkggS","unselected","focusLayers","pressedLayers","children","description","error","label","buttonContent","ripple","state","interactive","isDisabled","isReadOnly","tone","isSelected","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","className","surface","groupContent","horizontal","isInvalid","isRequired","stack","optionContent","button","Radio","t0","$","T0","t1","field","t2","t3","t4","t5","orientation","undefined","validationBehavior","root","t6"],"sources":["../../../src/components/radio-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { RadioGroupProps as RACRadioGroupProps, RadioButtonRenderProps, RadioFieldProps, RadioFieldRenderProps, 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// A change of selection moves together: the ring's colour fades, and the dot\n// grows in from nothing or shrinks away, over the same duration and curve.\n// The dot is always drawn, at no size while the button is not 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 itemsHorizontal: {\n k1C7PZ: \"xpamuu5\",\n kXwgrk: \"x1q0g3np\",\n kwnvtZ: \"x1a02dak\",\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 * A link or a button in it acts on its own, as in a native label, and\n * leaves the selection as it was. A press anywhere else in the label\n * selects this option.\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 <span {...{\n 0: {\n className: \"x12w9bfk xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl x1f85oc2 x1qno0dh xuo13n2 xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk xtwfq29 x1jzqe4 x170jfvy x16fbrrb x1fsd2vl x1qno0dh xuo13n2 xpc4ca7 x3oybdh\"\n },\n 1: {\n className: \"x12w9bfk x170jfvy x16fbrrb x1fsd2vl x1f85oc2 x1qno0dh xuo13n2 xpc4ca7 xtwfq29 x1o55y2u\"\n },\n 3: {\n className: \"x12w9bfk x170jfvy x16fbrrb x1fsd2vl x1qno0dh xuo13n2 xpc4ca7 x3oybdh xtwfq29 x1o55y2u\"\n }\n }[!!state.isSelected << 1 | !!state.isDisabled << 0]} />\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 isDisabled={state.isDisabled} isInvalid={state.isInvalid} isRequired={state.isRequired} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...stylex.props(controlStyles.stack, horizontal && styles.itemsHorizontal)}>\n {children}\n </div>\n <FieldMessage description={description} error={error} inset={false} isDisabled={state.isDisabled} />\n </>;\n}\n\n// The option's button and its description, from the option's render state:\n// the description fades with the option whether the option is disabled by\n// itself or by its group, as its label does.\nfunction optionContent(button: ReactNode, description: string | undefined) {\n return ({\n isDisabled\n }: RadioFieldRenderProps) => <>\n {button}\n <ControlDescription isDisabled={isDisabled}>\n {description}\n </ControlDescription>\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 {optionContent(<RadioButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </RadioButton>, description)}\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 * ```tsx\n * <RadioGroup defaultValue=\"first\" label=\"Label\">\n * <Radio value=\"first\">First item</Radio>\n * <Radio value=\"second\">Second item</Radio>\n * </RadioGroup>\n * ```\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":";;;;;;;;;;;;;;AA+CA,MAAMY,SAAS;CACbC,SAAS;EACPC,QAAQ;EACRC,OAAO;CACT;CACAC,iBAAiB;EACfC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,YAAY;EACVN,QAAQ;EACRC,OAAO;CACT;CACAM,cAAc;EACZP,QAAQ;EACRC,OAAO;CACT;CACAO,cAAc;EACZR,QAAQ;EACRC,OAAO;CACT;AACF;AAIA,MAAMQ,cAAc;CAClBC,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AAGA,MAAMY,cAAc;CAClBH,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AACA,MAAMa,gBAAgB;CACpBJ,UAAU;EACRC,QAAQ;EACRV,OAAO;CACT;CACAW,YAAY;EACVD,QAAQ;EACRV,OAAO;CACT;AACF;AA8CA,SAASkB,cAAcJ,UAAqBK,QAAgB;CAC1D,QAAQC,UAAkC;EACxC,MAAMC,cAAc,CAACD,MAAME,cAAc,CAACF,MAAMG;EAChD,MAAMC,OAAOJ,MAAMK,aAAa,aAAa;EAC7C,MAAMC,SAASN,MAAMO,aAAaP,MAAMQ,aAAaR,MAAMS;EAC3D,OAAO,qBAAA,UAAA,EAAA,UAAA,CACH,qBAAC,QAAD;GAAM,GAAIR,cAAcF,OAAOW,WAAW,CAAC;GAAG,GAAI5C,MAAaI,cAAc0C,MAAMnC,OAAOC,SAASsB,MAAMK,cAAc5B,OAAOU,cAAc,CAACa,MAAMK,cAAcJ,eAAeK,UAAU7B,OAAOQ,YAAYe,MAAME,cAAczB,OAAOS,cAAcc,MAAMG,cAAc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;EAAAP,EAAA,MAAAU;EAAAV,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAFXY;AAEW"}
|
|
@@ -16,10 +16,10 @@ function fieldContent(label, placeholder, clearLabel, description, error, inputR
|
|
|
16
16
|
/* @__PURE__ */ jsxs("div", {
|
|
17
17
|
onPointerDown: focusesControl(void 0),
|
|
18
18
|
...{
|
|
19
|
-
0: { className: "x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s
|
|
20
|
-
2: { className: "x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s
|
|
21
|
-
1: { className: "x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s
|
|
22
|
-
3: { className: "x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s
|
|
19
|
+
0: { className: "x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7" },
|
|
20
|
+
2: { className: "x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 x1bll8u6 x19irva8" },
|
|
21
|
+
1: { className: "x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc" },
|
|
22
|
+
3: { className: "x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc" }
|
|
23
23
|
}[!!state.isInvalid << 1 | !!state.isDisabled << 0],
|
|
24
24
|
children: [
|
|
25
25
|
/* @__PURE__ */ jsx(SearchGlyph, { ...{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","FieldInputContext","SearchField","RACSearchField","useSlottedContext","focusesControl","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","clearLabel","description","enterKeyHint","error","inputRef","label","placeholder","fieldContent","state","undefined","className","isInvalid","isDisabled","isEmpty","t0","$","t1","props","validationBehavior","inherited","T0","t2","t3","t4","root","t5","t6"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport type { SearchFieldProps as RACSearchFieldProps, SearchFieldRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { FieldInputContext, Label, SearchField as RACSearchField, useSlottedContext, VisuallyHidden } from 'react-aria-components';\nimport { FieldInput, FieldMessage } from '../../field';\nimport { focusesControl } from '../../field/press';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CloseGlyph, SearchGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\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// A pointer that can hover: a mouse or a trackpad, not a finger. The bar is a\n// plain element around the input rather than a part React Aria hosts, so its\n// hover layer is a pseudo-class, and Chromium leaves `:hover` on whatever a\n// touch last tapped. Inside this query a touch screen draws no hover at all;\n// a touchscreen laptop still matches it for its trackpad.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The search page's search bar, on its own: a 56dp container with a full\n// corner on surface container high, a 24dp magnifier in on surface at the\n// start, the supporting text in on surface variant and the input text in on\n// surface, both body-large, and a trailing icon button in on surface\n// variant that clears the field while it holds anything. The page's\n// 16dp of padding is to a 48dp tap target, and the icon sits 12dp inside\n// that, so the magnifier starts 28dp in and the text 4dp past the target,\n// at 68dp; the clear button is the medium icon button, 40dp around a 24dp\n// icon, set 4dp in from the padding so its icon ends 28dp from the end. The\n// container follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it. The list of suggestions the page draws under the bar is\n// Autocomplete's, and nothing here.\n//\n// The page gives the container level 3 elevation, and the bar casts no\n// shadow for it. Surface container high is the tone that level stands for,\n// and Google's own search bars draw it so: Compose's defaults give the bar\n// a shadow elevation of level 0, and the Android library keeps its 6dp but\n// makes the shadow transparent. The docked SearchView, which floats over\n// the page, is what casts level 3.\n//\n// The page's hovered and pressed states are on surface state layers over\n// the container, at the opacities the tokens hold. It names a focused state\n// and draws nothing for it, so the bar takes the 2dp primary ring the text\n// fields page gives a focused field, drawn inside the pill as a shadow for\n// the reason the chrome's box draws its underline that way: a shadow\n// changes nothing about the bar's size, and clipped to the corner it stays\n// inside the pill. It shows on any focus, as the underline does; a text\n// control matches `:focus-visible` on every focus anyway. Disabled takes\n// the chrome's dimmed container and content, since the page has no disabled\n// state and the sibling fields already agree on one.\n//\n// React Aria's `SearchField` is the root, a div holding the label,\n// description and error slots and the clear button's context; the bar is\n// its own element around the field chrome's input, and the label is\n// visually hidden, since the bar carries no label of its own and the\n// supporting text is what a person reads.\n\ntype SearchFieldProps = {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Clear search\" in\n * English.\n */\n clearLabel?: string;\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The action an on-screen keyboard labels its Enter key with. A search\n * field asks for Search, which iOS otherwise shows only for a search input\n * inside a form with an action, so a field submitted through `onSubmit`\n * alone gets it too. Inside an `Autocomplete` the field takes the Go key\n * React Aria gives it there, for the option Enter picks.\n *\n * @default 'search'\n */\n enterKeyHint?: RACSearchFieldProps['enterKeyHint'];\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and `aria-invalid` follow\n * 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 * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * What the field searches, for a screen reader. The bar draws no label,\n * so this is read and never shown; `placeholder` is what is seen.\n *\n * Write it so it contains the placeholder's words — `Search` beside a\n * `Search` placeholder, or `Search people`. The placeholder is the only\n * text a sighted reader has to call the field by, so it is what someone\n * driving the page by voice says, and a name that does not contain it\n * leaves them nothing to say.\n */\n label: string;\n /** The supporting text in the empty bar, which is what a person reads. */\n placeholder?: string;\n} & Omit<RACSearchFieldProps, 'children' | 'enterKeyHint' | 'isInvalid' | 'validationBehavior'>;\n\n// What the bar draws, from the field's render state: the clear button only\n// while the field holds something, and the error ring while it is invalid. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after; the React Compiler memoises the result on its inputs.\n//\n// A press anywhere on the bar focuses the input, as a press anywhere on the\n// box of every other field does. The bar is 56dp and the input's line 24dp\n// of it, so the magnifier, the padding at either end and the strips above\n// and below the text took a press, darkened the bar for it, and focused\n// nothing. A press on the input itself or on the clear button is left to\n// them, and a disabled field takes none.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined, description: string | undefined, error: string | undefined, inputRef: Ref<HTMLInputElement> | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <div onPointerDown={focusesControl(undefined)} {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 x1bll8u6 x19irva8\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1jrff4x x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n }\n }[!!state.isInvalid << 1 | !!state.isDisabled << 0]}>\n <SearchGlyph {...{\n 0: {\n className: \"xxk0z11 x139gbkf x1lliihq x2lah0s xvy4d1p\"\n },\n 1: {\n className: \"xxk0z11 x1lliihq x2lah0s xvy4d1p x1heor9g\"\n }\n }[!!state.isDisabled << 0]} />\n <FieldInput placeholder={placeholder} ref={inputRef} className=\"x1hcrkkg xzwh6sb xjyslct xmper1u x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </div>\n <FieldMessage description={description} error={error} />\n </>;\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with Enter and\n * cleared with Escape or its button. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own; `onSubmit` is handed the value on Enter and `onClear` is called\n * when it is emptied.\n *\n * ```tsx\n * <SearchField label=\"Search\" onSubmit={search} placeholder=\"Search\" />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The input and the message are\n * drawn as every field in the library draws them; the pill around them is\n * Material Design's search bar rather than the box of its text fields.\n */\nfunction SearchField({\n clearLabel,\n description,\n enterKeyHint,\n error,\n inputRef,\n isDisabled = false,\n label,\n placeholder,\n ...props\n}: RefAttributes<HTMLDivElement> & SearchFieldProps) {\n const validationBehavior = useFieldValidationBehavior();\n // An Autocomplete hands its input `go` through this context, and a prop\n // written here would replace it, so the default steps aside for it; an\n // undefined prop leaves the context's value standing.\n const inherited = useSlottedContext(FieldInputContext)?.enterKeyHint;\n return <RACSearchField enterKeyHint={enterKeyHint ?? (inherited === undefined ? 'search' : undefined)} isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {fieldContent(label, placeholder, clearLabel, description, error, inputRef)}\n </RACSearchField>;\n}\nexport type { SearchFieldProps };\nexport default SearchField;"],"mappings":";;;;;;;;;;;;AAiIA,SAASkB,aAAaF,OAAeC,aAAiCN,YAAgCC,aAAiCE,OAA2BC,UAA6C;CAC7M,QAAQI,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQH,MAAa,CAAA,EACP,CAAA;EAChB,qBAAC,OAAD;GAAK,eAAeV,eAAec,KAAAA,CAAS;GAAG,GAAI;IACnD,GAAG,EACDC,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,8NACb;IACA,GAAG,EACDA,WAAW,8NACb;GACF,EAAE,CAAC,CAACF,MAAMG,aAAa,IAAI,CAAC,CAACH,MAAMI,cAAc;GAb/C,UAAA;IAcE,oBAAC,aAAD,EAAa,GAAI;KACjB,GAAG,EACDF,WAAW,4CACb;KACA,GAAG,EACDA,WAAW,4CACb;IACF,EAAE,CAAC,CAACF,MAAMI,cAAc,GAAG,CAAA;IACzB,oBAAC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AAS,EAAA,KAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,IAAAW;CAAA,IAAAX,EAAA,OAAAK,MAAAL,EAAA,QAAAH,cAAAG,EAAA,QAAAE,WAAAF,EAAA,QAAAM,MAAAN,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAU,MAAAV,EAAA,QAAAG,oBAAA;EADxEQ,KAAA,oBAAC,IAAD;GAA8B,cAAAL;GAA8ET;GAAuB,WAAAU;GAAwCJ;GAAkB,GAAMD;GAAK,GAAMM;GAChNE,UAAAA;EADiB,CAAA;EAEHV,EAAA,KAAAK;EAAAL,EAAA,MAAAH;EAAAG,EAAA,MAAAE;EAAAF,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAU;EAAAV,EAAA,MAAAG;EAAAH,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OAFZW;AAEY"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","FieldInputContext","SearchField","RACSearchField","useSlottedContext","focusesControl","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","clearLabel","description","enterKeyHint","error","inputRef","label","placeholder","fieldContent","state","undefined","className","isInvalid","isDisabled","isEmpty","t0","$","t1","props","validationBehavior","inherited","T0","t2","t3","t4","root","t5","t6"],"sources":["../../../src/components/search-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Ref, RefAttributes } from 'react';\nimport type { SearchFieldProps as RACSearchFieldProps, SearchFieldRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { FieldInputContext, Label, SearchField as RACSearchField, useSlottedContext, VisuallyHidden } from 'react-aria-components';\nimport { FieldInput, FieldMessage } from '../../field';\nimport { focusesControl } from '../../field/press';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CloseGlyph, SearchGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport IconButton from '../icon-button';\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// A pointer that can hover: a mouse or a trackpad, not a finger. The bar is a\n// plain element around the input rather than a part React Aria hosts, so its\n// hover layer is a pseudo-class, and Chromium leaves `:hover` on whatever a\n// touch last tapped. Inside this query a touch screen draws no hover at all;\n// a touchscreen laptop still matches it for its trackpad.\nconst HOVER_CAPABLE = '@media (hover: hover)';\n\n// The search page's search bar, on its own: a 56dp container with a full\n// corner on surface container high, a 24dp magnifier in on surface at the\n// start, the supporting text in on surface variant and the input text in on\n// surface, both body-large, and a trailing icon button in on surface\n// variant that clears the field while it holds anything. The page's\n// 16dp of padding is to a 48dp tap target, and the icon sits 12dp inside\n// that, so the magnifier starts 28dp in and the text 4dp past the target,\n// at 68dp; the clear button is the medium icon button, 40dp around a 24dp\n// icon, set 4dp in from the padding so its icon ends 28dp from the end. The\n// container follows its own width up to the page's 720dp; the page's 360dp\n// floor is left to the call site, since a phone's width less its margins is\n// under it. The list of suggestions the page draws under the bar is\n// Autocomplete's, and nothing here.\n//\n// The page gives the container level 3 elevation, and the bar casts no\n// shadow for it. Surface container high is the tone that level stands for,\n// and Google's own search bars draw it so: Compose's defaults give the bar\n// a shadow elevation of level 0, and the Android library keeps its 6dp but\n// makes the shadow transparent. The docked SearchView, which floats over\n// the page, is what casts level 3.\n//\n// The page's hovered and pressed states are on surface state layers over\n// the container, at the opacities the tokens hold. It names a focused state\n// and draws nothing for it, so the bar takes the 2dp primary ring the text\n// fields page gives a focused field, drawn inside the pill as a shadow for\n// the reason the chrome's box draws its underline that way: a shadow\n// changes nothing about the bar's size, and clipped to the corner it stays\n// inside the pill. It shows on any focus, as the underline does; a text\n// control matches `:focus-visible` on every focus anyway. Disabled takes\n// the chrome's dimmed container and content, since the page has no disabled\n// state and the sibling fields already agree on one.\n//\n// React Aria's `SearchField` is the root, a div holding the label,\n// description and error slots and the clear button's context; the bar is\n// its own element around the field chrome's input, and the label is\n// visually hidden, since the bar carries no label of its own and the\n// supporting text is what a person reads.\n\ntype SearchFieldProps = {\n /**\n * The name of the button that clears the field, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Clear search\" in\n * English.\n */\n clearLabel?: string;\n /**\n * A hint shown under the bar. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The action an on-screen keyboard labels its Enter key with. A search\n * field asks for Search, which iOS otherwise shows only for a search input\n * inside a form with an action, so a field submitted through `onSubmit`\n * alone gets it too. Inside an `Autocomplete` the field takes the Go key\n * React Aria gives it there, for the option Enter picks.\n *\n * @default 'search'\n */\n enterKeyHint?: RACSearchFieldProps['enterKeyHint'];\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message and `aria-invalid` follow\n * 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 * A ref to the field's own `<input>`, which is the element a call site moves\n * focus to — after a server's error, say. `ref` is the field as a whole.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * What the field searches, for a screen reader. The bar draws no label,\n * so this is read and never shown; `placeholder` is what is seen.\n *\n * Write it so it contains the placeholder's words — `Search` beside a\n * `Search` placeholder, or `Search people`. The placeholder is the only\n * text a sighted reader has to call the field by, so it is what someone\n * driving the page by voice says, and a name that does not contain it\n * leaves them nothing to say.\n */\n label: string;\n /** The supporting text in the empty bar, which is what a person reads. */\n placeholder?: string;\n} & Omit<RACSearchFieldProps, 'children' | 'enterKeyHint' | 'isInvalid' | 'validationBehavior'>;\n\n// What the bar draws, from the field's render state: the clear button only\n// while the field holds something, and the error ring while it is invalid. Built by a call rather than written\n// inline at the prop, which is what react-perf's no-new-function-as-prop is\n// after; the React Compiler memoises the result on its inputs.\n//\n// A press anywhere on the bar focuses the input, as a press anywhere on the\n// box of every other field does. The bar is 56dp and the input's line 24dp\n// of it, so the magnifier, the padding at either end and the strips above\n// and below the text took a press, darkened the bar for it, and focused\n// nothing. A press on the input itself or on the clear button is left to\n// them, and a disabled field takes none.\nfunction fieldContent(label: string, placeholder: string | undefined, clearLabel: string | undefined, description: string | undefined, error: string | undefined, inputRef: Ref<HTMLInputElement> | undefined) {\n return (state: SearchFieldRenderProps) => <>\n <VisuallyHidden>\n <Label>{label}</Label>\n </VisuallyHidden>\n <div onPointerDown={focusesControl(undefined)} {...{\n 0: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x19i8hm1 x1gnnqk1 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7\"\n },\n 2: {\n className: \"x12w9bfk x6s0dn4 x5u4zhu x17m4uoy xuwmtp3 xmaqtb8 x9qvdww x42wrt3 xvkjz1l xs1ryiz x1ylmb6m x1dkaolv xx61lck x13rsnn2 x9f619 x1w5n3ug x1ed109x x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 x1bll8u6 x19irva8\"\n },\n 1: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n },\n 3: {\n className: \"x12w9bfk x6s0dn4 xs1ryiz x1dkaolv xx61lck x13rsnn2 x9f619 x78zum5 xxj4525 xh8yej3 xwnkcuf x1x84bn5 x12iqurn xi9ts3s x1nrpzel x1glmgrm xtrd051 x1qno0dh x106061f xpc4ca7 xepofeg xmnqt3w x1gnnqk1 x1xj74d8 x1bhcspo x1h6gzvc\"\n }\n }[!!state.isInvalid << 1 | !!state.isDisabled << 0]}>\n <SearchGlyph {...{\n 0: {\n className: \"xxk0z11 x139gbkf x1lliihq x2lah0s xvy4d1p\"\n },\n 1: {\n className: \"xxk0z11 x1lliihq x2lah0s xvy4d1p x1heor9g\"\n }\n }[!!state.isDisabled << 0]} />\n <FieldInput placeholder={placeholder} ref={inputRef} className=\"x1hcrkkg xzwh6sb xjyslct xmper1u x1iyjqo2 xeuugli\" />\n {state.isEmpty ? null : <IconButton aria-label={clearLabel} className=\"x15ir4sr\">\n <CloseGlyph className=\"xlzyvqe x1lliihq x15vhz18\" />\n </IconButton>}\n </div>\n <FieldMessage description={description} error={error} />\n </>;\n}\n\n/**\n * A search bar: a keyword typed into a pill, submitted with Enter and\n * cleared with Escape or its button. Its value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep\n * its own; `onSubmit` is handed the value on Enter and `onClear` is called\n * when it is emptied.\n *\n * ```tsx\n * <SearchField label=\"Search\" onSubmit={search} placeholder=\"Search\" />\n * ```\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions. The input and the message are\n * drawn as every field in the library draws them; the pill around them is\n * Material Design's search bar rather than the box of its text fields.\n */\nfunction SearchField({\n clearLabel,\n description,\n enterKeyHint,\n error,\n inputRef,\n isDisabled = false,\n label,\n placeholder,\n ...props\n}: RefAttributes<HTMLDivElement> & SearchFieldProps) {\n const validationBehavior = useFieldValidationBehavior();\n // An Autocomplete hands its input `go` through this context, and a prop\n // written here would replace it, so the default steps aside for it; an\n // undefined prop leaves the context's value standing.\n const inherited = useSlottedContext(FieldInputContext)?.enterKeyHint;\n return <RACSearchField enterKeyHint={enterKeyHint ?? (inherited === undefined ? 'search' : undefined)} isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {fieldContent(label, placeholder, clearLabel, description, error, inputRef)}\n </RACSearchField>;\n}\nexport type { SearchFieldProps };\nexport default SearchField;"],"mappings":";;;;;;;;;;;;AAiIA,SAASkB,aAAaF,OAAeC,aAAiCN,YAAgCC,aAAiCE,OAA2BC,UAA6C;CAC7M,QAAQI,UAAkC,qBAAA,UAAA,EAAA,UAAA;EACtC,oBAAC,gBAAD,EAAA,UACE,oBAAC,OAAD,EAAA,UAAQH,MAAa,CAAA,EACP,CAAA;EAChB,qBAAC,OAAD;GAAK,eAAeV,eAAec,KAAAA,CAAS;GAAG,GAAI;IACnD,GAAG,EACDC,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,gRACb;IACA,GAAG,EACDA,WAAW,8NACb;IACA,GAAG,EACDA,WAAW,8NACb;GACF,EAAE,CAAC,CAACF,MAAMG,aAAa,IAAI,CAAC,CAACH,MAAMI,cAAc;GAb/C,UAAA;IAcE,oBAAC,aAAD,EAAa,GAAI;KACjB,GAAG,EACDF,WAAW,4CACb;KACA,GAAG,EACDA,WAAW,4CACb;IACF,EAAE,CAAC,CAACF,MAAMI,cAAc,GAAG,CAAA;IACzB,oBAAC,YAAD;KAAyBN;KAAa,KAAKF;KAAU,WAAU;IAAmD,CAAA;IACjHI,MAAMK,UAAU,OAAO,oBAAC,YAAD;KAAY,cAAYb;KAAY,WAAU;KAClE,UAAA,oBAAC,YAAD,EAAY,WAAU,4BAA2B,CAAA;IACvC,CAAA;GACX;;EACL,oBAAC,cAAD;GAA2BC;GAAoBE;EAAM,CAAA;CACvD,EAAA,CAAA;AACJ;;;;;;;;;;;;;;;;;AAkBA,SAAAX,YAAAsB,IAAA;CAAA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