@kanso-labs/kanso-ui 0.29.1 → 0.30.1
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/components/checkbox/index.d.ts +4 -0
- package/dist/components/checkbox/index.js.map +1 -1
- package/dist/components/checkbox-group/index.d.ts +4 -0
- package/dist/components/checkbox-group/index.js.map +1 -1
- package/dist/components/chip-group/index.d.ts +4 -0
- package/dist/components/chip-group/index.js.map +1 -1
- package/dist/components/color-field/index.d.ts +8 -1
- package/dist/components/color-field/index.js.map +1 -1
- package/dist/components/combo-box/index.d.ts +4 -0
- package/dist/components/combo-box/index.js.map +1 -1
- package/dist/components/copy-field/index.d.ts +17 -1
- package/dist/components/copy-field/index.js +58 -51
- package/dist/components/copy-field/index.js.map +1 -1
- package/dist/components/date-field/index.d.ts +8 -1
- package/dist/components/date-field/index.js.map +1 -1
- package/dist/components/date-picker/index.d.ts +8 -1
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/date-range-picker/index.d.ts +8 -1
- package/dist/components/date-range-picker/index.js.map +1 -1
- package/dist/components/form/index.d.ts +7 -0
- package/dist/components/form/index.js +7 -0
- package/dist/components/form/index.js.map +1 -1
- package/dist/components/number-field/index.d.ts +4 -0
- package/dist/components/number-field/index.js.map +1 -1
- package/dist/components/radio-group/index.d.ts +4 -0
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/search-field/index.d.ts +4 -0
- package/dist/components/search-field/index.js.map +1 -1
- package/dist/components/segmented-button/index.js +60 -32
- package/dist/components/segmented-button/index.js.map +1 -1
- package/dist/components/select/index.d.ts +4 -0
- package/dist/components/select/index.js.map +1 -1
- package/dist/components/switch/index.d.ts +4 -0
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/text-area/index.d.ts +4 -0
- package/dist/components/text-area/index.js.map +1 -1
- package/dist/components/text-field/index.d.ts +4 -0
- package/dist/components/text-field/index.js.map +1 -1
- package/dist/components/time-field/index.d.ts +8 -1
- package/dist/components/time-field/index.js.map +1 -1
- package/dist/components/token-field/index.d.ts +4 -0
- package/dist/components/token-field/index.js.map +1 -1
- package/dist/styles.css +32 -0
- package/package.json +4 -2
|
@@ -16,6 +16,10 @@ type CheckboxProps = {
|
|
|
16
16
|
* The problem with the current value, in words. Its presence is what puts
|
|
17
17
|
* the checkbox in its error state — the message, the error colours and
|
|
18
18
|
* `aria-invalid` all follow from it.
|
|
19
|
+
*
|
|
20
|
+
* Outside a `Form` the message line arrives with the message, so the
|
|
21
|
+
* field grows when this does and moves what is under it. A `Form` holds
|
|
22
|
+
* that space from the start; so does a permanent `description`.
|
|
19
23
|
*/
|
|
20
24
|
error?: string;
|
|
21
25
|
} & Omit<CheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","CheckboxButtonRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","CheckboxButton","CheckboxField","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","styles","box","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","state","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","_c","validationBehavior","T0","t1","t2","field","t3","t4","t5","Symbol","for","messages","t6","t7"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxButton, CheckboxField } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\nconst styles = {\n box: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"xrpadme\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\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 checkbox 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: CheckboxButtonRenderProps) => {\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\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 Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </CheckboxButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} />\n </div>\n </CheckboxField>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;AAmCA,MAAMoB,SAAS;CACbC,KAAK;EACHC,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,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;A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;GAAK,CAAA;EAC9D,CAAA;EAAAmC,EAAA,KAAA7B;EAAA6B,EAAA,KAAAnC;EAAAmC,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAG,MAAAH,EAAA,QAAAR,WAAAQ,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,MAAAb,EAAA,QAAAE,oBAAA;EANHY,KAAA,qBAAC,IAAD;GAA0B,WAAAV;GAAwCF;GAAkB,GAAMV;GAAK,GAAMa;GAArG,UAAA,CACHG,IAGAK,EAJiB;;EAOHb,EAAA,MAAAG;EAAAH,EAAA,MAAAR;EAAAQ,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAE;EAAAF,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAPXc;AAOW"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","CheckboxButtonRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","CheckboxButton","CheckboxField","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","styles","box","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","state","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","_c","validationBehavior","T0","t1","t2","field","t3","t4","t5","Symbol","for","messages","t6","t7"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxButton, CheckboxField } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\nconst styles = {\n box: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"xrpadme\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours 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} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\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 checkbox 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: CheckboxButtonRenderProps) => {\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel state={state}>{children}</ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\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 Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple)}\n </CheckboxButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} />\n </div>\n </CheckboxField>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;AAmCA,MAAMoB,SAAS;CACbC,KAAK;EACHC,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,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS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S;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAa;CAAA,IAAAb,EAAA,OAAA7B,eAAA6B,EAAA,OAAAnC,OAAA;EAA7CgD,KAAA,oBAAA,OAAA;GAEM,GAFGJ;GACP,UAAA,oBAAC,cAAD;IAA2BtC;IAAoBN;IAAc,OAAA;GAAK,CAAA;EAC9D,CAAA;EAAAmC,EAAA,KAAA7B;EAAA6B,EAAA,KAAAnC;EAAAmC,EAAA,MAAAa;CAAA,OAAAA,KAAAb,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAG,MAAAH,EAAA,QAAAR,WAAAQ,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,MAAAL,EAAA,QAAAQ,MAAAR,EAAA,QAAAa,MAAAb,EAAA,QAAAE,oBAAA;EANHY,KAAA,qBAAC,IAAD;GAA0B,WAAAV;GAAwCF;GAAkB,GAAMV;GAAK,GAAMa;GAArG,UAAA,CACHG,IAGAK,EAJiB;;EAOHb,EAAA,MAAAG;EAAAH,EAAA,MAAAR;EAAAQ,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAQ;EAAAR,EAAA,MAAAa;EAAAb,EAAA,MAAAE;EAAAF,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAPXc;AAOW"}
|
|
@@ -13,6 +13,10 @@ type CheckboxGroupProps$1 = {
|
|
|
13
13
|
* The problem with the current selection, in words. Its presence is what
|
|
14
14
|
* puts the group in its error state — the message, the boxes' error
|
|
15
15
|
* colours and `aria-invalid` all follow from it.
|
|
16
|
+
*
|
|
17
|
+
* Outside a `Form` the message line arrives with the message, so the
|
|
18
|
+
* field grows when this does and moves what is under it. A `Form` holds
|
|
19
|
+
* that space from the start; so does a permanent `description`.
|
|
16
20
|
*/
|
|
17
21
|
error?: string;
|
|
18
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","_c","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\n\ntype CheckboxGroupProps = {\n /** The checkboxes, 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 boxes' error\n * colours and `aria-invalid` all follow from it.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\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 CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\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 label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div className=\"x78zum5 xdt5ytf\">{children}</div>\n <FieldMessage description={description} error={error} inset={false} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","_c","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\n\ntype CheckboxGroupProps = {\n /** The checkboxes, 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 boxes' error\n * colours and `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 * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\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 CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\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 label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div className=\"x78zum5 xdt5ytf\">{children}</div>\n <FieldMessage description={description} error={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aZ,OAAeH,UAAqBC,aAAiCC,OAA2B;CACpH,QAAQe,UAAoC,qBAAA,UAAA,EAAA,UAAA;EACxC,oBAAC,YAAD;GAAmBA;GAAO,SAAQ;GAC/Bd,UAAAA;EACS,CAAA;EACZ,oBAAC,OAAD;GAAK,WAAU;GAAmBH;EAAc,CAAA;EAChD,oBAAC,cAAD;GAA2BC;GAAoBC;GAAO,OAAO;EAAM,CAAA;CACrE,EAAA,CAAA;AACJ"}
|
|
@@ -21,6 +21,10 @@ type ChipGroupProps<T extends object = object> = {
|
|
|
21
21
|
* The problem with the current selection, in words. Its presence is what
|
|
22
22
|
* puts the group in its error state — the message and `aria-invalid` both
|
|
23
23
|
* follow from it.
|
|
24
|
+
*
|
|
25
|
+
* Outside a `Form` the message line arrives with the message, so the
|
|
26
|
+
* field grows when this does and moves what is under it. A `Form` holds
|
|
27
|
+
* that space from the start; so does a permanent `description`.
|
|
24
28
|
*/
|
|
25
29
|
error?: string;
|
|
26
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","TagGroupProps","RACTagGroupProps","TagListProps","RACTagListProps","TagProps","RACTagProps","TagRenderProps","stylex","createContext","useContext","Button","RACButton","Tag","RACTag","TagGroup","RACTagGroup","TagList","RACTagList","chipGlyph","chipStyles","FieldLabel","FieldMessage","invalidFrom","groupStyles","CloseGlyph","focus","mergeStatefulStyles","mergeStyles","spacing","ChipGroupChipProps","Omit","children","className","style","ChipGroupProps","description","error","label","removeLabel","Pick","T","chipContent","state","isSelected","allowsRemoving","props","remove","removeGlyph","RemoveLabelContext","LABEL_STATE_VALID","isInvalid","LABEL_STATE_INVALID","ChipGroup","t0","$","_c","T0","invalid","items","renderEmptyState","t1","t2","t3","t4","t5","t6","t7","t8","t9","undefined","root","ChipGroupChip","textValue","textOf","chipPropsFor","base","ring","selected","unselected","isDisabled","disabled","disabledSelected","disabledUnselected","Chip"],"sources":["../../../src/components/chip-group/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TagGroupProps as RACTagGroupProps, TagListProps as RACTagListProps, TagProps as RACTagProps, TagRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tag as RACTag, TagGroup as RACTagGroup, TagList as RACTagList } from 'react-aria-components';\nimport { chipGlyph } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { CloseGlyph } from '../../glyphs';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// The chips page's filter and input chips as a set: one or more chosen from a\n// row, each one removable. The pill is the chip module's in `src/chip`,\n// shared with the standalone Chip, so the two cannot drift; what is here is\n// the group around them.\n//\n// Three things it adds over a row of Chips.\n//\n// **It is a group, not a row of buttons.** React Aria's `TagGroup` names the\n// set, describes it, reports it invalid as a whole, and moves between its\n// chips with the arrow keys rather than making each one a tab stop — which\n// is what a set of a dozen filters needs. The label, the supporting line and\n// the error are the field chrome's, so a group reads like the fields beside\n// it, exactly as CheckboxGroup and RadioGroup do.\n//\n// **A chip can be removed.** Give the group `onRemove` and each chip draws\n// the page's trailing close target, an 18dp glyph in a target of its own so a\n// press there removes rather than toggles. Backspace and Delete remove the\n// focused chip too, which is React Aria's. A chosen chip's check sits at the\n// other end, so a chip that is both selected and removable carries one glyph\n// on each side of its label.\n//\n// **Selection is the group's, not each chip's.** `selectionMode` and\n// `selectedKeys` live on the group, so a set that chooses one of its chips\n// and a set that chooses several are the same component with a different\n// word. A chip on its own that toggles nothing else is still Chip.\n//\n// One thing is worth knowing about how this maps onto React Aria. A chip's\n// text value is read off its children and found only when they are a plain\n// string, and a chip here is always an element — the label sits beside a\n// close target. So a plain-string label is passed through as the text value,\n// which is what typeahead and a screen reader's announcement are made of;\n// see ListBox.Item, where the same thing bit.\n\ntype ChipGroupChipProps = Omit<RACTagProps, 'children' | 'className' | 'style'> & {\n /** The chip's label. */\n children?: ReactNode;\n /** A function may compute the class from the chip's render state. */\n className?: RACTagProps['className'];\n /** A function may compute the style from the chip's render state. */\n style?: RACTagProps['style'];\n};\ntype ChipGroupProps<T extends object = object> = {\n /** The chips, each with an `id` 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 and `aria-invalid` both\n * follow from it.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a set of chips\n * with no name is a row a screen reader cannot introduce.\n */\n label: string;\n /**\n * What the close target on each chip is called, for a screen reader. React\n * Aria adds the chip's own label after it, so this is the verb rather than\n * the whole phrase — \"Remove\" becomes \"Remove First item\".\n * @default 'Remove'\n */\n removeLabel?: string;\n} & Omit<RACTagGroupProps, 'children'> & Pick<RACTagListProps<T>, 'items' | 'renderEmptyState'>;\n\n// What the chip draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The check is the chip module's, so a chip in a group and a chip on its own\n// draw the same one. The close target is drawn only where the group allows\n// removing, which React Aria reports rather than the call site saying so on\n// every chip.\nfunction chipContent(children: ReactNode, removeLabel: string) {\n return (state: TagRenderProps) => <>\n {chipGlyph(state.isSelected)}\n {children}\n {state.allowsRemoving ? <RACButton aria-label={removeLabel} slot=\"remove\" {...stylex.props(chipStyles.remove)}>\n <CloseGlyph {...stylex.props(chipStyles.removeGlyph)} />\n </RACButton> : null}\n </>;\n}\n\n/**\n * A labelled set of chips, one or more of which can be chosen, each of which\n * can be removed. Selection is React Aria's: set `selectionMode` to `single`\n * or `multiple` and pass `selectedKeys` with `onSelectionChange` to control\n * it, or `defaultSelectedKeys` to let it keep its own.\n *\n * ```tsx\n * <ChipGroup label=\"Label\" selectionMode=\"multiple\" onRemove={remove}>\n * <ChipGroup.Chip id=\"first\">First item</ChipGroup.Chip>\n * </ChipGroup>\n * ```\n *\n * Give the group `onRemove` and each chip draws a close target. The arrow\n * keys move between chips, so a set of many is one tab stop rather than many.\n *\n * A chip that toggles nothing else is Chip; this is for a set that shares a\n * value.\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 */\n// What each chip calls its close target. A context rather than a prop on the\n// chip, since it is the group's decision and repeating it on every chip is\n// how the two drift.\nconst RemoveLabelContext = createContext('Remove');\n\n// Hoisted so neither is a new object on every render.\nconst LABEL_STATE_VALID = {\n isInvalid: false\n};\nconst LABEL_STATE_INVALID = {\n isInvalid: true\n};\nfunction ChipGroup<T extends object = object>({\n children,\n description,\n error,\n items,\n label,\n removeLabel = 'Remove',\n renderEmptyState,\n ...props\n}: ChipGroupProps<T>) {\n const invalid = invalidFrom(error);\n return <RACTagGroup {...props} {...mergeStyles(stylex.props(groupStyles.root), props)}>\n {/* React Aria's tag group has no disabled state of its own — a chip is\n disabled through the group's `disabledKeys` — so the label follows\n validity alone. */}\n <FieldLabel state={invalid ? LABEL_STATE_INVALID : LABEL_STATE_VALID} variant=\"group\">\n {label}\n </FieldLabel>\n <RemoveLabelContext value={removeLabel}>\n <RACTagList<T> items={items} renderEmptyState={renderEmptyState} className=\"x9f619 x78zum5 x1a02dak x126z3so x1t137rt\">\n {children}\n </RACTagList>\n </RemoveLabelContext>\n <FieldMessage description={description} error={error} inset={false} />\n </RACTagGroup>;\n}\n\n/**\n * One chip. Give every chip an `id` — that is the key selection and removal\n * are reported by.\n */\nfunction ChipGroupChip({\n children,\n ...props\n}: ChipGroupChipProps) {\n const removeLabel = useContext(RemoveLabelContext);\n return <RACTag textValue={props.textValue ?? textOf(children)} {...props} {...mergeStatefulStyles(chipPropsFor, props)}>\n {chipContent(children, removeLabel)}\n </RACTag>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// chip's state comes from the render state React Aria hands its className.\n// Disabled is applied last so it wins over both containers, and StyleX\n// replaces a property whole, so it takes their hover branches with it.\nfunction chipPropsFor(state: TagRenderProps) {\n return stylex.props(chipStyles.base, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, state.isDisabled && chipStyles.disabled, state.isDisabled && (state.isSelected ? chipStyles.disabledSelected : chipStyles.disabledUnselected));\n}\n\n// What the chip is worth as text, for the typeahead React Aria drives from a\n// chip's words and for what a screen reader announces. It reads it off the\n// children when they are a string and finds nothing when they are not — and a\n// chip here is always an element once it can be removed. So a plain-string\n// label becomes the text value, and anything else has to say what it is worth\n// through `textValue`.\nfunction textOf(children: ReactNode) {\n return typeof children === 'string' ? children : undefined;\n}\nChipGroup.Chip = ChipGroupChip;\nexport type { ChipGroupChipProps, ChipGroupProps };\nexport default ChipGroup;"],"mappings":";;;;;;;;;;;;;;AA8FA,SAAS0C,YAAYV,UAAqBO,aAAqB;CAC7D,QAAQI,UAA0B,qBAAA,YAAA,EAAA,UAAA;EAC7BxB,UAAUwB,MAAMC,UAAU;EAC1BZ;EACAW,MAAME,iBAAiB,oBAAC,QAAD;GAAW,cAAYN;GAAa,MAAK;GAAS,GAAI/B,MAAaY,WAAW2B,MAAM;GACxG,UAAA,oBAAC,YAAD,EAAY,GAAIvC,MAAaY,WAAW4B,WAAW,EAAE,CAAA;EAC5C,CAAA,IAAI;CACnB,EAAA,CAAA;AACJ;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMC,qBAAqBxC,cAAc,QAAQ;AAGjD,MAAMyC,oBAAoB,EACxBC,WAAW,MACb;AACA,MAAMC,sBAAsB,EAC1BD,WAAW,KACb;AACA,SAAAE,UAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAzB;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAqB;CAAA,IAAAC;CAAA,IAAArB;CAAA,IAAAC;CAAA,IAA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|
+
{"version":3,"file":"index.js","names":["ReactNode","TagGroupProps","RACTagGroupProps","TagListProps","RACTagListProps","TagProps","RACTagProps","TagRenderProps","stylex","createContext","useContext","Button","RACButton","Tag","RACTag","TagGroup","RACTagGroup","TagList","RACTagList","chipGlyph","chipStyles","FieldLabel","FieldMessage","invalidFrom","groupStyles","CloseGlyph","focus","mergeStatefulStyles","mergeStyles","spacing","ChipGroupChipProps","Omit","children","className","style","ChipGroupProps","description","error","label","removeLabel","Pick","T","chipContent","state","isSelected","allowsRemoving","props","remove","removeGlyph","RemoveLabelContext","LABEL_STATE_VALID","isInvalid","LABEL_STATE_INVALID","ChipGroup","t0","$","_c","T0","invalid","items","renderEmptyState","t1","t2","t3","t4","t5","t6","t7","t8","t9","undefined","root","ChipGroupChip","textValue","textOf","chipPropsFor","base","ring","selected","unselected","isDisabled","disabled","disabledSelected","disabledUnselected","Chip"],"sources":["../../../src/components/chip-group/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { TagGroupProps as RACTagGroupProps, TagListProps as RACTagListProps, TagProps as RACTagProps, TagRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tag as RACTag, TagGroup as RACTagGroup, TagList as RACTagList } from 'react-aria-components';\nimport { chipGlyph } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { CloseGlyph } from '../../glyphs';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { spacing } from '../../tokens/design.tokens.stylex';\n\n// The chips page's filter and input chips as a set: one or more chosen from a\n// row, each one removable. The pill is the chip module's in `src/chip`,\n// shared with the standalone Chip, so the two cannot drift; what is here is\n// the group around them.\n//\n// Three things it adds over a row of Chips.\n//\n// **It is a group, not a row of buttons.** React Aria's `TagGroup` names the\n// set, describes it, reports it invalid as a whole, and moves between its\n// chips with the arrow keys rather than making each one a tab stop — which\n// is what a set of a dozen filters needs. The label, the supporting line and\n// the error are the field chrome's, so a group reads like the fields beside\n// it, exactly as CheckboxGroup and RadioGroup do.\n//\n// **A chip can be removed.** Give the group `onRemove` and each chip draws\n// the page's trailing close target, an 18dp glyph in a target of its own so a\n// press there removes rather than toggles. Backspace and Delete remove the\n// focused chip too, which is React Aria's. A chosen chip's check sits at the\n// other end, so a chip that is both selected and removable carries one glyph\n// on each side of its label.\n//\n// **Selection is the group's, not each chip's.** `selectionMode` and\n// `selectedKeys` live on the group, so a set that chooses one of its chips\n// and a set that chooses several are the same component with a different\n// word. A chip on its own that toggles nothing else is still Chip.\n//\n// One thing is worth knowing about how this maps onto React Aria. A chip's\n// text value is read off its children and found only when they are a plain\n// string, and a chip here is always an element — the label sits beside a\n// close target. So a plain-string label is passed through as the text value,\n// which is what typeahead and a screen reader's announcement are made of;\n// see ListBox.Item, where the same thing bit.\n\ntype ChipGroupChipProps = Omit<RACTagProps, 'children' | 'className' | 'style'> & {\n /** The chip's label. */\n children?: ReactNode;\n /** A function may compute the class from the chip's render state. */\n className?: RACTagProps['className'];\n /** A function may compute the style from the chip's render state. */\n style?: RACTagProps['style'];\n};\ntype ChipGroupProps<T extends object = object> = {\n /** The chips, each with an `id` 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 and `aria-invalid` both\n * 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 chips\n * with no name is a row a screen reader cannot introduce.\n */\n label: string;\n /**\n * What the close target on each chip is called, for a screen reader. React\n * Aria adds the chip's own label after it, so this is the verb rather than\n * the whole phrase — \"Remove\" becomes \"Remove First item\".\n * @default 'Remove'\n */\n removeLabel?: string;\n} & Omit<RACTagGroupProps, 'children'> & Pick<RACTagListProps<T>, 'items' | 'renderEmptyState'>;\n\n// What the chip draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The check is the chip module's, so a chip in a group and a chip on its own\n// draw the same one. The close target is drawn only where the group allows\n// removing, which React Aria reports rather than the call site saying so on\n// every chip.\nfunction chipContent(children: ReactNode, removeLabel: string) {\n return (state: TagRenderProps) => <>\n {chipGlyph(state.isSelected)}\n {children}\n {state.allowsRemoving ? <RACButton aria-label={removeLabel} slot=\"remove\" {...stylex.props(chipStyles.remove)}>\n <CloseGlyph {...stylex.props(chipStyles.removeGlyph)} />\n </RACButton> : null}\n </>;\n}\n\n/**\n * A labelled set of chips, one or more of which can be chosen, each of which\n * can be removed. Selection is React Aria's: set `selectionMode` to `single`\n * or `multiple` and pass `selectedKeys` with `onSelectionChange` to control\n * it, or `defaultSelectedKeys` to let it keep its own.\n *\n * ```tsx\n * <ChipGroup label=\"Label\" selectionMode=\"multiple\" onRemove={remove}>\n * <ChipGroup.Chip id=\"first\">First item</ChipGroup.Chip>\n * </ChipGroup>\n * ```\n *\n * Give the group `onRemove` and each chip draws a close target. The arrow\n * keys move between chips, so a set of many is one tab stop rather than many.\n *\n * A chip that toggles nothing else is Chip; this is for a set that shares a\n * value.\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 */\n// What each chip calls its close target. A context rather than a prop on the\n// chip, since it is the group's decision and repeating it on every chip is\n// how the two drift.\nconst RemoveLabelContext = createContext('Remove');\n\n// Hoisted so neither is a new object on every render.\nconst LABEL_STATE_VALID = {\n isInvalid: false\n};\nconst LABEL_STATE_INVALID = {\n isInvalid: true\n};\nfunction ChipGroup<T extends object = object>({\n children,\n description,\n error,\n items,\n label,\n removeLabel = 'Remove',\n renderEmptyState,\n ...props\n}: ChipGroupProps<T>) {\n const invalid = invalidFrom(error);\n return <RACTagGroup {...props} {...mergeStyles(stylex.props(groupStyles.root), props)}>\n {/* React Aria's tag group has no disabled state of its own — a chip is\n disabled through the group's `disabledKeys` — so the label follows\n validity alone. */}\n <FieldLabel state={invalid ? LABEL_STATE_INVALID : LABEL_STATE_VALID} variant=\"group\">\n {label}\n </FieldLabel>\n <RemoveLabelContext value={removeLabel}>\n <RACTagList<T> items={items} renderEmptyState={renderEmptyState} className=\"x9f619 x78zum5 x1a02dak x126z3so x1t137rt\">\n {children}\n </RACTagList>\n </RemoveLabelContext>\n <FieldMessage description={description} error={error} inset={false} />\n </RACTagGroup>;\n}\n\n/**\n * One chip. Give every chip an `id` — that is the key selection and removal\n * are reported by.\n */\nfunction ChipGroupChip({\n children,\n ...props\n}: ChipGroupChipProps) {\n const removeLabel = useContext(RemoveLabelContext);\n return <RACTag textValue={props.textValue ?? textOf(children)} {...props} {...mergeStatefulStyles(chipPropsFor, props)}>\n {chipContent(children, removeLabel)}\n </RACTag>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// chip's state comes from the render state React Aria hands its className.\n// Disabled is applied last so it wins over both containers, and StyleX\n// replaces a property whole, so it takes their hover branches with it.\nfunction chipPropsFor(state: TagRenderProps) {\n return stylex.props(chipStyles.base, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, state.isDisabled && chipStyles.disabled, state.isDisabled && (state.isSelected ? chipStyles.disabledSelected : chipStyles.disabledUnselected));\n}\n\n// What the chip is worth as text, for the typeahead React Aria drives from a\n// chip's words and for what a screen reader announces. It reads it off the\n// children when they are a string and finds nothing when they are not — and a\n// chip here is always an element once it can be removed. So a plain-string\n// label becomes the text value, and anything else has to say what it is worth\n// through `textValue`.\nfunction textOf(children: ReactNode) {\n return typeof children === 'string' ? children : undefined;\n}\nChipGroup.Chip = ChipGroupChip;\nexport type { ChipGroupChipProps, ChipGroupProps };\nexport default ChipGroup;"],"mappings":";;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AAM,MAAAN,EAAA,OAAAO,MAAAP,EAAA,OAAAQ,IAAA;EADhCC,KAAA,oBAAC,IAAD;GAAmB,WAAAH;GAAmC,GAAMf;GAAK,GAAMgB;GACzEC,UAAAA;EADS,CAAA;EAEHR,EAAA,KAAAE;EAAAF,EAAA,KAAAT;EAAAS,EAAA,KAAAM;EAAAN,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;EAAAR,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,OAFJS;AAEI;AAOb,SAASW,aAAahC,OAAuB;CAC3C,OAAOnC,MAAaY,WAAWwD,MAAMlD,MAAMmD,MAAMlC,MAAMC,aAAaxB,WAAW0D,WAAW1D,WAAW2D,YAAYpC,MAAMqC,cAAc5D,WAAW6D,UAAUtC,MAAMqC,eAAerC,MAAMC,aAAaxB,WAAW8D,mBAAmB9D,WAAW+D,mBAAmB;AAChQ;AAQA,SAAST,OAAO1C,UAAqB;CACnC,OAAO,OAAOA,aAAa,WAAWA,WAAWsC,KAAAA;AACnD;AACAjB,UAAU+B,OAAOZ"}
|
|
@@ -7,7 +7,14 @@ type ColorFieldProps$1 = Omit<ColorFieldProps, 'children' | 'className' | 'style
|
|
|
7
7
|
className?: ColorFieldProps['className'];
|
|
8
8
|
/** Supporting text under the field. */
|
|
9
9
|
description?: string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* The message shown instead of the description, which also marks the
|
|
12
|
+
* field invalid.
|
|
13
|
+
*
|
|
14
|
+
* Outside a `Form` the message line arrives with the message, so the
|
|
15
|
+
* field grows when this does and moves what is under it. A `Form` holds
|
|
16
|
+
* that space from the start; so does a permanent `description`.
|
|
17
|
+
*/
|
|
11
18
|
error?: string;
|
|
12
19
|
/**
|
|
13
20
|
* Whether the label floats into the box's top once the field holds a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","ColorFieldProps","RACColorFieldProps","stylex","ColorField","RACColorField","FieldVariant","FieldBox","FieldInput","FieldMessage","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","Omit","className","description","error","floatingLabel","label","leadingIcon","style","trailingIcon","variant","t0","$","_c","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","t7","t8","t9"],"sources":["../../../src/components/color-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ColorFieldProps as RACColorFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorField as RACColorField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A colour typed rather than picked. React Aria renders a plain text input\n// holding the colour's own notation, so this is the text fields page's box\n// with nothing added — the same chrome `TextField` draws through, which is\n// what makes a colour field on a form the same shape as the field beside\n// it.\n//\n// Two things are worth knowing about what it holds.\n//\n// **`channel` turns it from a colour into a number.** Without one the field\n// holds the whole colour — `#6750A4` — and parses what is typed. With one\n// it holds that channel alone, as a number a reader can step, which is what\n// a picker's three boxes beside a plane are.\n//\n// **A swatch is the natural leading icon.** The field's value is a colour,\n// and the chrome already has a slot for something at the box's leading end;\n// passing a `ColorSwatch` there is what makes the field show the colour it\n// holds. It is left to the call site rather than drawn here, since a field\n// inside a picker sits beside a swatch already.\n\ntype ColorFieldProps = Omit<RACColorFieldProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACColorFieldProps['className'];\n /** Supporting text under the field. */\n description?: string;\n
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","ColorFieldProps","RACColorFieldProps","stylex","ColorField","RACColorField","FieldVariant","FieldBox","FieldInput","FieldMessage","fieldStyles","invalidFrom","useFieldValidationBehavior","mergeStatefulStyles","Omit","className","description","error","floatingLabel","label","leadingIcon","style","trailingIcon","variant","t0","$","_c","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","t7","t8","t9"],"sources":["../../../src/components/color-field/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ColorFieldProps as RACColorFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorField as RACColorField } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A colour typed rather than picked. React Aria renders a plain text input\n// holding the colour's own notation, so this is the text fields page's box\n// with nothing added — the same chrome `TextField` draws through, which is\n// what makes a colour field on a form the same shape as the field beside\n// it.\n//\n// Two things are worth knowing about what it holds.\n//\n// **`channel` turns it from a colour into a number.** Without one the field\n// holds the whole colour — `#6750A4` — and parses what is typed. With one\n// it holds that channel alone, as a number a reader can step, which is what\n// a picker's three boxes beside a plane are.\n//\n// **A swatch is the natural leading icon.** The field's value is a colour,\n// and the chrome already has a slot for something at the box's leading end;\n// passing a `ColorSwatch` there is what makes the field show the colour it\n// holds. It is left to the call site rather than drawn here, since a field\n// inside a picker sits beside a swatch already.\n\ntype ColorFieldProps = Omit<RACColorFieldProps, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACColorFieldProps['className'];\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\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 floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. A\n * `ColorSwatch` shows the value. An icon drawn in `em` takes that size\n * from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACColorFieldProps['style'];\n /**\n * An icon at the box's trailing end, in the page's 24dp size. An icon\n * drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n};\n\n/**\n * A colour typed into a field. The value is React Aria's — pass `value` with\n * `onChange` to control it, or `defaultValue` — as a CSS colour string or a\n * `Color` from `parseColor`, which this package re-exports.\n *\n * ```tsx\n * <ColorField defaultValue=\"#6750A4\" label=\"Label\" />\n * ```\n *\n * Without `channel` the field holds the whole colour and parses what is\n * typed; with one it holds that channel alone as a number. `colorSpace`\n * decides which space a channel belongs to, the same as on `ColorSlider`.\n *\n * The box, label and message are the field chrome in `src/field`, shared\n * with every other field. The call site's `className` and `style` land on\n * the field as a whole, which is the element a layout positions.\n */\nfunction ColorField({\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: ColorFieldProps) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACColorField isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel} label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldInput />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACColorField>;\n}\nexport type { ColorFieldProps };\nexport default ColorField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuFA,SAAAI,aAAAoB,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAoB,MAAA,EAAAV,aAAAC,OAAAC,eAAAS,IAAAC,YAAAC,IAAAV,OAAAC,aAAAE,cAAAC,SAAAO,IAAA,GAAAC,YAAAP;CAGlB,MAAAN,gBAAAS,OAAAK,KAAAA,IAAA,OAAAL;CACA,MAAAC,aAAA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QAAAW,MAAAX,EAAA,QAAAgB,MAAAhB,EAAA,QAAAiB,MAAAjB,EAAA,QAAAQ,oBAAA;EAJrDU,KAAA,qBAAC,IAAD;GAA2Bf;GAAuB,WAAAO;GAAwCF;GAAkB,GAAMF;GAAK,GAAMK;GAA7H,UAAA,CACHK,IAGAC,EAJiB;;EAKHjB,EAAA,MAAAS;EAAAT,EAAA,MAAAG;EAAAH,EAAA,MAAAM;EAAAN,EAAA,MAAAU;EAAAV,EAAA,MAAAW;EAAAX,EAAA,MAAAgB;EAAAhB,EAAA,MAAAiB;EAAAjB,EAAA,MAAAQ;EAAAR,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,OALXkB;AAKW"}
|
|
@@ -20,6 +20,10 @@ type ComboBoxProps$1<T extends object = object, M extends ComboBoxSelectionMode
|
|
|
20
20
|
* The problem with the current value, in words. Its presence is what puts
|
|
21
21
|
* the field in its error state — the message, the red underline, and
|
|
22
22
|
* `aria-invalid` all follow from it.
|
|
23
|
+
*
|
|
24
|
+
* Outside a `Form` the message line arrives with the message, so the
|
|
25
|
+
* field grows when this does and moves what is under it. A `Form` holds
|
|
26
|
+
* that space from the start; so does a permanent `description`.
|
|
23
27
|
*/
|
|
24
28
|
error?: string;
|
|
25
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ReactNode","ComboBoxProps","RACComboBoxProps","stylex","useContext","useRef","ComboBoxStateContext","Button","RACButton","ComboBox","RACComboBox","ComboBoxValue","RACComboBoxValue","Popover","RACPopover","FieldVariant","FieldBox","FieldInput","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","focus","mergeStatefulStyles","overlay","colors","motion","radii","spacing","ListBox","TOGGLE","styles","list","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","toggle","kGNEyG","kZKoxP","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kjj79g","kmVPX3","ComboBoxSelectionMode","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","M","ChosenValues","$","_c","t0","Symbol","for","t1","isDisabled","t2","t3","props","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","t7","selectionMode","t8","t9","t10","t11","popup","t12","t13","t14","ComboToggle","state","ring","0","className","1","isOpen"],"sources":["../../../src/components/combo-box/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ComboBoxProps as RACComboBoxProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { ComboBoxStateContext, Button as RACButton, ComboBox as RACComboBox, ComboBoxValue as RACComboBoxValue, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } 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 text fields page's autocomplete text field: a text field that filters a\n// list as it is typed. Everything above the list is the field chrome in\n// `src/field` — the same box, label, supporting line and error treatment\n// every other field draws — and the list is ListBox on the shared overlay\n// surface, positioned and sized against the box exactly as Select's is.\n//\n// It is Select's shape with two differences.\n//\n// The control is a real input, so the box is not a press target — typing has\n// to reach the input — and only the chevron at the end opens the list. That\n// is what the page draws too: an autocomplete text field is a text field,\n// with a button on it.\n//\n// And the field is an element tree rather than a function of React Aria's\n// render state, which every other component here writes. React Aria builds a\n// combo box's collection by walking its children for options, and a function\n// is opaque to that walk: with one, the collection is empty until the list\n// has been opened, so a `defaultSelectedKey` resolves to no text and the\n// field starts blank. What needed the render state — whether the list is\n// open — reads the combo box's own state from context instead.\n//\n// Two more things are this component's own.\n//\n// **Filtering is React Aria's, and stays theirs.** `defaultFilter` takes a\n// predicate, and the package re-exports `useFilter` for a locale-aware one;\n// `items` with `useAsyncList` is how a list that is fetched rather than\n// listed gets in. None of that is wrapped, because a combo box's whole job\n// is which options it shows and a wrapper would be a second place to decide\n// it.\n//\n// **A value that is not in the list is allowed or refused, not corrected.**\n// `allowsCustomValue` is React Aria's, and with it off the input reverts to\n// the last chosen option on blur rather than keeping text that means nothing.\n//\n// Choosing more than one is `selectionMode=\"multiple\"`, which draws the\n// chosen options before the input through React Aria's `ComboBoxValue`. For\n// a field that draws each of them as a removable chip, the coverage plan has\n// TokenField.\n\n// Hoisted so it is not a new element on every render, which is what\n// react-perf's jsx-no-jsx-as-prop is after.\nconst TOGGLE = <ComboToggle />;\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 toggle: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xxk0z11\",\n kaIpWk: \"x16fbrrb\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kzqmXN: \"xvy4d1p\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n }\n};\ntype ComboBoxProps<T extends object = object, M extends ComboBoxSelectionMode = 'single'> = {\n /**\n * Where to portal the list. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the list renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\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 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. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a combo box with\n * no 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<RACComboBoxProps<T, M>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n// React Aria's combo box takes its own two-value selection mode rather than\n// the collection-wide one, which also has `none`; that type is local to its\n// module, so the two values are named again here.\ntype ComboBoxSelectionMode = 'multiple' | 'single';\n\n/**\n * The chosen options, drawn before the input when more than one may be\n * chosen. The chrome's `FieldValue` is the styled element and React Aria's\n * `ComboBoxValue` sits inside it, as it does in Select.\n */\nfunction ChosenValues() {\n return <FieldValue className=\"x2lah0s\">\n <RACComboBoxValue />\n </FieldValue>;\n}\n\n/**\n * A labelled text field that filters a list as it is typed. Its value is\n * React Aria's: pass `value` with `onChange` to control which option is\n * chosen, `inputValue` with `onInputChange` to control the text, or the\n * `default` forms of either to let it keep its own. React Aria's older\n * `selectedKey` names are deprecated and are left out of this component's\n * props rather than passed through.\n *\n * ```tsx\n * <ComboBox\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 * Filtering is React Aria's: `defaultFilter` takes a predicate, `useFilter`\n * is re-exported for a locale-aware one, and `items` with `useAsyncList`\n * feeds a list that is fetched rather than listed. `allowsCustomValue` lets\n * the field keep text that matches nothing.\n *\n * The box, label, input, 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 ComboBox<T extends object = object, M extends ComboBoxSelectionMode = 'single'>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: ComboBoxProps<T, M>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from: the box, not the\n // button inside it, which is a 24dp icon.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACComboBox<T, M> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `ComboBox` does not, so the box\n // is told outright or its label and its underline never turn.\n isDisabled={isDisabled} isInvalid={invalidFrom(error)} label={label} leading={leadingIcon} ref={boxRef} trailing={TOGGLE} variant={variant}>\n {props.selectionMode === 'multiple' ? <ChosenValues /> : null}\n <FieldInput />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover 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} {...stylex.props(overlay.popup, styles.list)}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </RACComboBox>;\n}\n\n/**\n * The button that opens the list. It takes its press behaviour from the\n * combo box around it through React Aria's button context, and reads whether\n * the list is open from the combo box's state rather than from a render prop\n * — the whole field cannot be a render function, since React Aria builds its\n * collection by walking the children and a function is opaque to that walk.\n */\nfunction ComboToggle() {\n const state = useContext(ComboBoxStateContext);\n return <RACButton {...stylex.props(styles.toggle, focus.ring)}>\n <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!(state?.isOpen === true) << 0]} />\n </RACButton>;\n}\nexport type { ComboBoxProps, ComboBoxSelectionMode };\nexport default ComboBox;"],"mappings":";;;;;;;;;;;;;AAyDA,MAAMgC,SAAS,oBAAC,aAAD,CAAY,CAAA;AAC3B,MAAMC,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRV,QAAQ;EACRW,QAAQ;EACRV,QAAQ;EACRW,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRd,QAAQ;EACRe,QAAQ;EACRC,QAAQ;EACRV,OAAO;CACT;AACF;;;;;;AA6DA,SAAAwB,eAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAF,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EACSF,KAAA,oBAAC,YAAD;GAAsB,WAAA;GACzB,UAAA,oBAAC,eAAD,CAAiB,CAAA;EADH,CAAA;EAEHF,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,OAFRE;AAEQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCjB,SAAA7D,WAAA6D,IAAA;CAAA,MAAAF,IAAAC,EAAA,EAAA;CAAyF,MAAA,EAAAd,WAAAE,aAAAC,OAAAC,eAAAc,IAAAC,YAAAC,IAAAf,OAAAC,aA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;CAAA,OAAAA,KAAAR,EAAA;CAAA,OATPQ;AASO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ReactNode","ComboBoxProps","RACComboBoxProps","stylex","useContext","useRef","ComboBoxStateContext","Button","RACButton","ComboBox","RACComboBox","ComboBoxValue","RACComboBoxValue","Popover","RACPopover","FieldVariant","FieldBox","FieldInput","FieldMessage","FieldValue","fieldStyles","invalidFrom","useFieldValidationBehavior","ChevronEndGlyph","focus","mergeStatefulStyles","overlay","colors","motion","radii","spacing","ListBox","TOGGLE","styles","list","kWkggS","kaIpWk","kzqmXN","kskxy","ks0D6T","k7Eaqz","kORKVm","k8WAf4","$$css","toggle","kGNEyG","kZKoxP","kMzoRj","kB7OPa","kMwMTN","kkrTdU","k1xSpc","kjj79g","kmVPX3","ComboBoxSelectionMode","container","Element","description","error","floatingLabel","label","leadingIcon","options","variant","Omit","T","M","ChosenValues","$","_c","t0","Symbol","for","t1","isDisabled","t2","t3","props","undefined","validationBehavior","boxRef","T0","t4","t5","root","t6","t7","selectionMode","t8","t9","t10","t11","popup","t12","t13","t14","ComboToggle","state","ring","0","className","1","isOpen"],"sources":["../../../src/components/combo-box/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport type { ComboBoxProps as RACComboBoxProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext, useRef } from 'react';\nimport { ComboBoxStateContext, Button as RACButton, ComboBox as RACComboBox, ComboBoxValue as RACComboBoxValue, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldInput, FieldMessage, FieldValue } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } 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 text fields page's autocomplete text field: a text field that filters a\n// list as it is typed. Everything above the list is the field chrome in\n// `src/field` — the same box, label, supporting line and error treatment\n// every other field draws — and the list is ListBox on the shared overlay\n// surface, positioned and sized against the box exactly as Select's is.\n//\n// It is Select's shape with two differences.\n//\n// The control is a real input, so the box is not a press target — typing has\n// to reach the input — and only the chevron at the end opens the list. That\n// is what the page draws too: an autocomplete text field is a text field,\n// with a button on it.\n//\n// And the field is an element tree rather than a function of React Aria's\n// render state, which every other component here writes. React Aria builds a\n// combo box's collection by walking its children for options, and a function\n// is opaque to that walk: with one, the collection is empty until the list\n// has been opened, so a `defaultSelectedKey` resolves to no text and the\n// field starts blank. What needed the render state — whether the list is\n// open — reads the combo box's own state from context instead.\n//\n// Two more things are this component's own.\n//\n// **Filtering is React Aria's, and stays theirs.** `defaultFilter` takes a\n// predicate, and the package re-exports `useFilter` for a locale-aware one;\n// `items` with `useAsyncList` is how a list that is fetched rather than\n// listed gets in. None of that is wrapped, because a combo box's whole job\n// is which options it shows and a wrapper would be a second place to decide\n// it.\n//\n// **A value that is not in the list is allowed or refused, not corrected.**\n// `allowsCustomValue` is React Aria's, and with it off the input reverts to\n// the last chosen option on blur rather than keeping text that means nothing.\n//\n// Choosing more than one is `selectionMode=\"multiple\"`, which draws the\n// chosen options before the input through React Aria's `ComboBoxValue`. For\n// a field that draws each of them as a removable chip, the coverage plan has\n// TokenField.\n\n// Hoisted so it is not a new element on every render, which is what\n// react-perf's jsx-no-jsx-as-prop is after.\nconst TOGGLE = <ComboToggle />;\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 toggle: {\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xxk0z11\",\n kaIpWk: \"x16fbrrb\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kzqmXN: \"xvy4d1p\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n $$css: true\n }\n};\ntype ComboBoxProps<T extends object = object, M extends ComboBoxSelectionMode = 'single'> = {\n /**\n * Where to portal the list. Defaults to the end of `<body>`, which is\n * right for an app that sets its StyleX theme on `:root`. An app that\n * scopes the theme to a subtree has to point this at an element inside it,\n * or the list renders outside the theme and falls back to the tokens'\n * `prefers-color-scheme` default.\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 holds a value. `false` keeps it small at the top in\n * every state.\n * @default true\n */\n floatingLabel?: boolean;\n /**\n * What the field is for. Required rather than optional: a combo box with\n * no 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<RACComboBoxProps<T, M>, 'children' | 'defaultSelectedKey' | 'isInvalid' | 'onSelectionChange' | 'selectedKey' | 'validationBehavior'>;\n\n// React Aria's combo box takes its own two-value selection mode rather than\n// the collection-wide one, which also has `none`; that type is local to its\n// module, so the two values are named again here.\ntype ComboBoxSelectionMode = 'multiple' | 'single';\n\n/**\n * The chosen options, drawn before the input when more than one may be\n * chosen. The chrome's `FieldValue` is the styled element and React Aria's\n * `ComboBoxValue` sits inside it, as it does in Select.\n */\nfunction ChosenValues() {\n return <FieldValue className=\"x2lah0s\">\n <RACComboBoxValue />\n </FieldValue>;\n}\n\n/**\n * A labelled text field that filters a list as it is typed. Its value is\n * React Aria's: pass `value` with `onChange` to control which option is\n * chosen, `inputValue` with `onInputChange` to control the text, or the\n * `default` forms of either to let it keep its own. React Aria's older\n * `selectedKey` names are deprecated and are left out of this component's\n * props rather than passed through.\n *\n * ```tsx\n * <ComboBox\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 * Filtering is React Aria's: `defaultFilter` takes a predicate, `useFilter`\n * is re-exported for a locale-aware one, and `items` with `useAsyncList`\n * feeds a list that is fetched rather than listed. `allowsCustomValue` lets\n * the field keep text that matches nothing.\n *\n * The box, label, input, 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 ComboBox<T extends object = object, M extends ComboBoxSelectionMode = 'single'>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n options,\n variant = 'filled',\n ...props\n}: ComboBoxProps<T, M>) {\n const validationBehavior = useFieldValidationBehavior();\n // What the list is anchored to and takes its width from: the box, not the\n // button inside it, which is a 24dp icon.\n const boxRef = useRef<HTMLDivElement>(null);\n return <RACComboBox<T, M> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // React Aria's `TextField` hands its group the field's disabled and\n // invalid state through context; its `ComboBox` does not, so the box\n // is told outright or its label and its underline never turn.\n isDisabled={isDisabled} isInvalid={invalidFrom(error)} label={label} leading={leadingIcon} ref={boxRef} trailing={TOGGLE} variant={variant}>\n {props.selectionMode === 'multiple' ? <ChosenValues /> : null}\n <FieldInput />\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover 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} {...stylex.props(overlay.popup, styles.list)}>\n <ListBox>{options}</ListBox>\n </RACPopover>\n </RACComboBox>;\n}\n\n/**\n * The button that opens the list. It takes its press behaviour from the\n * combo box around it through React Aria's button context, and reads whether\n * the list is open from the combo box's state rather than from a render prop\n * — the whole field cannot be a render function, since React Aria builds its\n * collection by walking the children and a function is opaque to that walk.\n */\nfunction ComboToggle() {\n const state = useContext(ComboBoxStateContext);\n return <RACButton {...stylex.props(styles.toggle, focus.ring)}>\n <ChevronEndGlyph {...{\n 0: {\n className: \"xxk0z11 xvy4d1p x1iffjtl xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"xxk0z11 xvy4d1p xkzkux9 x11xpdln xpc4ca7 x9tu13d\"\n }\n }[!!(state?.isOpen === true) << 0]} />\n </RACButton>;\n}\nexport type { ComboBoxProps, ComboBoxSelectionMode };\nexport default ComboBox;"],"mappings":";;;;;;;;;;;;;AAyDA,MAAMgC,SAAS,oBAAC,aAAD,CAAY,CAAA;AAC3B,MAAMC,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,QAAQ;EACNC,QAAQ;EACRV,QAAQ;EACRW,QAAQ;EACRV,QAAQ;EACRW,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC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ACzBF,KAAAnE,MAAa8B,OAAMW,QAASpB,MAAK0E,IAAK;EAAC9B,EAAA,KAAAE;CAAA,OAAAA,KAAAF,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAG,OAAAC,IAAA,2BAAA,GAAA;EACpCC,KAAA;GAAA0B,GAClB,EAAAC,WACU,oDACb;GAACC,GACE,EAAAD,WACU,mDACb;EACF;EAAChC,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAPsB,MAAAO,KAAAF,GAOrB,CAAC,EAAEwB,OAAKK,WAAa,SAAS;CAAE,IAAA1B;CAAA,IAAAR,EAAA,OAAAO,IAAA;EAR7BC,KAAA,oBAAC,QAAD;GAAU,GAAKN;GAClB,UAAA,oBAAC,iBAAD,EAAgB,GAAKK,GAOW,CAAA;EARnB,CAAA;EASHP,EAAA,KAAAO;EAAAP,EAAA,KAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OATPQ;AASO"}
|
|
@@ -22,6 +22,18 @@ type CopyFieldProps = {
|
|
|
22
22
|
* built-in would be a trap rather than a convenience.
|
|
23
23
|
*/
|
|
24
24
|
onCopied?: (value: string) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Called when the write is refused, with whatever was thrown. The button
|
|
27
|
+
* stays at rest, so this is the only signal an app gets — reach for it to
|
|
28
|
+
* fall back, by selecting the value or saying so in a snackbar.
|
|
29
|
+
*
|
|
30
|
+
* Takes the error where `onCopied` takes the value, because the value is
|
|
31
|
+
* the one thing the call site already has and the reason is the one thing
|
|
32
|
+
* it does not. The two refusals throw differently: outside a secure
|
|
33
|
+
* context `navigator.clipboard` is not there at all, and where the
|
|
34
|
+
* permission is denied it is a `DOMException`.
|
|
35
|
+
*/
|
|
36
|
+
onCopyFailed?: (error: unknown) => void;
|
|
25
37
|
/** The text shown, and the text copied. */
|
|
26
38
|
value: string;
|
|
27
39
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
@@ -29,8 +41,12 @@ type CopyFieldProps = {
|
|
|
29
41
|
* A value to be read and taken away — a repository URL, a token, a command.
|
|
30
42
|
* It shows the value in the mono face and copies it on request, confirming
|
|
31
43
|
* on the button itself.
|
|
44
|
+
*
|
|
45
|
+
* A write refused — outside a secure context, or where the permission is
|
|
46
|
+
* denied — leaves the button at rest rather than confirming, and calls
|
|
47
|
+
* `onCopyFailed`.
|
|
32
48
|
*/
|
|
33
|
-
declare function CopyField({ copiedLabel, copyLabel, onCopied, value, ...props }: CopyFieldProps): import("react").JSX.Element;
|
|
49
|
+
declare function CopyField({ copiedLabel, copyLabel, onCopied, onCopyFailed, value, ...props }: CopyFieldProps): import("react").JSX.Element;
|
|
34
50
|
//#endregion
|
|
35
51
|
export { type CopyFieldProps, CopyField as default };
|
|
36
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -10,10 +10,14 @@ const COPIED_RESET_MS = 2e3;
|
|
|
10
10
|
* A value to be read and taken away — a repository URL, a token, a command.
|
|
11
11
|
* It shows the value in the mono face and copies it on request, confirming
|
|
12
12
|
* on the button itself.
|
|
13
|
+
*
|
|
14
|
+
* A write refused — outside a secure context, or where the permission is
|
|
15
|
+
* denied — leaves the button at rest rather than confirming, and calls
|
|
16
|
+
* `onCopyFailed`.
|
|
13
17
|
*/
|
|
14
18
|
function CopyField(t0) {
|
|
15
|
-
const $ = c(
|
|
16
|
-
const { copiedLabel: t1, copyLabel: t2, onCopied, value, ...props } = t0;
|
|
19
|
+
const $ = c(32);
|
|
20
|
+
const { copiedLabel: t1, copyLabel: t2, onCopied, onCopyFailed, value, ...props } = t0;
|
|
17
21
|
const copiedLabel = t1 === void 0 ? "Copied" : t1;
|
|
18
22
|
const copyLabel = t2 === void 0 ? "Copy" : t2;
|
|
19
23
|
const [copied, setCopied] = useState(false);
|
|
@@ -33,13 +37,15 @@ function CopyField(t0) {
|
|
|
33
37
|
}
|
|
34
38
|
useEffect(t3, t4);
|
|
35
39
|
let t5;
|
|
36
|
-
if ($[2] !== onCopied || $[3] !== value) {
|
|
40
|
+
if ($[2] !== onCopied || $[3] !== onCopyFailed || $[4] !== value) {
|
|
37
41
|
t5 = () => {
|
|
38
42
|
const write = async () => {
|
|
39
43
|
try {
|
|
40
44
|
await navigator.clipboard.writeText(value);
|
|
41
|
-
} catch {
|
|
45
|
+
} catch (t6) {
|
|
46
|
+
const error = t6;
|
|
42
47
|
setCopied(false);
|
|
48
|
+
onCopyFailed?.(error);
|
|
43
49
|
return;
|
|
44
50
|
}
|
|
45
51
|
setCopied(true);
|
|
@@ -52,98 +58,99 @@ function CopyField(t0) {
|
|
|
52
58
|
write();
|
|
53
59
|
};
|
|
54
60
|
$[2] = onCopied;
|
|
55
|
-
$[3] =
|
|
56
|
-
$[4] =
|
|
57
|
-
|
|
61
|
+
$[3] = onCopyFailed;
|
|
62
|
+
$[4] = value;
|
|
63
|
+
$[5] = t5;
|
|
64
|
+
} else t5 = $[5];
|
|
58
65
|
const handleCopy = t5;
|
|
59
66
|
const t6 = mergeStyles({ className: "x6s0dn4 x14s9m32 x1fwvt7v x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x78zum5 x126z3so xmqoko8 x18fpw6u" }, props);
|
|
60
67
|
let t7;
|
|
61
|
-
if ($[
|
|
68
|
+
if ($[6] !== value) {
|
|
62
69
|
t7 = /* @__PURE__ */ jsx("span", {
|
|
63
70
|
className: "x1iyjqo2 x1b35g6e xeuugli",
|
|
64
71
|
children: /* @__PURE__ */ jsx(Code, { children: value })
|
|
65
72
|
});
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
} else t7 = $[
|
|
73
|
+
$[6] = value;
|
|
74
|
+
$[7] = t7;
|
|
75
|
+
} else t7 = $[7];
|
|
69
76
|
const t8 = copied || void 0;
|
|
70
77
|
let t9;
|
|
71
|
-
if ($[
|
|
78
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
72
79
|
t9 = {
|
|
73
80
|
0: { className: "x15r89dc" },
|
|
74
81
|
1: { className: "x15r89dc xlshs6z" }
|
|
75
82
|
};
|
|
76
|
-
$[
|
|
77
|
-
} else t9 = $[
|
|
83
|
+
$[8] = t9;
|
|
84
|
+
} else t9 = $[8];
|
|
78
85
|
const t10 = t9[!!copied << 0];
|
|
79
86
|
let t11;
|
|
80
|
-
if ($[
|
|
87
|
+
if ($[9] !== copyLabel || $[10] !== t10 || $[11] !== t8) {
|
|
81
88
|
t11 = /* @__PURE__ */ jsx("span", {
|
|
82
89
|
"aria-hidden": t8,
|
|
83
90
|
...t10,
|
|
84
91
|
children: copyLabel
|
|
85
92
|
});
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
} else t11 = $[
|
|
93
|
+
$[9] = copyLabel;
|
|
94
|
+
$[10] = t10;
|
|
95
|
+
$[11] = t8;
|
|
96
|
+
$[12] = t11;
|
|
97
|
+
} else t11 = $[12];
|
|
91
98
|
const t12 = !copied || void 0;
|
|
92
99
|
let t13;
|
|
93
|
-
if ($[
|
|
100
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
94
101
|
t13 = {
|
|
95
102
|
0: { className: "x15r89dc" },
|
|
96
103
|
1: { className: "x15r89dc xlshs6z" }
|
|
97
104
|
};
|
|
98
|
-
$[
|
|
99
|
-
} else t13 = $[
|
|
105
|
+
$[13] = t13;
|
|
106
|
+
} else t13 = $[13];
|
|
100
107
|
const t14 = t13[!!!copied << 0];
|
|
101
108
|
let t15;
|
|
102
|
-
if ($[
|
|
109
|
+
if ($[14] !== copiedLabel || $[15] !== t12 || $[16] !== t14) {
|
|
103
110
|
t15 = /* @__PURE__ */ jsx("span", {
|
|
104
111
|
"aria-hidden": t12,
|
|
105
112
|
...t14,
|
|
106
113
|
children: copiedLabel
|
|
107
114
|
});
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
} else t15 = $[
|
|
115
|
+
$[14] = copiedLabel;
|
|
116
|
+
$[15] = t12;
|
|
117
|
+
$[16] = t14;
|
|
118
|
+
$[17] = t15;
|
|
119
|
+
} else t15 = $[17];
|
|
113
120
|
let t16;
|
|
114
|
-
if ($[
|
|
121
|
+
if ($[18] !== t11 || $[19] !== t15) {
|
|
115
122
|
t16 = /* @__PURE__ */ jsxs("span", {
|
|
116
123
|
className: "xrvj5dj x1o2pa38",
|
|
117
124
|
children: [t11, t15]
|
|
118
125
|
});
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
} else t16 = $[
|
|
126
|
+
$[18] = t11;
|
|
127
|
+
$[19] = t15;
|
|
128
|
+
$[20] = t16;
|
|
129
|
+
} else t16 = $[20];
|
|
123
130
|
let t17;
|
|
124
|
-
if ($[
|
|
131
|
+
if ($[21] !== handleCopy || $[22] !== t16) {
|
|
125
132
|
t17 = /* @__PURE__ */ jsx(Button, {
|
|
126
133
|
onClick: handleCopy,
|
|
127
134
|
size: "xs",
|
|
128
135
|
variant: "text",
|
|
129
136
|
children: t16
|
|
130
137
|
});
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
} else t17 = $[
|
|
138
|
+
$[21] = handleCopy;
|
|
139
|
+
$[22] = t16;
|
|
140
|
+
$[23] = t17;
|
|
141
|
+
} else t17 = $[23];
|
|
135
142
|
const t18 = copied ? copiedLabel : "";
|
|
136
143
|
let t19;
|
|
137
|
-
if ($[
|
|
144
|
+
if ($[24] !== t18) {
|
|
138
145
|
t19 = /* @__PURE__ */ jsx("output", {
|
|
139
146
|
className: "xjm9jq1 x1hyvwdk x1i1rx1s xb3r6kr x10l6tqk xuxw1ft",
|
|
140
147
|
children: t18
|
|
141
148
|
});
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
} else t19 = $[
|
|
149
|
+
$[24] = t18;
|
|
150
|
+
$[25] = t19;
|
|
151
|
+
} else t19 = $[25];
|
|
145
152
|
let t20;
|
|
146
|
-
if ($[
|
|
153
|
+
if ($[26] !== props || $[27] !== t17 || $[28] !== t19 || $[29] !== t6 || $[30] !== t7) {
|
|
147
154
|
t20 = /* @__PURE__ */ jsxs("div", {
|
|
148
155
|
...props,
|
|
149
156
|
...t6,
|
|
@@ -153,13 +160,13 @@ function CopyField(t0) {
|
|
|
153
160
|
t19
|
|
154
161
|
]
|
|
155
162
|
});
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
} else t20 = $[
|
|
163
|
+
$[26] = props;
|
|
164
|
+
$[27] = t17;
|
|
165
|
+
$[28] = t19;
|
|
166
|
+
$[29] = t6;
|
|
167
|
+
$[30] = t7;
|
|
168
|
+
$[31] = t20;
|
|
169
|
+
} else t20 = $[31];
|
|
163
170
|
return t20;
|
|
164
171
|
}
|
|
165
172
|
//#endregion
|