@react-spectrum/s2 3.0.0-nightly-326f48154-241216 → 3.0.0-nightly-fee532d6a-241217
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/ActionButton.cjs +58 -80
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +76 -96
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +58 -80
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/ActionButtonGroup.cjs.map +1 -1
- package/dist/ActionButtonGroup.css.map +1 -1
- package/dist/ActionButtonGroup.mjs.map +1 -1
- package/dist/Badge.cjs +66 -66
- package/dist/Badge.css +43 -43
- package/dist/Badge.mjs +66 -66
- package/dist/Breadcrumbs.cjs +6 -6
- package/dist/Breadcrumbs.css +4 -4
- package/dist/Breadcrumbs.mjs +6 -6
- package/dist/Button.cjs +89 -134
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +102 -134
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +89 -134
- package/dist/Button.mjs.map +1 -1
- package/dist/Card.cjs +4 -4
- package/dist/Card.css +3 -3
- package/dist/Card.mjs +4 -4
- package/dist/CardView.cjs +1 -1
- package/dist/CardView.css +1 -1
- package/dist/CardView.mjs +1 -1
- package/dist/Checkbox.cjs +10 -10
- package/dist/Checkbox.css +10 -10
- package/dist/Checkbox.mjs +10 -10
- package/dist/CloseButton.cjs +17 -28
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +19 -31
- package/dist/CloseButton.css.map +1 -1
- package/dist/CloseButton.mjs +17 -28
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorArea.cjs +1 -1
- package/dist/ColorArea.css +1 -1
- package/dist/ColorArea.mjs +1 -1
- package/dist/ColorHandle.cjs +3 -3
- package/dist/ColorHandle.css +3 -3
- package/dist/ColorHandle.mjs +3 -3
- package/dist/ColorSlider.cjs +1 -1
- package/dist/ColorSlider.css +1 -1
- package/dist/ColorSlider.mjs +1 -1
- package/dist/ColorSwatchPicker.cjs +1 -1
- package/dist/ColorSwatchPicker.css +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorWheel.cjs +2 -2
- package/dist/ColorWheel.css +1 -1
- package/dist/ColorWheel.mjs +2 -2
- package/dist/ComboBox.cjs +5 -5
- package/dist/ComboBox.css +4 -4
- package/dist/ComboBox.mjs +5 -5
- package/dist/Disclosure.cjs +1 -1
- package/dist/Disclosure.css +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/Divider.cjs +8 -8
- package/dist/Divider.cjs.map +1 -1
- package/dist/Divider.css +13 -13
- package/dist/Divider.css.map +1 -1
- package/dist/Divider.mjs +8 -8
- package/dist/Divider.mjs.map +1 -1
- package/dist/DropZone.cjs +4 -4
- package/dist/DropZone.css +2 -2
- package/dist/DropZone.mjs +4 -4
- package/dist/Field.cjs +7 -8
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +7 -11
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +7 -8
- package/dist/Field.mjs.map +1 -1
- package/dist/InlineAlert.cjs +23 -23
- package/dist/InlineAlert.css +15 -15
- package/dist/InlineAlert.mjs +23 -23
- package/dist/Link.cjs +7 -6
- package/dist/Link.cjs.map +1 -1
- package/dist/Link.css +14 -14
- package/dist/Link.css.map +1 -1
- package/dist/Link.mjs +7 -6
- package/dist/Link.mjs.map +1 -1
- package/dist/Menu.cjs +26 -6
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +3 -3
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +27 -7
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +13 -13
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +18 -22
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +13 -13
- package/dist/Meter.mjs.map +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.css +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NumberField.cjs +4 -4
- package/dist/NumberField.css +4 -4
- package/dist/NumberField.mjs +4 -4
- package/dist/Picker.cjs +4 -4
- package/dist/Picker.css +4 -4
- package/dist/Picker.mjs +4 -4
- package/dist/Popover.cjs +3 -3
- package/dist/Popover.css +3 -3
- package/dist/Popover.mjs +3 -3
- package/dist/ProgressBar.cjs +20 -18
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +20 -24
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +20 -18
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/ProgressCircle.cjs +11 -9
- package/dist/ProgressCircle.cjs.map +1 -1
- package/dist/ProgressCircle.css +14 -14
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/ProgressCircle.mjs +11 -9
- package/dist/ProgressCircle.mjs.map +1 -1
- package/dist/Provider.cjs +1 -1
- package/dist/Provider.css +1 -1
- package/dist/Provider.mjs +1 -1
- package/dist/Radio.cjs +6 -6
- package/dist/Radio.css +6 -6
- package/dist/Radio.mjs +6 -6
- package/dist/SearchField.cjs +1 -1
- package/dist/SearchField.css +1 -1
- package/dist/SearchField.mjs +1 -1
- package/dist/SegmentedControl.cjs +8 -8
- package/dist/SegmentedControl.css +8 -8
- package/dist/SegmentedControl.mjs +8 -8
- package/dist/Slider.cjs +8 -8
- package/dist/Slider.css +5 -5
- package/dist/Slider.mjs +8 -8
- package/dist/Switch.cjs +7 -7
- package/dist/Switch.css +6 -6
- package/dist/Switch.mjs +7 -7
- package/dist/TableView.cjs +17 -17
- package/dist/TableView.css +11 -11
- package/dist/TableView.mjs +17 -17
- package/dist/Tabs.cjs +5 -5
- package/dist/Tabs.css +5 -5
- package/dist/Tabs.mjs +5 -5
- package/dist/TabsPicker.cjs +1 -1
- package/dist/TabsPicker.css +1 -1
- package/dist/TabsPicker.mjs +1 -1
- package/dist/TagGroup.cjs +10 -10
- package/dist/TagGroup.css +8 -8
- package/dist/TagGroup.mjs +10 -10
- package/dist/ToggleButton.cjs +1 -0
- package/dist/ToggleButton.cjs.map +1 -1
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs +1 -0
- package/dist/ToggleButton.mjs.map +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.css +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/ActionButton.tsx +19 -43
- package/src/ActionButtonGroup.tsx +1 -1
- package/src/Button.tsx +36 -79
- package/src/CloseButton.tsx +10 -20
- package/src/Divider.tsx +10 -16
- package/src/Field.tsx +2 -2
- package/src/Link.tsx +7 -12
- package/src/Menu.tsx +22 -6
- package/src/Meter.tsx +7 -14
- package/src/ProgressBar.tsx +8 -15
- package/src/ProgressCircle.tsx +12 -15
- package/src/ToggleButton.tsx +1 -0
- package/src/bar-utils.ts +3 -10
- package/src/style-utils.ts +15 -8
- package/style/dist/spectrum-theme.cjs +15 -1
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +15 -1
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +40 -27
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +4 -2
- package/style/tokens.ts +30 -0
package/dist/Field.mjs
CHANGED
|
@@ -101,9 +101,8 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
101
101
|
rules += ' _eb';
|
|
102
102
|
rules += ' _f-1x99dlob';
|
|
103
103
|
rules += ' _fa';
|
|
104
|
-
rules += '
|
|
105
|
-
if (props.
|
|
106
|
-
else if (props.staticColor === "white") rules += ' a_____d';
|
|
104
|
+
rules += ' aa_____K';
|
|
105
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
107
106
|
else if (props.isDisabled) rules += ' aj';
|
|
108
107
|
else {
|
|
109
108
|
if (props.isPressed) rules += ' an';
|
|
@@ -117,7 +116,7 @@ const $9afd80978c252040$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $7A6HT$forwa
|
|
|
117
116
|
labelPosition: labelPosition,
|
|
118
117
|
isDisabled: isDisabled,
|
|
119
118
|
size: size,
|
|
120
|
-
|
|
119
|
+
isStaticColor: !!staticColor
|
|
121
120
|
}), props.styles),
|
|
122
121
|
children: [
|
|
123
122
|
props.children,
|
|
@@ -159,7 +158,7 @@ const $9afd80978c252040$var$fieldGroupStyles = function anonymous(props) {
|
|
|
159
158
|
let rules = " .";
|
|
160
159
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
161
160
|
else rules += ' _La';
|
|
162
|
-
rules += '
|
|
161
|
+
rules += ' da_____M';
|
|
163
162
|
rules += ' dx';
|
|
164
163
|
rules += ' _Nc';
|
|
165
164
|
rules += ' _M-3t1z';
|
|
@@ -232,10 +231,10 @@ const $9afd80978c252040$var$fieldGroupStyles = function anonymous(props) {
|
|
|
232
231
|
rules += ' _Q-375x7f';
|
|
233
232
|
rules += ' _Ra';
|
|
234
233
|
if (props.isDisabled) {
|
|
235
|
-
rules += '
|
|
234
|
+
rules += ' ca_____O';
|
|
236
235
|
rules += ' ci';
|
|
237
236
|
} else if (props.isFocusWithin) {
|
|
238
|
-
rules += '
|
|
237
|
+
rules += ' ca_____M';
|
|
239
238
|
if (props.isInvalid) rules += ' cP';
|
|
240
239
|
else rules += ' co';
|
|
241
240
|
} else if (props.isInvalid) {
|
|
@@ -394,7 +393,7 @@ function $9afd80978c252040$export$bda0d075e0e342c9(props) {
|
|
|
394
393
|
{
|
|
395
394
|
render: (0, $1f4b04be3f24aae3$export$9d7e2342a7e53afa)({
|
|
396
395
|
slot: 'icon',
|
|
397
|
-
styles: " . __A-3t1x _8-3t1x -rwx0fg_e-e -rwx0fg_e-
|
|
396
|
+
styles: " . __A-3t1x _8-3t1x -rwx0fg_e-e -rwx0fg_e-a_____8"
|
|
398
397
|
}),
|
|
399
398
|
styles: " . l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ACZ,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',\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, 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 <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0,\n marginStart: 4\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 )}\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"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAkCM,MAAM,0DAAa,CAAA,GAAA,iBAAS,EAAE,SAAS,WAAW,KAAsB,EAAE,GAA6B;IAC5G,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,G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AAM;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 <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0,\n marginStart: 4\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 )}\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"}
|
package/dist/InlineAlert.cjs
CHANGED
|
@@ -64,7 +64,7 @@ const $72bf3a9f94a75d9f$var$inlineAlert = function anonymous(props, overrides) {
|
|
|
64
64
|
}
|
|
65
65
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
66
66
|
else rules += ' _La';
|
|
67
|
-
rules += '
|
|
67
|
+
rules += ' da_____M';
|
|
68
68
|
rules += ' dx';
|
|
69
69
|
rules += ' _Nc';
|
|
70
70
|
rules += ' _M-3t1z';
|
|
@@ -96,39 +96,39 @@ const $72bf3a9f94a75d9f$var$inlineAlert = function anonymous(props, overrides) {
|
|
|
96
96
|
}
|
|
97
97
|
if (props.variant === "neutral") {
|
|
98
98
|
if (props.fillStyle === "boldFill") {
|
|
99
|
-
if (props.isPressed) rules += '
|
|
100
|
-
else if (props.isFocusVisible) rules += '
|
|
101
|
-
else if (props.isHovered) rules += '
|
|
102
|
-
else rules += '
|
|
103
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
99
|
+
if (props.isPressed) rules += ' b_____V';
|
|
100
|
+
else if (props.isFocusVisible) rules += ' b_____V';
|
|
101
|
+
else if (props.isHovered) rules += ' b_____V';
|
|
102
|
+
else rules += ' b_____U';
|
|
103
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____W';
|
|
104
104
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
105
105
|
} else if (props.variant === "negative") {
|
|
106
106
|
if (props.fillStyle === "boldFill") {
|
|
107
|
-
if (props.isPressed) rules += '
|
|
108
|
-
else if (props.isFocusVisible) rules += '
|
|
109
|
-
else if (props.isHovered) rules += '
|
|
110
|
-
else rules += '
|
|
111
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
107
|
+
if (props.isPressed) rules += ' b_____Y';
|
|
108
|
+
else if (props.isFocusVisible) rules += ' b_____Y';
|
|
109
|
+
else if (props.isHovered) rules += ' b_____Y';
|
|
110
|
+
else rules += ' b_____X';
|
|
111
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____Z';
|
|
112
112
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
113
113
|
} else if (props.variant === "notice") {
|
|
114
|
-
if (props.fillStyle === "boldFill") rules += '
|
|
115
|
-
else if (props.fillStyle === "subtleFill") rules += '
|
|
114
|
+
if (props.fillStyle === "boldFill") rules += ' b_____3';
|
|
115
|
+
else if (props.fillStyle === "subtleFill") rules += ' b_____4';
|
|
116
116
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
117
117
|
} else if (props.variant === "positive") {
|
|
118
118
|
if (props.fillStyle === "boldFill") {
|
|
119
|
-
if (props.isPressed) rules += '
|
|
120
|
-
else if (props.isFocusVisible) rules += '
|
|
121
|
-
else if (props.isHovered) rules += '
|
|
122
|
-
else rules += '
|
|
123
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
119
|
+
if (props.isPressed) rules += ' b_____1';
|
|
120
|
+
else if (props.isFocusVisible) rules += ' b_____1';
|
|
121
|
+
else if (props.isHovered) rules += ' b_____1';
|
|
122
|
+
else rules += ' b_____0';
|
|
123
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____2';
|
|
124
124
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
125
125
|
} else if (props.variant === "informative") {
|
|
126
126
|
if (props.fillStyle === "boldFill") {
|
|
127
|
-
if (props.isPressed) rules += '
|
|
128
|
-
else if (props.isFocusVisible) rules += '
|
|
129
|
-
else if (props.isHovered) rules += '
|
|
130
|
-
else rules += '
|
|
131
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
127
|
+
if (props.isPressed) rules += ' b_____S';
|
|
128
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
129
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
130
|
+
else rules += ' b_____R';
|
|
131
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____T';
|
|
132
132
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
133
133
|
}
|
|
134
134
|
return rules;
|
package/dist/InlineAlert.css
CHANGED
|
@@ -111,47 +111,47 @@
|
|
|
111
111
|
border-color: #0000;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
114
|
+
.b_____T {
|
|
115
115
|
background-color: var(--lightningcss-light, #e5f0fe) var(--lightningcss-dark, #0c2175);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.
|
|
118
|
+
.b_____R {
|
|
119
119
|
background-color: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #4069fd);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.
|
|
122
|
+
.b_____S {
|
|
123
123
|
background-color: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.
|
|
126
|
+
.b_____2 {
|
|
127
127
|
background-color: var(--lightningcss-light, #d7f7e1) var(--lightningcss-dark, #003326);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
.
|
|
130
|
+
.b_____0 {
|
|
131
131
|
background-color: var(--lightningcss-light, #05834e) var(--lightningcss-dark, #068850);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.
|
|
134
|
+
.b_____1 {
|
|
135
135
|
background-color: var(--lightningcss-light, #036e45) var(--lightningcss-dark, #047c4b);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.
|
|
138
|
+
.b_____4 {
|
|
139
139
|
background-color: var(--lightningcss-light, #ffeccf) var(--lightningcss-dark, #501b00);
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
.
|
|
142
|
+
.b_____3 {
|
|
143
143
|
background-color: var(--lightningcss-light, #fc7d00) var(--lightningcss-dark, #e06400);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.
|
|
146
|
+
.b_____Z {
|
|
147
147
|
background-color: var(--lightningcss-light, #ffebe8) var(--lightningcss-dark, #571107);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.
|
|
150
|
+
.b_____X {
|
|
151
151
|
background-color: var(--lightningcss-light, #d73220) var(--lightningcss-dark, #df3422);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
.
|
|
154
|
+
.b_____Y {
|
|
155
155
|
background-color: var(--lightningcss-light, #b72818) var(--lightningcss-dark, #cd2e1d);
|
|
156
156
|
}
|
|
157
157
|
|
|
@@ -159,15 +159,15 @@
|
|
|
159
159
|
background-color: var(--lightningcss-light, #fff) var(--lightningcss-dark, #111);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
.
|
|
162
|
+
.b_____W {
|
|
163
163
|
background-color: var(--lightningcss-light, #e9e9e9) var(--lightningcss-dark, #393939);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
.
|
|
166
|
+
.b_____U {
|
|
167
167
|
background-color: var(--lightningcss-light, #505050) var(--lightningcss-dark, #6d6d6d);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
.
|
|
170
|
+
.b_____V {
|
|
171
171
|
background-color: var(--lightningcss-light, #292929) var(--lightningcss-dark, #444);
|
|
172
172
|
}
|
|
173
173
|
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
|
|
346
346
|
@layer _.b.a {
|
|
347
347
|
@media (forced-colors: active) {
|
|
348
|
-
.
|
|
348
|
+
.da_____M {
|
|
349
349
|
outline-color: highlight;
|
|
350
350
|
}
|
|
351
351
|
}
|
package/dist/InlineAlert.mjs
CHANGED
|
@@ -57,7 +57,7 @@ const $fc2cf6b397804b9c$var$inlineAlert = function anonymous(props, overrides) {
|
|
|
57
57
|
}
|
|
58
58
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
59
59
|
else rules += ' _La';
|
|
60
|
-
rules += '
|
|
60
|
+
rules += ' da_____M';
|
|
61
61
|
rules += ' dx';
|
|
62
62
|
rules += ' _Nc';
|
|
63
63
|
rules += ' _M-3t1z';
|
|
@@ -89,39 +89,39 @@ const $fc2cf6b397804b9c$var$inlineAlert = function anonymous(props, overrides) {
|
|
|
89
89
|
}
|
|
90
90
|
if (props.variant === "neutral") {
|
|
91
91
|
if (props.fillStyle === "boldFill") {
|
|
92
|
-
if (props.isPressed) rules += '
|
|
93
|
-
else if (props.isFocusVisible) rules += '
|
|
94
|
-
else if (props.isHovered) rules += '
|
|
95
|
-
else rules += '
|
|
96
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
92
|
+
if (props.isPressed) rules += ' b_____V';
|
|
93
|
+
else if (props.isFocusVisible) rules += ' b_____V';
|
|
94
|
+
else if (props.isHovered) rules += ' b_____V';
|
|
95
|
+
else rules += ' b_____U';
|
|
96
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____W';
|
|
97
97
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
98
98
|
} else if (props.variant === "negative") {
|
|
99
99
|
if (props.fillStyle === "boldFill") {
|
|
100
|
-
if (props.isPressed) rules += '
|
|
101
|
-
else if (props.isFocusVisible) rules += '
|
|
102
|
-
else if (props.isHovered) rules += '
|
|
103
|
-
else rules += '
|
|
104
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
100
|
+
if (props.isPressed) rules += ' b_____Y';
|
|
101
|
+
else if (props.isFocusVisible) rules += ' b_____Y';
|
|
102
|
+
else if (props.isHovered) rules += ' b_____Y';
|
|
103
|
+
else rules += ' b_____X';
|
|
104
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____Z';
|
|
105
105
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
106
106
|
} else if (props.variant === "notice") {
|
|
107
|
-
if (props.fillStyle === "boldFill") rules += '
|
|
108
|
-
else if (props.fillStyle === "subtleFill") rules += '
|
|
107
|
+
if (props.fillStyle === "boldFill") rules += ' b_____3';
|
|
108
|
+
else if (props.fillStyle === "subtleFill") rules += ' b_____4';
|
|
109
109
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
110
110
|
} else if (props.variant === "positive") {
|
|
111
111
|
if (props.fillStyle === "boldFill") {
|
|
112
|
-
if (props.isPressed) rules += '
|
|
113
|
-
else if (props.isFocusVisible) rules += '
|
|
114
|
-
else if (props.isHovered) rules += '
|
|
115
|
-
else rules += '
|
|
116
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
112
|
+
if (props.isPressed) rules += ' b_____1';
|
|
113
|
+
else if (props.isFocusVisible) rules += ' b_____1';
|
|
114
|
+
else if (props.isHovered) rules += ' b_____1';
|
|
115
|
+
else rules += ' b_____0';
|
|
116
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____2';
|
|
117
117
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
118
118
|
} else if (props.variant === "informative") {
|
|
119
119
|
if (props.fillStyle === "boldFill") {
|
|
120
|
-
if (props.isPressed) rules += '
|
|
121
|
-
else if (props.isFocusVisible) rules += '
|
|
122
|
-
else if (props.isHovered) rules += '
|
|
123
|
-
else rules += '
|
|
124
|
-
} else if (props.fillStyle === "subtleFill") rules += '
|
|
120
|
+
if (props.isPressed) rules += ' b_____S';
|
|
121
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
122
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
123
|
+
else rules += ' b_____R';
|
|
124
|
+
} else if (props.fillStyle === "subtleFill") rules += ' b_____T';
|
|
125
125
|
else if (props.fillStyle === "border") rules += ' bd';
|
|
126
126
|
}
|
|
127
127
|
return rules;
|
package/dist/Link.cjs
CHANGED
|
@@ -38,12 +38,13 @@ const $064658f378a85eef$var$link = function anonymous(props, overrides) {
|
|
|
38
38
|
rules += matches.join('');
|
|
39
39
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
40
40
|
else rules += ' _La';
|
|
41
|
-
rules += '
|
|
42
|
-
if (props.
|
|
43
|
-
else if (props.staticColor === "white") rules += ' dc';
|
|
41
|
+
rules += ' da_____M';
|
|
42
|
+
if (props.isStaticColor) rules += ' d_____G';
|
|
44
43
|
else rules += ' dx';
|
|
45
44
|
rules += ' _Nc';
|
|
46
45
|
rules += ' _M-3t1z';
|
|
46
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
47
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
47
48
|
rules += ' _vb';
|
|
48
49
|
rules += ' _wb';
|
|
49
50
|
rules += ' _xb';
|
|
@@ -67,9 +68,8 @@ const $064658f378a85eef$var$link = function anonymous(props, overrides) {
|
|
|
67
68
|
rules += ' _f-1x99dlob';
|
|
68
69
|
rules += ' _fa';
|
|
69
70
|
}
|
|
70
|
-
rules += '
|
|
71
|
-
if (props.
|
|
72
|
-
else if (props.staticColor === "white") rules += ' ac';
|
|
71
|
+
rules += ' aa_____Q';
|
|
72
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
73
73
|
else if (props.variant === "secondary") {
|
|
74
74
|
if (props.isPressed) rules += ' ao';
|
|
75
75
|
else if (props.isFocusVisible) rules += ' ao';
|
|
@@ -115,6 +115,7 @@ const $064658f378a85eef$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $7PkpH$react
|
|
|
115
115
|
...renderProps,
|
|
116
116
|
variant: variant,
|
|
117
117
|
staticColor: staticColor,
|
|
118
|
+
isStaticColor: !!staticColor,
|
|
118
119
|
isQuiet: isQuiet,
|
|
119
120
|
isStandalone: isStandalone,
|
|
120
121
|
isSkeleton: isSkeleton
|
package/dist/Link.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CC,MAAM,4CAAO,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAAoC;IAC/G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WAAC,UAAU,wBAAW,WAAW,WAAE,OAAO,gBAAE,YAAY,gBAAE,YAAY,oBAAE,mBAAmB,YAAI,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEvH,IAAI,SAAS,CAAA,GAAA,yCAAc,EAAE;IAC7B,IAAI,aAAa,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,yCAAc,MAAM;IAChD,CAAC,UAAU,aAAa,GAAG,CAAA,GAAA,yCAAc,EAAE,UAAU;IAErD,CAAA,GAAA,qCAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,4CAA4C;QAC5C,OAAO,OAAO,CAAC,KAAK,GAAG;IAE3B,GAAG;QAAC;QAAQ;KAAW;IAEvB,qBACE,gCAAC,CAAA,GAAA,+BAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,2BAAK;gBAAC,GAAG,WAAW;yBAAE;6BAAS;gBAAa,eAAe,CAAC,CAAC;yBAAa;8BAAS;4BAAc;YAAU,GAAG;kBAC1J;;AAGP","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, staticColor, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean, isStaticColor: boolean}>({\n ...focusRing(),\n ...staticColor(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport const Link = /*#__PURE__*/ forwardRef(function Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isStaticColor: !!staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n});\n"],"names":[],"version":3,"file":"Link.cjs.map"}
|
package/dist/Link.css
CHANGED
|
@@ -15,12 +15,8 @@
|
|
|
15
15
|
outline-color: var(--lightningcss-light, #4b75ff) var(--lightningcss-dark, #4069fd);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
19
|
-
outline-color:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.db {
|
|
23
|
-
outline-color: #000;
|
|
18
|
+
.d_____G {
|
|
19
|
+
outline-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
24
20
|
}
|
|
25
21
|
|
|
26
22
|
._Nc {
|
|
@@ -31,6 +27,14 @@
|
|
|
31
27
|
outline-offset: 2px;
|
|
32
28
|
}
|
|
33
29
|
|
|
30
|
+
.-_1de2x0q_b-c {
|
|
31
|
+
--s2-container-bg: white;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.-_1de2x0q_b-b {
|
|
35
|
+
--s2-container-bg: black;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
._vb {
|
|
35
39
|
border-start-start-radius: .25rem;
|
|
36
40
|
}
|
|
@@ -81,12 +85,8 @@
|
|
|
81
85
|
color: var(--lightningcss-light, #131313) var(--lightningcss-dark, #f2f2f2);
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
.
|
|
85
|
-
color:
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.ab {
|
|
89
|
-
color: #000;
|
|
88
|
+
.a_____G {
|
|
89
|
+
color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
._Oa {
|
|
@@ -166,11 +166,11 @@
|
|
|
166
166
|
|
|
167
167
|
@layer _.b.a {
|
|
168
168
|
@media (forced-colors: active) {
|
|
169
|
-
.
|
|
169
|
+
.da_____M {
|
|
170
170
|
outline-color: highlight;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
.
|
|
173
|
+
.aa_____Q {
|
|
174
174
|
color: linktext;
|
|
175
175
|
}
|
|
176
176
|
}
|
package/dist/Link.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA0Ca;;;;AAAA;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
|
|
1
|
+
{"mappings":"AA0Ca;;;;AAAA;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;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, staticColor, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean, isStaticColor: boolean}>({\n ...focusRing(),\n ...staticColor(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport const Link = /*#__PURE__*/ forwardRef(function Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isStaticColor: !!staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n});\n"],"names":[],"version":3,"file":"Link.css.map"}
|
package/dist/Link.mjs
CHANGED
|
@@ -31,12 +31,13 @@ const $f50c78733c21bfe2$var$link = function anonymous(props, overrides) {
|
|
|
31
31
|
rules += matches.join('');
|
|
32
32
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
33
33
|
else rules += ' _La';
|
|
34
|
-
rules += '
|
|
35
|
-
if (props.
|
|
36
|
-
else if (props.staticColor === "white") rules += ' dc';
|
|
34
|
+
rules += ' da_____M';
|
|
35
|
+
if (props.isStaticColor) rules += ' d_____G';
|
|
37
36
|
else rules += ' dx';
|
|
38
37
|
rules += ' _Nc';
|
|
39
38
|
rules += ' _M-3t1z';
|
|
39
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
40
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
40
41
|
rules += ' _vb';
|
|
41
42
|
rules += ' _wb';
|
|
42
43
|
rules += ' _xb';
|
|
@@ -60,9 +61,8 @@ const $f50c78733c21bfe2$var$link = function anonymous(props, overrides) {
|
|
|
60
61
|
rules += ' _f-1x99dlob';
|
|
61
62
|
rules += ' _fa';
|
|
62
63
|
}
|
|
63
|
-
rules += '
|
|
64
|
-
if (props.
|
|
65
|
-
else if (props.staticColor === "white") rules += ' ac';
|
|
64
|
+
rules += ' aa_____Q';
|
|
65
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
66
66
|
else if (props.variant === "secondary") {
|
|
67
67
|
if (props.isPressed) rules += ' ao';
|
|
68
68
|
else if (props.isFocusVisible) rules += ' ao';
|
|
@@ -108,6 +108,7 @@ const $f50c78733c21bfe2$export$a6c7ac8248d6e38a = /*#__PURE__*/ (0, $d6Kqa$forwa
|
|
|
108
108
|
...renderProps,
|
|
109
109
|
variant: variant,
|
|
110
110
|
staticColor: staticColor,
|
|
111
|
+
isStaticColor: !!staticColor,
|
|
111
112
|
isQuiet: isQuiet,
|
|
112
113
|
isStandalone: isStandalone,
|
|
113
114
|
isSkeleton: isSkeleton
|
package/dist/Link.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8BM,MAAM,0DAAc,CAAA,GAAA,oBAAY,EAAiE;AAExG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CC,MAAM,4CAAO,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,KAAK,KAAgB,EAAE,GAAoC;IAC/G,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WAAC,UAAU,wBAAW,WAAW,WAAE,OAAO,gBAAE,YAAY,gBAAE,YAAY,oBAAE,mBAAmB,YAAI,MAAM,YAAE,QAAQ,EAAC,GAAG;IAEvH,IAAI,SAAS,CAAA,GAAA,sBAAc,EAAE;IAC7B,IAAI,aAAa,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAc,MAAM;IAChD,CAAC,UAAU,aAAa,GAAG,CAAA,GAAA,yCAAc,EAAE,UAAU;IAErD,CAAA,GAAA,sBAAc,EAAE;QACd,IAAI,OAAO,OAAO,EAChB,4CAA4C;QAC5C,OAAO,OAAO,CAAC,KAAK,GAAG;IAE3B,GAAG;QAAC;QAAQ;KAAW;IAEvB,qBACE,gBAAC,CAAA,GAAA,WAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,2BAAK;gBAAC,GAAG,WAAW;yBAAE;6BAAS;gBAAa,eAAe,CAAC,CAAC;yBAAa;8BAAS;4BAAc;YAAU,GAAG;kBAC1J;;AAGP","sources":["packages/@react-spectrum/s2/src/Link.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 {ContextValue, LinkRenderProps, Link as RACLink, LinkProps as RACLinkProps} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {focusRing, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, staticColor, StyleProps} from './style-utils' with {type: 'macro'};\nimport {SkeletonContext, useSkeletonText} from './Skeleton';\nimport {useFocusableRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface LinkStyleProps {\n /**\n * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n * @default 'primary'\n */\n variant?: 'primary' | 'secondary',\n /** The static color style to apply. Useful when the link appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto',\n /** Whether the link is on its own vs inside a longer string of text. */\n isStandalone?: boolean,\n /** Whether the link should be displayed with a quiet style. */\n isQuiet?: boolean\n}\n\nexport interface LinkProps extends Omit<RACLinkProps, 'isDisabled' | 'className' | 'style' | 'children' | 'onHover' | 'onHoverStart' | 'onHoverEnd' | 'onHoverChange'>, StyleProps, LinkStyleProps {\n children?: ReactNode\n}\n\nexport const LinkContext = createContext<ContextValue<LinkProps, FocusableRefValue<HTMLAnchorElement>>>(null);\n\nconst link = style<LinkRenderProps & LinkStyleProps & {isSkeleton: boolean, isStaticColor: boolean}>({\n ...focusRing(),\n ...staticColor(),\n borderRadius: 'sm',\n font: {\n isStandalone: 'ui'\n },\n color: {\n variant: {\n primary: 'accent',\n secondary: 'neutral' // TODO: should there be an option to inherit from the paragraph? What about hover states?\n },\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'LinkText'\n },\n transition: 'default',\n fontWeight: {\n isStandalone: 'medium'\n },\n textDecoration: {\n default: 'underline',\n isStandalone: {\n // Inline links must always have an underline for accessibility.\n isQuiet: {\n default: 'none',\n isHovered: 'underline',\n isFocusVisible: 'underline'\n }\n }\n },\n outlineColor: {\n default: 'focus-ring',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'Highlight'\n },\n disableTapHighlight: true\n}, getAllowedOverrides());\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport const Link = /*#__PURE__*/ forwardRef(function Link(props: LinkProps, ref: FocusableRef<HTMLAnchorElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, LinkContext);\n let {variant = 'primary', staticColor, isQuiet, isStandalone, UNSAFE_style, UNSAFE_className = '', styles, children} = props;\n\n let domRef = useFocusableRef(ref);\n let isSkeleton = useContext(SkeletonContext) || false;\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n\n useLayoutEffect(() => {\n if (domRef.current) {\n // TODO: should RAC Link pass through inert?\n domRef.current.inert = isSkeleton;\n }\n }, [domRef, isSkeleton]);\n\n return (\n <RACLink\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + link({...renderProps, variant, staticColor, isStaticColor: !!staticColor, isQuiet, isStandalone, isSkeleton}, styles)}>\n {children}\n </RACLink>\n );\n});\n"],"names":[],"version":3,"file":"Link.mjs.map"}
|