@react-spectrum/s2 3.0.0-nightly-326f48154-241216 → 3.0.0-nightly-adae13c78-241218
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 +23 -18
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +7 -15
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +23 -18
- package/dist/Field.mjs.map +1 -1
- package/dist/InlineAlert.cjs +24 -29
- package/dist/InlineAlert.cjs.map +1 -1
- package/dist/InlineAlert.css +15 -19
- package/dist/InlineAlert.css.map +1 -1
- package/dist/InlineAlert.mjs +24 -29
- package/dist/InlineAlert.mjs.map +1 -1
- 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 +28 -8
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +3 -3
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +29 -9
- 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 +19 -17
- package/src/InlineAlert.tsx +0 -1
- package/src/Link.tsx +7 -12
- package/src/Menu.tsx +24 -8
- 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/ComboBox.cjs
CHANGED
|
@@ -83,10 +83,10 @@ const $a2d5b35c01bebcd6$var$inputButton = function anonymous(props) {
|
|
|
83
83
|
rules += ' _Q-375x7f';
|
|
84
84
|
rules += ' _Raa';
|
|
85
85
|
rules += ' _Ra';
|
|
86
|
-
if (props.isDisabled) rules += '
|
|
87
|
-
else if (props.isOpen) rules += '
|
|
88
|
-
else if (props.isHovered) rules += '
|
|
89
|
-
else rules += '
|
|
86
|
+
if (props.isDisabled) rules += ' ba_____O';
|
|
87
|
+
else if (props.isOpen) rules += ' ba_____M';
|
|
88
|
+
else if (props.isHovered) rules += ' ba_____M';
|
|
89
|
+
else rules += ' ba_____K';
|
|
90
90
|
if (props.isDisabled) rules += ' bg';
|
|
91
91
|
else if (props.isOpen) rules += ' bh';
|
|
92
92
|
else {
|
|
@@ -95,7 +95,7 @@ const $a2d5b35c01bebcd6$var$inputButton = function anonymous(props) {
|
|
|
95
95
|
else if (props.isHovered) rules += ' bh';
|
|
96
96
|
else rules += ' bg';
|
|
97
97
|
}
|
|
98
|
-
rules += '
|
|
98
|
+
rules += ' aa_____J';
|
|
99
99
|
if (props.isDisabled) rules += ' aj';
|
|
100
100
|
else {
|
|
101
101
|
if (props.isPressed) rules += ' ao';
|
package/dist/ComboBox.css
CHANGED
|
@@ -333,19 +333,19 @@
|
|
|
333
333
|
transition-timing-function: cubic-bezier(.45, 0, .4, 1);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
.
|
|
336
|
+
.ba_____K {
|
|
337
337
|
background-color: buttontext;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
-
.
|
|
340
|
+
.ba_____M {
|
|
341
341
|
background-color: highlight;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
.
|
|
344
|
+
.ba_____O {
|
|
345
345
|
background-color: graytext;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
.
|
|
348
|
+
.aa_____J {
|
|
349
349
|
color: buttonface;
|
|
350
350
|
}
|
|
351
351
|
}
|
package/dist/ComboBox.mjs
CHANGED
|
@@ -74,10 +74,10 @@ const $a2f262fac286a920$var$inputButton = function anonymous(props) {
|
|
|
74
74
|
rules += ' _Q-375x7f';
|
|
75
75
|
rules += ' _Raa';
|
|
76
76
|
rules += ' _Ra';
|
|
77
|
-
if (props.isDisabled) rules += '
|
|
78
|
-
else if (props.isOpen) rules += '
|
|
79
|
-
else if (props.isHovered) rules += '
|
|
80
|
-
else rules += '
|
|
77
|
+
if (props.isDisabled) rules += ' ba_____O';
|
|
78
|
+
else if (props.isOpen) rules += ' ba_____M';
|
|
79
|
+
else if (props.isHovered) rules += ' ba_____M';
|
|
80
|
+
else rules += ' ba_____K';
|
|
81
81
|
if (props.isDisabled) rules += ' bg';
|
|
82
82
|
else if (props.isOpen) rules += ' bh';
|
|
83
83
|
else {
|
|
@@ -86,7 +86,7 @@ const $a2f262fac286a920$var$inputButton = function anonymous(props) {
|
|
|
86
86
|
else if (props.isHovered) rules += ' bh';
|
|
87
87
|
else rules += ' bg';
|
|
88
88
|
}
|
|
89
|
-
rules += '
|
|
89
|
+
rules += ' aa_____J';
|
|
90
90
|
if (props.isDisabled) rules += ' aj';
|
|
91
91
|
else {
|
|
92
92
|
if (props.isPressed) rules += ' ao';
|
package/dist/Disclosure.cjs
CHANGED
|
@@ -94,7 +94,7 @@ const $4e301a98f0cc4e4f$var$buttonStyles = function anonymous(props) {
|
|
|
94
94
|
let rules = " .";
|
|
95
95
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
96
96
|
else rules += ' _La';
|
|
97
|
-
rules += '
|
|
97
|
+
rules += ' da_____M';
|
|
98
98
|
rules += ' dx';
|
|
99
99
|
rules += ' _Nc';
|
|
100
100
|
rules += ' _M-3hmpw';
|
package/dist/Disclosure.css
CHANGED
package/dist/Disclosure.mjs
CHANGED
|
@@ -84,7 +84,7 @@ const $cf1d656285911959$var$buttonStyles = function anonymous(props) {
|
|
|
84
84
|
let rules = " .";
|
|
85
85
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
86
86
|
else rules += ' _La';
|
|
87
|
-
rules += '
|
|
87
|
+
rules += ' da_____M';
|
|
88
88
|
rules += ' dx';
|
|
89
89
|
rules += ' _Nc';
|
|
90
90
|
rules += ' _M-3hmpw';
|
package/dist/Divider.cjs
CHANGED
|
@@ -47,14 +47,13 @@ const $2d04acb918636de0$export$e8c9778bf415dd08 = function anonymous(props, over
|
|
|
47
47
|
if (/^\s*z/.test(p)) $z = true;
|
|
48
48
|
if (/^\s*l/.test(p)) $l = true;
|
|
49
49
|
}
|
|
50
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
51
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
50
52
|
if (!$_4) rules += ' _4e';
|
|
51
|
-
rules += '
|
|
52
|
-
if (props.
|
|
53
|
-
if (props.size === "L") rules += '
|
|
54
|
-
else rules += '
|
|
55
|
-
} else if (props.staticColor === "white") {
|
|
56
|
-
if (props.size === "L") rules += ' b_____e';
|
|
57
|
-
else rules += ' b____8';
|
|
53
|
+
rules += ' ba_____I';
|
|
54
|
+
if (props.isStaticColor) {
|
|
55
|
+
if (props.size === "L") rules += ' b_____E';
|
|
56
|
+
else rules += ' b_____y';
|
|
58
57
|
} else if (props.size === "L") rules += ' bn';
|
|
59
58
|
else rules += ' bh';
|
|
60
59
|
rules += ' wf';
|
|
@@ -90,7 +89,8 @@ const $2d04acb918636de0$export$2e0a83ec2e27ecbb = /*#__PURE__*/ (0, $98jss$react
|
|
|
90
89
|
className: (props.UNSAFE_className || '') + $2d04acb918636de0$export$e8c9778bf415dd08({
|
|
91
90
|
size: props.size || 'M',
|
|
92
91
|
orientation: props.orientation || 'horizontal',
|
|
93
|
-
staticColor: props.staticColor
|
|
92
|
+
staticColor: props.staticColor,
|
|
93
|
+
isStaticColor: !!props.staticColor
|
|
94
94
|
}, props.styles)
|
|
95
95
|
});
|
|
96
96
|
});
|
package/dist/Divider.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAE9E,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA2C;AAE9E,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDN,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAAW;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,oCAAW;QACT,GAAG,KAAK;QACT,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,0CAAQ;YAClD,MAAM,MAAM,IAAI,IAAI;YACpB,aAAa,MAAM,WAAW,IAAI;YAClC,aAAa,MAAM,WAAW;YAC9B,eAAe,CAAC,CAAC,MAAM,WAAW;QACpC,GAAG,MAAM,MAAM;;AAErB","sources":["packages/@react-spectrum/s2/src/Divider.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, Separator as RACSeparator, SeparatorProps as RACSeparatorProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, staticColor, 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\n/*\n * Adding as it's own type to deal with size being a part of the theme so we\n * can type style() and it's parameters.\n */\ninterface DividerSpectrumProps {\n /**\n * How thick the Divider should be.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * How thick the Divider should be.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical',\n /** The static color style to apply. Useful when the Divider appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto'\n}\n\n// TODO: allow overriding height (only when orientation is vertical)??\nexport interface DividerProps extends DividerSpectrumProps, Omit<RACSeparatorProps, 'className' | 'style' | 'elementType'>, StyleProps {}\n\nexport const DividerContext = createContext<ContextValue<DividerProps, DOMRefValue>>(null);\n\nexport const divider = style<DividerSpectrumProps & {isStaticColor: boolean}>({\n ...staticColor(),\n alignSelf: 'stretch',\n backgroundColor: {\n default: 'gray-200',\n size: {\n L: 'gray-800'\n },\n isStaticColor: {\n default: 'transparent-overlay-200',\n size: {\n L: 'transparent-overlay-800'\n }\n },\n forcedColors: 'ButtonBorder'\n },\n borderStyle: 'none',\n borderRadius: 'full',\n margin: 0,\n height: {\n orientation: {\n horizontal: {\n // These should be px not rems, because we're emulating a border.\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n },\n width: {\n orientation: {\n vertical: {\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\n/**\n * Dividers bring clarity to a layout by grouping and dividing content in close proximity.\n * They can also be used to establish rhythm and hierarchy.\n */\nexport const Divider = /*#__PURE__*/ forwardRef(function Divider(props: DividerProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, DividerContext);\n let domRef = useDOMRef(ref);\n\n return (\n <RACSeparator\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + divider({\n size: props.size || 'M',\n orientation: props.orientation || 'horizontal',\n staticColor: props.staticColor,\n isStaticColor: !!props.staticColor\n }, props.styles)} />\n );\n});\n"],"names":[],"version":3,"file":"Divider.cjs.map"}
|
package/dist/Divider.css
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
@layer _.a {
|
|
6
|
+
.-_1de2x0q_b-c {
|
|
7
|
+
--s2-container-bg: white;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.-_1de2x0q_b-b {
|
|
11
|
+
--s2-container-bg: black;
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
._4e {
|
|
7
15
|
align-self: stretch;
|
|
8
16
|
}
|
|
@@ -15,20 +23,12 @@
|
|
|
15
23
|
background-color: var(--lightningcss-light, #292929) var(--lightningcss-dark, #dbdbdb);
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
.
|
|
19
|
-
background-color:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.b_____e {
|
|
23
|
-
background-color: #ffffffd9;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.b_____l {
|
|
27
|
-
background-color: #0000001f;
|
|
26
|
+
.b_____y {
|
|
27
|
+
background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .14);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
31
|
-
background-color:
|
|
30
|
+
.b_____E {
|
|
31
|
+
background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .85);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.wf {
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
|
|
97
97
|
@layer _.b.a {
|
|
98
98
|
@media (forced-colors: active) {
|
|
99
|
-
.
|
|
99
|
+
.ba_____I {
|
|
100
100
|
background-color: buttonborder;
|
|
101
101
|
}
|
|
102
102
|
}
|
package/dist/Divider.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AA4CuB;;;;AAAA;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA","sources":["packages/@react-spectrum/s2/src/Divider.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, Separator as RACSeparator, SeparatorProps as RACSeparatorProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\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\n/*\n * Adding as it's own type to deal with size being a part of the theme so we\n * can type style() and it's parameters.\n */\ninterface DividerSpectrumProps {\n /**\n * How thick the Divider should be.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * How thick the Divider should be.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical',\n /** The static color style to apply. Useful when the Divider appears over a color background. */\n staticColor?: 'white' | 'black'\n}\n\n// TODO: allow overriding height (only when orientation is vertical)??\nexport interface DividerProps extends DividerSpectrumProps, Omit<RACSeparatorProps, 'className' | 'style' | 'elementType'>, StyleProps {}\n\nexport const DividerContext = createContext<ContextValue<DividerProps, DOMRefValue>>(null);\n\nexport const divider = style<DividerSpectrumProps>({\n alignSelf: 'stretch',\n backgroundColor: {\n default: 'gray-200',\n size: {\n L: 'gray-800'\n },\n
|
|
1
|
+
{"mappings":"AA4CuB;;;;AAAA;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;;AAAA;EAAA;IAAA","sources":["packages/@react-spectrum/s2/src/Divider.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, Separator as RACSeparator, SeparatorProps as RACSeparatorProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, staticColor, 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\n/*\n * Adding as it's own type to deal with size being a part of the theme so we\n * can type style() and it's parameters.\n */\ninterface DividerSpectrumProps {\n /**\n * How thick the Divider should be.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * How thick the Divider should be.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical',\n /** The static color style to apply. Useful when the Divider appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto'\n}\n\n// TODO: allow overriding height (only when orientation is vertical)??\nexport interface DividerProps extends DividerSpectrumProps, Omit<RACSeparatorProps, 'className' | 'style' | 'elementType'>, StyleProps {}\n\nexport const DividerContext = createContext<ContextValue<DividerProps, DOMRefValue>>(null);\n\nexport const divider = style<DividerSpectrumProps & {isStaticColor: boolean}>({\n ...staticColor(),\n alignSelf: 'stretch',\n backgroundColor: {\n default: 'gray-200',\n size: {\n L: 'gray-800'\n },\n isStaticColor: {\n default: 'transparent-overlay-200',\n size: {\n L: 'transparent-overlay-800'\n }\n },\n forcedColors: 'ButtonBorder'\n },\n borderStyle: 'none',\n borderRadius: 'full',\n margin: 0,\n height: {\n orientation: {\n horizontal: {\n // These should be px not rems, because we're emulating a border.\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n },\n width: {\n orientation: {\n vertical: {\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\n/**\n * Dividers bring clarity to a layout by grouping and dividing content in close proximity.\n * They can also be used to establish rhythm and hierarchy.\n */\nexport const Divider = /*#__PURE__*/ forwardRef(function Divider(props: DividerProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, DividerContext);\n let domRef = useDOMRef(ref);\n\n return (\n <RACSeparator\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + divider({\n size: props.size || 'M',\n orientation: props.orientation || 'horizontal',\n staticColor: props.staticColor,\n isStaticColor: !!props.staticColor\n }, props.styles)} />\n );\n});\n"],"names":[],"version":3,"file":"Divider.css.map"}
|
package/dist/Divider.mjs
CHANGED
|
@@ -39,14 +39,13 @@ const $bdf52657dac0f070$export$e8c9778bf415dd08 = function anonymous(props, over
|
|
|
39
39
|
if (/^\s*z/.test(p)) $z = true;
|
|
40
40
|
if (/^\s*l/.test(p)) $l = true;
|
|
41
41
|
}
|
|
42
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
43
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
42
44
|
if (!$_4) rules += ' _4e';
|
|
43
|
-
rules += '
|
|
44
|
-
if (props.
|
|
45
|
-
if (props.size === "L") rules += '
|
|
46
|
-
else rules += '
|
|
47
|
-
} else if (props.staticColor === "white") {
|
|
48
|
-
if (props.size === "L") rules += ' b_____e';
|
|
49
|
-
else rules += ' b____8';
|
|
45
|
+
rules += ' ba_____I';
|
|
46
|
+
if (props.isStaticColor) {
|
|
47
|
+
if (props.size === "L") rules += ' b_____E';
|
|
48
|
+
else rules += ' b_____y';
|
|
50
49
|
} else if (props.size === "L") rules += ' bn';
|
|
51
50
|
else rules += ' bh';
|
|
52
51
|
rules += ' wf';
|
|
@@ -82,7 +81,8 @@ const $bdf52657dac0f070$export$2e0a83ec2e27ecbb = /*#__PURE__*/ (0, $5nGzy$forwa
|
|
|
82
81
|
className: (props.UNSAFE_className || '') + $bdf52657dac0f070$export$e8c9778bf415dd08({
|
|
83
82
|
size: props.size || 'M',
|
|
84
83
|
orientation: props.orientation || 'horizontal',
|
|
85
|
-
staticColor: props.staticColor
|
|
84
|
+
staticColor: props.staticColor,
|
|
85
|
+
isStaticColor: !!props.staticColor
|
|
86
86
|
}, props.styles)
|
|
87
87
|
});
|
|
88
88
|
});
|
package/dist/Divider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAE9E,MAAM
|
|
1
|
+
{"mappings":";;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAgCM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA2C;AAE9E,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDN,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,QAAQ,KAAmB,EAAE,GAAW;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gBAAC,CAAA,GAAA,gBAAW;QACT,GAAG,KAAK;QACT,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,0CAAQ;YAClD,MAAM,MAAM,IAAI,IAAI;YACpB,aAAa,MAAM,WAAW,IAAI;YAClC,aAAa,MAAM,WAAW;YAC9B,eAAe,CAAC,CAAC,MAAM,WAAW;QACpC,GAAG,MAAM,MAAM;;AAErB","sources":["packages/@react-spectrum/s2/src/Divider.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, Separator as RACSeparator, SeparatorProps as RACSeparatorProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, staticColor, 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\n/*\n * Adding as it's own type to deal with size being a part of the theme so we\n * can type style() and it's parameters.\n */\ninterface DividerSpectrumProps {\n /**\n * How thick the Divider should be.\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /**\n * How thick the Divider should be.\n * @default 'horizontal'\n */\n orientation?: 'horizontal' | 'vertical',\n /** The static color style to apply. Useful when the Divider appears over a color background. */\n staticColor?: 'white' | 'black' | 'auto'\n}\n\n// TODO: allow overriding height (only when orientation is vertical)??\nexport interface DividerProps extends DividerSpectrumProps, Omit<RACSeparatorProps, 'className' | 'style' | 'elementType'>, StyleProps {}\n\nexport const DividerContext = createContext<ContextValue<DividerProps, DOMRefValue>>(null);\n\nexport const divider = style<DividerSpectrumProps & {isStaticColor: boolean}>({\n ...staticColor(),\n alignSelf: 'stretch',\n backgroundColor: {\n default: 'gray-200',\n size: {\n L: 'gray-800'\n },\n isStaticColor: {\n default: 'transparent-overlay-200',\n size: {\n L: 'transparent-overlay-800'\n }\n },\n forcedColors: 'ButtonBorder'\n },\n borderStyle: 'none',\n borderRadius: 'full',\n margin: 0,\n height: {\n orientation: {\n horizontal: {\n // These should be px not rems, because we're emulating a border.\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n },\n width: {\n orientation: {\n vertical: {\n default: '[2px]',\n size: {\n S: '[1px]',\n L: '[4px]'\n }\n }\n }\n }\n}, getAllowedOverrides());\n\n/**\n * Dividers bring clarity to a layout by grouping and dividing content in close proximity.\n * They can also be used to establish rhythm and hierarchy.\n */\nexport const Divider = /*#__PURE__*/ forwardRef(function Divider(props: DividerProps, ref: DOMRef) {\n [props, ref] = useSpectrumContextProps(props, ref, DividerContext);\n let domRef = useDOMRef(ref);\n\n return (\n <RACSeparator\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + divider({\n size: props.size || 'M',\n orientation: props.orientation || 'horizontal',\n staticColor: props.staticColor,\n isStaticColor: !!props.staticColor\n }, props.styles)} />\n );\n});\n"],"names":[],"version":3,"file":"Divider.mjs.map"}
|
package/dist/DropZone.cjs
CHANGED
|
@@ -92,10 +92,10 @@ const $797cda10ca96fc86$var$banner = function anonymous(props) {
|
|
|
92
92
|
if (props.size === "L") rules += ' r___L';
|
|
93
93
|
else if (props.size === "S") rules += ' r__Z';
|
|
94
94
|
else rules += ' r___v';
|
|
95
|
-
if (props.isPressed) rules += '
|
|
96
|
-
else if (props.isFocusVisible) rules += '
|
|
97
|
-
else if (props.isHovered) rules += '
|
|
98
|
-
else rules += '
|
|
95
|
+
if (props.isPressed) rules += ' b_____S';
|
|
96
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
97
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
98
|
+
else rules += ' b_____R';
|
|
99
99
|
rules += ' _vc';
|
|
100
100
|
rules += ' _wc';
|
|
101
101
|
rules += ' _xc';
|
package/dist/DropZone.css
CHANGED
|
@@ -131,11 +131,11 @@
|
|
|
131
131
|
max-width: calc(13rem * var(--s2-scale));
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.
|
|
134
|
+
.b_____R {
|
|
135
135
|
background-color: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #4069fd);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.
|
|
138
|
+
.b_____S {
|
|
139
139
|
background-color: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
140
140
|
}
|
|
141
141
|
|
package/dist/DropZone.mjs
CHANGED
|
@@ -85,10 +85,10 @@ const $fb6e45fba2483f65$var$banner = function anonymous(props) {
|
|
|
85
85
|
if (props.size === "L") rules += ' r___L';
|
|
86
86
|
else if (props.size === "S") rules += ' r__Z';
|
|
87
87
|
else rules += ' r___v';
|
|
88
|
-
if (props.isPressed) rules += '
|
|
89
|
-
else if (props.isFocusVisible) rules += '
|
|
90
|
-
else if (props.isHovered) rules += '
|
|
91
|
-
else rules += '
|
|
88
|
+
if (props.isPressed) rules += ' b_____S';
|
|
89
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
90
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
91
|
+
else rules += ' b_____R';
|
|
92
92
|
rules += ' _vc';
|
|
93
93
|
rules += ' _wc';
|
|
94
94
|
rules += ' _xc';
|
package/dist/Field.cjs
CHANGED
|
@@ -111,9 +111,8 @@ const $a0b996a550bb0891$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $4hgIp$react
|
|
|
111
111
|
rules += ' _eb';
|
|
112
112
|
rules += ' _f-1x99dlob';
|
|
113
113
|
rules += ' _fa';
|
|
114
|
-
rules += '
|
|
115
|
-
if (props.
|
|
116
|
-
else if (props.staticColor === "white") rules += ' a_____d';
|
|
114
|
+
rules += ' aa_____K';
|
|
115
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
117
116
|
else if (props.isDisabled) rules += ' aj';
|
|
118
117
|
else {
|
|
119
118
|
if (props.isPressed) rules += ' an';
|
|
@@ -127,7 +126,7 @@ const $a0b996a550bb0891$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $4hgIp$react
|
|
|
127
126
|
labelPosition: labelPosition,
|
|
128
127
|
isDisabled: isDisabled,
|
|
129
128
|
size: size,
|
|
130
|
-
|
|
129
|
+
isStaticColor: !!staticColor
|
|
131
130
|
}), props.styles),
|
|
132
131
|
children: [
|
|
133
132
|
props.children,
|
|
@@ -151,16 +150,22 @@ const $a0b996a550bb0891$export$1acdcf5a973a8414 = /*#__PURE__*/ (0, $4hgIp$react
|
|
|
151
150
|
})
|
|
152
151
|
]
|
|
153
152
|
}),
|
|
154
|
-
contextualHelp && /*#__PURE__*/ (0, $4hgIp$reactjsxruntime.
|
|
155
|
-
|
|
156
|
-
children:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
contextualHelp && /*#__PURE__*/ (0, $4hgIp$reactjsxruntime.jsxs)("span", {
|
|
154
|
+
className: " . _pb",
|
|
155
|
+
children: [
|
|
156
|
+
"\xa0",
|
|
157
|
+
/*#__PURE__*/ (0, $4hgIp$reactjsxruntime.jsx)((0, $e991cbcdf82ced71$exports.CenterBaseline), {
|
|
158
|
+
styles: " . _Ze ko",
|
|
159
|
+
children: /*#__PURE__*/ (0, $4hgIp$reactjsxruntime.jsx)((0, $bab829476f85a155$exports.ContextualHelpContext).Provider, {
|
|
160
|
+
value: {
|
|
161
|
+
id: contextualHelpId,
|
|
162
|
+
'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,
|
|
163
|
+
size: size === 'L' || size === 'XL' ? 'S' : 'XS'
|
|
164
|
+
},
|
|
165
|
+
children: contextualHelp
|
|
166
|
+
})
|
|
167
|
+
})
|
|
168
|
+
]
|
|
164
169
|
})
|
|
165
170
|
]
|
|
166
171
|
});
|
|
@@ -169,7 +174,7 @@ const $a0b996a550bb0891$var$fieldGroupStyles = function anonymous(props) {
|
|
|
169
174
|
let rules = " .";
|
|
170
175
|
if (props.isFocusVisible) rules += ' _Lb';
|
|
171
176
|
else rules += ' _La';
|
|
172
|
-
rules += '
|
|
177
|
+
rules += ' da_____M';
|
|
173
178
|
rules += ' dx';
|
|
174
179
|
rules += ' _Nc';
|
|
175
180
|
rules += ' _M-3t1z';
|
|
@@ -242,10 +247,10 @@ const $a0b996a550bb0891$var$fieldGroupStyles = function anonymous(props) {
|
|
|
242
247
|
rules += ' _Q-375x7f';
|
|
243
248
|
rules += ' _Ra';
|
|
244
249
|
if (props.isDisabled) {
|
|
245
|
-
rules += '
|
|
250
|
+
rules += ' ca_____O';
|
|
246
251
|
rules += ' ci';
|
|
247
252
|
} else if (props.isFocusWithin) {
|
|
248
|
-
rules += '
|
|
253
|
+
rules += ' ca_____M';
|
|
249
254
|
if (props.isInvalid) rules += ' cP';
|
|
250
255
|
else rules += ' co';
|
|
251
256
|
} else if (props.isInvalid) {
|
|
@@ -404,7 +409,7 @@ function $a0b996a550bb0891$export$bda0d075e0e342c9(props) {
|
|
|
404
409
|
{
|
|
405
410
|
render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
|
|
406
411
|
slot: 'icon',
|
|
407
|
-
styles: " . __A-3t1x _8-3t1x -rwx0fg_e-e -rwx0fg_e-
|
|
412
|
+
styles: " . __A-3t1x _8-3t1x -rwx0fg_e-e -rwx0fg_e-a_____8"
|
|
408
413
|
}),
|
|
409
414
|
styles: " . l-1sthc3k k-1sthc3k yG ybH z-177861o _8-3t1x"
|
|
410
415
|
}
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;;kCAGb,gCAAC;kCAAM,YAAY,iBAAiB,IAAI,CAAC;;;;;AAIjD;AAEO,SAAS,0CAAe,KAA6B;IAC1D,qBACE,gCAAC,CAAA,GAAA,mCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,qCAAU;gBAAG;oBACZ,QAAQ,CAAA,GAAA,wCAAa,EAAE;wBACrB,MAAM;wBACN,MAAM;oBAUJ;oBACJ,MAAM;gBAMR;aAAE;SACH;kBACA,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,iCAAQ;;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.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;AAkCM,MAAM,0DAAa,CAAA,GAAA,uBAAS,EAAE,SAAS,WAAW,KAAsB,EAAE,GAA6B;IAC5G,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE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ACN,MAAM;oBAUJ;oBACJ,MAAM;gBAMR;aAAE;SACH;kBACA,CAAC,MAAM,UAAU,kBAAI,gCAAC,CAAA,GAAA,iCAAQ;;AAGrC","sources":["packages/@react-spectrum/s2/src/Field.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport AlertIcon from '../s2wf-icons/S2_Icon_AlertTriangle_20_N.svg';\nimport {Alignment, DOMRef, NecessityIndicator} from '@react-types/shared';\nimport AsteriskIcon from '../ui-icons/Asterisk';\nimport {baseColor, focusRing, fontRelative, style} from '../style' with {type: 'macro'};\nimport {CenterBaseline, centerBaseline, centerBaselineBefore} from './CenterBaseline';\nimport {composeRenderProps, FieldError, FieldErrorProps, Group, GroupProps, Label, LabelProps, Provider, Input as RACInput, InputProps as RACInputProps, Text} from 'react-aria-components';\nimport {ContextualHelpContext} from './ContextualHelp';\nimport {fieldInput, fieldLabel, StyleProps, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {ForwardedRef, forwardRef, ReactNode} from 'react';\nimport {IconContext} from './Icon';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeStyles} from '../style/runtime';\nimport {StyleString} from '../style/types';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useId} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\ninterface FieldLabelProps extends Omit<LabelProps, 'className' | 'style' | 'children'>, StyleProps {\n isDisabled?: boolean,\n isRequired?: boolean,\n size?: 'S' | 'M' | 'L' | 'XL',\n necessityIndicator?: NecessityIndicator,\n labelAlign?: Alignment,\n labelPosition?: 'top' | 'side',\n includeNecessityIndicatorInAccessibilityName?: boolean,\n staticColor?: 'white' | 'black' | 'auto',\n contextualHelp?: ReactNode,\n isQuiet?: boolean,\n children?: ReactNode\n}\n\nexport const FieldLabel = forwardRef(function FieldLabel(props: FieldLabelProps, ref: DOMRef<HTMLLabelElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n let {\n isDisabled,\n isRequired,\n size = 'M',\n necessityIndicator = 'icon',\n includeNecessityIndicatorInAccessibilityName = false,\n labelAlign,\n labelPosition,\n staticColor,\n contextualHelp,\n isQuiet,\n UNSAFE_style,\n UNSAFE_className = '',\n ...labelProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let contextualHelpId = useId();\n let fallbackLabelPropsId = useId();\n if (contextualHelp && !labelProps.id) {\n labelProps.id = fallbackLabelPropsId;\n }\n\n if (!props.children) {\n return null;\n }\n\n return (\n <div\n className={style({\n gridArea: 'label',\n display: 'inline',\n textAlign: {\n labelAlign: {\n start: 'start',\n end: 'end'\n }\n },\n paddingBottom: {\n labelPosition: {\n top: '--field-gap'\n }\n },\n contain: {\n labelPosition: {\n top: 'inline-size'\n },\n isQuiet: 'none'\n }\n })({labelAlign, labelPosition, isQuiet})}>\n <Label\n {...labelProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style(fieldLabel())({labelPosition, isDisabled, size, isStaticColor: !!staticColor}), props.styles)}>\n {props.children}\n {(isRequired || necessityIndicator === 'label') && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n {necessityIndicator === 'icon' &&\n <AsteriskIcon\n size={size === 'S' ? 'M' : size}\n className={style({\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n })}\n aria-label={includeNecessityIndicatorInAccessibilityName ? stringFormatter.format('label.(required)') : undefined} />\n }\n {necessityIndicator === 'label' &&\n /* The necessity label is hidden to screen readers if the field is required because\n * aria-required is set on the field in that case. That will already be announced,\n * so no need to duplicate it here. If optional, we do want it to be announced here.\n */\n <span aria-hidden={!includeNecessityIndicatorInAccessibilityName ? isRequired : undefined}>\n {isRequired ? stringFormatter.format('label.(required)') : stringFormatter.format('label.(optional)')}\n </span>\n }\n </span>\n )}\n </Label>\n {contextualHelp && (\n <span className={style({whiteSpace: 'nowrap'})}>\n \n <CenterBaseline\n styles={style({\n display: 'inline-flex',\n height: 0\n })}>\n <ContextualHelpContext.Provider\n value={{\n id: contextualHelpId,\n 'aria-labelledby': labelProps?.id ? `${labelProps.id} ${contextualHelpId}` : undefined,\n size: (size === 'L' || size === 'XL') ? 'S' : 'XS'\n }}>\n {contextualHelp}\n </ContextualHelpContext.Provider>\n </CenterBaseline>\n </span>\n )}\n </div>\n );\n});\n\ninterface FieldGroupProps extends Omit<GroupProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n size?: 'S' | 'M' | 'L' | 'XL',\n children?: ReactNode,\n styles?: StyleString\n}\n\nconst fieldGroupStyles = style({\n ...focusRing(),\n ...fieldInput(),\n display: 'flex',\n alignItems: 'center',\n height: 'control',\n boxSizing: 'border-box',\n paddingX: 'edge-to-text',\n font: 'control',\n borderRadius: 'control',\n borderWidth: 2,\n borderStyle: 'solid',\n transition: 'default',\n borderColor: {\n default: baseColor('gray-300'),\n isInvalid: 'negative',\n isFocusWithin: {\n default: 'gray-900',\n isInvalid: 'negative-1000',\n forcedColors: 'Highlight'\n },\n isDisabled: {\n default: 'disabled',\n forcedColors: 'GrayText'\n }\n },\n backgroundColor: 'gray-25',\n color: {\n default: 'neutral',\n isDisabled: 'disabled'\n },\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport const FieldGroup = forwardRef(function FieldGroup(props: FieldGroupProps, ref: ForwardedRef<HTMLDivElement>) {\n return (\n <Group\n ref={ref}\n {...props}\n onPointerDown={(e) => {\n // Forward focus to input element when clicking on a non-interactive child (e.g. icon or padding)\n if (e.pointerType === 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n onPointerUp={e => {\n if (e.pointerType !== 'mouse' && !(e.target as Element).closest('button,input,textarea')) {\n e.preventDefault();\n e.currentTarget.querySelector('input')?.focus();\n }\n }}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + ' ' + centerBaselineBefore + mergeStyles(\n fieldGroupStyles({...renderProps, size: props.size || 'M'}),\n props.styles\n )} />\n );\n});\n\nexport interface InputProps extends Omit<RACInputProps, 'className' | 'style'>, StyleProps {}\n\nexport const Input = forwardRef(function Input(props: InputProps, ref: ForwardedRef<HTMLInputElement>) {\n let {UNSAFE_className = '', UNSAFE_style, styles, ...otherProps} = props;\n return (\n <RACInput\n {...otherProps}\n ref={ref}\n style={UNSAFE_style}\n className={UNSAFE_className + mergeStyles(style({\n padding: 0,\n backgroundColor: 'transparent',\n color: '[inherit]',\n fontFamily: '[inherit]',\n fontSize: '[inherit]',\n fontWeight: '[inherit]',\n flexGrow: 1,\n flexShrink: 1,\n minWidth: 0,\n width: 'full',\n outlineStyle: 'none',\n borderStyle: 'none',\n truncate: true\n }), styles)} />\n );\n});\n\ninterface HelpTextProps extends FieldErrorProps {\n size?: 'S' | 'M' | 'L' | 'XL',\n isDisabled?: boolean,\n isInvalid?: boolean, // TODO: export FieldErrorContext from RAC to get this.\n description?: ReactNode,\n showErrorIcon?: boolean\n}\n\nconst helpTextStyles = style({\n gridArea: 'helptext',\n display: 'flex',\n alignItems: 'baseline',\n gap: 'text-to-visual',\n font: 'control',\n color: {\n default: 'neutral-subdued',\n isInvalid: 'negative',\n isDisabled: 'disabled'\n },\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n },\n contain: 'inline-size',\n paddingTop: '--field-gap',\n cursor: {\n default: 'text',\n isDisabled: 'default'\n }\n});\n\nexport function HelpText(props: HelpTextProps & {descriptionRef?: DOMRef<HTMLDivElement>, errorRef?: DOMRef<HTMLDivElement>}) {\n let domDescriptionRef = useDOMRef(props.descriptionRef || null);\n let domErrorRef = useDOMRef(props.errorRef || null);\n\n if (!props.isInvalid && props.description) {\n return (\n <Text\n slot=\"description\"\n ref={domDescriptionRef}\n className={helpTextStyles({size: props.size || 'M', isDisabled: props.isDisabled})}>\n {props.description}\n </Text>\n );\n }\n\n return (\n <FieldError\n {...props}\n ref={domErrorRef}\n className={renderProps => helpTextStyles({...renderProps, size: props.size || 'M', isDisabled: props.isDisabled})}>\n {composeRenderProps(props.children, (children, {validationErrors}) => (<>\n {props.showErrorIcon &&\n <CenterBaseline>\n <AlertIcon />\n </CenterBaseline>\n }\n <span>{children || validationErrors.join(' ')}</span>\n </>))}\n </FieldError>\n );\n}\n\nexport function FieldErrorIcon(props: {isDisabled?: boolean}) {\n return (\n <Provider\n values={[\n [IconContext, {\n render: centerBaseline({\n slot: 'icon',\n styles: style({\n order: 0,\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: {\n default: 'negative',\n forcedColors: 'ButtonText'\n }\n }\n })}),\n styles: style({\n size: fontRelative(20),\n marginStart: 'text-to-visual',\n marginEnd: fontRelative(-2),\n flexShrink: 0\n })\n }]\n ]}>\n {!props.isDisabled && <AlertIcon />}\n </Provider>\n );\n}\n"],"names":[],"version":3,"file":"Field.cjs.map"}
|
package/dist/Field.css
CHANGED
|
@@ -31,12 +31,8 @@
|
|
|
31
31
|
padding-bottom: var(--field-gap);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
35
|
-
color:
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.a_____s {
|
|
39
|
-
color: #000000ed;
|
|
34
|
+
.a_____G {
|
|
35
|
+
color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
._Ze {
|
|
@@ -47,10 +43,6 @@
|
|
|
47
43
|
height: 0;
|
|
48
44
|
}
|
|
49
45
|
|
|
50
|
-
.yc {
|
|
51
|
-
margin-inline-start: .25rem;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
46
|
._Lb {
|
|
55
47
|
outline-style: solid;
|
|
56
48
|
}
|
|
@@ -562,23 +554,23 @@
|
|
|
562
554
|
|
|
563
555
|
@layer _.b.a {
|
|
564
556
|
@media (forced-colors: active) {
|
|
565
|
-
.
|
|
557
|
+
.aa_____K {
|
|
566
558
|
color: buttontext;
|
|
567
559
|
}
|
|
568
560
|
|
|
569
|
-
.
|
|
561
|
+
.da_____M {
|
|
570
562
|
outline-color: highlight;
|
|
571
563
|
}
|
|
572
564
|
|
|
573
|
-
.
|
|
565
|
+
.ca_____M {
|
|
574
566
|
border-color: highlight;
|
|
575
567
|
}
|
|
576
568
|
|
|
577
|
-
.
|
|
569
|
+
.ca_____O {
|
|
578
570
|
border-color: graytext;
|
|
579
571
|
}
|
|
580
572
|
|
|
581
|
-
.-rwx0fg_e-
|
|
573
|
+
.-rwx0fg_e-a_____8 {
|
|
582
574
|
--iconPrimary: ButtonText;
|
|
583
575
|
}
|
|
584
576
|
}
|