@react-spectrum/s2 3.0.0-nightly-c53ab48ec-250115 → 3.0.0-nightly-cdba74876-250117
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.css +1 -5
- package/dist/Accordion.css.map +1 -1
- package/dist/ActionBar.cjs +2 -2
- package/dist/ActionBar.css +0 -6
- package/dist/ActionBar.css.map +1 -1
- package/dist/ActionBar.mjs +2 -2
- package/dist/ActionButton.cjs +4 -4
- package/dist/ActionButton.css +0 -6
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +4 -4
- package/dist/ActionButtonGroup.css +1 -5
- package/dist/ActionButtonGroup.css.map +1 -1
- package/dist/AlertDialog.css +1 -5
- package/dist/AlertDialog.css.map +1 -1
- package/dist/Avatar.css +1 -5
- package/dist/Avatar.css.map +1 -1
- package/dist/AvatarGroup.cjs +1 -1
- package/dist/AvatarGroup.css +0 -6
- package/dist/AvatarGroup.css.map +1 -1
- package/dist/AvatarGroup.mjs +1 -1
- package/dist/Badge.cjs +3 -3
- package/dist/Badge.css +0 -6
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +3 -3
- package/dist/Breadcrumbs.cjs +4 -4
- package/dist/Breadcrumbs.cjs.map +1 -1
- package/dist/Breadcrumbs.css +0 -6
- package/dist/Breadcrumbs.css.map +1 -1
- package/dist/Breadcrumbs.mjs +4 -4
- package/dist/Breadcrumbs.mjs.map +1 -1
- package/dist/Button.cjs +4 -4
- package/dist/Button.css +0 -6
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +4 -4
- package/dist/ButtonGroup.cjs +1 -1
- package/dist/ButtonGroup.css +1 -5
- package/dist/ButtonGroup.css.map +1 -1
- package/dist/ButtonGroup.mjs +1 -1
- package/dist/Card.cjs +15 -15
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css +0 -6
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +16 -16
- package/dist/Card.mjs.map +1 -1
- package/dist/CardView.cjs +1 -1
- package/dist/CardView.css +1 -5
- package/dist/CardView.css.map +1 -1
- package/dist/CardView.mjs +1 -1
- package/dist/CenterBaseline.cjs +1 -1
- package/dist/CenterBaseline.css +1 -5
- package/dist/CenterBaseline.css.map +1 -1
- package/dist/CenterBaseline.mjs +1 -1
- package/dist/Checkbox.cjs +1 -1
- package/dist/Checkbox.css +0 -6
- package/dist/Checkbox.css.map +1 -1
- package/dist/Checkbox.mjs +1 -1
- package/dist/CheckboxGroup.css +0 -6
- package/dist/CheckboxGroup.css.map +1 -1
- package/dist/ClearButton.css +1 -5
- package/dist/ClearButton.css.map +1 -1
- package/dist/CloseButton.css +1 -5
- package/dist/CloseButton.css.map +1 -1
- package/dist/ColorArea.css +1 -5
- package/dist/ColorArea.css.map +1 -1
- package/dist/ColorField.css +0 -6
- package/dist/ColorField.css.map +1 -1
- package/dist/ColorHandle.cjs +3 -3
- package/dist/ColorHandle.css +1 -5
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs +3 -3
- package/dist/ColorSlider.css +0 -6
- package/dist/ColorSlider.css.map +1 -1
- package/dist/ColorSwatch.css +1 -5
- package/dist/ColorSwatch.css.map +1 -1
- package/dist/ColorSwatchPicker.cjs +1 -1
- package/dist/ColorSwatchPicker.css +1 -5
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorWheel.css +1 -5
- package/dist/ColorWheel.css.map +1 -1
- package/dist/ComboBox.cjs +2 -2
- package/dist/ComboBox.css +0 -6
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs +2 -2
- package/dist/Content.cjs +3 -1
- package/dist/Content.cjs.map +1 -1
- package/dist/Content.mjs +3 -1
- package/dist/Content.mjs.map +1 -1
- package/dist/ContextualHelp.cjs +5 -5
- package/dist/ContextualHelp.css +0 -6
- package/dist/ContextualHelp.css.map +1 -1
- package/dist/ContextualHelp.mjs +5 -5
- package/dist/CustomDialog.css +1 -5
- package/dist/CustomDialog.css.map +1 -1
- package/dist/Dialog.cjs +10 -10
- package/dist/Dialog.css +0 -6
- package/dist/Dialog.css.map +1 -1
- package/dist/Dialog.mjs +10 -10
- package/dist/Disclosure.cjs +2 -2
- package/dist/Disclosure.css +0 -6
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +2 -2
- package/dist/Divider.css +1 -5
- package/dist/Divider.css.map +1 -1
- package/dist/DropZone.css +0 -6
- package/dist/DropZone.css.map +1 -1
- package/dist/Field.cjs +7 -7
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +0 -6
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +7 -7
- package/dist/Field.mjs.map +1 -1
- package/dist/Form.css +1 -5
- package/dist/Form.css.map +1 -1
- package/dist/FullscreenDialog.cjs +5 -5
- package/dist/FullscreenDialog.css +0 -6
- package/dist/FullscreenDialog.css.map +1 -1
- package/dist/FullscreenDialog.mjs +5 -5
- package/dist/IllustratedMessage.cjs +1 -1
- package/dist/IllustratedMessage.css +0 -6
- package/dist/IllustratedMessage.css.map +1 -1
- package/dist/IllustratedMessage.mjs +1 -1
- package/dist/Image.cjs +1 -1
- package/dist/Image.css +1 -5
- package/dist/Image.css.map +1 -1
- package/dist/Image.mjs +1 -1
- package/dist/InlineAlert.cjs +1 -1
- package/dist/InlineAlert.css +0 -6
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +1 -1
- package/dist/Link.css +0 -6
- package/dist/Link.css.map +1 -1
- package/dist/Menu.cjs +7 -7
- package/dist/Menu.css +0 -6
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +7 -7
- package/dist/Meter.css +0 -6
- package/dist/Meter.css.map +1 -1
- package/dist/Modal.css +1 -5
- package/dist/Modal.css.map +1 -1
- package/dist/NumberField.css +0 -6
- package/dist/NumberField.css.map +1 -1
- package/dist/Picker.cjs +3 -3
- package/dist/Picker.css +0 -6
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs +3 -3
- package/dist/Popover.css +1 -5
- package/dist/Popover.css.map +1 -1
- package/dist/ProgressBar.css +0 -6
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressCircle.css +1 -5
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/Provider.css +1 -5
- package/dist/Provider.css.map +1 -1
- package/dist/Radio.css +0 -6
- package/dist/Radio.css.map +1 -1
- package/dist/RadioGroup.css +0 -6
- package/dist/RadioGroup.css.map +1 -1
- package/dist/SearchField.cjs +3 -3
- package/dist/SearchField.css +0 -6
- package/dist/SearchField.css.map +1 -1
- package/dist/SearchField.mjs +3 -3
- package/dist/SegmentedControl.cjs +3 -3
- package/dist/SegmentedControl.css +0 -6
- package/dist/SegmentedControl.css.map +1 -1
- package/dist/SegmentedControl.mjs +3 -3
- package/dist/Slider.css +0 -6
- package/dist/Slider.css.map +1 -1
- package/dist/StatusLight.css +0 -6
- package/dist/StatusLight.css.map +1 -1
- package/dist/Switch.css +0 -6
- package/dist/Switch.css.map +1 -1
- package/dist/TableView.cjs +13 -13
- package/dist/TableView.css +0 -6
- package/dist/TableView.css.map +1 -1
- package/dist/TableView.mjs +13 -13
- package/dist/Tabs.cjs +3 -3
- package/dist/Tabs.css +0 -6
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +3 -3
- package/dist/TagGroup.cjs +13 -13
- package/dist/TagGroup.cjs.map +1 -1
- package/dist/TagGroup.css +0 -6
- package/dist/TagGroup.css.map +1 -1
- package/dist/TagGroup.mjs +13 -13
- package/dist/TagGroup.mjs.map +1 -1
- package/dist/TextField.cjs +1 -1
- package/dist/TextField.css +0 -6
- package/dist/TextField.css.map +1 -1
- package/dist/TextField.mjs +1 -1
- package/dist/ToggleButton.cjs +3 -3
- package/dist/ToggleButton.css +1 -5
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs +3 -3
- package/dist/Tooltip.css +0 -6
- package/dist/Tooltip.css.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/icons/Skeleton.cjs +4 -4
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css +3 -5
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs +5 -5
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +19 -19
- package/src/Breadcrumbs.tsx +2 -2
- package/src/Card.tsx +2 -2
- package/src/Content.tsx +2 -1
- package/src/Skeleton.tsx +3 -3
- package/src/TagGroup.tsx +2 -2
- package/style/__tests__/style-macro.test.js +3 -7
- package/style/dist/style-macro.cjs +5 -3
- package/style/dist/style-macro.cjs.map +1 -1
- package/style/dist/style-macro.mjs +5 -3
- package/style/dist/style-macro.mjs.map +1 -1
- package/style/style-macro.ts +9 -3
package/dist/ColorField.css
CHANGED
package/dist/ColorField.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA8EoC
|
|
1
|
+
{"mappings":"AA8EoC;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;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA","sources":["packages/@react-spectrum/s2/src/ColorField.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 {\n ColorField as AriaColorField,\n ColorFieldProps as AriaColorFieldProps,\n ContextValue\n} from 'react-aria-components';\nimport {createContext, forwardRef, Ref, useContext, useImperativeHandle, useRef} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {field, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ColorFieldProps extends Omit<AriaColorFieldProps, 'children' | 'className' | 'style'>, StyleProps, SpectrumLabelableProps, HelpTextProps {\n /**\n * The size of the color field.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport const ColorFieldContext = createContext<ContextValue<ColorFieldProps, TextFieldRef>>(null);\n\n/**\n * A color field allows users to edit a hex color or individual color channel value.\n */\nexport const ColorField = forwardRef(function ColorField(props: ColorFieldProps, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, ColorFieldContext);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n label,\n description,\n errorMessage,\n necessityIndicator,\n labelPosition = 'top',\n labelAlign = 'start',\n UNSAFE_style,\n UNSAFE_className = '',\n styles,\n ...fieldProps\n } = props;\n\n // Expose imperative interface for ref\n let domRef = useRef<HTMLDivElement>(null);\n let inputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n return (\n <AriaColorField\n {...fieldProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n size: props.size,\n labelPosition,\n isInForm: !!formContext\n }, styles)}>\n {({isDisabled, isInvalid}) => (<>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={props.isRequired}\n size={props.size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup role=\"presentation\" isDisabled={isDisabled} isInvalid={isInvalid} size={props.size}>\n <Input ref={inputRef} />\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n </FieldGroup>\n <HelpText\n size={props.size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={description}>\n {errorMessage}\n </HelpText>\n </>)}\n </AriaColorField>\n );\n});\n"],"names":[],"version":3,"file":"ColorField.css.map"}
|
package/dist/ColorHandle.cjs
CHANGED
|
@@ -70,7 +70,7 @@ function $5b07976eb9e358fe$export$92862704de639678({ containerRef: containerRef,
|
|
|
70
70
|
children: ({ isDragging: isDragging, color: color })=>/*#__PURE__*/ (0, $8hzuN$reactjsxruntime.jsxs)((0, $8hzuN$reactjsxruntime.Fragment), {
|
|
71
71
|
children: [
|
|
72
72
|
/*#__PURE__*/ (0, $8hzuN$reactjsxruntime.jsx)("div", {
|
|
73
|
-
className: "
|
|
73
|
+
className: " lb kb _wf _xf _yf _zf __oa wa ub vb sb tb cb42 ca_____I"
|
|
74
74
|
}),
|
|
75
75
|
/*#__PURE__*/ (0, $8hzuN$reactjsxruntime.jsx)($5b07976eb9e358fe$var$ColorLoupePortal, {
|
|
76
76
|
isOpen: isDragging,
|
|
@@ -131,7 +131,7 @@ function $5b07976eb9e358fe$var$ColorLoupe({ isExiting: isExiting, onExited: onEx
|
|
|
131
131
|
marginLeft: -$5b07976eb9e358fe$var$LOUPE_WIDTH / 2 - $5b07976eb9e358fe$var$LOUPE_BORDER_WIDTH,
|
|
132
132
|
animationName: isExiting ? exitAnimation : enterAnimation
|
|
133
133
|
},
|
|
134
|
-
className: "
|
|
134
|
+
className: " _vb __Ca _U-375x4t _Xb _Za __Ga",
|
|
135
135
|
onAnimationEnd: (e)=>{
|
|
136
136
|
if (e.animationName === exitAnimation) onExited();
|
|
137
137
|
},
|
|
@@ -180,7 +180,7 @@ function $5b07976eb9e358fe$var$ColorLoupe({ isExiting: isExiting, onExited: onEx
|
|
|
180
180
|
fill: color.toString()
|
|
181
181
|
}),
|
|
182
182
|
/*#__PURE__*/ (0, $8hzuN$reactjsxruntime.jsx)("path", {
|
|
183
|
-
className: "
|
|
183
|
+
className: " xb f_____n fa_____K eA",
|
|
184
184
|
d: "M25 3A21.98 21.98 0 003 25c0 6.2 4 14.794 11.568 24.853A144.233 144.233 0 0025 62.132a144.085 144.085 0 0010.4-12.239C42.99 39.816 47 31.209 47 25A21.98 21.98 0 0025 3m0-2a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z"
|
|
185
185
|
})
|
|
186
186
|
]
|
package/dist/ColorHandle.css
CHANGED
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
@layer _.b
|
|
159
|
+
@layer _.b;
|
|
160
160
|
|
|
161
161
|
@layer _.b.a {
|
|
162
162
|
@media (forced-colors: active) {
|
|
@@ -187,8 +187,4 @@
|
|
|
187
187
|
transform: translateY(8px);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
.\.:not(#a#b) {
|
|
192
|
-
all: revert-layer;
|
|
193
|
-
}
|
|
194
190
|
/*# sourceMappingURL=ColorHandle.css.map */
|
package/dist/ColorHandle.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACiCiB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgCI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkFJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6BE;;;;EAAA;;;;EAAA;;;;;AA/IF;;AAAA;EAAA;IAAA;;;;IAgCI;;;;IA+GF;;;;;;AAtDI;;;;;;;AAOD
|
|
1
|
+
{"mappings":"ACiCiB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgCI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkFJ;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA6BE;;;;EAAA;;;;EAAA;;;;;AA/IF;;AAAA;EAAA;IAAA;;;;IAgCI;;;;IA+GF;;;;;;AAtDI;;;;;;;AAOD","sources":["e345175c46126410","packages/@react-spectrum/s2/src/ColorHandle.tsx"],"sourcesContent":["@import \"63203eb3a948f993\";\n@import \"ba33a56d675003f7\";\n@import \"bf115cb0a25c2b12\";\n@import \"5d32c8c9143517d5\";\n@import \"cf10a6b7558ccf38\";\n@import \"d7c9e49b2d44a61e\";\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 {cloneElement, JSX, RefObject, useState} from 'react';\nimport {ColorThumb} from 'react-aria-components';\nimport {createPortal} from 'react-dom';\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useId, useLayoutEffect} from '@react-aria/utils';\n\nconst HANDLE_SIZE = 16;\nconst LOUPE_HEIGHT = 64; // Does not include borders\nconst LOUPE_WIDTH = 48;\nconst LOUPE_BORDER_WIDTH = 1;\nconst LOUPE_OFFSET = 12; // Offset from handle to loupe\n\ninterface ColorHandleProps {\n containerRef: RefObject<HTMLElement | null>,\n getPosition: () => {x: number, y: number}\n}\n\nexport function ColorHandle({containerRef, getPosition}: ColorHandleProps) {\n return (\n <ColorThumb\n className={style({\n transition: '[width, height]',\n size: {\n default: HANDLE_SIZE,\n isFocusVisible: 32\n },\n backgroundColor: {\n isDisabled: 'disabled'\n },\n borderRadius: 'full',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 2,\n borderColor: {\n default: 'white',\n isDisabled: 'disabled'\n },\n outlineStyle: 'solid',\n outlineWidth: 1,\n outlineColor: {\n default: 'black/42',\n forcedColors: 'ButtonBorder'\n }\n })}\n style={({defaultStyle, isDisabled}) => ({\n background: isDisabled ? undefined : `linear-gradient(${defaultStyle.backgroundColor}, ${defaultStyle.backgroundColor}), repeating-conic-gradient(#E1E1E1 0% 25%, white 0% 50%) 50% / 16px 16px`,\n backgroundColor: undefined,\n top: defaultStyle.top || '50%',\n left: defaultStyle.left || '50%'\n })}>\n {({isDragging, color}) => (<>\n <div\n className={style({\n size: 'full',\n borderRadius: 'full',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: 1,\n borderColor: {\n default: 'black/42',\n forcedColors: 'ButtonBorder'\n }\n })} />\n <ColorLoupePortal isOpen={isDragging}>\n <ColorLoupe containerRef={containerRef} color={color} getPosition={getPosition} />\n </ColorLoupePortal>\n </>)}\n </ColorThumb>\n );\n}\n\n// ColorLoupe is rendered in a portal so that it breaks out of clipped/scrolling containers (e.g. popovers).\nfunction ColorLoupePortal({isOpen, children}: { isOpen: boolean, children: JSX.Element }) {\n let [state, setState] = useState(isOpen ? 'open' : 'closed');\n if (isOpen && state === 'closed') {\n setState('open');\n }\n\n if (!isOpen && state === 'open') {\n setState('exiting');\n }\n\n if (isOpen || state === 'exiting') {\n return createPortal(cloneElement(children, {isExiting: state === 'exiting', onExited: () => setState('closed')}), document.body);\n }\n\n return null;\n}\n\nfunction ColorLoupe({isExiting, onExited, containerRef, loupeRef, getPosition, color}: any) {\n let patternId = useId();\n\n // Get the bounding rectangle of the container (e.g. ColorArea/ColorSlider).\n let [containerRect, setContainerRect] = useState({top: 0, left: 0, width: 0, height: 0});\n useLayoutEffect(() => {\n let rect = containerRef.current?.getBoundingClientRect();\n setContainerRect({\n top: rect?.top || 0,\n left: rect?.left || 0,\n width: rect?.width || 0,\n height: rect?.height || 0\n });\n }, [containerRef]);\n\n // Compute the pixel position of the thumb.\n let {x: thumbLeft, y: thumbTop} = getPosition();\n thumbTop *= containerRect.height;\n thumbLeft *= containerRect.width;\n\n let enterAnimation = keyframes(`\n from {\n transform: translateY(8px);\n opacity: 0;\n }\n `);\n\n let exitAnimation = keyframes(`\n to {\n transform: translateY(8px);\n opacity: 0;\n }\n `);\n\n return (\n <svg\n style={{\n // Position relative to the viewport.\n position: 'fixed',\n top: containerRect.top + thumbTop,\n left: containerRect.left + thumbLeft,\n marginTop: -LOUPE_HEIGHT - LOUPE_BORDER_WIDTH * 2 - HANDLE_SIZE / 2 - LOUPE_OFFSET,\n marginLeft: -LOUPE_WIDTH / 2 - LOUPE_BORDER_WIDTH,\n animationName: isExiting ? exitAnimation : enterAnimation\n }}\n className={style({\n filter: 'elevated',\n pointerEvents: 'none',\n animationDuration: 125,\n animationFillMode: 'forwards',\n animationTimingFunction: 'in-out',\n isolation: 'isolate'\n })}\n onAnimationEnd={e => {\n if (e.animationName === exitAnimation) {\n onExited();\n }\n }}\n width={LOUPE_WIDTH + LOUPE_BORDER_WIDTH * 2}\n height={LOUPE_HEIGHT + LOUPE_BORDER_WIDTH * 2}\n ref={loupeRef}\n aria-hidden=\"true\">\n <pattern id={patternId} x=\"0\" y=\"0\" width=\"16\" height=\"16\" patternUnits=\"userSpaceOnUse\">\n <rect fill=\"white\" x=\"0\" y=\"0\" width=\"16\" height=\"16\" />\n <rect fill=\"#E1E1E1\" x=\"0\" y=\"0\" width=\"8\" height=\"8\" />\n <rect fill=\"#E1E1E1\" x=\"8\" y=\"8\" width=\"8\" height=\"8\" />\n </pattern>\n <path\n d=\"M25 1a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z\"\n fill={`url(#${patternId})`} />\n <path\n d=\"M25 1a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z\"\n fill={color.toString()} />\n <path\n className={style({\n strokeWidth: 1,\n stroke: {\n default: 'transparent-black-200',\n forcedColors: 'ButtonBorder'\n },\n fill: 'white'\n })}\n d=\"M25 3A21.98 21.98 0 003 25c0 6.2 4 14.794 11.568 24.853A144.233 144.233 0 0025 62.132a144.085 144.085 0 0010.4-12.239C42.99 39.816 47 31.209 47 25A21.98 21.98 0 0025 3m0-2a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z\" />\n </svg>\n );\n}\n"],"names":[],"version":3,"file":"ColorHandle.css.map"}
|
package/dist/ColorHandle.mjs
CHANGED
|
@@ -64,7 +64,7 @@ function $b4f7db7c45cd3de9$export$92862704de639678({ containerRef: containerRef,
|
|
|
64
64
|
children: ({ isDragging: isDragging, color: color })=>/*#__PURE__*/ (0, $kShzN$jsxs)((0, $kShzN$Fragment), {
|
|
65
65
|
children: [
|
|
66
66
|
/*#__PURE__*/ (0, $kShzN$jsx)("div", {
|
|
67
|
-
className: "
|
|
67
|
+
className: " lb kb _wf _xf _yf _zf __oa wa ub vb sb tb cb42 ca_____I"
|
|
68
68
|
}),
|
|
69
69
|
/*#__PURE__*/ (0, $kShzN$jsx)($b4f7db7c45cd3de9$var$ColorLoupePortal, {
|
|
70
70
|
isOpen: isDragging,
|
|
@@ -125,7 +125,7 @@ function $b4f7db7c45cd3de9$var$ColorLoupe({ isExiting: isExiting, onExited: onEx
|
|
|
125
125
|
marginLeft: -$b4f7db7c45cd3de9$var$LOUPE_WIDTH / 2 - $b4f7db7c45cd3de9$var$LOUPE_BORDER_WIDTH,
|
|
126
126
|
animationName: isExiting ? exitAnimation : enterAnimation
|
|
127
127
|
},
|
|
128
|
-
className: "
|
|
128
|
+
className: " _vb __Ca _U-375x4t _Xb _Za __Ga",
|
|
129
129
|
onAnimationEnd: (e)=>{
|
|
130
130
|
if (e.animationName === exitAnimation) onExited();
|
|
131
131
|
},
|
|
@@ -174,7 +174,7 @@ function $b4f7db7c45cd3de9$var$ColorLoupe({ isExiting: isExiting, onExited: onEx
|
|
|
174
174
|
fill: color.toString()
|
|
175
175
|
}),
|
|
176
176
|
/*#__PURE__*/ (0, $kShzN$jsx)("path", {
|
|
177
|
-
className: "
|
|
177
|
+
className: " xb f_____n fa_____K eA",
|
|
178
178
|
d: "M25 3A21.98 21.98 0 003 25c0 6.2 4 14.794 11.568 24.853A144.233 144.233 0 0025 62.132a144.085 144.085 0 0010.4-12.239C42.99 39.816 47 31.209 47 25A21.98 21.98 0 0025 3m0-2a24 24 0 0124 24c0 16.255-24 40-24 40S1 41.255 1 25A24 24 0 0125 1z"
|
|
179
179
|
})
|
|
180
180
|
]
|
package/dist/ColorSlider.css
CHANGED
|
@@ -177,8 +177,6 @@
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
@layer UNSAFE_overrides;
|
|
181
|
-
|
|
182
180
|
@layer _.c {
|
|
183
181
|
._d-enzwzjc:lang(he) {
|
|
184
182
|
font-family: myriad-hebrew, ui-sans-serif, system-ui, sans-serif;
|
|
@@ -239,10 +237,6 @@
|
|
|
239
237
|
}
|
|
240
238
|
}
|
|
241
239
|
|
|
242
|
-
.\.:not(#a#b) {
|
|
243
|
-
all: revert-layer;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
240
|
@layer _.b.a {
|
|
247
241
|
@media (forced-colors: active) {
|
|
248
242
|
.da_____I {
|
package/dist/ColorSlider.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACoDmD;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAoC5B;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAeF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAnD8B;EAoC5B;;;;EAAA;;;;;
|
|
1
|
+
{"mappings":"ACoDmD;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAoC5B;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAeF;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAnD8B;EAoC5B;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAeF;EAAA;IAAA","sources":["14771332a5b9bbc4","packages/@react-spectrum/s2/src/ColorSlider.tsx"],"sourcesContent":["@import \"d6c5746f419c314b\";\n@import \"59869632975fb938\";\n@import \"927ebdef839461cd\";\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 {\n ColorSlider as AriaColorSlider,\n ColorSliderProps as AriaColorSliderProps,\n ContextValue,\n SliderOutput,\n SliderTrack,\n useLocale\n} from 'react-aria-components';\nimport {ColorHandle} from './ColorHandle';\nimport {createContext, forwardRef, useRef} from 'react';\nimport {DOMRef, DOMRefValue, SpectrumLabelableProps} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ColorSliderProps extends Omit<AriaColorSliderProps, 'children' | 'className' | 'style'>, Pick<SpectrumLabelableProps, 'contextualHelp'>, StyleProps {\n label?: string\n}\n\nexport const ColorSliderContext = createContext<ContextValue<ColorSliderProps, DOMRefValue<HTMLDivElement>>>(null);\n\n/**\n * A ColorSlider allows users to adjust an individual channel of a color value.\n */\nexport const ColorSlider = forwardRef(function ColorSlider(props: ColorSliderProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ColorSliderContext);\n let {UNSAFE_className = '', UNSAFE_style, styles} = props;\n let containerRef = useDOMRef(ref);\n let trackRef = useRef(null);\n let {locale} = useLocale();\n\n return (\n <AriaColorSlider\n {...props}\n ref={containerRef}\n style={UNSAFE_style}\n // The visual label is hidden when vertical, so make it an aria-label instead.\n aria-label={props['aria-label'] || (props.orientation === 'vertical' ? props.label : undefined)}\n className={renderProps => UNSAFE_className + style({\n width: {\n orientation: {\n horizontal: 192\n }\n },\n height: {\n orientation: {\n vertical: 192\n }\n },\n display: {\n orientation: {\n horizontal: 'grid',\n vertical: 'block'\n }\n },\n gridTemplateColumns: ['1fr', 'auto'],\n gridTemplateAreas: [\n 'label output',\n 'track track'\n ],\n rowGap: 4\n }, getAllowedOverrides())(renderProps, styles)}>\n {({isDisabled, orientation, state}) => (<>\n {orientation === 'horizontal' && (props.label || (props.label === undefined && !props['aria-label'] && !props['aria-labelledby'])) && (\n // If no external label, aria-label or aria-labelledby is provided,\n // default to displaying the localized channel value.\n // Specifically check if label is undefined. If label is `null` then display no visible label.\n // A default aria-label is provided by useColorSlider in that case.\n <FieldLabel isDisabled={isDisabled} contextualHelp={props.contextualHelp}>\n {props.label || state.value.getChannelName(props.channel, locale)}\n </FieldLabel>\n )}\n {orientation === 'horizontal' &&\n <SliderOutput\n className={style({\n gridArea: 'output',\n font: 'control',\n cursor: 'default',\n color: {\n default: 'neutral-subdued',\n isDisabled: 'disabled'\n }\n })} />\n }\n <SliderTrack\n ref={trackRef}\n style={({defaultStyle, isDisabled}) => ({\n background: isDisabled ? undefined : `${defaultStyle.background}, repeating-conic-gradient(#E1E1E1 0% 25%, white 0% 50%) 50% / 16px 16px`\n })}\n className={style({\n gridArea: 'track',\n width: {\n orientation: {\n horizontal: 'full',\n vertical: 24\n }\n },\n height: {\n orientation: {\n horizontal: 24,\n vertical: 'full'\n }\n },\n borderRadius: 'default',\n outlineColor: {\n default: 'gray-1000/10',\n forcedColors: 'ButtonBorder'\n },\n outlineWidth: 1,\n outlineOffset: -1,\n outlineStyle: {\n default: 'solid',\n isDisabled: 'none'\n },\n backgroundColor: {\n isDisabled: 'disabled'\n }\n })}>\n <ColorHandle\n containerRef={trackRef}\n getPosition={() => {\n let x = state.orientation === 'horizontal' ? state.getThumbPercent(0) : 0.5;\n let y = state.orientation === 'horizontal' ? 0.5 : 1 - state.getThumbPercent(0);\n return {x, y};\n }} />\n </SliderTrack>\n </>)}\n </AriaColorSlider>\n );\n});\n"],"names":[],"version":3,"file":"ColorSlider.css.map"}
|
package/dist/ColorSwatch.css
CHANGED
package/dist/ColorSwatch.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA2EiB
|
|
1
|
+
{"mappings":"AA2EiB;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;;;;;AAAA","sources":["packages/@react-spectrum/s2/src/ColorSwatch.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 {\n ColorSwatch as AriaColorSwatch,\n ColorSwatchProps as AriaColorSwatchProps,\n ContextValue,\n parseColor\n} from 'react-aria-components';\nimport {Color} from '@react-types/color';\nimport {createContext, forwardRef, JSX, ReactElement, useContext, useMemo} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ColorSwatchProps extends Omit<AriaColorSwatchProps, 'className' | 'style'>, UnsafeStyles {\n /**\n * The size of the ColorSwatch.\n * @default 'M'\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the ColorSwatch.\n * @default 'default'\n */\n rounding?: 'default' | 'none' | 'full',\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\ninterface SpectrumColorSwatchContextValue extends Pick<ColorSwatchProps, 'size' | 'rounding'> {\n useWrapper: (swatch: ReactElement, color: Color, rounding: ColorSwatchProps['rounding']) => JSX.Element\n}\n\nexport const ColorSwatchContext = createContext<ContextValue<ColorSwatchProps, DOMRefValue<HTMLDivElement>>>(null);\nexport const InternalColorSwatchContext = createContext<SpectrumColorSwatchContextValue | null>(null);\n\n/**\n * A ColorSwatch displays a preview of a selected color.\n */\nexport const ColorSwatch = forwardRef(function ColorSwatch(props: ColorSwatchProps, ref: DOMRef<HTMLDivElement>): JSX.Element {\n [props, ref] = useSpectrumContextProps(props, ref, ColorSwatchContext);\n let domRef = useDOMRef(ref);\n let ctx = useContext(InternalColorSwatchContext);\n let {\n size = ctx?.size || 'M',\n rounding = ctx?.rounding || 'default',\n color\n } = props;\n let nonNullValue = color || '#fff0';\n color = useMemo(() => typeof nonNullValue === 'string' ? parseColor(nonNullValue) : nonNullValue, [nonNullValue]);\n\n let swatch = (\n <AriaColorSwatch\n {...props}\n color={color}\n ref={domRef}\n style={({color}) => ({\n // TODO: should there be a distinction between transparent and no value (e.g. null)?\n background: color.getChannelValue('alpha') > 0\n ? `linear-gradient(${color}, ${color}), repeating-conic-gradient(#e6e6e6 0% 25%, white 0% 50%) 0% 50% / 16px 16px`\n // Red slash to indicate there is no selected color.\n : 'linear-gradient(to bottom right, transparent calc(50% - 2px), var(--slash-color) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)) no-repeat'\n })}\n className={style({\n size: {\n size: {\n XS: 16,\n S: 24,\n M: 32,\n L: 40\n }\n },\n borderRadius: {\n rounding: {\n default: 'sm',\n none: 'none',\n full: 'full'\n }\n },\n borderColor: 'gray-1000/42',\n borderWidth: 1,\n borderStyle: 'solid',\n boxSizing: 'border-box',\n forcedColorAdjust: 'none',\n '--slash-color': {\n type: 'color',\n value: 'red-900'\n }\n }, getAllowedOverrides({height: true}))({size, rounding}, props.styles)} />\n );\n\n // ColorSwatchPicker needs to wrap the swatch in a ListBoxItem.\n if (ctx) {\n return ctx.useWrapper(swatch, color, rounding);\n }\n\n return swatch;\n});\n"],"names":[],"version":3,"file":"ColorSwatch.css.map"}
|
|
@@ -97,7 +97,7 @@ function $a267e3efa7024819$var$useWrapper(swatch, color, rounding) {
|
|
|
97
97
|
swatch,
|
|
98
98
|
isSelected && /*#__PURE__*/ (0, $7eldL$reactjsxruntime.jsx)("div", {
|
|
99
99
|
"aria-hidden": true,
|
|
100
|
-
className: "
|
|
100
|
+
className: " Va __Ca Ya _aa Wa Xa __oa co wa uc vc sc tc dd _Mb _Oc _N-3hmpy _Ab _w-17zqamw _x-17zqamw _y-17zqamw _z-17zqamw"
|
|
101
101
|
})
|
|
102
102
|
]
|
|
103
103
|
})
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
@layer _.b
|
|
187
|
+
@layer _.b;
|
|
188
188
|
|
|
189
189
|
@layer _.b.a {
|
|
190
190
|
@media (forced-colors: active) {
|
|
@@ -193,8 +193,4 @@
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
.\.:not(#a#b) {
|
|
198
|
-
all: revert-layer;
|
|
199
|
-
}
|
|
200
196
|
/*# sourceMappingURL=ColorSwatchPicker.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC6D0C;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAsBV;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgBT;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAtCmB;;AAsBV;EAAA;IAAA
|
|
1
|
+
{"mappings":"AC6D0C;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAsBV;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAgBT;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAtCmB;;AAsBV;EAAA;IAAA","sources":["26baf334ec196f8c","packages/@react-spectrum/s2/src/ColorSwatchPicker.tsx"],"sourcesContent":["@import \"e16c0c8e50c537a4\";\n@import \"6325f62168102e9d\";\n@import \"aa108d3a66fddade\";\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 {ColorSwatchPicker as AriaColorSwatchPicker, ColorSwatchPickerItem as AriaColorSwatchPickerItem, ContextValue, SlotProps} from 'react-aria-components';\nimport {Color} from '@react-types/color';\nimport {ColorSwatchProps, InternalColorSwatchContext} from './ColorSwatch';\nimport {createContext, forwardRef, ReactElement, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, ValueBase} from '@react-types/shared';\nimport {focusRing, space, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ColorSwatchPickerProps extends ValueBase<string | Color, Color>, StyleProps, SlotProps {\n /** The ColorSwatches within the ColorSwatchPicker. */\n children: ReactNode,\n /**\n * The amount of padding between the swatches.\n * @default 'regular'\n */\n density?: 'compact' | 'regular' | 'spacious',\n /**\n * The size of the color swatches.\n * @default 'M'\n */\n size?: 'XS' | 'S' | 'M' | 'L',\n /**\n * The corner rounding of the color swatches.\n * @default 'none'\n */\n rounding?: 'none' | 'default' | 'full'\n}\n\nexport const ColorSwatchPickerContext = createContext<ContextValue<Partial<ColorSwatchPickerProps>, DOMRefValue<HTMLDivElement>>>(null);\n\n/**\n * A ColorSwatchPicker displays a list of color swatches and allows a user to select one of them.\n */\nexport const ColorSwatchPicker = forwardRef(function ColorSwatchPicker(props: ColorSwatchPickerProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ColorSwatchPickerContext);\n let {\n density = 'regular',\n size = 'M',\n rounding = 'none',\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n\n return (\n <AriaColorSwatchPicker\n {...otherProps}\n ref={domRef}\n className={props.UNSAFE_className + style({\n display: 'flex',\n flexWrap: 'wrap',\n gap: {\n density: {\n compact: space(2),\n regular: 4,\n spacious: space(6)\n }\n }\n }, getAllowedOverrides())({density}, props.styles)}>\n <InternalColorSwatchContext.Provider value={{useWrapper, size, rounding}}>\n {props.children}\n </InternalColorSwatchContext.Provider>\n </AriaColorSwatchPicker>\n );\n});\n\nfunction useWrapper(swatch: ReactElement, color: Color, rounding: ColorSwatchProps['rounding']) {\n return (\n <AriaColorSwatchPickerItem\n color={color}\n className={renderProps => style({\n ...focusRing(),\n position: 'relative',\n borderRadius: {\n rounding: {\n none: 'none',\n default: 'sm',\n full: 'full'\n }\n }\n })({...renderProps, rounding})}>\n {({isSelected}) => (<>\n {swatch}\n {isSelected && (\n <div\n aria-hidden\n className={style({\n position: 'absolute',\n pointerEvents: 'none',\n inset: 0,\n boxSizing: 'border-box',\n borderColor: 'gray-900',\n borderStyle: 'solid',\n borderWidth: 2,\n outlineColor: 'gray-25',\n outlineStyle: 'solid',\n outlineWidth: 2,\n outlineOffset: -4,\n forcedColorAdjust: 'none',\n borderRadius: '[inherit]'\n })} />\n )}\n </>)}\n </AriaColorSwatchPickerItem>\n );\n}\n"],"names":[],"version":3,"file":"ColorSwatchPicker.css.map"}
|
|
@@ -90,7 +90,7 @@ function $ba9c901b6c815fb9$var$useWrapper(swatch, color, rounding) {
|
|
|
90
90
|
swatch,
|
|
91
91
|
isSelected && /*#__PURE__*/ (0, $bOBHx$jsx)("div", {
|
|
92
92
|
"aria-hidden": true,
|
|
93
|
-
className: "
|
|
93
|
+
className: " Va __Ca Ya _aa Wa Xa __oa co wa uc vc sc tc dd _Mb _Oc _N-3hmpy _Ab _w-17zqamw _x-17zqamw _y-17zqamw _z-17zqamw"
|
|
94
94
|
})
|
|
95
95
|
]
|
|
96
96
|
})
|
package/dist/ColorWheel.css
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
@layer _.b
|
|
67
|
+
@layer _.b;
|
|
68
68
|
|
|
69
69
|
@layer _.b.a {
|
|
70
70
|
@media (forced-colors: active) {
|
|
@@ -73,8 +73,4 @@
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
.\.:not(#a#b) {
|
|
78
|
-
all: revert-layer;
|
|
79
|
-
}
|
|
80
76
|
/*# sourceMappingURL=ColorWheel.css.map */
|
package/dist/ColorWheel.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC4DqB;EAAA;;;;EAAA;;;;EAkBA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAlBA;;AAAA;EAAA;IAAA
|
|
1
|
+
{"mappings":"AC4DqB;EAAA;;;;EAAA;;;;EAkBA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAlBA;;AAAA;EAAA;IAAA","sources":["08c4afb7d0604130","packages/@react-spectrum/s2/src/ColorWheel.tsx"],"sourcesContent":["@import \"54eced5f2b164503\";\n@import \"1e65bf1fcba37015\";\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 {\n ColorWheel as AriaColorWheel,\n ColorWheelProps as AriaColorWheelProps,\n ColorWheelTrack,\n ContextValue\n} from 'react-aria-components';\nimport {ColorHandle} from './ColorHandle';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {style} from '../style' with {type: 'macro'};\nimport {StyleProps} from './style-utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ColorWheelProps extends Omit<AriaColorWheelProps, 'children' | 'className' | 'style' | 'outerRadius' | 'innerRadius'>, StyleProps {\n /**\n * @default 192\n */\n size?: number\n}\n\nexport const ColorWheelContext = createContext<ContextValue<ColorWheelProps, DOMRefValue<HTMLDivElement>>>(null);\n\n/**\n * A ColorWheel allows users to adjust the hue of an HSL or HSB color value on a circular track.\n */\nexport const ColorWheel = forwardRef(function ColorWheel(props: ColorWheelProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ColorWheelContext);\n let {UNSAFE_className = '', UNSAFE_style, styles = ''} = props;\n let containerRef = useDOMRef(ref);\n // TODO: how to do mobile scaling?\n let {size = 192} = props;\n let outerRadius = Math.max(size, 175) / 2;\n let thickness = 24;\n let innerRadius = outerRadius - 24;\n return (\n <AriaColorWheel \n {...props}\n outerRadius={outerRadius}\n innerRadius={innerRadius}\n ref={containerRef}\n style={UNSAFE_style}\n className={UNSAFE_className + styles}>\n {({isDisabled, state}) => (<>\n <ColorWheelTrack\n style={({defaultStyle, isDisabled}) => ({\n background: isDisabled ? undefined : defaultStyle.background\n })}\n className={style({\n // Outer border\n borderRadius: 'full',\n outlineColor: {\n default: 'gray-1000/10',\n forcedColors: 'ButtonBorder'\n },\n outlineWidth: 1,\n outlineOffset: -1,\n outlineStyle: {\n default: 'solid',\n isDisabled: 'none'\n },\n backgroundColor: {\n isDisabled: 'disabled'\n }\n })} />\n <div\n className={style({\n // Inner border\n position: 'absolute',\n inset: 24,\n pointerEvents: 'none',\n borderRadius: 'full',\n outlineColor: {\n default: 'gray-1000/10',\n forcedColors: 'ButtonBorder'\n },\n outlineWidth: 1,\n outlineStyle: {\n default: 'solid',\n isDisabled: 'none'\n }\n })({isDisabled})} />\n <ColorHandle\n containerRef={containerRef}\n getPosition={() => {\n let {x, y} = state.getThumbPosition(outerRadius - thickness / 2);\n return {\n x: (outerRadius + x) / (outerRadius * 2),\n y: (outerRadius + y) / (outerRadius * 2)\n };\n }} />\n </>)}\n </AriaColorWheel>\n );\n});\n"],"names":[],"version":3,"file":"ColorWheel.css.map"}
|
package/dist/ComboBox.cjs
CHANGED
|
@@ -105,7 +105,7 @@ const $a2d5b35c01bebcd6$var$inputButton = function anonymous(props) {
|
|
|
105
105
|
}
|
|
106
106
|
return rules;
|
|
107
107
|
};
|
|
108
|
-
const $a2d5b35c01bebcd6$var$iconStyles = "
|
|
108
|
+
const $a2d5b35c01bebcd6$var$iconStyles = " _9-3t1x R-3hn0u -rwx0fg_e-b";
|
|
109
109
|
let $a2d5b35c01bebcd6$var$InternalComboboxContext = /*#__PURE__*/ (0, $1KUtr$react.createContext)({
|
|
110
110
|
size: 'M'
|
|
111
111
|
});
|
|
@@ -312,7 +312,7 @@ const $a2d5b35c01bebcd6$export$72b9695b8216309a = /*#__PURE__*/ (0, $1KUtr$react
|
|
|
312
312
|
// manually subtract border as we can't set Popover to border-box, it causes the contents to spill out
|
|
313
313
|
'--trigger-width': `calc(${triggerWidth} - 2px)`
|
|
314
314
|
},
|
|
315
|
-
styles: "
|
|
315
|
+
styles: " q-1utmx2y l-1utmx2y",
|
|
316
316
|
children: /*#__PURE__*/ (0, $1KUtr$reactjsxruntime.jsx)((0, $1KUtr$reactariacomponents.Provider), {
|
|
317
317
|
values: [
|
|
318
318
|
[
|
package/dist/ComboBox.css
CHANGED
|
@@ -317,8 +317,6 @@
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
@layer UNSAFE_overrides;
|
|
321
|
-
|
|
322
320
|
@layer _.b.a {
|
|
323
321
|
@media (forced-colors: active) {
|
|
324
322
|
._Pag {
|
|
@@ -382,8 +380,4 @@
|
|
|
382
380
|
}
|
|
383
381
|
}
|
|
384
382
|
}
|
|
385
|
-
|
|
386
|
-
.\.:not(#a#b) {
|
|
387
|
-
all: revert-layer;
|
|
388
|
-
}
|
|
389
383
|
/*# sourceMappingURL=ComboBox.css.map */
|
package/dist/ComboBox.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACiGoB;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;;;;EA2CD;;;;EAAA;;;;EAAA;;;;EAsFiB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwBd;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkDA;;;;EAAA;;;;;AA3MF;EAiIgB;;;;;AAjIhB;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAiIgB;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAwBd;EAAA;IAAA;;;;;;AAkDA","sources":["13beeca66baffd35","packages/@react-spectrum/s2/src/ComboBox.tsx"],"sourcesContent":["@import \"434b6dc809c84a70\";\n@import \"9807be49da09aafb\";\n@import \"affe2b90434aec6a\";\n@import \"96ebc07fe89537d3\";\n@import \"85ea669da1afabc2\";\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 {\n ComboBox as AriaComboBox,\n ComboBoxProps as AriaComboBoxProps,\n ListBoxSection as AriaListBoxSection,\n PopoverProps as AriaPopoverProps,\n Button,\n ContextValue,\n InputContext,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxProps,\n Provider,\n SectionProps\n} from 'react-aria-components';\nimport {baseColor, style} from '../style' with {type: 'macro'};\nimport {centerBaseline} from './CenterBaseline';\nimport {\n checkmark,\n description,\n Divider,\n icon,\n iconCenterWrapper,\n label,\n menuitem,\n section,\n sectionHeader,\n sectionHeading\n} from './Menu';\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronIcon from '../ui-icons/Chevron';\nimport {createContext, CSSProperties, forwardRef, ReactNode, Ref, useCallback, useContext, useImperativeHandle, useRef, useState} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, Text, TextContext} from './Content';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {IconContext} from './Icon';\nimport {menu} from './Picker';\nimport {mergeRefs, useResizeObserver} from '@react-aria/utils';\nimport {Placement} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface ComboboxStyleProps {\n /**\n * The size of the Combobox.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\nexport interface ComboBoxProps<T extends object> extends\n Omit<AriaComboBoxProps<T>, 'children' | 'style' | 'className' | 'defaultFilter' | 'allowsEmptyCollection'>,\n ComboboxStyleProps,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps,\n Pick<ListBoxProps<T>, 'items'>,\n Pick<AriaPopoverProps, 'shouldFlip'> {\n /** The contents of the collection. */\n children: ReactNode | ((item: T) => ReactNode),\n /**\n * Direction the menu will render relative to the Picker.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top',\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n menuWidth?: number\n}\n\nexport const ComboBoxContext = createContext<ContextValue<Partial<ComboBoxProps<any>>, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderRadius: 'control-sm',\n alignItems: 'center',\n justifyContent: 'center',\n size: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n marginStart: 'text-to-control',\n aspectRatio: 'square',\n flexShrink: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isOpen: 'gray-200',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isOpen: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n }\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: 90,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalComboboxContext = createContext<{size: 'S' | 'M' | 'L' | 'XL'}>({size: 'M'});\n\n/**\n * ComboBox allow users to choose a single option from a collapsible list of options when space is limited.\n */\nexport const ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function ComboBox<T extends object>(props: ComboBoxProps<T>, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, ComboBoxContext);\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n menuWidth,\n label,\n description: descriptionMessage,\n errorMessage,\n children,\n items,\n size = 'M',\n labelPosition = 'top',\n labelAlign = 'start',\n necessityIndicator,\n UNSAFE_className = '',\n UNSAFE_style,\n ...pickerProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n // Better way to encode this into a style? need to account for flipping\n let menuOffset: number;\n if (size === 'S') {\n menuOffset = 6;\n } else if (size === 'M') {\n menuOffset = 6;\n } else if (size === 'L') {\n menuOffset = 7;\n } else {\n menuOffset = 8;\n }\n\n let triggerRef = useRef<HTMLDivElement>(null);\n // Make menu width match input + button\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (triggerRef.current) {\n let inputRect = triggerRef.current.getBoundingClientRect();\n let minX = inputRect.left;\n let maxX = inputRect.right;\n setTriggerWidth((maxX - minX) + 'px');\n }\n }, [triggerRef, setTriggerWidth]);\n\n useResizeObserver({\n ref: triggerRef,\n onResize: onResize\n });\n\n return (\n <AriaComboBox\n {...pickerProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {({isDisabled, isOpen, isRequired, isInvalid}) => (\n <>\n <InternalComboboxContext.Provider value={{size}}>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n ref={triggerRef}\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n // better way to do this one? it's not actually half, they are\n // [9, 4], [12, 6], [15, 8], [18, 8]\n // also noticed that our measurement is including the border, making the padding too much\n paddingEnd: '[calc(self(height, self(minHeight)) * 3 / 16)]'\n })({size})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n <Button\n ref={buttonRef}\n // Prevent press scale from sticking while ComboBox is open.\n // @ts-ignore\n isPressed={false}\n style={renderProps => pressScale(buttonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n size,\n isOpen\n })}>\n <ChevronIcon\n size={size}\n className={iconStyles} />\n </Button>\n </FieldGroup>\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n <PopoverBase\n hideArrow\n triggerRef={triggerRef}\n offset={menuOffset}\n placement={`${direction} ${align}` as Placement}\n shouldFlip={shouldFlip}\n UNSAFE_style={{\n width: menuWidth ? `${menuWidth}px` : undefined,\n // manually subtract border as we can't set Popover to border-box, it causes the contents to spill out\n '--trigger-width': `calc(${triggerWidth} - 2px)`\n } as CSSProperties}\n styles={style({\n minWidth: '[var(--trigger-width)]',\n width: '[var(--trigger-width)]'\n })}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <ListBox\n items={items}\n className={menu({size})}>\n {children}\n </ListBox>\n </Provider>\n </PopoverBase>\n </InternalComboboxContext.Provider>\n </>\n )}\n </AriaComboBox>\n );\n});\n\n\nexport interface ComboBoxItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nexport function ComboBoxItem(props: ComboBoxItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let {size} = useContext(InternalComboboxContext);\n return (\n <ListBoxItem\n {...props}\n ref={ref}\n textValue={props.textValue || (typeof props.children === 'string' ? props.children as string : undefined)}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon}\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})}\n }\n }]\n ]}>\n {!isLink && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n </Provider>\n </>\n );\n }}\n </ListBoxItem>\n );\n}\n\nexport interface ComboBoxSectionProps<T extends object> extends SectionProps<T> {}\nexport function ComboBoxSection<T extends object>(props: ComboBoxSectionProps<T>) {\n let {size} = useContext(InternalComboboxContext);\n return (\n <>\n <AriaListBoxSection\n {...props}\n className={section({size})}>\n {props.children}\n </AriaListBoxSection>\n <Divider />\n </>\n );\n}\n"],"names":[],"version":3,"file":"ComboBox.css.map"}
|
|
1
|
+
{"mappings":"ACiGoB;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;;;;EA2CD;;;;EAAA;;;;EAAA;;;;EAsFiB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAwBd;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAkDA;;;;EAAA;;;;;AA3MF;EAiIgB;;;;;AAjIhB;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAiIgB;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAwBd;EAAA;IAAA","sources":["13beeca66baffd35","packages/@react-spectrum/s2/src/ComboBox.tsx"],"sourcesContent":["@import \"434b6dc809c84a70\";\n@import \"9807be49da09aafb\";\n@import \"affe2b90434aec6a\";\n@import \"96ebc07fe89537d3\";\n@import \"85ea669da1afabc2\";\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 {\n ComboBox as AriaComboBox,\n ComboBoxProps as AriaComboBoxProps,\n ListBoxSection as AriaListBoxSection,\n PopoverProps as AriaPopoverProps,\n Button,\n ContextValue,\n InputContext,\n ListBox,\n ListBoxItem,\n ListBoxItemProps,\n ListBoxProps,\n Provider,\n SectionProps\n} from 'react-aria-components';\nimport {baseColor, style} from '../style' with {type: 'macro'};\nimport {centerBaseline} from './CenterBaseline';\nimport {\n checkmark,\n description,\n Divider,\n icon,\n iconCenterWrapper,\n label,\n menuitem,\n section,\n sectionHeader,\n sectionHeading\n} from './Menu';\nimport CheckmarkIcon from '../ui-icons/Checkmark';\nimport ChevronIcon from '../ui-icons/Chevron';\nimport {createContext, CSSProperties, forwardRef, ReactNode, Ref, useCallback, useContext, useImperativeHandle, useRef, useState} from 'react';\nimport {createFocusableRef} from '@react-spectrum/utils';\nimport {field, fieldInput, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {FieldErrorIcon, FieldGroup, FieldLabel, HelpText, Input} from './Field';\nimport {FormContext, useFormProps} from './Form';\nimport {forwardRefType} from './types';\nimport {HeaderContext, HeadingContext, Text, TextContext} from './Content';\nimport {HelpTextProps, SpectrumLabelableProps} from '@react-types/shared';\nimport {IconContext} from './Icon';\nimport {menu} from './Picker';\nimport {mergeRefs, useResizeObserver} from '@react-aria/utils';\nimport {Placement} from 'react-aria';\nimport {PopoverBase} from './Popover';\nimport {pressScale} from './pressScale';\nimport {TextFieldRef} from '@react-types/textfield';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\n\nexport interface ComboboxStyleProps {\n /**\n * The size of the Combobox.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\nexport interface ComboBoxProps<T extends object> extends\n Omit<AriaComboBoxProps<T>, 'children' | 'style' | 'className' | 'defaultFilter' | 'allowsEmptyCollection'>,\n ComboboxStyleProps,\n StyleProps,\n SpectrumLabelableProps,\n HelpTextProps,\n Pick<ListBoxProps<T>, 'items'>,\n Pick<AriaPopoverProps, 'shouldFlip'> {\n /** The contents of the collection. */\n children: ReactNode | ((item: T) => ReactNode),\n /**\n * Direction the menu will render relative to the Picker.\n *\n * @default 'bottom'\n */\n direction?: 'bottom' | 'top',\n /**\n * Alignment of the menu relative to the input target.\n *\n * @default 'start'\n */\n align?: 'start' | 'end',\n /** Width of the menu. By default, matches width of the trigger. Note that the minimum width of the dropdown is always equal to the trigger's width. */\n menuWidth?: number\n}\n\nexport const ComboBoxContext = createContext<ContextValue<Partial<ComboBoxProps<any>>, TextFieldRef>>(null);\n\nconst inputButton = style({\n display: 'flex',\n outlineStyle: 'none',\n textAlign: 'center',\n borderStyle: 'none',\n borderRadius: 'control-sm',\n alignItems: 'center',\n justifyContent: 'center',\n size: {\n size: {\n S: 16,\n M: 20,\n L: 24,\n XL: 32\n }\n },\n marginStart: 'text-to-control',\n aspectRatio: 'square',\n flexShrink: 0,\n transition: {\n default: 'default',\n forcedColors: 'none'\n },\n backgroundColor: {\n default: baseColor('gray-100'),\n isOpen: 'gray-200',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonText',\n isHovered: 'Highlight',\n isOpen: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n color: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'ButtonFace'\n }\n }\n});\n\nconst iconStyles = style({\n flexShrink: 0,\n rotate: 90,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nlet InternalComboboxContext = createContext<{size: 'S' | 'M' | 'L' | 'XL'}>({size: 'M'});\n\n/**\n * ComboBox allow users to choose a single option from a collapsible list of options when space is limited.\n */\nexport const ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(function ComboBox<T extends object>(props: ComboBoxProps<T>, ref: Ref<TextFieldRef>) {\n [props, ref] = useSpectrumContextProps(props, ref, ComboBoxContext);\n let inputRef = useRef<HTMLInputElement>(null);\n let domRef = useRef<HTMLDivElement>(null);\n let buttonRef = useRef<HTMLButtonElement>(null);\n let formContext = useContext(FormContext);\n props = useFormProps(props);\n let {\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n menuWidth,\n label,\n description: descriptionMessage,\n errorMessage,\n children,\n items,\n size = 'M',\n labelPosition = 'top',\n labelAlign = 'start',\n necessityIndicator,\n UNSAFE_className = '',\n UNSAFE_style,\n ...pickerProps\n } = props;\n\n // Expose imperative interface for ref\n useImperativeHandle(ref, () => ({\n ...createFocusableRef(domRef, inputRef),\n select() {\n if (inputRef.current) {\n inputRef.current.select();\n }\n },\n getInputElement() {\n return inputRef.current;\n }\n }));\n\n // Better way to encode this into a style? need to account for flipping\n let menuOffset: number;\n if (size === 'S') {\n menuOffset = 6;\n } else if (size === 'M') {\n menuOffset = 6;\n } else if (size === 'L') {\n menuOffset = 7;\n } else {\n menuOffset = 8;\n }\n\n let triggerRef = useRef<HTMLDivElement>(null);\n // Make menu width match input + button\n let [triggerWidth, setTriggerWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (triggerRef.current) {\n let inputRect = triggerRef.current.getBoundingClientRect();\n let minX = inputRect.left;\n let maxX = inputRect.right;\n setTriggerWidth((maxX - minX) + 'px');\n }\n }, [triggerRef, setTriggerWidth]);\n\n useResizeObserver({\n ref: triggerRef,\n onResize: onResize\n });\n\n return (\n <AriaComboBox\n {...pickerProps}\n style={UNSAFE_style}\n className={UNSAFE_className + style(field(), getAllowedOverrides())({\n isInForm: !!formContext,\n labelPosition,\n size\n }, props.styles)}>\n {({isDisabled, isOpen, isRequired, isInvalid}) => (\n <>\n <InternalComboboxContext.Provider value={{size}}>\n <FieldLabel\n isDisabled={isDisabled}\n isRequired={isRequired}\n size={size}\n labelPosition={labelPosition}\n labelAlign={labelAlign}\n necessityIndicator={necessityIndicator}\n contextualHelp={props.contextualHelp}>\n {label}\n </FieldLabel>\n <FieldGroup\n ref={triggerRef}\n role=\"presentation\"\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n size={size}\n styles={style({\n ...fieldInput(),\n paddingStart: 'edge-to-text',\n // better way to do this one? it's not actually half, they are\n // [9, 4], [12, 6], [15, 8], [18, 8]\n // also noticed that our measurement is including the border, making the padding too much\n paddingEnd: '[calc(self(height, self(minHeight)) * 3 / 16)]'\n })({size})}>\n <InputContext.Consumer>\n {ctx => (\n <InputContext.Provider value={{...ctx, ref: mergeRefs((ctx as any)?.ref, inputRef)}}>\n <Input />\n </InputContext.Provider>\n )}\n </InputContext.Consumer>\n {isInvalid && <FieldErrorIcon isDisabled={isDisabled} />}\n <Button\n ref={buttonRef}\n // Prevent press scale from sticking while ComboBox is open.\n // @ts-ignore\n isPressed={false}\n style={renderProps => pressScale(buttonRef)(renderProps)}\n className={renderProps => inputButton({\n ...renderProps,\n size,\n isOpen\n })}>\n <ChevronIcon\n size={size}\n className={iconStyles} />\n </Button>\n </FieldGroup>\n <HelpText\n size={size}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n description={descriptionMessage}>\n {errorMessage}\n </HelpText>\n <PopoverBase\n hideArrow\n triggerRef={triggerRef}\n offset={menuOffset}\n placement={`${direction} ${align}` as Placement}\n shouldFlip={shouldFlip}\n UNSAFE_style={{\n width: menuWidth ? `${menuWidth}px` : undefined,\n // manually subtract border as we can't set Popover to border-box, it causes the contents to spill out\n '--trigger-width': `calc(${triggerWidth} - 2px)`\n } as CSSProperties}\n styles={style({\n minWidth: '[var(--trigger-width)]',\n width: '[var(--trigger-width)]'\n })}>\n <Provider\n values={[\n [HeaderContext, {styles: sectionHeader({size})}],\n [HeadingContext, {styles: sectionHeading}],\n [TextContext, {\n slots: {\n 'description': {styles: description({size})}\n }\n }]\n ]}>\n <ListBox\n items={items}\n className={menu({size})}>\n {children}\n </ListBox>\n </Provider>\n </PopoverBase>\n </InternalComboboxContext.Provider>\n </>\n )}\n </AriaComboBox>\n );\n});\n\n\nexport interface ComboBoxItemProps extends Omit<ListBoxItemProps, 'children' | 'style' | 'className'>, StyleProps {\n children: ReactNode\n}\n\nconst checkmarkIconSize = {\n S: 'XS',\n M: 'M',\n L: 'L',\n XL: 'XL'\n} as const;\n\nexport function ComboBoxItem(props: ComboBoxItemProps) {\n let ref = useRef(null);\n let isLink = props.href != null;\n let {size} = useContext(InternalComboboxContext);\n return (\n <ListBoxItem\n {...props}\n ref={ref}\n textValue={props.textValue || (typeof props.children === 'string' ? props.children as string : undefined)}\n style={pressScale(ref, props.UNSAFE_style)}\n className={renderProps => (props.UNSAFE_className || '') + menuitem({...renderProps, size, isLink}, props.styles)}>\n {(renderProps) => {\n let {children} = props;\n return (\n <>\n <Provider\n values={[\n [IconContext, {\n slots: {\n icon: {render: centerBaseline({slot: 'icon', styles: iconCenterWrapper}), styles: icon}\n }\n }],\n [TextContext, {\n slots: {\n label: {styles: label({size})},\n description: {styles: description({...renderProps, size})}\n }\n }]\n ]}>\n {!isLink && <CheckmarkIcon size={checkmarkIconSize[size]} className={checkmark({...renderProps, size})} />}\n {typeof children === 'string' ? <Text slot=\"label\">{children}</Text> : children}\n </Provider>\n </>\n );\n }}\n </ListBoxItem>\n );\n}\n\nexport interface ComboBoxSectionProps<T extends object> extends SectionProps<T> {}\nexport function ComboBoxSection<T extends object>(props: ComboBoxSectionProps<T>) {\n let {size} = useContext(InternalComboboxContext);\n return (\n <>\n <AriaListBoxSection\n {...props}\n className={section({size})}>\n {props.children}\n </AriaListBoxSection>\n <Divider />\n </>\n );\n}\n"],"names":[],"version":3,"file":"ComboBox.css.map"}
|
package/dist/ComboBox.mjs
CHANGED
|
@@ -96,7 +96,7 @@ const $a2f262fac286a920$var$inputButton = function anonymous(props) {
|
|
|
96
96
|
}
|
|
97
97
|
return rules;
|
|
98
98
|
};
|
|
99
|
-
const $a2f262fac286a920$var$iconStyles = "
|
|
99
|
+
const $a2f262fac286a920$var$iconStyles = " _9-3t1x R-3hn0u -rwx0fg_e-b";
|
|
100
100
|
let $a2f262fac286a920$var$InternalComboboxContext = /*#__PURE__*/ (0, $5rXoR$createContext)({
|
|
101
101
|
size: 'M'
|
|
102
102
|
});
|
|
@@ -303,7 +303,7 @@ const $a2f262fac286a920$export$72b9695b8216309a = /*#__PURE__*/ (0, $5rXoR$forwa
|
|
|
303
303
|
// manually subtract border as we can't set Popover to border-box, it causes the contents to spill out
|
|
304
304
|
'--trigger-width': `calc(${triggerWidth} - 2px)`
|
|
305
305
|
},
|
|
306
|
-
styles: "
|
|
306
|
+
styles: " q-1utmx2y l-1utmx2y",
|
|
307
307
|
children: /*#__PURE__*/ (0, $5rXoR$jsx)((0, $5rXoR$Provider), {
|
|
308
308
|
values: [
|
|
309
309
|
[
|
package/dist/Content.cjs
CHANGED
|
@@ -3,6 +3,7 @@ var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
|
|
|
3
3
|
var $bwC5I$reactjsxruntime = require("react/jsx-runtime");
|
|
4
4
|
var $bwC5I$reactariacomponents = require("react-aria-components");
|
|
5
5
|
var $bwC5I$react = require("react");
|
|
6
|
+
var $bwC5I$reactariautils = require("@react-aria/utils");
|
|
6
7
|
var $bwC5I$reactspectrumutils = require("@react-spectrum/utils");
|
|
7
8
|
|
|
8
9
|
|
|
@@ -38,6 +39,7 @@ $parcel$export(module.exports, "Footer", () => $6367bc87eb7d24ad$export$a06f1c67
|
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
42
|
+
|
|
41
43
|
const $6367bc87eb7d24ad$export$d688439359537581 = /*#__PURE__*/ (0, $bwC5I$react.createContext)(null);
|
|
42
44
|
const $6367bc87eb7d24ad$export$a8a3e93435678ff9 = /*#__PURE__*/ (0, $bwC5I$react.forwardRef)(function Heading(props, ref) {
|
|
43
45
|
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $6367bc87eb7d24ad$export$d688439359537581);
|
|
@@ -93,7 +95,7 @@ const $6367bc87eb7d24ad$export$5f1af8db9871e1d6 = /*#__PURE__*/ (0, $bwC5I$react
|
|
|
93
95
|
...otherProps,
|
|
94
96
|
ref: domRef,
|
|
95
97
|
// @ts-ignore - compatibility with React < 19
|
|
96
|
-
inert: isSkeleton
|
|
98
|
+
inert: (0, $bwC5I$reactariautils.inertValue)(isSkeleton),
|
|
97
99
|
className: UNSAFE_className + styles,
|
|
98
100
|
style: UNSAFE_style,
|
|
99
101
|
slot: slot || undefined,
|
package/dist/Content.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAsBM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA+D;AAElG,MAAM,0DAAU,CAAA,GAAA,uBAAS,EAChC,SAAS,QAAQ,KAAmB,EAAE,GAA+B;IACnE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,EAAE,GAAG,YAAW,GAAG;IACnF,IAAI,UACF,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,kCAAS;QACP,GAAG,UAAU;QACd,KAAK;QACL,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;;AAEpB;AAEO,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAwD;AAE1F,MAAM,0DAAS,CAAA,GAAA,uBAAS,EAAE,SAAS,OAAO,KAAmB,EAAE,GAAW;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,EAAE,GAAG,YAAW,GAAG;IACnF,IAAI,UACF,OAAO;IAGT,qBACE,gCAAC,CAAA,GAAA,iCAAQ;QACN,GAAG,UAAU;QACd,KAAK;QACL,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;;AAEpB;AAEO,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2D;AAE9F,MAAM,0DAAU,CAAA,GAAA,uBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAA2B;IACjG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,EAAE,GAAG,YAAW,GAAG;IACnF,IAAI,UACF,OAAO;IAET,qBACE,gCAAC;QACE,GAAG,UAAU;QACd,KAAK;QACL,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;;AAEpB;AAEO,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAA2C;AAE3E,MAAM,0DAAO,CAAA,GAAA,uBAAS,EAAE,SAAS,KAAK,KAAmB,EAAE,GAAW;IAC3E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,YAAE,QAAQ,EAAE,GAAG,YAAW,GAAG;IAC7F,IAAI,aAAa,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,sCAAa;IACzC,IAAI,aAAa,CAAA,GAAA,uCAAY;IAC7B,CAAC,UAAU,aAAa,GAAG,CAAA,GAAA,yCAAc,EAAE,UAAU;IACrD,IAAI,UACF,OAAO;IAGT,IAAI,qBACF,gCAAC,CAAA,GAAA,+BAAO;QACL,GAAG,UAAU;QACd,KAAK;QACL,6CAA6C;QAC7C,OAAO,CAAA,GAAA,gCAAS,EAAE;QAClB,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;QACd,iBAAc;kBACb;;IAIL,IAAI,QAAQ,cAAc,WAAW,cAAc,CAAC,WAAW,KAAK,EAAE,CAAC,KAAK,EAC1E,qBAAO,gCAAC,CAAA,GAAA,sCAAa,EAAE,QAAQ;QAAC,OAAO;kBAAO;;IAGhD,OAAO;AACT;AAEO,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAA2C,CAAC;AAEhF,MAAM,0DAAW,CAAA,GAAA,uBAAS,EAAE,SAAS,SAAS,KAAmB,EAAE,GAAW;IACnF,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,EAAE,GAAG,YAAW,GAAG;IACnF,IAAI,UACF,OAAO;IAET,qBACE,gCAAC,CAAA,GAAA,mCAAW;QACT,GAAG,UAAU;QACd,KAAK;QACL,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;;AAEpB;AAEO,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA2C,CAAC;AAE9E,MAAM,0DAAS,CAAA,GAAA,uBAAS,EAAE,SAAS,OAAO,KAAmB,EAAE,GAAW;IAC/E,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,oBAAC,mBAAmB,kBAAI,YAAY,UAAE,MAAM,YAAE,QAAQ,QAAE,IAAI,EAAE,GAAG,YAAW,GAAG;IACnF,IAAI,UACF,OAAO;IAET,qBACE,gCAAC;QACE,GAAG,UAAU;QACd,KAAK;QACL,WAAW,mBAAmB;QAC9B,OAAO;QACP,MAAM,QAAQ;;AAEpB","sources":["packages/@react-spectrum/s2/src/Content.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, Keyboard as KeyboardAria, Header as RACHeader, Heading as RACHeading, TextContext as RACTextContext, SlotProps, Text as TextAria} from 'react-aria-components';\nimport {createContext, forwardRef, ReactNode, useContext} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {inertValue} from '@react-aria/utils';\nimport {StyleString} from '../style/types';\nimport {UnsafeStyles} from './style-utils';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useIsSkeleton, useSkeletonText} from './Skeleton';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ContentProps extends UnsafeStyles, SlotProps {\n children?: ReactNode,\n styles?: StyleString,\n isHidden?: boolean\n}\n\ninterface HeadingProps extends ContentProps {\n level?: number\n}\n\nexport const HeadingContext = createContext<ContextValue<HeadingProps, DOMRefValue<HTMLHeadingElement>>>(null);\n\nexport const Heading = forwardRef(// Wrapper around RAC Heading to unmount when hidden.\nfunction Heading(props: HeadingProps, ref: DOMRef<HTMLHeadingElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, HeadingContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;\n if (isHidden) {\n return null;\n }\n\n return (\n <RACHeading\n {...otherProps}\n ref={domRef}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined} />\n );\n});\n\nexport const HeaderContext = createContext<ContextValue<ContentProps, DOMRefValue<HTMLElement>>>(null);\n\nexport const Header = forwardRef(function Header(props: ContentProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, HeaderContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;\n if (isHidden) {\n return null;\n }\n\n return (\n <RACHeader\n {...otherProps}\n ref={domRef}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined} />\n );\n});\n\nexport const ContentContext = createContext<ContextValue<ContentProps, DOMRefValue<HTMLDivElement>>>(null);\n\nexport const Content = forwardRef(function Content(props: ContentProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ContentContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;\n if (isHidden) {\n return null;\n }\n return (\n <div\n {...otherProps}\n ref={domRef}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined} />\n );\n});\n\nexport const TextContext = createContext<ContextValue<ContentProps, DOMRefValue>>(null);\n\nexport const Text = forwardRef(function Text(props: ContentProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, TextContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, children, ...otherProps} = props;\n let racContext = useContext(RACTextContext);\n let isSkeleton = useIsSkeleton();\n [children, UNSAFE_style] = useSkeletonText(children, UNSAFE_style);\n if (isHidden) {\n return null;\n }\n\n let text = (\n <TextAria\n {...otherProps}\n ref={domRef}\n // @ts-ignore - compatibility with React < 19\n inert={inertValue(isSkeleton)}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined}\n data-rsp-slot=\"text\">\n {children}\n </TextAria>\n );\n\n if (slot && racContext && 'slots' in racContext && !racContext.slots?.[slot]) {\n return <RACTextContext.Provider value={null}>{text}</RACTextContext.Provider>;\n }\n\n return text;\n});\n\nexport const KeyboardContext = createContext<ContextValue<ContentProps, DOMRefValue>>({});\n\nexport const Keyboard = forwardRef(function Keyboard(props: ContentProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, KeyboardContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;\n if (isHidden) {\n return null;\n }\n return (\n <KeyboardAria\n {...otherProps}\n ref={domRef}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined} />\n );\n});\n\nexport const FooterContext = createContext<ContextValue<ContentProps, DOMRefValue>>({});\n\nexport const Footer = forwardRef(function Footer(props: ContentProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, FooterContext);\n let domRef = useDOMRef(ref);\n let {UNSAFE_className = '', UNSAFE_style, styles, isHidden, slot, ...otherProps} = props;\n if (isHidden) {\n return null;\n }\n return (\n <footer\n {...otherProps}\n ref={domRef}\n className={UNSAFE_className + styles}\n style={UNSAFE_style}\n slot={slot || undefined} />\n );\n});\n"],"names":[],"version":3,"file":"Content.cjs.map"}
|
package/dist/Content.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} fr
|
|
|
3
3
|
import {jsx as $7TVeb$jsx} from "react/jsx-runtime";
|
|
4
4
|
import {Heading as $7TVeb$Heading, Header as $7TVeb$Header, TextContext as $7TVeb$TextContext, Text as $7TVeb$Text, Keyboard as $7TVeb$Keyboard} from "react-aria-components";
|
|
5
5
|
import {createContext as $7TVeb$createContext, forwardRef as $7TVeb$forwardRef, useContext as $7TVeb$useContext} from "react";
|
|
6
|
+
import {inertValue as $7TVeb$inertValue} from "@react-aria/utils";
|
|
6
7
|
import {useDOMRef as $7TVeb$useDOMRef} from "@react-spectrum/utils";
|
|
7
8
|
|
|
8
9
|
/*
|
|
@@ -21,6 +22,7 @@ import {useDOMRef as $7TVeb$useDOMRef} from "@react-spectrum/utils";
|
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
|
|
24
26
|
const $8e847109a6ab556d$export$d688439359537581 = /*#__PURE__*/ (0, $7TVeb$createContext)(null);
|
|
25
27
|
const $8e847109a6ab556d$export$a8a3e93435678ff9 = /*#__PURE__*/ (0, $7TVeb$forwardRef)(function Heading(props, ref) {
|
|
26
28
|
[props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $8e847109a6ab556d$export$d688439359537581);
|
|
@@ -76,7 +78,7 @@ const $8e847109a6ab556d$export$5f1af8db9871e1d6 = /*#__PURE__*/ (0, $7TVeb$forwa
|
|
|
76
78
|
...otherProps,
|
|
77
79
|
ref: domRef,
|
|
78
80
|
// @ts-ignore - compatibility with React < 19
|
|
79
|
-
inert: isSkeleton
|
|
81
|
+
inert: (0, $7TVeb$inertValue)(isSkeleton),
|
|
80
82
|
className: UNSAFE_className + styles,
|
|
81
83
|
style: UNSAFE_style,
|
|
82
84
|
slot: slot || undefined,
|