@react-spectrum/s2 3.0.0-nightly-56da82e3e-250212 → 3.0.0-nightly-260eb700f-250213
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/Accordion.cjs +3 -3
- package/dist/Accordion.css +2 -2
- package/dist/Accordion.mjs +3 -3
- package/dist/ActionBar.cjs +47 -47
- package/dist/ActionBar.css +51 -51
- package/dist/ActionBar.mjs +47 -47
- package/dist/ActionButton.cjs +97 -97
- package/dist/ActionButton.css +96 -96
- package/dist/ActionButton.mjs +97 -97
- package/dist/ActionButtonGroup.cjs +11 -11
- package/dist/ActionButtonGroup.css +9 -9
- package/dist/ActionButtonGroup.mjs +11 -11
- package/dist/AlertDialog.cjs +3 -3
- package/dist/AlertDialog.css +3 -3
- package/dist/AlertDialog.mjs +3 -3
- package/dist/Avatar.cjs +17 -17
- package/dist/Avatar.css +14 -14
- package/dist/Avatar.mjs +17 -17
- package/dist/AvatarGroup.cjs +100 -100
- package/dist/AvatarGroup.css +34 -34
- package/dist/AvatarGroup.mjs +100 -100
- package/dist/Badge.cjs +68 -92
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +92 -164
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +68 -92
- package/dist/Badge.mjs.map +1 -1
- package/dist/Breadcrumbs.cjs +115 -115
- package/dist/Breadcrumbs.css +89 -89
- package/dist/Breadcrumbs.mjs +115 -115
- package/dist/Button.cjs +152 -236
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +165 -309
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +152 -236
- package/dist/Button.mjs.map +1 -1
- package/dist/ButtonGroup.cjs +19 -19
- package/dist/ButtonGroup.css +15 -15
- package/dist/ButtonGroup.mjs +19 -19
- package/dist/Card.cjs +261 -264
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css +198 -210
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +261 -264
- package/dist/Card.mjs.map +1 -1
- package/dist/CardView.cjs +15 -15
- package/dist/CardView.css +18 -18
- package/dist/CardView.mjs +15 -15
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +2 -2
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +73 -124
- package/dist/Checkbox.cjs.map +1 -1
- package/dist/Checkbox.css +81 -201
- package/dist/Checkbox.css.map +1 -1
- package/dist/Checkbox.mjs +73 -124
- package/dist/Checkbox.mjs.map +1 -1
- package/dist/CheckboxGroup.cjs +49 -49
- package/dist/CheckboxGroup.css +41 -41
- package/dist/CheckboxGroup.mjs +49 -49
- package/dist/ClearButton.cjs +15 -15
- package/dist/ClearButton.css +17 -17
- package/dist/ClearButton.mjs +15 -15
- package/dist/CloseButton.cjs +35 -35
- package/dist/CloseButton.css +33 -33
- package/dist/CloseButton.mjs +35 -35
- package/dist/ColorArea.cjs +22 -22
- package/dist/ColorArea.css +15 -15
- package/dist/ColorArea.mjs +22 -22
- package/dist/ColorField.cjs +38 -38
- package/dist/ColorField.css +32 -32
- package/dist/ColorField.mjs +38 -38
- package/dist/ColorHandle.cjs +21 -27
- package/dist/ColorHandle.cjs.map +1 -1
- package/dist/ColorHandle.css +45 -93
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs +21 -27
- package/dist/ColorHandle.mjs.map +1 -1
- package/dist/ColorSlider.cjs +52 -52
- package/dist/ColorSlider.css +51 -51
- package/dist/ColorSlider.mjs +52 -52
- package/dist/ColorSwatch.cjs +24 -27
- package/dist/ColorSwatch.cjs.map +1 -1
- package/dist/ColorSwatch.css +29 -41
- package/dist/ColorSwatch.css.map +1 -1
- package/dist/ColorSwatch.mjs +24 -27
- package/dist/ColorSwatch.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +23 -23
- package/dist/ColorSwatchPicker.css +48 -60
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +23 -23
- package/dist/ColorWheel.cjs +22 -22
- package/dist/ColorWheel.css +16 -16
- package/dist/ColorWheel.mjs +22 -22
- package/dist/ComboBox.cjs +80 -80
- package/dist/ComboBox.css +88 -88
- package/dist/ComboBox.mjs +80 -80
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +38 -38
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/CustomDialog.cjs +31 -31
- package/dist/CustomDialog.css +25 -25
- package/dist/CustomDialog.mjs +31 -31
- package/dist/Dialog.cjs +17 -17
- package/dist/Dialog.css +64 -64
- package/dist/Dialog.mjs +17 -17
- package/dist/Disclosure.cjs +108 -111
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +112 -124
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +108 -111
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/Divider.cjs +26 -26
- package/dist/Divider.css +16 -16
- package/dist/Divider.mjs +26 -26
- package/dist/DropZone.cjs +47 -56
- package/dist/DropZone.cjs.map +1 -1
- package/dist/DropZone.css +56 -80
- package/dist/DropZone.css.map +1 -1
- package/dist/DropZone.mjs +47 -56
- package/dist/DropZone.mjs.map +1 -1
- package/dist/Field.cjs +150 -204
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +150 -246
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +150 -204
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.cjs +10 -10
- package/dist/Form.css +9 -9
- package/dist/Form.mjs +10 -10
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +72 -72
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +134 -134
- package/dist/IllustratedMessage.css +69 -69
- package/dist/IllustratedMessage.mjs +134 -134
- package/dist/Image.cjs +12 -12
- package/dist/Image.css +13 -13
- package/dist/Image.mjs +12 -12
- package/dist/InlineAlert.cjs +77 -104
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +77 -149
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +77 -104
- package/dist/InlineAlert.mjs.map +1 -1
- package/dist/Link.cjs +31 -31
- package/dist/Link.css +30 -30
- package/dist/Link.mjs +31 -31
- package/dist/Menu.cjs +269 -269
- package/dist/Menu.css +155 -155
- package/dist/Menu.mjs +269 -269
- package/dist/Meter.cjs +85 -85
- package/dist/Meter.css +81 -81
- package/dist/Meter.mjs +85 -85
- package/dist/Modal.cjs +48 -48
- package/dist/Modal.css +46 -46
- package/dist/Modal.mjs +48 -48
- package/dist/NumberField.cjs +115 -115
- package/dist/NumberField.css +114 -114
- package/dist/NumberField.mjs +115 -115
- package/dist/Picker.cjs +177 -195
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css +164 -224
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +177 -195
- package/dist/Picker.mjs.map +1 -1
- package/dist/Popover.cjs +79 -85
- package/dist/Popover.cjs.map +1 -1
- package/dist/Popover.css +65 -89
- package/dist/Popover.css.map +1 -1
- package/dist/Popover.mjs +79 -85
- package/dist/Popover.mjs.map +1 -1
- package/dist/ProgressBar.cjs +98 -98
- package/dist/ProgressBar.css +92 -92
- package/dist/ProgressBar.mjs +98 -98
- package/dist/ProgressCircle.cjs +17 -17
- package/dist/ProgressCircle.css +15 -15
- package/dist/ProgressCircle.mjs +17 -17
- package/dist/Provider.cjs +4 -4
- package/dist/Provider.css +5 -5
- package/dist/Provider.mjs +4 -4
- package/dist/Radio.cjs +80 -152
- package/dist/Radio.cjs.map +1 -1
- package/dist/Radio.css +96 -240
- package/dist/Radio.css.map +1 -1
- package/dist/Radio.mjs +80 -152
- package/dist/Radio.mjs.map +1 -1
- package/dist/RadioGroup.cjs +47 -47
- package/dist/RadioGroup.css +41 -41
- package/dist/RadioGroup.mjs +47 -47
- package/dist/SearchField.cjs +42 -42
- package/dist/SearchField.css +47 -47
- package/dist/SearchField.mjs +42 -42
- package/dist/SegmentedControl.cjs +89 -101
- package/dist/SegmentedControl.cjs.map +1 -1
- package/dist/SegmentedControl.css +92 -140
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +89 -101
- package/dist/SegmentedControl.mjs.map +1 -1
- package/dist/Slider.cjs +196 -229
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css +149 -221
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs +196 -229
- package/dist/Slider.mjs.map +1 -1
- package/dist/StatusLight.cjs +56 -56
- package/dist/StatusLight.css +59 -59
- package/dist/StatusLight.mjs +56 -56
- package/dist/Switch.cjs +74 -107
- package/dist/Switch.cjs.map +1 -1
- package/dist/Switch.css +69 -141
- package/dist/Switch.css.map +1 -1
- package/dist/Switch.mjs +74 -107
- package/dist/Switch.mjs.map +1 -1
- package/dist/TableView.cjs +253 -280
- package/dist/TableView.cjs.map +1 -1
- package/dist/TableView.css +163 -199
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +253 -280
- package/dist/TableView.mjs.map +1 -1
- package/dist/Tabs.cjs +108 -108
- package/dist/Tabs.css +81 -81
- package/dist/Tabs.mjs +108 -108
- package/dist/TabsPicker.cjs +105 -105
- package/dist/TabsPicker.css +111 -111
- package/dist/TabsPicker.mjs +105 -105
- package/dist/TagGroup.cjs +148 -148
- package/dist/TagGroup.css +134 -134
- package/dist/TagGroup.mjs +148 -148
- package/dist/TextField.cjs +59 -59
- package/dist/TextField.css +62 -62
- package/dist/TextField.mjs +59 -59
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +12 -12
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.cjs +57 -60
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css +71 -83
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +57 -60
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs +199 -248
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css +131 -175
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs +202 -248
- package/dist/TreeView.mjs.map +1 -1
- package/dist/main.cjs +1 -0
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +2 -2
- package/dist/module.mjs.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/icons/Skeleton.cjs +2 -2
- package/icons/Skeleton.css +5 -5
- package/icons/Skeleton.mjs +2 -2
- package/package.json +21 -21
- package/src/TreeView.tsx +66 -134
- package/src/index.ts +1 -1
- package/style/__tests__/style-macro.test.js +18 -18
- package/style/dist/spectrum-theme.cjs +10 -20
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +10 -20
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +0 -4
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +11 -19
package/dist/Field.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC2EiB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyBiC;;;;EAgC9B;;;;EAAA;;;;EAyBK;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwEuB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0BzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA8DH;;;;EAAA;;;;EAWF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA7PD;EAoLM;;;;EAAA;;;;;AA3J2B;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IA2J3B;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAyEL;;;;;;AApOgC;EAAA;IAAA;;;;IAyDzB;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAgKL;;;;;;AAhKK;EAAA;IAAA","sources":["18dc2c1262434547","packages/@react-spectrum/s2/src/Field.tsx"],"sourcesContent":["@import \"5451fbb197e5f742\";\n@import \"4c96520903762dec\";\n@import \"dec1ed3fcae5e2a0\";\n@import \"7f2f9d36b130a0fc\";\n@import \"d78be91638043334\";\n@import \"1287e36439fa04a9\";\n@import \"ae2e3271ad92acb6\";\n@import \"657c7598b6083861\";\n@import \"227d65898b7fdc0f\";\n@import \"312761f7202cddfd\";\n@import \"bf76db767f0fbbad\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {Alignment, DOMRef, NecessityIndicator} from '@react-types/shared';\nimport AsteriskIcon from '../ui-icons/Asterisk';\nimport {baseColor, focusRing, fontRelative, style} from '../style' with {type: 'macro'};\nimport {CenterBaseline, centerBaseline, centerBaselineBefore} from './CenterBaseline';\nimport {composeRenderProps, FieldError, FieldErrorProps, Group, GroupProps, Label, LabelProps, Provider, Input as RACInput, InputProps as RACInputProps, Text} from 'react-aria-components';\nimport {ContextualHelpContext} from './ContextualHelp';\nimport {fieldInput, fieldLabel, StyleProps, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ForwardedRef, forwardRef, ReactNode} from 'react';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface FieldLabelProps extends Omit<LabelProps, 'className' | 'style' | 'children'>, StyleProps {\n isDisabled?: boolean,\n isRequired?: boolean,\n size?: 'S' | 'M' | 'L' | 'XL',\n necessityIndicator?: NecessityIndicator,\n labelAlign?: Alignment,\n labelPosition?: 'top' | 'side',\n includeNecessityIndicatorInAccessibilityName?: boolean,\n staticColor?: 'white' | 'black' | 'auto',\n contextualHelp?: ReactNode,\n isQuiet?: boolean,\n children?: ReactNode\n}\n\nexport const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isDisabled,\n isRequired,\n size = 'M',\n necessityIndicator = 'icon',\n includeNecessityIndicatorInAccessibilityName = false,\n labelAlign,\n labelPosition,\n staticColor,\n contextualHelp,\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = '',\n ...labelProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let contextualHelpId = useId();\n let fallbackLabelPropsId = useId();\n if (contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n if (!props.children) {\n return null;\n }\n\n return (\n <div\n className={style({\n gridArea: 'label',\n display: 'inline',\n textAlign: {\n labelAlign: {\n start: 'start',\n end: 'end'\n }\n },\n paddingBottom: {\n labelPosition: {\n top: '--field-gap'\n }\n },\n contain: {\n labelPosition: {\n top: 'inline-size'\n },\n isQuiet: 'none'\n }\n })({labelAlign, labelPosition, isQuiet})}>\n <Label\n {...labelProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style(fieldLabel())({labelPosition, isDisabled, size, isStaticColor: !!staticColor}), props.styles)}>\n {props.children}\n {(isRequired || necessityIndicator === 'label') && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n {necessityIndicator === 'icon' &&\n <AsteriskIcon\n size={size === 'S' ? 'M' : size}\n className={style({\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })}\n aria-label={includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined} />\n }\n {necessityIndicator === 'label' &&\n /* The necessity label is hidden to screen readers if the field is required because\n * aria-required is set on the field in that case. That will already be announced,\n * so no need to duplicate it here. If optional, we do want it to be announced here.\n */\n <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n {isRequired ? stringFormatter.format('label.(required)') : stringFormatter.format('label.(optional)')}\n </span>\n }\n </span>\n )}\n </Label>\n {contextualHelp && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0\n })}>\n <ContextualHelpContext.Provider\n value={{\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,\n size: (size === 'L' || size === 'XL') ? 'S' : 'XS'\n }}>\n {contextualHelp}\n </ContextualHelpContext.Provider>\n </CenterBaseline>\n </span>\n )}\n </div>\n );\n});\n\ninterface FieldGroupProps extends Omit<GroupProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n size?: 'S' | 'M' | 'L' | 'XL',\n children: ReactNode,\n styles?: StyleString\n}\n\nconst fieldGroupStyles = style({\n ...focusRing(),\n ...fieldInput(),\n display: 'flex',\n alignItems: 'center',\n height: 'control',\n boxSizing: 'border-box',\n paddingX: 'edge-to-text',\n font: 'control',\n borderRadius: 'control',\n borderWidth: 2,\n borderStyle: 'solid',\n transition: 'default',\n borderColor: {\n default: baseColor('gray-300'),\n isInvalid: 'negative',\n isFocusWithin: {\n default: 'gray-900',\n isInvalid: 'negative-1000',\n forcedColors: 'Highlight'\n },\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n backgroundColor: 'gray-25',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <Group\n ref={ref}\n {...props}\n onPointerDown={(e) => {\n // Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)\n if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n onPointerUp={e => {\n if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + ' ' + centerBaselineBefore + mergeStyles(\n fieldGroupStyles({...renderProps, size: props.size || 'M'}),\n props.styles\n )} />\n );\n});\n\nexport interface InputProps extends Omit<RACInputProps, 'className' | 'style'>, StyleProps {}\n\nexport const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {\n let {UNSAFE_className = '', UNSAFE_style, styles, ...otherProps} = props;\n return (\n <RACInput\n {...otherProps}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style({\n padding: 0,\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n width: 'full',\n outlineStyle: 'none',\n borderStyle: 'none',\n truncate: true\n }), styles)} />\n );\n});\n\ninterface HelpTextProps extends FieldErrorProps {\n size?: 'S' | 'M' | 'L' | 'XL',\n isDisabled?: boolean,\n isInvalid?: boolean, // TODO: export FieldErrorContext from RAC to get this.\n description?: ReactNode,\n showErrorIcon?: boolean\n}\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative',\n isDisabled: 'disabled'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {\n let domDescriptionRef = useDOMRef(props.descriptionRef || null);\n let domErrorRef = useDOMRef(props.errorRef || null);\n\n if (!props.isInvalid && props.description) {\n return (\n <Text\n slot=\"description\"\n ref={domDescriptionRef}\n className={helpTextStyles({size: props.size || 'M', isDisabled: props.isDisabled})}>\n {props.description}\n </Text>\n );\n }\n\n return (\n <FieldError\n {...props}\n ref={domErrorRef}\n className={renderProps => helpTextStyles({...renderProps, size: props.size || 'M', isDisabled: props.isDisabled})}>\n {composeRenderProps(props.children, (children, {validationErrors}) => (<>\n {props.showErrorIcon &&\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n }\n <span>{children || validationErrors.join(' ')}</span>\n </>))}\n </FieldError>\n );\n}\n\nexport function FieldErrorIcon(props: {isDisabled?: boolean}) {\n return (\n <Provider\n values={[\n [IconContext, {\n render: centerBaseline({\n slot: 'icon',\n styles: style({\n order: 0,\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'negative',\n forcedColors: 'ButtonText'\n }\n }\n })}),\n styles: style({\n size: fontRelative(20),\n marginStart: 'text-to-visual',\n marginEnd: fontRelative(-2),\n flexShrink: 0\n })\n }]\n ]}>\n {!props.isDisabled && <AlertIcon />}\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"Field.css.map"}
|
|
1
|
+
{"mappings":"AC2EiB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAyBiC;;;;EAgC9B;;;;EAAA;;;;EAyBK;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwEuB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0BzB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA8DH;;;;EAAA;;;;EAWF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA7PD;EAoLM;;;;EAAA;;;;;AA3J2B;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IA2J3B;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAyEL;;;;;;AApOgC;EAAA;IAAA;;;;IAyDzB;;;;IAAA;;;;IAAA;;;;IAgKL;;;;;;AAhKK;EAAA;IAAA","sources":["18dc2c1262434547","packages/@react-spectrum/s2/src/Field.tsx"],"sourcesContent":["@import \"5451fbb197e5f742\";\n@import \"4c96520903762dec\";\n@import \"dec1ed3fcae5e2a0\";\n@import \"7f2f9d36b130a0fc\";\n@import \"d78be91638043334\";\n@import \"1287e36439fa04a9\";\n@import \"ae2e3271ad92acb6\";\n@import \"657c7598b6083861\";\n@import \"227d65898b7fdc0f\";\n@import \"312761f7202cddfd\";\n@import \"bf76db767f0fbbad\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {Alignment, DOMRef, NecessityIndicator} from '@react-types/shared';\nimport AsteriskIcon from '../ui-icons/Asterisk';\nimport {baseColor, focusRing, fontRelative, style} from '../style' with {type: 'macro'};\nimport {CenterBaseline, centerBaseline, centerBaselineBefore} from './CenterBaseline';\nimport {composeRenderProps, FieldError, FieldErrorProps, Group, GroupProps, Label, LabelProps, Provider, Input as RACInput, InputProps as RACInputProps, Text} from 'react-aria-components';\nimport {ContextualHelpContext} from './ContextualHelp';\nimport {fieldInput, fieldLabel, StyleProps, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ForwardedRef, forwardRef, ReactNode} from 'react';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface FieldLabelProps extends Omit<LabelProps, 'className' | 'style' | 'children'>, StyleProps {\n isDisabled?: boolean,\n isRequired?: boolean,\n size?: 'S' | 'M' | 'L' | 'XL',\n necessityIndicator?: NecessityIndicator,\n labelAlign?: Alignment,\n labelPosition?: 'top' | 'side',\n includeNecessityIndicatorInAccessibilityName?: boolean,\n staticColor?: 'white' | 'black' | 'auto',\n contextualHelp?: ReactNode,\n isQuiet?: boolean,\n children?: ReactNode\n}\n\nexport const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isDisabled,\n isRequired,\n size = 'M',\n necessityIndicator = 'icon',\n includeNecessityIndicatorInAccessibilityName = false,\n labelAlign,\n labelPosition,\n staticColor,\n contextualHelp,\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = '',\n ...labelProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let contextualHelpId = useId();\n let fallbackLabelPropsId = useId();\n if (contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n if (!props.children) {\n return null;\n }\n\n return (\n <div\n className={style({\n gridArea: 'label',\n display: 'inline',\n textAlign: {\n labelAlign: {\n start: 'start',\n end: 'end'\n }\n },\n paddingBottom: {\n labelPosition: {\n top: '--field-gap'\n }\n },\n contain: {\n labelPosition: {\n top: 'inline-size'\n },\n isQuiet: 'none'\n }\n })({labelAlign, labelPosition, isQuiet})}>\n <Label\n {...labelProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style(fieldLabel())({labelPosition, isDisabled, size, isStaticColor: !!staticColor}), props.styles)}>\n {props.children}\n {(isRequired || necessityIndicator === 'label') && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n {necessityIndicator === 'icon' &&\n <AsteriskIcon\n size={size === 'S' ? 'M' : size}\n className={style({\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })}\n aria-label={includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined} />\n }\n {necessityIndicator === 'label' &&\n /* The necessity label is hidden to screen readers if the field is required because\n * aria-required is set on the field in that case. That will already be announced,\n * so no need to duplicate it here. If optional, we do want it to be announced here.\n */\n <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n {isRequired ? stringFormatter.format('label.(required)') : stringFormatter.format('label.(optional)')}\n </span>\n }\n </span>\n )}\n </Label>\n {contextualHelp && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0\n })}>\n <ContextualHelpContext.Provider\n value={{\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,\n size: (size === 'L' || size === 'XL') ? 'S' : 'XS'\n }}>\n {contextualHelp}\n </ContextualHelpContext.Provider>\n </CenterBaseline>\n </span>\n )}\n </div>\n );\n});\n\ninterface FieldGroupProps extends Omit<GroupProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n size?: 'S' | 'M' | 'L' | 'XL',\n children: ReactNode,\n styles?: StyleString\n}\n\nconst fieldGroupStyles = style({\n ...focusRing(),\n ...fieldInput(),\n display: 'flex',\n alignItems: 'center',\n height: 'control',\n boxSizing: 'border-box',\n paddingX: 'edge-to-text',\n font: 'control',\n borderRadius: 'control',\n borderWidth: 2,\n borderStyle: 'solid',\n transition: 'default',\n borderColor: {\n default: baseColor('gray-300'),\n isInvalid: 'negative',\n isFocusWithin: {\n default: 'gray-900',\n isInvalid: 'negative-1000',\n forcedColors: 'Highlight'\n },\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n backgroundColor: 'gray-25',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <Group\n ref={ref}\n {...props}\n onPointerDown={(e) => {\n // Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)\n if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n onPointerUp={e => {\n if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + ' ' + centerBaselineBefore + mergeStyles(\n fieldGroupStyles({...renderProps, size: props.size || 'M'}),\n props.styles\n )} />\n );\n});\n\nexport interface InputProps extends Omit<RACInputProps, 'className' | 'style'>, StyleProps {}\n\nexport const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {\n let {UNSAFE_className = '', UNSAFE_style, styles, ...otherProps} = props;\n return (\n <RACInput\n {...otherProps}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style({\n padding: 0,\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n width: 'full',\n outlineStyle: 'none',\n borderStyle: 'none',\n truncate: true\n }), styles)} />\n );\n});\n\ninterface HelpTextProps extends FieldErrorProps {\n size?: 'S' | 'M' | 'L' | 'XL',\n isDisabled?: boolean,\n isInvalid?: boolean, // TODO: export FieldErrorContext from RAC to get this.\n description?: ReactNode,\n showErrorIcon?: boolean\n}\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative',\n isDisabled: 'disabled'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {\n let domDescriptionRef = useDOMRef(props.descriptionRef || null);\n let domErrorRef = useDOMRef(props.errorRef || null);\n\n if (!props.isInvalid && props.description) {\n return (\n <Text\n slot=\"description\"\n ref={domDescriptionRef}\n className={helpTextStyles({size: props.size || 'M', isDisabled: props.isDisabled})}>\n {props.description}\n </Text>\n );\n }\n\n return (\n <FieldError\n {...props}\n ref={domErrorRef}\n className={renderProps => helpTextStyles({...renderProps, size: props.size || 'M', isDisabled: props.isDisabled})}>\n {composeRenderProps(props.children, (children, {validationErrors}) => (<>\n {props.showErrorIcon &&\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n }\n <span>{children || validationErrors.join(' ')}</span>\n </>))}\n </FieldError>\n );\n}\n\nexport function FieldErrorIcon(props: {isDisabled?: boolean}) {\n return (\n <Provider\n values={[\n [IconContext, {\n render: centerBaseline({\n slot: 'icon',\n styles: style({\n order: 0,\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'negative',\n forcedColors: 'ButtonText'\n }\n }\n })}),\n styles: style({\n size: fontRelative(20),\n marginStart: 'text-to-visual',\n marginEnd: fontRelative(-2),\n flexShrink: 0\n })\n }]\n ]}>\n {!props.isDisabled && <AlertIcon />}\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"Field.css.map"}
|
package/dist/Field.mjs
CHANGED
|
@@ -51,16 +51,16 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
51
51
|
return /*#__PURE__*/ (0, $7A6HT$jsxs)("div", {
|
|
52
52
|
className: function anonymous(props) {
|
|
53
53
|
let rules = " .";
|
|
54
|
+
rules += ' __b-hr3t0p';
|
|
55
|
+
rules += ' __c-hr3t0p';
|
|
56
|
+
rules += ' __d-hr3t0p';
|
|
54
57
|
rules += ' __e-hr3t0p';
|
|
55
|
-
rules += '
|
|
56
|
-
rules += '
|
|
57
|
-
rules += '
|
|
58
|
-
rules += '
|
|
59
|
-
if (props.
|
|
60
|
-
else if (props.
|
|
61
|
-
if (props.labelPosition === "top") rules += ' I-1inj1bc';
|
|
62
|
-
if (props.isQuiet) rules += ' __qa';
|
|
63
|
-
else if (props.labelPosition === "top") rules += ' __qe';
|
|
58
|
+
rules += ' _0c';
|
|
59
|
+
if (props.labelAlign === "end") rules += ' _kc';
|
|
60
|
+
else if (props.labelAlign === "start") rules += ' _ka';
|
|
61
|
+
if (props.labelPosition === "top") rules += ' F-1inj1bc';
|
|
62
|
+
if (props.isQuiet) rules += ' __na';
|
|
63
|
+
else if (props.labelPosition === "top") rules += ' __ne';
|
|
64
64
|
return rules;
|
|
65
65
|
}({
|
|
66
66
|
labelAlign: labelAlign,
|
|
@@ -74,33 +74,33 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
74
74
|
style: UNSAFE_style,
|
|
75
75
|
className: UNSAFE_className + (0, $feb886035e0d4633$export$e618dc39ac9ad607)(function anonymous(props) {
|
|
76
76
|
let rules = " .";
|
|
77
|
-
rules += '
|
|
78
|
-
rules += '
|
|
79
|
-
rules += '
|
|
80
|
-
rules += '
|
|
81
|
-
rules += '
|
|
82
|
-
rules += '
|
|
83
|
-
rules += '
|
|
84
|
-
rules += '
|
|
77
|
+
rules += ' _d-bc1l9oh';
|
|
78
|
+
rules += ' _d-1uotwbwg';
|
|
79
|
+
rules += ' _d-eo0c6sf';
|
|
80
|
+
rules += ' _d-enzzrge';
|
|
81
|
+
rules += ' _d-enzykdd';
|
|
82
|
+
rules += ' _d-enzwzjc';
|
|
83
|
+
rules += ' _d-enzrfpb';
|
|
84
|
+
rules += ' _da';
|
|
85
85
|
if (props.size === "XL") {
|
|
86
|
-
rules += '
|
|
87
|
-
rules += '
|
|
86
|
+
rules += ' _ebj';
|
|
87
|
+
rules += ' _ei';
|
|
88
88
|
} else if (props.size === "L") {
|
|
89
|
-
rules += '
|
|
90
|
-
rules += '
|
|
89
|
+
rules += ' _ebh';
|
|
90
|
+
rules += ' _eg';
|
|
91
91
|
} else if (props.size === "S") {
|
|
92
|
-
rules += '
|
|
93
|
-
rules += '
|
|
92
|
+
rules += ' _ebd';
|
|
93
|
+
rules += ' _ec';
|
|
94
94
|
} else if (props.size === "XS") {
|
|
95
|
-
rules += '
|
|
96
|
-
rules += '
|
|
95
|
+
rules += ' _ebb';
|
|
96
|
+
rules += ' _ea';
|
|
97
97
|
} else {
|
|
98
|
-
rules += '
|
|
99
|
-
rules += '
|
|
98
|
+
rules += ' _ebf';
|
|
99
|
+
rules += ' _ee';
|
|
100
100
|
}
|
|
101
|
-
rules += '
|
|
102
|
-
rules += '
|
|
103
|
-
rules += '
|
|
101
|
+
rules += ' _fb';
|
|
102
|
+
rules += ' _g-1x99dlob';
|
|
103
|
+
rules += ' _ga';
|
|
104
104
|
rules += ' aa_____K';
|
|
105
105
|
if (props.isStaticColor) rules += ' a_____G';
|
|
106
106
|
else if (props.isDisabled) rules += ' aj';
|
|
@@ -110,7 +110,7 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
110
110
|
else if (props.isHovered) rules += ' an';
|
|
111
111
|
else rules += ' am';
|
|
112
112
|
}
|
|
113
|
-
rules += '
|
|
113
|
+
rules += ' __Ib';
|
|
114
114
|
return rules;
|
|
115
115
|
}({
|
|
116
116
|
labelPosition: labelPosition,
|
|
@@ -121,12 +121,12 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
121
121
|
children: [
|
|
122
122
|
props.children,
|
|
123
123
|
(isRequired || necessityIndicator === 'label') && /*#__PURE__*/ (0, $7A6HT$jsxs)("span", {
|
|
124
|
-
className: "
|
|
124
|
+
className: " _qb",
|
|
125
125
|
children: [
|
|
126
126
|
"\xa0",
|
|
127
127
|
necessityIndicator === 'icon' && /*#__PURE__*/ (0, $7A6HT$jsx)((0, $8373af657584cab2$export$2e2bcd8739ae039), {
|
|
128
128
|
size: size === 'S' ? 'M' : size,
|
|
129
|
-
className: " -
|
|
129
|
+
className: " -rwx0fg_e-b",
|
|
130
130
|
"aria-label": includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined
|
|
131
131
|
}),
|
|
132
132
|
necessityIndicator === 'label' && /* The necessity label is hidden to screen readers if the field is required because
|
|
@@ -141,11 +141,11 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
141
141
|
]
|
|
142
142
|
}),
|
|
143
143
|
contextualHelp && /*#__PURE__*/ (0, $7A6HT$jsxs)("span", {
|
|
144
|
-
className: "
|
|
144
|
+
className: " _qb",
|
|
145
145
|
children: [
|
|
146
146
|
"\xa0",
|
|
147
147
|
/*#__PURE__*/ (0, $7A6HT$jsx)((0, $1f4b04be3f24aae3$export$768dac55bb57081d), {
|
|
148
|
-
styles: "
|
|
148
|
+
styles: " _0e ko",
|
|
149
149
|
children: /*#__PURE__*/ (0, $7A6HT$jsx)((0, $8e176595bc49ca3f$export$41b9afaaba473494).Provider, {
|
|
150
150
|
value: {
|
|
151
151
|
id: contextualHelpId,
|
|
@@ -162,61 +162,61 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
162
162
|
});
|
|
163
163
|
const $9afd80978c252040$var$fieldGroupStyles = function anonymous(props) {
|
|
164
164
|
let rules = " .";
|
|
165
|
-
if (props.isFocusVisible) rules += '
|
|
166
|
-
else rules += '
|
|
167
|
-
rules += '
|
|
168
|
-
rules += '
|
|
169
|
-
rules += '
|
|
170
|
-
rules += '
|
|
165
|
+
if (props.isFocusVisible) rules += ' _Mb';
|
|
166
|
+
else rules += ' _Ma';
|
|
167
|
+
rules += ' da_____M';
|
|
168
|
+
rules += ' dx';
|
|
169
|
+
rules += ' _Oc';
|
|
170
|
+
rules += ' _N-3t1z';
|
|
171
|
+
rules += ' __b-g2ozi1';
|
|
172
|
+
rules += ' __c-g2ozi1';
|
|
173
|
+
rules += ' __d-g2ozi1';
|
|
171
174
|
rules += ' __e-g2ozi1';
|
|
172
|
-
rules += '
|
|
173
|
-
rules += '
|
|
174
|
-
rules += '
|
|
175
|
-
if (props.size === "
|
|
176
|
-
else
|
|
177
|
-
|
|
178
|
-
else
|
|
179
|
-
|
|
180
|
-
if (props.
|
|
181
|
-
else rules += '
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
rules += '
|
|
187
|
-
rules += '
|
|
188
|
-
rules += '
|
|
189
|
-
rules += '
|
|
190
|
-
rules += '
|
|
191
|
-
rules += '
|
|
192
|
-
rules += '
|
|
193
|
-
rules += '
|
|
194
|
-
rules += '
|
|
195
|
-
rules += '
|
|
196
|
-
rules += '
|
|
197
|
-
rules += '
|
|
198
|
-
rules += ' _g-enzwzjc';
|
|
199
|
-
rules += ' _g-enzrfpb';
|
|
200
|
-
rules += ' _ga';
|
|
175
|
+
if (props.size === "XL") rules += ' qj';
|
|
176
|
+
else if (props.size === "L") rules += ' qi';
|
|
177
|
+
else if (props.size === "S") rules += ' qh';
|
|
178
|
+
else if (props.size === "XS") rules += ' qg';
|
|
179
|
+
else rules += ' qf';
|
|
180
|
+
if (props.isQuiet) rules += ' __na';
|
|
181
|
+
else rules += ' __n-1s8glxue';
|
|
182
|
+
if (props.size === "XL") rules += ' -usygro_l-____g';
|
|
183
|
+
else if (props.size === "L") rules += ' -usygro_l-___0';
|
|
184
|
+
else if (props.size === "S") rules += ' -usygro_l-___u';
|
|
185
|
+
else rules += ' -usygro_l-___K';
|
|
186
|
+
rules += ' m-rwozxi';
|
|
187
|
+
rules += ' _0d';
|
|
188
|
+
rules += ' _2c';
|
|
189
|
+
rules += ' k-375toq';
|
|
190
|
+
rules += ' __oa';
|
|
191
|
+
rules += ' C-375tnm';
|
|
192
|
+
rules += ' D-375tnn';
|
|
193
|
+
rules += ' _d-bc1l9oh';
|
|
194
|
+
rules += ' _d-1uotwbwg';
|
|
195
|
+
rules += ' _d-eo0c6sf';
|
|
196
|
+
rules += ' _d-enzzrge';
|
|
197
|
+
rules += ' _d-enzykdd';
|
|
198
|
+
rules += ' _d-enzwzjc';
|
|
199
|
+
rules += ' _d-enzrfpb';
|
|
200
|
+
rules += ' _da';
|
|
201
201
|
if (props.size === "XL") {
|
|
202
|
-
rules += '
|
|
203
|
-
rules += '
|
|
202
|
+
rules += ' _ebj';
|
|
203
|
+
rules += ' _ei';
|
|
204
204
|
} else if (props.size === "L") {
|
|
205
|
-
rules += '
|
|
206
|
-
rules += '
|
|
205
|
+
rules += ' _ebh';
|
|
206
|
+
rules += ' _eg';
|
|
207
207
|
} else if (props.size === "S") {
|
|
208
|
-
rules += '
|
|
209
|
-
rules += '
|
|
208
|
+
rules += ' _ebd';
|
|
209
|
+
rules += ' _ec';
|
|
210
210
|
} else if (props.size === "XS") {
|
|
211
|
-
rules += '
|
|
212
|
-
rules += '
|
|
211
|
+
rules += ' _ebb';
|
|
212
|
+
rules += ' _ea';
|
|
213
213
|
} else {
|
|
214
|
-
rules += '
|
|
215
|
-
rules += '
|
|
214
|
+
rules += ' _ebf';
|
|
215
|
+
rules += ' _ee';
|
|
216
216
|
}
|
|
217
|
-
rules += '
|
|
218
|
-
rules += '
|
|
219
|
-
rules += '
|
|
217
|
+
rules += ' _fb';
|
|
218
|
+
rules += ' _g-1x99dlob';
|
|
219
|
+
rules += ' _ga';
|
|
220
220
|
if (props.isDisabled) rules += ' aj';
|
|
221
221
|
else {
|
|
222
222
|
if (props.isPressed) rules += ' ao';
|
|
@@ -224,102 +224,48 @@ const $9afd80978c252040$var$fieldGroupStyles = function anonymous(props) {
|
|
|
224
224
|
else if (props.isHovered) rules += ' ao';
|
|
225
225
|
else rules += ' an';
|
|
226
226
|
}
|
|
227
|
+
rules += ' _wh';
|
|
228
|
+
rules += ' _xh';
|
|
229
|
+
rules += ' _yh';
|
|
227
230
|
rules += ' _zh';
|
|
228
|
-
rules += ' _Ah';
|
|
229
|
-
rules += ' _Bh';
|
|
230
|
-
rules += ' _Ch';
|
|
231
|
-
rules += ' tc';
|
|
232
231
|
rules += ' uc';
|
|
233
|
-
rules += '
|
|
232
|
+
rules += ' vc';
|
|
234
233
|
rules += ' s-375toy';
|
|
235
|
-
rules += '
|
|
234
|
+
rules += ' t-375toz';
|
|
235
|
+
rules += ' wa';
|
|
236
|
+
rules += ' _Pa';
|
|
237
|
+
rules += ' _R-375x7f';
|
|
236
238
|
rules += ' _Sa';
|
|
237
|
-
rules += ' _U-375x7f';
|
|
238
|
-
rules += ' _Va';
|
|
239
239
|
if (props.isDisabled) {
|
|
240
|
-
rules += '
|
|
241
|
-
rules += '
|
|
240
|
+
rules += ' ca_____O';
|
|
241
|
+
rules += ' ci';
|
|
242
242
|
} else if (props.isFocusWithin) {
|
|
243
|
-
rules += '
|
|
244
|
-
if (props.isInvalid) rules += '
|
|
245
|
-
else rules += '
|
|
243
|
+
rules += ' ca_____M';
|
|
244
|
+
if (props.isInvalid) rules += ' cP';
|
|
245
|
+
else rules += ' co';
|
|
246
246
|
} else if (props.isInvalid) {
|
|
247
|
-
if (props.isPressed) rules += '
|
|
248
|
-
else if (props.isFocusVisible) rules += '
|
|
249
|
-
else if (props.isHovered) rules += '
|
|
250
|
-
else rules += '
|
|
247
|
+
if (props.isPressed) rules += ' cQ';
|
|
248
|
+
else if (props.isFocusVisible) rules += ' cP';
|
|
249
|
+
else if (props.isHovered) rules += ' cP';
|
|
250
|
+
else rules += ' cO';
|
|
251
251
|
} else {
|
|
252
|
-
if (props.isPressed) rules += '
|
|
253
|
-
else if (props.isFocusVisible) rules += '
|
|
254
|
-
else if (props.isHovered) rules += '
|
|
255
|
-
else rules += '
|
|
256
|
-
}
|
|
257
|
-
if (props.isDisabled) {
|
|
258
|
-
rules += ' ya_____O';
|
|
259
|
-
rules += ' yi';
|
|
260
|
-
} else if (props.isFocusWithin) {
|
|
261
|
-
rules += ' ya_____M';
|
|
262
|
-
if (props.isInvalid) rules += ' yP';
|
|
263
|
-
else rules += ' yo';
|
|
264
|
-
} else if (props.isInvalid) {
|
|
265
|
-
if (props.isPressed) rules += ' yQ';
|
|
266
|
-
else if (props.isFocusVisible) rules += ' yP';
|
|
267
|
-
else if (props.isHovered) rules += ' yP';
|
|
268
|
-
else rules += ' yO';
|
|
269
|
-
} else {
|
|
270
|
-
if (props.isPressed) rules += ' yj';
|
|
271
|
-
else if (props.isFocusVisible) rules += ' yj';
|
|
272
|
-
else if (props.isHovered) rules += ' yj';
|
|
273
|
-
else rules += ' yi';
|
|
274
|
-
}
|
|
275
|
-
if (props.isDisabled) {
|
|
276
|
-
rules += ' va_____O';
|
|
277
|
-
rules += ' vi';
|
|
278
|
-
} else if (props.isFocusWithin) {
|
|
279
|
-
rules += ' va_____M';
|
|
280
|
-
if (props.isInvalid) rules += ' vP';
|
|
281
|
-
else rules += ' vo';
|
|
282
|
-
} else if (props.isInvalid) {
|
|
283
|
-
if (props.isPressed) rules += ' vQ';
|
|
284
|
-
else if (props.isFocusVisible) rules += ' vP';
|
|
285
|
-
else if (props.isHovered) rules += ' vP';
|
|
286
|
-
else rules += ' vO';
|
|
287
|
-
} else {
|
|
288
|
-
if (props.isPressed) rules += ' vj';
|
|
289
|
-
else if (props.isFocusVisible) rules += ' vj';
|
|
290
|
-
else if (props.isHovered) rules += ' vj';
|
|
291
|
-
else rules += ' vi';
|
|
292
|
-
}
|
|
293
|
-
if (props.isDisabled) {
|
|
294
|
-
rules += ' wa_____O';
|
|
295
|
-
rules += ' wi';
|
|
296
|
-
} else if (props.isFocusWithin) {
|
|
297
|
-
rules += ' wa_____M';
|
|
298
|
-
if (props.isInvalid) rules += ' wP';
|
|
299
|
-
else rules += ' wo';
|
|
300
|
-
} else if (props.isInvalid) {
|
|
301
|
-
if (props.isPressed) rules += ' wQ';
|
|
302
|
-
else if (props.isFocusVisible) rules += ' wP';
|
|
303
|
-
else if (props.isHovered) rules += ' wP';
|
|
304
|
-
else rules += ' wO';
|
|
305
|
-
} else {
|
|
306
|
-
if (props.isPressed) rules += ' wj';
|
|
307
|
-
else if (props.isFocusVisible) rules += ' wj';
|
|
308
|
-
else if (props.isHovered) rules += ' wj';
|
|
309
|
-
else rules += ' wi';
|
|
252
|
+
if (props.isPressed) rules += ' cj';
|
|
253
|
+
else if (props.isFocusVisible) rules += ' cj';
|
|
254
|
+
else if (props.isHovered) rules += ' cj';
|
|
255
|
+
else rules += ' ci';
|
|
310
256
|
}
|
|
311
257
|
rules += ' bd';
|
|
312
|
-
if (props.isDisabled) rules += '
|
|
313
|
-
else rules += '
|
|
314
|
-
rules += ' -
|
|
315
|
-
rules += ' -
|
|
316
|
-
rules += ' -_375tox_r-c';
|
|
258
|
+
if (props.isDisabled) rules += ' __Ib';
|
|
259
|
+
else rules += ' __Ie';
|
|
260
|
+
rules += ' -_375tnm_C-I';
|
|
261
|
+
rules += ' -_375tnn_D-I';
|
|
317
262
|
rules += ' -_375toy_s-c';
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
else if (props.size === "
|
|
321
|
-
else if (props.size === "
|
|
322
|
-
else rules += ' -
|
|
263
|
+
rules += ' -_375toz_t-c';
|
|
264
|
+
if (props.size === "XL") rules += ' -_375toq_k-j';
|
|
265
|
+
else if (props.size === "L") rules += ' -_375toq_k-i';
|
|
266
|
+
else if (props.size === "S") rules += ' -_375toq_k-h';
|
|
267
|
+
else if (props.size === "XS") rules += ' -_375toq_k-g';
|
|
268
|
+
else rules += ' -_375toq_k-f';
|
|
323
269
|
return rules;
|
|
324
270
|
};
|
|
325
271
|
const $9afd80978c252040$export$f0fe469072bc6950 = /*#__PURE__*/ (0, $7A6HT$forwardRef)(function FieldGroup(props, ref) {
|
|
@@ -352,48 +298,48 @@ const $9afd80978c252040$export$f5b8910cec6cf069 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
352
298
|
...otherProps,
|
|
353
299
|
ref: ref,
|
|
354
300
|
style: UNSAFE_style,
|
|
355
|
-
className: UNSAFE_className + (0, $feb886035e0d4633$export$e618dc39ac9ad607)("
|
|
301
|
+
className: UNSAFE_className + (0, $feb886035e0d4633$export$e618dc39ac9ad607)(" Ea Fa Ca Da ba a-17zqamw _d-17zqamw _e-17zqamw _f-17zqamw __a-3t1y _9-3t1y qo lb _Ma wf __wb __xb _na _qb", styles)
|
|
356
302
|
});
|
|
357
303
|
});
|
|
358
304
|
const $9afd80978c252040$var$helpTextStyles = function anonymous(props) {
|
|
359
305
|
let rules = " .";
|
|
306
|
+
rules += ' __b-1le9d6f';
|
|
307
|
+
rules += ' __c-1le9d6f';
|
|
308
|
+
rules += ' __d-1le9d6f';
|
|
360
309
|
rules += ' __e-1le9d6f';
|
|
361
|
-
rules += '
|
|
362
|
-
rules += '
|
|
363
|
-
rules += ' __h-1le9d6f';
|
|
364
|
-
rules += ' _3d';
|
|
365
|
-
rules += ' _5d';
|
|
366
|
-
rules += ' hbH';
|
|
367
|
-
rules += ' hG';
|
|
310
|
+
rules += ' _0d';
|
|
311
|
+
rules += ' _2d';
|
|
368
312
|
rules += ' ibH';
|
|
369
313
|
rules += ' iG';
|
|
370
|
-
rules += '
|
|
371
|
-
rules += '
|
|
372
|
-
rules += '
|
|
373
|
-
rules += '
|
|
374
|
-
rules += '
|
|
375
|
-
rules += '
|
|
376
|
-
rules += '
|
|
377
|
-
rules += '
|
|
314
|
+
rules += ' jbH';
|
|
315
|
+
rules += ' jG';
|
|
316
|
+
rules += ' _d-bc1l9oh';
|
|
317
|
+
rules += ' _d-1uotwbwg';
|
|
318
|
+
rules += ' _d-eo0c6sf';
|
|
319
|
+
rules += ' _d-enzzrge';
|
|
320
|
+
rules += ' _d-enzykdd';
|
|
321
|
+
rules += ' _d-enzwzjc';
|
|
322
|
+
rules += ' _d-enzrfpb';
|
|
323
|
+
rules += ' _da';
|
|
378
324
|
if (props.size === "XL") {
|
|
379
|
-
rules += '
|
|
380
|
-
rules += '
|
|
325
|
+
rules += ' _ebj';
|
|
326
|
+
rules += ' _ei';
|
|
381
327
|
} else if (props.size === "L") {
|
|
382
|
-
rules += '
|
|
383
|
-
rules += '
|
|
328
|
+
rules += ' _ebh';
|
|
329
|
+
rules += ' _eg';
|
|
384
330
|
} else if (props.size === "S") {
|
|
385
|
-
rules += '
|
|
386
|
-
rules += '
|
|
331
|
+
rules += ' _ebd';
|
|
332
|
+
rules += ' _ec';
|
|
387
333
|
} else if (props.size === "XS") {
|
|
388
|
-
rules += '
|
|
389
|
-
rules += '
|
|
334
|
+
rules += ' _ebb';
|
|
335
|
+
rules += ' _ea';
|
|
390
336
|
} else {
|
|
391
|
-
rules += '
|
|
392
|
-
rules += '
|
|
337
|
+
rules += ' _ebf';
|
|
338
|
+
rules += ' _ee';
|
|
393
339
|
}
|
|
394
|
-
rules += '
|
|
395
|
-
rules += '
|
|
396
|
-
rules += '
|
|
340
|
+
rules += ' _fb';
|
|
341
|
+
rules += ' _g-1x99dlob';
|
|
342
|
+
rules += ' _ga';
|
|
397
343
|
if (props.isDisabled) rules += ' aj';
|
|
398
344
|
else if (props.isInvalid) {
|
|
399
345
|
if (props.isPressed) rules += ' aP';
|
|
@@ -406,11 +352,11 @@ const $9afd80978c252040$var$helpTextStyles = function anonymous(props) {
|
|
|
406
352
|
else if (props.isHovered) rules += ' an';
|
|
407
353
|
else rules += ' am';
|
|
408
354
|
}
|
|
409
|
-
rules += ' -
|
|
410
|
-
rules += '
|
|
411
|
-
rules += '
|
|
412
|
-
if (props.isDisabled) rules += '
|
|
413
|
-
else rules += '
|
|
355
|
+
rules += ' -rwx0fg_e-b';
|
|
356
|
+
rules += ' __ne';
|
|
357
|
+
rules += ' E-1inj1bc';
|
|
358
|
+
if (props.isDisabled) rules += ' __Ib';
|
|
359
|
+
else rules += ' __Ie';
|
|
414
360
|
return rules;
|
|
415
361
|
};
|
|
416
362
|
function $9afd80978c252040$export$a67c0bc59081311a(props) {
|
|
@@ -453,9 +399,9 @@ function $9afd80978c252040$export$bda0d075e0e342c9(props) {
|
|
|
453
399
|
{
|
|
454
400
|
render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
|
|
455
401
|
slot: 'icon',
|
|
456
|
-
styles: "
|
|
402
|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L,WAAW,CAAA,cAAe,qCAAe;gBAAC,GAAG,WAAW;gBAAE,MAAM,MAAM,IAAI,IAAI;gBAAK,YAAY,MAAM,UAAU;YAAA;kBAC9G,CAAA,GAAA,yBAAiB,EAAE,MAAM,QAAQ,EAAE,CAAC,UAAU,oBAAC,gBAAgB,EAAC,iBAAM;;oBACpE,MAAM,aAAa,kBAClB,gBAAC,CAAA,GAAA,yCAAa;kCACZ,cAAA,gBAAC,CAAA,GAAA,wCAAQ;;kCAGb,gBAAC;kCAAM,YAAY,iBAAiB,IAAI,CAAC;;;;;AAIjD;AAEO,SAAS,0CAAe,KAA6B;IAC1D,qBACE,gBAAC,CAAA,GAAA,eAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;wBACrB,MAAM;wBACN,MAAM;oBAUJ;oBACJ,MAAM;gBAMR;aAAE;SACH;kBACA,CAAC,MAAM,UAAU,kBAAI,gBAAC,CAAA,GAAA,wCAAQ;;AAGrC","sources":["packages/@react-spectrum/s2/src/Field.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {Alignment, DOMRef, NecessityIndicator} from '@react-types/shared';\nimport AsteriskIcon from '../ui-icons/Asterisk';\nimport {baseColor, focusRing, fontRelative, style} from '../style' with {type: 'macro'};\nimport {CenterBaseline, centerBaseline, centerBaselineBefore} from './CenterBaseline';\nimport {composeRenderProps, FieldError, FieldErrorProps, Group, GroupProps, Label, LabelProps, Provider, Input as RACInput, InputProps as RACInputProps, Text} from 'react-aria-components';\nimport {ContextualHelpContext} from './ContextualHelp';\nimport {fieldInput, fieldLabel, StyleProps, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ForwardedRef, forwardRef, ReactNode} from 'react';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface FieldLabelProps extends Omit<LabelProps, 'className' | 'style' | 'children'>, StyleProps {\n isDisabled?: boolean,\n isRequired?: boolean,\n size?: 'S' | 'M' | 'L' | 'XL',\n necessityIndicator?: NecessityIndicator,\n labelAlign?: Alignment,\n labelPosition?: 'top' | 'side',\n includeNecessityIndicatorInAccessibilityName?: boolean,\n staticColor?: 'white' | 'black' | 'auto',\n contextualHelp?: ReactNode,\n isQuiet?: boolean,\n children?: ReactNode\n}\n\nexport const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isDisabled,\n isRequired,\n size = 'M',\n necessityIndicator = 'icon',\n includeNecessityIndicatorInAccessibilityName = false,\n labelAlign,\n labelPosition,\n staticColor,\n contextualHelp,\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = '',\n ...labelProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let contextualHelpId = useId();\n let fallbackLabelPropsId = useId();\n if (contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n if (!props.children) {\n return null;\n }\n\n return (\n <div\n className={style({\n gridArea: 'label',\n display: 'inline',\n textAlign: {\n labelAlign: {\n start: 'start',\n end: 'end'\n }\n },\n paddingBottom: {\n labelPosition: {\n top: '--field-gap'\n }\n },\n contain: {\n labelPosition: {\n top: 'inline-size'\n },\n isQuiet: 'none'\n }\n })({labelAlign, labelPosition, isQuiet})}>\n <Label\n {...labelProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style(fieldLabel())({labelPosition, isDisabled, size, isStaticColor: !!staticColor}), props.styles)}>\n {props.children}\n {(isRequired || necessityIndicator === 'label') && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n {necessityIndicator === 'icon' &&\n <AsteriskIcon\n size={size === 'S' ? 'M' : size}\n className={style({\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })}\n aria-label={includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined} />\n }\n {necessityIndicator === 'label' &&\n /* The necessity label is hidden to screen readers if the field is required because\n * aria-required is set on the field in that case. That will already be announced,\n * so no need to duplicate it here. If optional, we do want it to be announced here.\n */\n <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n {isRequired ? stringFormatter.format('label.(required)') : stringFormatter.format('label.(optional)')}\n </span>\n }\n </span>\n )}\n </Label>\n {contextualHelp && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0\n })}>\n <ContextualHelpContext.Provider\n value={{\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,\n size: (size === 'L' || size === 'XL') ? 'S' : 'XS'\n }}>\n {contextualHelp}\n </ContextualHelpContext.Provider>\n </CenterBaseline>\n </span>\n )}\n </div>\n );\n});\n\ninterface FieldGroupProps extends Omit<GroupProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n size?: 'S' | 'M' | 'L' | 'XL',\n children: ReactNode,\n styles?: StyleString\n}\n\nconst fieldGroupStyles = style({\n ...focusRing(),\n ...fieldInput(),\n display: 'flex',\n alignItems: 'center',\n height: 'control',\n boxSizing: 'border-box',\n paddingX: 'edge-to-text',\n font: 'control',\n borderRadius: 'control',\n borderWidth: 2,\n borderStyle: 'solid',\n transition: 'default',\n borderColor: {\n default: baseColor('gray-300'),\n isInvalid: 'negative',\n isFocusWithin: {\n default: 'gray-900',\n isInvalid: 'negative-1000',\n forcedColors: 'Highlight'\n },\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n backgroundColor: 'gray-25',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <Group\n ref={ref}\n {...props}\n onPointerDown={(e) => {\n // Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)\n if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n onPointerUp={e => {\n if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + ' ' + centerBaselineBefore + mergeStyles(\n fieldGroupStyles({...renderProps, size: props.size || 'M'}),\n props.styles\n )} />\n );\n});\n\nexport interface InputProps extends Omit<RACInputProps, 'className' | 'style'>, StyleProps {}\n\nexport const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {\n let {UNSAFE_className = '', UNSAFE_style, styles, ...otherProps} = props;\n return (\n <RACInput\n {...otherProps}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style({\n padding: 0,\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n width: 'full',\n outlineStyle: 'none',\n borderStyle: 'none',\n truncate: true\n }), styles)} />\n );\n});\n\ninterface HelpTextProps extends FieldErrorProps {\n size?: 'S' | 'M' | 'L' | 'XL',\n isDisabled?: boolean,\n isInvalid?: boolean, // TODO: export FieldErrorContext from RAC to get this.\n description?: ReactNode,\n showErrorIcon?: boolean\n}\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative',\n isDisabled: 'disabled'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {\n let domDescriptionRef = useDOMRef(props.descriptionRef || null);\n let domErrorRef = useDOMRef(props.errorRef || null);\n\n if (!props.isInvalid && props.description) {\n return (\n <Text\n slot=\"description\"\n ref={domDescriptionRef}\n className={helpTextStyles({size: props.size || 'M', isDisabled: props.isDisabled})}>\n {props.description}\n </Text>\n );\n }\n\n return (\n <FieldError\n {...props}\n ref={domErrorRef}\n className={renderProps => helpTextStyles({...renderProps, size: props.size || 'M', isDisabled: props.isDisabled})}>\n {composeRenderProps(props.children, (children, {validationErrors}) => (<>\n {props.showErrorIcon &&\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n }\n <span>{children || validationErrors.join(' ')}</span>\n </>))}\n </FieldError>\n );\n}\n\nexport function FieldErrorIcon(props: {isDisabled?: boolean}) {\n return (\n <Provider\n values={[\n [IconContext, {\n render: centerBaseline({\n slot: 'icon',\n styles: style({\n order: 0,\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'negative',\n forcedColors: 'ButtonText'\n }\n }\n })}),\n styles: style({\n size: fontRelative(20),\n marginStart: 'text-to-visual',\n marginEnd: fontRelative(-2),\n flexShrink: 0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MAAM,aAAa,kBAClB,gBAAC,CAAA,GAAA,yCAAa;kCACZ,cAAA,gBAAC,CAAA,GAAA,wCAAQ;;kCAGb,gBAAC;kCAAM,YAAY,iBAAiB,IAAI,CAAC;;;;;AAIjD;AAEO,SAAS,0CAAe,KAA6B;IAC1D,qBACE,gBAAC,CAAA,GAAA,eAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,QAAQ,CAAA,GAAA,yCAAa,EAAE;wBACrB,MAAM;wBACN,MAAM;oBAUJ;oBACJ,MAAM;gBAMR;aAAE;SACH;kBACA,CAAC,MAAM,UAAU,kBAAI,gBAAC,CAAA,GAAA,wCAAQ;;AAGrC","sources":["packages/@react-spectrum/s2/src/Field.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {Alignment, DOMRef, NecessityIndicator} from '@react-types/shared';\nimport AsteriskIcon from '../ui-icons/Asterisk';\nimport {baseColor, focusRing, fontRelative, style} from '../style' with {type: 'macro'};\nimport {CenterBaseline, centerBaseline, centerBaselineBefore} from './CenterBaseline';\nimport {composeRenderProps, FieldError, FieldErrorProps, Group, GroupProps, Label, LabelProps, Provider, Input as RACInput, InputProps as RACInputProps, Text} from 'react-aria-components';\nimport {ContextualHelpContext} from './ContextualHelp';\nimport {fieldInput, fieldLabel, StyleProps, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ForwardedRef, forwardRef, ReactNode} from 'react';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface FieldLabelProps extends Omit<LabelProps, 'className' | 'style' | 'children'>, StyleProps {\n isDisabled?: boolean,\n isRequired?: boolean,\n size?: 'S' | 'M' | 'L' | 'XL',\n necessityIndicator?: NecessityIndicator,\n labelAlign?: Alignment,\n labelPosition?: 'top' | 'side',\n includeNecessityIndicatorInAccessibilityName?: boolean,\n staticColor?: 'white' | 'black' | 'auto',\n contextualHelp?: ReactNode,\n isQuiet?: boolean,\n children?: ReactNode\n}\n\nexport const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isDisabled,\n isRequired,\n size = 'M',\n necessityIndicator = 'icon',\n includeNecessityIndicatorInAccessibilityName = false,\n labelAlign,\n labelPosition,\n staticColor,\n contextualHelp,\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = '',\n ...labelProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let contextualHelpId = useId();\n let fallbackLabelPropsId = useId();\n if (contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n if (!props.children) {\n return null;\n }\n\n return (\n <div\n className={style({\n gridArea: 'label',\n display: 'inline',\n textAlign: {\n labelAlign: {\n start: 'start',\n end: 'end'\n }\n },\n paddingBottom: {\n labelPosition: {\n top: '--field-gap'\n }\n },\n contain: {\n labelPosition: {\n top: 'inline-size'\n },\n isQuiet: 'none'\n }\n })({labelAlign, labelPosition, isQuiet})}>\n <Label\n {...labelProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style(fieldLabel())({labelPosition, isDisabled, size, isStaticColor: !!staticColor}), props.styles)}>\n {props.children}\n {(isRequired || necessityIndicator === 'label') && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n {necessityIndicator === 'icon' &&\n <AsteriskIcon\n size={size === 'S' ? 'M' : size}\n className={style({\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })}\n aria-label={includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined} />\n }\n {necessityIndicator === 'label' &&\n /* The necessity label is hidden to screen readers if the field is required because\n * aria-required is set on the field in that case. That will already be announced,\n * so no need to duplicate it here. If optional, we do want it to be announced here.\n */\n <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n {isRequired ? stringFormatter.format('label.(required)') : stringFormatter.format('label.(optional)')}\n </span>\n }\n </span>\n )}\n </Label>\n {contextualHelp && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0\n })}>\n <ContextualHelpContext.Provider\n value={{\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,\n size: (size === 'L' || size === 'XL') ? 'S' : 'XS'\n }}>\n {contextualHelp}\n </ContextualHelpContext.Provider>\n </CenterBaseline>\n </span>\n )}\n </div>\n );\n});\n\ninterface FieldGroupProps extends Omit<GroupProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n size?: 'S' | 'M' | 'L' | 'XL',\n children: ReactNode,\n styles?: StyleString\n}\n\nconst fieldGroupStyles = style({\n ...focusRing(),\n ...fieldInput(),\n display: 'flex',\n alignItems: 'center',\n height: 'control',\n boxSizing: 'border-box',\n paddingX: 'edge-to-text',\n font: 'control',\n borderRadius: 'control',\n borderWidth: 2,\n borderStyle: 'solid',\n transition: 'default',\n borderColor: {\n default: baseColor('gray-300'),\n isInvalid: 'negative',\n isFocusWithin: {\n default: 'gray-900',\n isInvalid: 'negative-1000',\n forcedColors: 'Highlight'\n },\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n backgroundColor: 'gray-25',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <Group\n ref={ref}\n {...props}\n onPointerDown={(e) => {\n // Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)\n if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n onPointerUp={e => {\n if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + ' ' + centerBaselineBefore + mergeStyles(\n fieldGroupStyles({...renderProps, size: props.size || 'M'}),\n props.styles\n )} />\n );\n});\n\nexport interface InputProps extends Omit<RACInputProps, 'className' | 'style'>, StyleProps {}\n\nexport const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {\n let {UNSAFE_className = '', UNSAFE_style, styles, ...otherProps} = props;\n return (\n <RACInput\n {...otherProps}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style({\n padding: 0,\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n width: 'full',\n outlineStyle: 'none',\n borderStyle: 'none',\n truncate: true\n }), styles)} />\n );\n});\n\ninterface HelpTextProps extends FieldErrorProps {\n size?: 'S' | 'M' | 'L' | 'XL',\n isDisabled?: boolean,\n isInvalid?: boolean, // TODO: export FieldErrorContext from RAC to get this.\n description?: ReactNode,\n showErrorIcon?: boolean\n}\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative',\n isDisabled: 'disabled'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {\n let domDescriptionRef = useDOMRef(props.descriptionRef || null);\n let domErrorRef = useDOMRef(props.errorRef || null);\n\n if (!props.isInvalid && props.description) {\n return (\n <Text\n slot=\"description\"\n ref={domDescriptionRef}\n className={helpTextStyles({size: props.size || 'M', isDisabled: props.isDisabled})}>\n {props.description}\n </Text>\n );\n }\n\n return (\n <FieldError\n {...props}\n ref={domErrorRef}\n className={renderProps => helpTextStyles({...renderProps, size: props.size || 'M', isDisabled: props.isDisabled})}>\n {composeRenderProps(props.children, (children, {validationErrors}) => (<>\n {props.showErrorIcon &&\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n }\n <span>{children || validationErrors.join(' ')}</span>\n </>))}\n </FieldError>\n );\n}\n\nexport function FieldErrorIcon(props: {isDisabled?: boolean}) {\n return (\n <Provider\n values={[\n [IconContext, {\n render: centerBaseline({\n slot: 'icon',\n styles: style({\n order: 0,\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'negative',\n forcedColors: 'ButtonText'\n }\n }\n })}),\n styles: style({\n size: fontRelative(20),\n marginStart: 'text-to-visual',\n marginEnd: fontRelative(-2),\n flexShrink: 0\n })\n }]\n ]}>\n {!props.isDisabled && <AlertIcon />}\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"Field.mjs.map"}
|