@kanso-labs/kanso-ui 0.45.28 → 0.45.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/calendar/index.js +4 -4
- package/dist/calendar/index.js.map +1 -1
- package/dist/components/app-bar/index.js +1 -0
- package/dist/components/app-bar/index.js.map +1 -1
- package/dist/components/autocomplete/index.d.ts +6 -6
- package/dist/components/autocomplete/index.js +4 -4
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/breadcrumbs/index.d.ts +5 -5
- package/dist/components/breadcrumbs/index.js +5 -5
- package/dist/components/breadcrumbs/index.js.map +1 -1
- package/dist/components/button/index.d.ts +3 -3
- package/dist/components/button/index.js +2 -2
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/calendar/index.d.ts +7 -7
- package/dist/components/calendar/index.js +4 -4
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +5 -5
- package/dist/components/checkbox-group/index.js +4 -4
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/color-area/index.d.ts +4 -4
- package/dist/components/color-area/index.js +4 -4
- package/dist/components/color-area/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +7 -7
- package/dist/components/color-field/index.js +4 -4
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/color-picker/index.d.ts +4 -4
- package/dist/components/color-picker/index.js +4 -4
- package/dist/components/color-picker/index.js.map +1 -1
- package/dist/components/color-slider/index.d.ts +6 -6
- package/dist/components/color-slider/index.js +4 -4
- package/dist/components/color-slider/index.js.map +1 -1
- package/dist/components/color-swatch/index.d.ts +4 -4
- package/dist/components/color-swatch/index.js +4 -4
- package/dist/components/color-swatch/index.js.map +1 -1
- package/dist/components/color-swatch-picker/index.d.ts +12 -12
- package/dist/components/color-swatch-picker/index.js +7 -7
- package/dist/components/color-swatch-picker/index.js.map +1 -1
- package/dist/components/color-wheel/index.d.ts +6 -6
- package/dist/components/color-wheel/index.js +4 -4
- package/dist/components/color-wheel/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +5 -5
- package/dist/components/combo-box/index.js +4 -4
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +6 -6
- package/dist/components/date-field/index.js +4 -4
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +6 -6
- package/dist/components/date-picker/index.js +4 -4
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +6 -6
- package/dist/components/date-range-picker/index.js +4 -4
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/dialog/index.d.ts +6 -6
- package/dist/components/dialog/index.js +9 -9
- package/dist/components/dialog/index.js.map +1 -1
- package/dist/components/disclosure/index.d.ts +10 -10
- package/dist/components/disclosure/index.js +8 -8
- package/dist/components/disclosure/index.js.map +1 -1
- package/dist/components/disclosure-group/index.d.ts +4 -4
- package/dist/components/disclosure-group/index.js +4 -4
- package/dist/components/disclosure-group/index.js.map +1 -1
- package/dist/components/drop-zone/index.d.ts +8 -8
- package/dist/components/drop-zone/index.js +6 -6
- package/dist/components/drop-zone/index.js.map +1 -1
- package/dist/components/form/index.d.ts +5 -5
- package/dist/components/form/index.js +4 -4
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/link/index.d.ts +6 -6
- package/dist/components/link/index.js +4 -4
- package/dist/components/link/index.js.map +1 -1
- package/dist/components/list-box/index.d.ts +18 -18
- package/dist/components/list-box/index.js +11 -11
- package/dist/components/list-box/index.js.map +1 -1
- package/dist/components/menu/index.d.ts +16 -16
- package/dist/components/menu/index.js +14 -14
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/meter/index.d.ts +6 -6
- package/dist/components/meter/index.js +4 -4
- package/dist/components/meter/index.js.map +1 -1
- package/dist/components/navigation-tree/index.d.ts +15 -15
- package/dist/components/navigation-tree/index.js +13 -13
- package/dist/components/navigation-tree/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +5 -5
- package/dist/components/number-field/index.js +4 -4
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popover/index.js +12 -12
- package/dist/components/popover/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +5 -5
- package/dist/components/radio-group/index.js +4 -4
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/range-calendar/index.d.ts +7 -7
- package/dist/components/range-calendar/index.js +4 -4
- package/dist/components/range-calendar/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +6 -6
- package/dist/components/search-field/index.js +4 -4
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/select/index.d.ts +5 -5
- package/dist/components/select/index.js +4 -4
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/separator/index.d.ts +5 -5
- package/dist/components/separator/index.js +4 -4
- package/dist/components/separator/index.js.map +1 -1
- package/dist/components/sheet/index.d.ts +5 -5
- package/dist/components/sheet/index.js +12 -12
- package/dist/components/sheet/index.js.map +1 -1
- package/dist/components/slider/index.d.ts +4 -4
- package/dist/components/slider/index.js +4 -4
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/table/index.d.ts +20 -20
- package/dist/components/table/index.js +17 -17
- package/dist/components/table/index.js.map +1 -1
- package/dist/components/tabs/index.d.ts +5 -5
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +2 -2
- package/dist/components/text-area/index.js +2 -2
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +4 -4
- package/dist/components/text-field/index.js +4 -4
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +6 -6
- package/dist/components/time-field/index.js +4 -4
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +7 -7
- package/dist/components/token-field/index.js +4 -4
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +6 -6
- package/dist/components/toolbar/index.js +4 -4
- package/dist/components/toolbar/index.js.map +1 -1
- package/dist/components/tooltip/index.d.ts +2 -2
- package/dist/components/tooltip/index.js +4 -4
- package/dist/components/tooltip/index.js.map +1 -1
- package/dist/components/tree/index.d.ts +17 -17
- package/dist/components/tree/index.js +14 -14
- package/dist/components/tree/index.js.map +1 -1
- package/dist/drag/hooks.d.ts +3 -3
- package/dist/drag/hooks.js +4 -4
- package/dist/drag/hooks.js.map +1 -1
- package/dist/drag/index.js +4 -4
- package/dist/drag/index.js.map +1 -1
- package/dist/react-aria.d.ts +2 -2
- package/dist/react-aria.js +2 -2
- package/package.json +9 -9
|
@@ -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,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,cAAAsB,IAAA;CAAA,MAAAC,IAAA1B,EAAA,EAAA;CAAqB,MAAA,EAAAW,YAAAC,aAAAC,cAAAC,OAAAC,UAAAQ,YAAAI,IAAAX,OAAAC,aAAA,GAAAW,YAAAH;CAMnB,MAAAF,aAAAI,OAAAP,KAAAA,IAAA,QAAAO;CAKA,M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AA,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 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,E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P,EAAA;CAAyD,MAAAQ,KAAAxB,oBAAoBT,MAAaM,YAAW4B,IAAK,GAAGP,OAAK;CAAC,IAAAQ;CAAA,IAAAV,EAAA,OAAAf,cAAAe,EAAA,OAAAd,eAAAc,EAAA,OAAAZ,SAAAY,EAAA,OAAAX,YAAAW,EAAA,OAAAV,SAAAU,EAAA,OAAAT,aAAA;EAC1QmB,KAAAlB,aAAaF,OAAOC,aAAaN,YAAYC,aAAaE,OAAOC,QAAQ;EAACW,EAAA,KAAAf;EAAAe,EAAA,KAAAd;EAAAc,EAAA,KAAAZ;EAAAY,EAAA,KAAAX;EAAAW,EAAA,KAAAV;EAAAU,EAAA,KAAAT;EAAAS,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,7 +1,7 @@
|
|
|
1
1
|
import { FieldVariant } from "../../field/index.js";
|
|
2
2
|
import { ReactNode, RefAttributes } from "react";
|
|
3
|
-
import { SelectProps } from "react-aria-components";
|
|
4
|
-
type SelectProps
|
|
3
|
+
import { SelectProps as SelectProps$1 } from "react-aria-components";
|
|
4
|
+
type SelectProps<T extends object = object> = {
|
|
5
5
|
/**
|
|
6
6
|
* Where to portal the list. Defaults to the container of the `ThemeScope`
|
|
7
7
|
* around it, which keeps the list on that scope's tokens, or to the end of
|
|
@@ -53,7 +53,7 @@ type SelectProps$1<T extends object = object> = {
|
|
|
53
53
|
* @default 'filled'
|
|
54
54
|
*/
|
|
55
55
|
variant?: FieldVariant;
|
|
56
|
-
} & Omit<SelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;
|
|
56
|
+
} & Omit<SelectProps$1<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;
|
|
57
57
|
/**
|
|
58
58
|
* A labelled field that opens a list to choose from. Its value is React
|
|
59
59
|
* Aria's: pass `value` with `onChange` to control it, or `defaultValue` to
|
|
@@ -80,5 +80,5 @@ type SelectProps$1<T extends object = object> = {
|
|
|
80
80
|
* The call site's `className` and `style` land on the field as a whole,
|
|
81
81
|
* which is the element a layout positions.
|
|
82
82
|
*/
|
|
83
|
-
declare function Select
|
|
84
|
-
export { type SelectProps
|
|
83
|
+
declare function Select<T extends object = object>({ container, description, error, floatingLabel, isDisabled, label, leadingIcon, options, variant, ...props }: RefAttributes<HTMLDivElement> & SelectProps<T>): import("react").JSX.Element;
|
|
84
|
+
export { type SelectProps, Select as default };
|
|
@@ -9,7 +9,7 @@ import ListBox$1 from "../list-box/index.js";
|
|
|
9
9
|
import { c } from "react/compiler-runtime";
|
|
10
10
|
import { useContext, useRef } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { Popover, Select, SelectStateContext, SelectValue } from "react-aria-components";
|
|
12
|
+
import { Popover, Select as Select$1, SelectStateContext, SelectValue } from "react-aria-components";
|
|
13
13
|
// src/components/select/index.tsx
|
|
14
14
|
const TRIGGER = /* @__PURE__ */ jsx(FieldTrigger, {});
|
|
15
15
|
function chevronFor(isOpen) {
|
|
@@ -58,7 +58,7 @@ const styles = { list: {
|
|
|
58
58
|
* The call site's `className` and `style` land on the field as a whole,
|
|
59
59
|
* which is the element a layout positions.
|
|
60
60
|
*/
|
|
61
|
-
function Select
|
|
61
|
+
function Select(t0) {
|
|
62
62
|
const $ = c(19);
|
|
63
63
|
const { container, description, error, floatingLabel: t1, isDisabled: t2, label, leadingIcon, options, variant: t3, ...props$1 } = t0;
|
|
64
64
|
const floatingLabel = t1 === void 0 ? true : t1;
|
|
@@ -66,7 +66,7 @@ function Select$1(t0) {
|
|
|
66
66
|
const variant = t3 === void 0 ? "filled" : t3;
|
|
67
67
|
const validationBehavior = useFieldValidationBehavior();
|
|
68
68
|
const boxRef = useRef(null);
|
|
69
|
-
const T0 = Select;
|
|
69
|
+
const T0 = Select$1;
|
|
70
70
|
let t4;
|
|
71
71
|
if ($[0] !== error) {
|
|
72
72
|
t4 = invalidFrom(error);
|
|
@@ -163,6 +163,6 @@ function SelectedValue(t0) {
|
|
|
163
163
|
} else t2 = $[3];
|
|
164
164
|
return t2;
|
|
165
165
|
}
|
|
166
|
-
export { Select
|
|
166
|
+
export { Select as default };
|
|
167
167
|
|
|
168
168
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","useContext","useRef","Select","RACSelect","SelectStateContext","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","overlay","popupOrigin","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","description","error","floatingLabel","label","leadingIcon","options","variant","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field draws, from React Aria's render state. Built by a call\n// rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\n//\n// The state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled}\n // Opening the list moves focus into it, out of the box, so the box\n // is told it is focused while the list is open — otherwise its label\n // fell back onto the placeholder the select still shows.\n isFocused={state.isOpen} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\nexport type { SelectProps };\nexport default Select;"],"mappings":";;;;;;;;;;;;;AAiDA,MAAMa,UAAU,oBAAC,cAAD,CAAa,CAAA;AAC7B,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G,SAASF;GAAkB2B;GAC/L,UAAA,oBAAC,eAAD,EAAe,WAAWtB,MAAMyC,UAAU,CAAA;EAClC,CAAA;EACV,oBAAC,cAAD;GAA2BzB;GAAoBC;EAAM,CAAA;EACrD,oBAACgC,SAAD;GAAY,WAAWlD;GAAe,YAAYgC;GAEpD,0BAA0BhB;GACtB,UAAA,oBAACmC,WAAD,EAAA,UAAU7B,QAAiB,CAAA;EACjB,CAAA;CACd,EAAA,CAAA;AACJ;;;;;;AAOA,SAAAqB,cAAAnB,IAAA;CAAA,MAAAC,IAAA1C,EAAA,CAAA;CAAuB,MAAA,EAAA2D,cAAAlB;CAMrB,MAAAoB,iBADc3D,WAAWI,kBACFY,CAAK,EAAA4C,iBAA+BC,aAAKC,QAAzC,OAAoD;CAAE,IAAArB;CAAA,IAAAD,EAAA,OAAAuB,OAAAC,IAAA,2BAAA,GAAA;EAEzEvB,KAAA,oBAAC0B,aAAD,CAAe,CAAA;EAAG3B,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAiB,aAAAjB,EAAA,OAAAmB,eAAA;EADfhB,KAAA,oBAAC,YAAD;GAAuBc;GAA0BE;GACpDlB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAiB;EAAAjB,EAAA,KAAAmB;EAAAnB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","useContext","useRef","Select","RACSelect","SelectStateContext","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","overlay","popupOrigin","TRIGGER","chevronFor","isOpen","className","listClassName","state","props","popup","styles","list","placement","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","container","description","error","floatingLabel","label","leadingIcon","options","variant","t0","$","t1","isDisabled","t2","t3","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","selectContent","t7","isInvalid","isRequired","isFocused","SelectedValue","isPlaceholder","selectionManager","selectedKeys","size","Symbol","for","RACPopover","ListBox","RACSelectValue"],"sources":["../../../src/components/select/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes, RefObject } from 'react';\nimport type { PopoverRenderProps, SelectProps as RACSelectProps, SelectRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { Popover as RACPopover, Select as RACSelect, SelectValue as RACSelectValue, SelectStateContext } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldTrigger, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay, popupOrigin } from '../../styles/overlay';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, spacing } from '../../tokens/design.tokens.stylex';\nimport ListBox from '../list-box';\n\n// The menus page's exposed dropdown menu: a text field that opens a list\n// rather than taking a keystroke. Everything above the list is the field\n// chrome in `src/field` — the same box, label, supporting line and error\n// treatment every other field draws — and the list is ListBox on the shared\n// overlay surface. What is here is React Aria's `Select` around the two, and\n// the three things that are this component's own.\n//\n// **The whole box opens the list.** The chrome's `FieldTrigger` covers the\n// box rather than sitting on the value's line, so the padding, the label and\n// the icons all open it, which is what the page draws and what a native\n// select does. It draws nothing itself: the box already carries the fill,\n// the underline and the focus indicator.\n//\n// **The chevron turns.** The page's trailing icon points down while the list\n// is closed and up while it is open. React Aria reports which through the\n// select's render state, so it is drawn from that rather than swapped for a\n// second glyph.\n//\n// **The list is the field's width.** The page draws it under the field and\n// as wide as it, which React Aria reports as `--trigger-width` — of whatever\n// it is anchored to. Left alone that is the button, which fills the box's\n// value column rather than the box, so the list came out narrower than the\n// field by the icons either side of it. Pointing the popover's `triggerRef`\n// at the box is what makes the two agree. The overlay's own 112 to 280 range\n// is a menu opened from a button rather than from a field, so it goes.\n//\n// A select's value is chosen rather than typed, which the chrome had no\n// notion of until this component: `useFieldPopulated` now reads the select's\n// own state, so the floating label floats once something is chosen.\n\n// Hoisted, and the chevron built by a call, so neither is a new element on\n// every render — which is what react-perf's jsx-no-jsx-as-prop is after.\nconst TRIGGER = <FieldTrigger />;\nfunction chevronFor(isOpen: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!isOpen << 0]} />;\n}\n\n// The list's classes, from React Aria's render state: it grows from the\n// edge it is anchored by, as every anchored overlay does, so a list that\n// opens above the field grows upward.\nfunction listClassName(state: PopoverRenderProps) {\n return stylex.props(overlay.popup, styles.list, popupOrigin(state.placement)).className ?? '';\n}\nconst styles = {\n list: {\n kWkggS: \"x1vnz5z6\",\n kaIpWk: \"x1tfhd1\",\n kzqmXN: \"xlvufjm\",\n kskxy: \"xedcshv\",\n ks0D6T: \"x1x1rfll\",\n k7Eaqz: \"xeuugli\",\n kORKVm: \"x1odjw0f\",\n k8WAf4: \"x1cmllll\",\n $$css: true\n }\n};\ntype SelectProps<T extends object = object> = {\n /**\n * Where to portal the list. Defaults to the container of the `ThemeScope`\n * around it, which keeps the list on that scope's tokens, or to the end of\n * `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the list\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /**\n * A hint shown under the field. Replaced by `error` when there is one, so\n * the two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the field in its error state — the message, the red underline, and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label sits in the empty box and floats to the top once the\n * field is focused or something is chosen. `false` keeps it small at the\n * top in every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a select with no\n * label is a box a screen reader cannot name.\n */\n label: string;\n /**\n * An icon at the start of the box, before the label and the value: the\n * page's 24dp leading icon, in the muted role. An icon drawn in `em` takes\n * that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * The options. `ListBox.Item` for each, and `ListBox.Section` to group\n * them — the list inside is a ListBox, and takes everything one does.\n */\n options?: ReactNode;\n /**\n * The filled box, or the outlined one, as the text fields page draws them.\n * @default 'filled'\n */\n variant?: FieldVariant;\n} & Omit<RACSelectProps<T>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n/**\n * A labelled field that opens a list to choose from. Its value is React\n * Aria's: pass `value` with `onChange` to control it, or `defaultValue` to\n * let it keep its own. The value is an option's `id`, so give every option\n * one. React Aria's older `selectedKey` names are deprecated and are left\n * out of this component's props rather than passed through.\n *\n * ```tsx\n * <Select\n * label=\"Label\"\n * options={\n * <>\n * <ListBox.Item id=\"first\">First item</ListBox.Item>\n * <ListBox.Item id=\"second\">Second item</ListBox.Item>\n * </>\n * }\n * />\n * ```\n *\n * The box, label, supporting line and error are the field chrome in\n * `src/field`, shared with every other field; the list is ListBox on the\n * overlay surface every anchored panel here draws.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Select<T extends object = object>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: RefAttributes<HTMLDivElement> & SelectProps<T>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from — see the note at\n // the top of the file.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACSelect<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n {selectContent(label, leadingIcon, floatingLabel, variant, description, error, options, container, boxRef)}\n </RACSelect>;\n}\n\n// What the field draws, from React Aria's render state. Built by a call\n// rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result\n// on its inputs.\n//\n// The state is read for the chevron alone — which way it points — since\n// everything else the box shows it reads from its own focus and validity.\nfunction selectContent(label: string, leadingIcon: ReactNode, floatingLabel: boolean, variant: FieldVariant, description: string | undefined, error: string | undefined, options: ReactNode, container: Element | undefined, boxRef: RefObject<HTMLDivElement | null>) {\n return (state: SelectRenderProps) => <>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `Select` does not, so the box is\n // told outright or its label and its underline never turn.\n isDisabled={state.isDisabled}\n // Opening the list moves focus into it, out of the box, so the box\n // is told it is focused while the list is open — otherwise its label\n // fell back onto the placeholder the select still shows.\n isFocused={state.isOpen} isInvalid={state.isInvalid} isRequired={state.isRequired} label={label} leading={leadingIcon} ref={boxRef} trailing={chevronFor(state.isOpen)} trigger={TRIGGER} variant={variant}>\n <SelectedValue isFocused={state.isFocused} />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={listClassName} triggerRef={boxRef}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </>;\n}\n\n/**\n * What has been chosen, drawn on the value's line. The chrome's `FieldValue`\n * is the styled element and React Aria's `SelectValue` sits inside it, since\n * the wrapper is the box's flex item.\n */\nfunction SelectedValue({\n isFocused\n}: {\n isFocused: boolean;\n}) {\n const state = useContext(SelectStateContext);\n const isPlaceholder = (state?.selectionManager.selectedKeys.size ?? 0) === 0;\n return <FieldValue isFocused={isFocused} isPlaceholder={isPlaceholder}>\n <RACSelectValue />\n </FieldValue>;\n}\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C;GAAW,YAAYvC,MAAMwC;GAAmBrB;GAAO,SAASC;GAAa,KAAKW;GAAQ,UAAUnC,WAAWI,MAAMH,MAAM;GAAG,SAASF;GAAkB2B;GAC/L,UAAA,oBAAC,eAAD,EAAe,WAAWtB,MAAMyC,UAAU,CAAA;EAClC,CAAA;EACV,oBAAC,cAAD;GAA2BzB;GAAoBC;EAAM,CAAA;EACrD,oBAACgC,SAAD;GAAY,WAAWlD;GAAe,YAAYgC;GAEpD,0BAA0BhB;GACtB,UAAA,oBAACmC,WAAD,EAAA,UAAU7B,QAAiB,CAAA;EACjB,CAAA;CACd,EAAA,CAAA;AACJ;;;;;;AAOA,SAAAqB,cAAAnB,IAAA;CAAA,MAAAC,IAAA1C,EAAA,CAAA;CAAuB,MAAA,EAAA2D,cAAAlB;CAMrB,MAAAoB,iBADc3D,WAAWI,kBACFY,CAAK,EAAA4C,iBAA+BC,aAAKC,QAAzC,OAAoD;CAAE,IAAArB;CAAA,IAAAD,EAAA,OAAAuB,OAAAC,IAAA,2BAAA,GAAA;EAEzEvB,KAAA,oBAAC0B,aAAD,CAAe,CAAA;EAAG3B,EAAA,KAAAC;CAAA,OAAAA,KAAAD,EAAA;CAAA,IAAAG;CAAA,IAAAH,EAAA,OAAAiB,aAAAjB,EAAA,OAAAmB,eAAA;EADfhB,KAAA,oBAAC,YAAD;GAAuBc;GAA0BE;GACpDlB,UAAAA;EADc,CAAA;EAEHD,EAAA,KAAAiB;EAAAjB,EAAA,KAAAmB;EAAAnB,EAAA,KAAAG;CAAA,OAAAA,KAAAH,EAAA;CAAA,OAFRG;AAEQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RefAttributes } from "react";
|
|
2
|
-
import { SeparatorProps } from "react-aria-components";
|
|
2
|
+
import { SeparatorProps as SeparatorProps$1 } from "react-aria-components";
|
|
3
3
|
type SeparatorInset = 'both' | 'none' | 'start';
|
|
4
|
-
type SeparatorProps
|
|
4
|
+
type SeparatorProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Takes the rule out of the accessibility tree, for a divider that only
|
|
7
7
|
* draws a line between things that already say where each starts — the
|
|
@@ -28,7 +28,7 @@ type SeparatorProps$1 = {
|
|
|
28
28
|
* @default 'horizontal'
|
|
29
29
|
*/
|
|
30
30
|
orientation?: 'horizontal' | 'vertical';
|
|
31
|
-
} & Omit<SeparatorProps, 'orientation'>;
|
|
31
|
+
} & Omit<SeparatorProps$1, 'orientation'>;
|
|
32
32
|
/**
|
|
33
33
|
* A 1px rule between items: inset between list rows, across a toolbar's
|
|
34
34
|
* direction among its controls, and as `Menu.Separator` between groups of a
|
|
@@ -71,5 +71,5 @@ type SeparatorProps$1 = {
|
|
|
71
71
|
* the rule across the toolbar's own direction. `elementType` picks a
|
|
72
72
|
* different element, and `render` is React Aria's function form.
|
|
73
73
|
*/
|
|
74
|
-
declare function Separator
|
|
75
|
-
export { type SeparatorInset, type SeparatorProps
|
|
74
|
+
declare function Separator({ decorative, inset, orientation, render, ...props }: RefAttributes<HTMLElement> & SeparatorProps): import("react").JSX.Element;
|
|
75
|
+
export { type SeparatorInset, type SeparatorProps, Separator as default };
|
|
@@ -4,7 +4,7 @@ import { mergeStyles } from "../../styles/merge.js";
|
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import { createElement } from "react";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { Separator, SeparatorContext, useSlottedContext } from "react-aria-components";
|
|
7
|
+
import { Separator as Separator$1, SeparatorContext, useSlottedContext } from "react-aria-components";
|
|
8
8
|
// src/components/separator/index.tsx
|
|
9
9
|
const styles = {
|
|
10
10
|
base: {
|
|
@@ -116,7 +116,7 @@ function decorativeRenderer(element, render) {
|
|
|
116
116
|
* the rule across the toolbar's own direction. `elementType` picks a
|
|
117
117
|
* different element, and `render` is React Aria's function form.
|
|
118
118
|
*/
|
|
119
|
-
function Separator
|
|
119
|
+
function Separator(t0) {
|
|
120
120
|
const $ = c(6);
|
|
121
121
|
const { decorative: t1, inset: t2, orientation, render, ...props$1 } = t0;
|
|
122
122
|
const decorative = t1 === void 0 ? false : t1;
|
|
@@ -125,7 +125,7 @@ function Separator$1(t0) {
|
|
|
125
125
|
const resolved = orientation ?? context?.orientation ?? "horizontal";
|
|
126
126
|
const requested = props$1.elementType ?? context?.elementType ?? "hr";
|
|
127
127
|
const element = requested === "hr" && resolved === "vertical" ? "div" : requested;
|
|
128
|
-
const T0 = Separator;
|
|
128
|
+
const T0 = Separator$1;
|
|
129
129
|
const t3 = decorative ? decorativeRenderer(element, render) : render;
|
|
130
130
|
const t4 = mergeStyles(props(styles.base, styles[resolved], insets[resolved][inset]), props$1);
|
|
131
131
|
let t5;
|
|
@@ -145,6 +145,6 @@ function Separator$1(t0) {
|
|
|
145
145
|
} else t5 = $[5];
|
|
146
146
|
return t5;
|
|
147
147
|
}
|
|
148
|
-
export { Separator
|
|
148
|
+
export { Separator as default };
|
|
149
149
|
|
|
150
150
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_c","stylex","createElement","Separator","RACSeparator","SeparatorContext","useSlottedContext","mergeStyles","styles","base","kWkggS","kMzoRj","kB7OPa","kmuXW","kogj98","$$css","horizontal","kZKoxP","kLZC3w","kPef9Z","kEafiO","kzqmXN","vertical","kSGwAc","kGJrpR","kVhnKS","k2ei4v","k1xSpc","kAzted","kXLuUW","horizontalInsets","both","k71WvV","keTefX","none","start","verticalInsets","k1K539","keoZOQ","insets","decorative","inset","orientation","decorativeRenderer","element","render","domProps","renderProps","hidden","undefined","role","t0","$","t1","t2","props","context","slot","resolved","requested","elementType","T0","t3","t4","t5"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { SeparatorProps as RACSeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement } from 'react';\nimport { Separator as RACSeparator, SeparatorContext, useSlottedContext } from 'react-aria-components';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own — the design system treats the two as one\n// decision, and a separator that drifted from the borders around it would\n// read as a mistake.\n//\n// Drawn as a background on a 1px box rather than as a border, so the rule is\n// the element itself. A border would leave the element's own box at zero\n// size, which makes it invisible to flex `gap` and to anything measuring it.\n// The horizontal element is an <hr>, which arrives with a border and a\n// margin of its own; both are zeroed here so it is the same 1px box a <div>\n// would be.\n//\n// Vertical takes its length from the flex or grid parent through\n// `alignSelf: stretch`, since a divider between two columns should match\n// whatever they turn out to be rather than being told a height at the call\n// site. Anywhere else there is nothing to stretch to, so it falls back to\n// `1em`, one line of the text around it, and sits in that line as an inline\n// block rather than breaking it: between two words in a paragraph it is a\n// short upright bar, rather than a 1px box with no height that draws\n// nothing. The divider page gives no length for a vertical rule standing on\n// its own, so the `1em` is this library's choice. Inside a flex or grid\n// parent the inline display is blockified and the floor sits below any\n// length the parent stretches it to, so neither changes the rule there.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The\n// page names them \"inset\" and \"middle-inset\"; the prop says `start` and\n// `both` instead, since `inset=\"inset\"` reads as nothing at all and the two\n// words say which ends move.\n//\n// The inset is drawn as a margin on the logical axis the rule runs along, so\n// it follows the writing mode and works for a vertical rule as well — the\n// page only draws horizontal ones, but a shortened vertical rule between two\n// columns is the same idea and would otherwise have to be written at the\n// call site. An inset rule's length is `100%` less its margins: a margin\n// sits outside the box, so a full-width rule with one would overflow its\n// parent by exactly the inset, and `auto` in its place gives an empty `<hr>`\n// a width only where the parent stretches it — in a flex row, or a parent\n// centring its children, the rule came out 0 wide and vanished.\n//\n// The orientation is resolved rather than defaulted eagerly, so a container\n// that sets one through React Aria's separator context reaches it. Toolbar\n// is what needs that: a rule between two controls in a row is vertical, and\n// a `Separator` written inside one should not have to say so. React Aria's\n// own `Toolbar` sets no such context — it puts the orientation on itself and\n// nothing else — so ours provides it, and this is the half that reads it.\nconst styles = {\n base: {\n kWkggS: \"x1l12bh\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n horizontal: {\n kZKoxP: \"xjm9jq1\",\n kLZC3w: \"x19dwuzr\",\n kPef9Z: \"x4z998w\",\n kEafiO: \"x1lym3mf\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n vertical: {\n kSGwAc: \"xkh2ocl\",\n kGJrpR: \"xjslfuv\",\n kVhnKS: \"x1gbqego\",\n k2ei4v: \"xjg5lhu\",\n k1xSpc: \"x1rg5ohu\",\n kzqmXN: \"x1i1rx1s\",\n kAzted: \"x1xaadd7\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\n\n// The page's 16dp, on whichever axis the rule runs along. The length is the\n// full-width rule's `100%` less the margins, which keeps the rule inside its\n// parent — a margin outside a 100% box overflows by the inset — and still\n// gives it a width in every layout, where `auto` gives an `<hr>` with no\n// content one only in a parent that stretches it.\nconst horizontalInsets = {\n both: {\n kzqmXN: \"x1n0idw\",\n k71WvV: \"xdf1gh2\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n kzqmXN: \"x1u7osep\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n }\n};\n\n// A vertical rule takes its length from the parent through `alignSelf`, so\n// the margin shortens it from the end it is on rather than moving it. The\n// `1em` floor is the rule's own length and the margins sit outside it: a\n// stretched rule is shortened down to the floor and no further, and one with\n// no parent to stretch to keeps its `1em` and takes the inset as space above\n// and below, since there is no length of the parent's for it to hold off.\nconst verticalInsets = {\n both: {\n k1K539: \"xxkrg4w\",\n keoZOQ: \"xwf6w2j\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n keoZOQ: \"xwf6w2j\",\n $$css: true\n }\n};\nconst insets = {\n horizontal: horizontalInsets,\n vertical: verticalInsets\n};\ntype SeparatorInset = 'both' | 'none' | 'start';\ntype SeparatorProps = {\n /**\n * Takes the rule out of the accessibility tree, for a divider that only\n * draws a line between things that already say where each starts — the\n * sections of a `DisclosureGroup`, or rows that are each a control. A\n * reader then hears nothing between them rather than \"separator\" at every\n * one. The rule draws the same either way.\n * @default false\n */\n decorative?: boolean;\n /**\n * How far the rule is held off the edges it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both`\n * holds it off each end, which is its middle-inset one. The inset follows\n * the writing mode rather than a fixed side.\n * @default 'none'\n */\n inset?: SeparatorInset;\n /**\n * Which way the rule runs. A vertical separator takes its length from a\n * flex or grid parent, and is one line of the text around it, `1em`, in\n * any other. Defaults to whatever the container asks for — a `Toolbar`\n * asks for the rule across its own direction — and to horizontal outside\n * one.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n} & Omit<RACSeparatorProps, 'orientation'>;\n\n// A rule taken out of the accessibility tree. React Aria passes on neither\n// `aria-hidden` nor `role` from a separator's props, and sets the separator\n// role itself, so the element is rewritten in its render function, after\n// both: hidden, with the role and orientation it would be announced by\n// dropped. A render function from the call site still gets the last word.\nfunction decorativeRenderer(element: string, render: RACSeparatorProps['render']): NonNullable<RACSeparatorProps['render']> {\n return (domProps, renderProps) => {\n const hidden = {\n ...domProps,\n 'aria-hidden': true,\n 'aria-orientation': undefined,\n role: undefined\n };\n return render === undefined ? createElement(element, hidden) : render(hidden, renderProps);\n };\n}\n\n/**\n * A 1px rule between items: inset between list rows, across a toolbar's\n * direction among its controls, and as `Menu.Separator` between groups of a\n * menu's items.\n *\n * ```tsx\n * <Card padding=\"none\" variant=\"outlined\">\n * <ListItem>First item</ListItem>\n * <Separator inset=\"start\" />\n * <ListItem>Second item</ListItem>\n * </Card>\n *\n * <Toolbar aria-label=\"Label\">\n * <Button variant=\"text\">First</Button>\n * <Separator />\n * <Button variant=\"text\">Second</Button>\n * </Toolbar>\n *\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * <Menu.Separator />\n * <Menu.Item id=\"second\">Second item</Menu.Item>\n * </Menu.Content>\n * ```\n *\n * The orientation drives the accessibility tree as well as which side the\n * rule is drawn on: horizontal renders an `<hr>` and vertical a `<div>`, each\n * given the separator role, and the vertical one `aria-orientation=\"vertical\"`\n * besides. `decorative` takes the rule out of that tree altogether, for one\n * that only draws a line between items that already carry their own\n * structure.\n *\n * `inset` holds the rule off the ends it runs between — `start` off the\n * leading one, `both` off each — which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * React Aria's rather than a styled element of the library's own, so a\n * `Menu` or `Toolbar` around it reaches it through context — a separator\n * between menu items is part of the collection, and one in a toolbar takes\n * the rule across the toolbar's own direction. `elementType` picks a\n * different element, and `render` is React Aria's function form.\n */\nfunction Separator({\n decorative = false,\n inset = 'none',\n orientation,\n render,\n ...props\n}: RefAttributes<HTMLElement> & SeparatorProps) {\n const context = useSlottedContext(SeparatorContext, props.slot);\n const resolved = orientation ?? context?.orientation ?? 'horizontal';\n // The element React Aria renders, which its render function is held to:\n // an <hr> unless the call site or a container asks for another, and a\n // <div> in place of a vertical <hr>.\n const requested = props.elementType ?? context?.elementType ?? 'hr';\n const element = requested === 'hr' && resolved === 'vertical' ? 'div' : requested;\n return <RACSeparator orientation={resolved} render={decorative ? decorativeRenderer(element, render) : render} {...props} {...mergeStyles(stylex.props(styles.base, styles[resolved], insets[resolved][inset]), props)} />;\n}\nexport type { SeparatorInset, SeparatorProps };\nexport default Separator;"],"mappings":";;;;;;;;AA+DA,MAAMQ,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QA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kBkD,QAAKE,IAAK;CAC9D,MAAAC,WAAiBhB,eAAec,SAAOd,eAAtB;CAIjB,MAAAiB,YAAkBJ,QAAKK,eAAgBJ,SAAOI,eAA5B;CAClB,MAAAhB,UAAgBe,cAAc,QAAQD,aAAa,aAAnC,QAAAC;CACR,MAAAE,KAAAzD;CAA4C,MAAA0D,KAAAtB,aAAaG,mBAAmBC,SAASC,MAAe,IAAxDA;CAA0E,MAAAkB,KAAAxD,YAAYN,MAAaO,OAAMC,MAAOD,OAAOkD,WAAWnB,OAAOmB,SAAS,CAACjB,MAAM,GAAGc,OAAK;CAAC,IAAAS;CAAA,IAAAZ,EAAA,OAAAS,MAAAT,EAAA,OAAAG,WAAAH,EAAA,OAAAM,YAAAN,EAAA,OAAAU,MAAAV,EAAA,OAAAW,IAAA;EAA/MC,KAAA,oBAAC,IAAD;GAA2BN,aAAAA;GAAkB,QAAAI;GAAyD,GAAMP;GAAK,GAAMQ;EAAwF,CAAA;EAAIX,EAAA,KAAAS;EAAAT,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAU;EAAAV,EAAA,KAAAW;EAAAX,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAAnNY;AAAmN"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_c","stylex","createElement","Separator","RACSeparator","SeparatorContext","useSlottedContext","mergeStyles","styles","base","kWkggS","kMzoRj","kB7OPa","kmuXW","kogj98","$$css","horizontal","kZKoxP","kLZC3w","kPef9Z","kEafiO","kzqmXN","vertical","kSGwAc","kGJrpR","kVhnKS","k2ei4v","k1xSpc","kAzted","kXLuUW","horizontalInsets","both","k71WvV","keTefX","none","start","verticalInsets","k1K539","keoZOQ","insets","decorative","inset","orientation","decorativeRenderer","element","render","domProps","renderProps","hidden","undefined","role","t0","$","t1","t2","props","context","slot","resolved","requested","elementType","T0","t3","t4","t5"],"sources":["../../../src/components/separator/index.tsx"],"sourcesContent":["'use client';\n\nimport type { RefAttributes } from 'react';\nimport type { SeparatorProps as RACSeparatorProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createElement } from 'react';\nimport { Separator as RACSeparator, SeparatorContext, useSlottedContext } from 'react-aria-components';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, spacing } from '../../tokens/design.tokens.stylex';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// A divider is the same colour as a border, so it draws from outlineVariant\n// rather than a role of its own — the design system treats the two as one\n// decision, and a separator that drifted from the borders around it would\n// read as a mistake.\n//\n// Drawn as a background on a 1px box rather than as a border, so the rule is\n// the element itself. A border would leave the element's own box at zero\n// size, which makes it invisible to flex `gap` and to anything measuring it.\n// The horizontal element is an <hr>, which arrives with a border and a\n// margin of its own; both are zeroed here so it is the same 1px box a <div>\n// would be.\n//\n// Vertical takes its length from the flex or grid parent through\n// `alignSelf: stretch`, since a divider between two columns should match\n// whatever they turn out to be rather than being told a height at the call\n// site. Anywhere else there is nothing to stretch to, so it falls back to\n// `1em`, one line of the text around it, and sits in that line as an inline\n// block rather than breaking it: between two words in a paragraph it is a\n// short upright bar, rather than a 1px box with no height that draws\n// nothing. The divider page gives no length for a vertical rule standing on\n// its own, so the `1em` is this library's choice. Inside a flex or grid\n// parent the inline display is blockified and the floor sits below any\n// length the parent stretches it to, so neither changes the rule there.\n//\n// The divider page gives three forms and this draws all three: full width,\n// inset by 16dp at the leading end, and middle-inset by 16dp at both. The\n// page names them \"inset\" and \"middle-inset\"; the prop says `start` and\n// `both` instead, since `inset=\"inset\"` reads as nothing at all and the two\n// words say which ends move.\n//\n// The inset is drawn as a margin on the logical axis the rule runs along, so\n// it follows the writing mode and works for a vertical rule as well — the\n// page only draws horizontal ones, but a shortened vertical rule between two\n// columns is the same idea and would otherwise have to be written at the\n// call site. An inset rule's length is `100%` less its margins: a margin\n// sits outside the box, so a full-width rule with one would overflow its\n// parent by exactly the inset, and `auto` in its place gives an empty `<hr>`\n// a width only where the parent stretches it — in a flex row, or a parent\n// centring its children, the rule came out 0 wide and vanished.\n//\n// The orientation is resolved rather than defaulted eagerly, so a container\n// that sets one through React Aria's separator context reaches it. Toolbar\n// is what needs that: a rule between two controls in a row is vertical, and\n// a `Separator` written inside one should not have to say so. React Aria's\n// own `Toolbar` sets no such context — it puts the orientation on itself and\n// nothing else — so ours provides it, and this is the half that reads it.\nconst styles = {\n base: {\n kWkggS: \"x1l12bh\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kmuXW: \"x2lah0s\",\n kogj98: \"x1ghz6dp\",\n $$css: true\n },\n horizontal: {\n kZKoxP: \"xjm9jq1\",\n kLZC3w: \"x19dwuzr\",\n kPef9Z: \"x4z998w\",\n kEafiO: \"x1lym3mf\",\n kzqmXN: \"xh8yej3\",\n $$css: true\n },\n vertical: {\n kSGwAc: \"xkh2ocl\",\n kGJrpR: \"xjslfuv\",\n kVhnKS: \"x1gbqego\",\n k2ei4v: \"xjg5lhu\",\n k1xSpc: \"x1rg5ohu\",\n kzqmXN: \"x1i1rx1s\",\n kAzted: \"x1xaadd7\",\n kXLuUW: \"xxymvpz\",\n $$css: true\n }\n};\n\n// The page's 16dp, on whichever axis the rule runs along. The length is the\n// full-width rule's `100%` less the margins, which keeps the rule inside its\n// parent — a margin outside a 100% box overflows by the inset — and still\n// gives it a width in every layout, where `auto` gives an `<hr>` with no\n// content one only in a parent that stretches it.\nconst horizontalInsets = {\n both: {\n kzqmXN: \"x1n0idw\",\n k71WvV: \"xdf1gh2\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n kzqmXN: \"x1u7osep\",\n keTefX: \"x1m7rnnc\",\n $$css: true\n }\n};\n\n// A vertical rule takes its length from the parent through `alignSelf`, so\n// the margin shortens it from the end it is on rather than moving it. The\n// `1em` floor is the rule's own length and the margins sit outside it: a\n// stretched rule is shortened down to the floor and no further, and one with\n// no parent to stretch to keeps its `1em` and takes the inset as space above\n// and below, since there is no length of the parent's for it to hold off.\nconst verticalInsets = {\n both: {\n k1K539: \"xxkrg4w\",\n keoZOQ: \"xwf6w2j\",\n $$css: true\n },\n none: {\n $$css: true\n },\n start: {\n keoZOQ: \"xwf6w2j\",\n $$css: true\n }\n};\nconst insets = {\n horizontal: horizontalInsets,\n vertical: verticalInsets\n};\ntype SeparatorInset = 'both' | 'none' | 'start';\ntype SeparatorProps = {\n /**\n * Takes the rule out of the accessibility tree, for a divider that only\n * draws a line between things that already say where each starts — the\n * sections of a `DisclosureGroup`, or rows that are each a control. A\n * reader then hears nothing between them rather than \"separator\" at every\n * one. The rule draws the same either way.\n * @default false\n */\n decorative?: boolean;\n /**\n * How far the rule is held off the edges it runs between. `start` holds it\n * 16dp off the leading end, which is the page's inset divider; `both`\n * holds it off each end, which is its middle-inset one. The inset follows\n * the writing mode rather than a fixed side.\n * @default 'none'\n */\n inset?: SeparatorInset;\n /**\n * Which way the rule runs. A vertical separator takes its length from a\n * flex or grid parent, and is one line of the text around it, `1em`, in\n * any other. Defaults to whatever the container asks for — a `Toolbar`\n * asks for the rule across its own direction — and to horizontal outside\n * one.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical';\n} & Omit<RACSeparatorProps, 'orientation'>;\n\n// A rule taken out of the accessibility tree. React Aria passes on neither\n// `aria-hidden` nor `role` from a separator's props, and sets the separator\n// role itself, so the element is rewritten in its render function, after\n// both: hidden, with the role and orientation it would be announced by\n// dropped. A render function from the call site still gets the last word.\nfunction decorativeRenderer(element: string, render: RACSeparatorProps['render']): NonNullable<RACSeparatorProps['render']> {\n return (domProps, renderProps) => {\n const hidden = {\n ...domProps,\n 'aria-hidden': true,\n 'aria-orientation': undefined,\n role: undefined\n };\n return render === undefined ? createElement(element, hidden) : render(hidden, renderProps);\n };\n}\n\n/**\n * A 1px rule between items: inset between list rows, across a toolbar's\n * direction among its controls, and as `Menu.Separator` between groups of a\n * menu's items.\n *\n * ```tsx\n * <Card padding=\"none\" variant=\"outlined\">\n * <ListItem>First item</ListItem>\n * <Separator inset=\"start\" />\n * <ListItem>Second item</ListItem>\n * </Card>\n *\n * <Toolbar aria-label=\"Label\">\n * <Button variant=\"text\">First</Button>\n * <Separator />\n * <Button variant=\"text\">Second</Button>\n * </Toolbar>\n *\n * <Menu.Content>\n * <Menu.Item id=\"first\">First item</Menu.Item>\n * <Menu.Separator />\n * <Menu.Item id=\"second\">Second item</Menu.Item>\n * </Menu.Content>\n * ```\n *\n * The orientation drives the accessibility tree as well as which side the\n * rule is drawn on: horizontal renders an `<hr>` and vertical a `<div>`, each\n * given the separator role, and the vertical one `aria-orientation=\"vertical\"`\n * besides. `decorative` takes the rule out of that tree altogether, for one\n * that only draws a line between items that already carry their own\n * structure.\n *\n * `inset` holds the rule off the ends it runs between — `start` off the\n * leading one, `both` off each — which is what a rule between list rows\n * takes so it lines up with their text rather than the container's edge.\n *\n * React Aria's rather than a styled element of the library's own, so a\n * `Menu` or `Toolbar` around it reaches it through context — a separator\n * between menu items is part of the collection, and one in a toolbar takes\n * the rule across the toolbar's own direction. `elementType` picks a\n * different element, and `render` is React Aria's function form.\n */\nfunction Separator({\n decorative = false,\n inset = 'none',\n orientation,\n render,\n ...props\n}: RefAttributes<HTMLElement> & SeparatorProps) {\n const context = useSlottedContext(SeparatorContext, props.slot);\n const resolved = orientation ?? context?.orientation ?? 'horizontal';\n // The element React Aria renders, which its render function is held to:\n // an <hr> unless the call site or a container asks for another, and a\n // <div> in place of a vertical <hr>.\n const requested = props.elementType ?? context?.elementType ?? 'hr';\n const element = requested === 'hr' && resolved === 'vertical' ? 'div' : requested;\n return <RACSeparator orientation={resolved} render={decorative ? decorativeRenderer(element, render) : render} {...props} {...mergeStyles(stylex.props(styles.base, styles[resolved], insets[resolved][inset]), props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jB,MAAAX,aAAAa,OAAAJ,KAAAA,IAAA,QAAAI;CACA,MAAAZ,QAAAa,OAAAL,KAAAA,IAAA,SAAAK;CAKA,MAAAE,UAAgBlD,kBAAkBD,kBAAkBkD,QAAKE,IAAK;CAC9D,MAAAC,WAAiBhB,eAAec,SAAOd,eAAtB;CAIjB,MAAAiB,YAAkBJ,QAAKK,eAAgBJ,SAAOI,eAA5B;CAClB,MAAAhB,UAAgBe,cAAc,QAAQD,aAAa,aAAnC,QAAAC;CACR,MAAAE,KAAAzD;CAA4C,MAAA0D,KAAAtB,aAAaG,mBAAmBC,SAASC,MAAe,IAAxDA;CAA0E,MAAAkB,KAAAxD,YAAYN,MAAaO,OAAMC,MAAOD,OAAOkD,WAAWnB,OAAOmB,SAAS,CAACjB,MAAM,GAAGc,OAAK;CAAC,IAAAS;CAAA,IAAAZ,EAAA,OAAAS,MAAAT,EAAA,OAAAG,WAAAH,EAAA,OAAAM,YAAAN,EAAA,OAAAU,MAAAV,EAAA,OAAAW,IAAA;EAA/MC,KAAA,oBAAC,IAAD;GAA2BN,aAAAA;GAAkB,QAAAI;GAAyD,GAAMP;GAAK,GAAMQ;EAAwF,CAAA;EAAIX,EAAA,KAAAS;EAAAT,EAAA,KAAAG;EAAAH,EAAA,KAAAM;EAAAN,EAAA,KAAAU;EAAAV,EAAA,KAAAW;EAAAX,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,OAAnNY;AAAmN"}
|
|
@@ -45,10 +45,10 @@ import { ClassNameOrFunction, DialogProps, DialogTriggerProps, HeadingProps, Mod
|
|
|
45
45
|
* with F6, which React Aria uses to move between landmarks. Tabbing on past
|
|
46
46
|
* the snackbar's last control leads back into the sheet.
|
|
47
47
|
*/
|
|
48
|
-
declare function Sheet
|
|
49
|
-
declare namespace Sheet
|
|
48
|
+
declare function Sheet({ children, ...props }: SheetProps): import("react").JSX.Element;
|
|
49
|
+
declare namespace Sheet {
|
|
50
50
|
var Body: typeof SheetBody;
|
|
51
|
-
var Content: typeof SheetContent
|
|
51
|
+
var Content: typeof SheetContent;
|
|
52
52
|
var Footer: typeof SheetFooter;
|
|
53
53
|
var Handle: typeof SheetHandle;
|
|
54
54
|
var Header: typeof SheetHeader;
|
|
@@ -81,7 +81,7 @@ declare function SheetBody({ ref: callerRef, ...props }: HTMLAttributes<HTMLDivE
|
|
|
81
81
|
* corner rather than fixing it to the window, so a `container` inside a
|
|
82
82
|
* positioned element holds the sheet to that element instead.
|
|
83
83
|
*/
|
|
84
|
-
declare function SheetContent
|
|
84
|
+
declare function SheetContent({ children, className, container, defaultOpen, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, ref, snapPoints, style, ...props }: RefAttributes<HTMLDivElement> & SheetContentProps): import("react").JSX.Element;
|
|
85
85
|
/**
|
|
86
86
|
* The sheet's actions. The panel rests on the window's bottom edge in both
|
|
87
87
|
* presentations, so they sit on that edge, and a toast rises clear of them
|
|
@@ -163,4 +163,4 @@ type SheetProps = Omit<DialogTriggerProps, 'children'> & {
|
|
|
163
163
|
children?: ReactNode;
|
|
164
164
|
};
|
|
165
165
|
type SheetTitleProps = HeadingProps;
|
|
166
|
-
export { SheetBody, SheetContent
|
|
166
|
+
export { SheetBody, SheetContent, type SheetContentProps, SheetFooter, SheetHandle, SheetHeader, type SheetProps, SheetTitle, type SheetTitleProps, Sheet as default };
|
|
@@ -10,7 +10,7 @@ import { overlay } from "../../styles/overlay.js";
|
|
|
10
10
|
import { c } from "react/compiler-runtime";
|
|
11
11
|
import { createContext, useContext, useLayoutEffect, useRef, useSyncExternalStore } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Button, Heading, HeadingContext, OverlayTriggerStateContext, Sheet, SheetBackdrop, SheetContent, SheetOverlay, SheetTrigger, useSlottedContext } from "react-aria-components";
|
|
13
|
+
import { Button, Heading, HeadingContext, OverlayTriggerStateContext, Sheet as Sheet$1, SheetBackdrop, SheetContent as SheetContent$1, SheetOverlay, SheetTrigger, useSlottedContext } from "react-aria-components";
|
|
14
14
|
// src/components/sheet/index.tsx
|
|
15
15
|
const scrimIn = "x18re5ia-B";
|
|
16
16
|
const BOTTOM_SHEET = "(width < 600px)";
|
|
@@ -229,7 +229,7 @@ function restWhereItOpens(layer, scroller) {
|
|
|
229
229
|
* with F6, which React Aria uses to move between landmarks. Tabbing on past
|
|
230
230
|
* the snackbar's last control leads back into the sheet.
|
|
231
231
|
*/
|
|
232
|
-
function Sheet
|
|
232
|
+
function Sheet(t0) {
|
|
233
233
|
const $ = c(6);
|
|
234
234
|
let children;
|
|
235
235
|
let props;
|
|
@@ -315,7 +315,7 @@ function SheetBody(t0) {
|
|
|
315
315
|
* corner rather than fixing it to the window, so a `container` inside a
|
|
316
316
|
* positioned element holds the sheet to that element instead.
|
|
317
317
|
*/
|
|
318
|
-
function SheetContent
|
|
318
|
+
function SheetContent(t0) {
|
|
319
319
|
const $ = c(43);
|
|
320
320
|
let children;
|
|
321
321
|
let className;
|
|
@@ -431,7 +431,7 @@ function SheetContent$1(t0) {
|
|
|
431
431
|
} else t10 = $[28];
|
|
432
432
|
let t11;
|
|
433
433
|
if ($[29] !== ref || $[30] !== t10 || $[31] !== t9) {
|
|
434
|
-
t11 = /* @__PURE__ */ jsx(Sheet, {
|
|
434
|
+
t11 = /* @__PURE__ */ jsx(Sheet$1, {
|
|
435
435
|
ref,
|
|
436
436
|
...t9,
|
|
437
437
|
children: t10
|
|
@@ -500,7 +500,7 @@ function SheetDialog(t0) {
|
|
|
500
500
|
} else t2 = $[8];
|
|
501
501
|
let t3;
|
|
502
502
|
if ($[9] !== props$1 || $[10] !== t1) {
|
|
503
|
-
t3 = /* @__PURE__ */ jsx(SheetContent, {
|
|
503
|
+
t3 = /* @__PURE__ */ jsx(SheetContent$1, {
|
|
504
504
|
...props$1,
|
|
505
505
|
render: t1,
|
|
506
506
|
...t2
|
|
@@ -699,12 +699,12 @@ function useRestOnTurn(overlayRef, position) {
|
|
|
699
699
|
}
|
|
700
700
|
useLayoutEffect(t0, t1);
|
|
701
701
|
}
|
|
702
|
-
Sheet
|
|
703
|
-
Sheet
|
|
704
|
-
Sheet
|
|
705
|
-
Sheet
|
|
706
|
-
Sheet
|
|
707
|
-
Sheet
|
|
708
|
-
export { SheetBody, SheetContent
|
|
702
|
+
Sheet.Body = SheetBody;
|
|
703
|
+
Sheet.Content = SheetContent;
|
|
704
|
+
Sheet.Footer = SheetFooter;
|
|
705
|
+
Sheet.Handle = SheetHandle;
|
|
706
|
+
Sheet.Header = SheetHeader;
|
|
707
|
+
Sheet.Title = SheetTitle;
|
|
708
|
+
export { SheetBody, SheetContent, SheetFooter, SheetHandle, SheetHeader, SheetTitle, Sheet as default };
|
|
709
709
|
|
|
710
710
|
//# sourceMappingURL=index.js.map
|