@commercetools-uikit/radio-input 16.1.0 → 16.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-uikit-radio-input.cjs.dev.js +26 -66
- package/dist/commercetools-uikit-radio-input.cjs.prod.js +17 -49
- package/dist/commercetools-uikit-radio-input.esm.js +26 -66
- package/dist/declarations/src/radio-option.d.ts +1 -3
- package/dist/declarations/src/radio-option.styles.d.ts +9 -28
- package/package.json +9 -9
|
@@ -19,10 +19,10 @@ var utils = require('@commercetools-uikit/utils');
|
|
|
19
19
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
20
20
|
var Stack = require('@commercetools-uikit/spacings-stack');
|
|
21
21
|
var Inline = require('@commercetools-uikit/spacings-inline');
|
|
22
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
23
22
|
var inputUtils = require('@commercetools-uikit/input-utils');
|
|
24
23
|
var _styled = require('@emotion/styled/base');
|
|
25
24
|
var react = require('@emotion/react');
|
|
25
|
+
var designSystem = require('@commercetools-uikit/design-system');
|
|
26
26
|
var SpacingsInset = require('@commercetools-uikit/spacings-inset');
|
|
27
27
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
28
28
|
|
|
@@ -44,15 +44,14 @@ var Inline__default = /*#__PURE__*/_interopDefault(Inline);
|
|
|
44
44
|
var _styled__default = /*#__PURE__*/_interopDefault(_styled);
|
|
45
45
|
var SpacingsInset__default = /*#__PURE__*/_interopDefault(SpacingsInset);
|
|
46
46
|
|
|
47
|
-
const getDefaultThemeLabelColor = props => !props.isNewTheme && /*#__PURE__*/react.css("color:", props.isDisabled ? designSystem.designTokens.fontColorForInputWhenDisabled : designSystem.designTokens.fontColorForInput, ";" + ("" ), "" );
|
|
48
47
|
const LabelTextWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
49
|
-
target: "e1x57rfz7"
|
|
50
|
-
} )("grid-area:label;margin-left:", designSystem.designTokens.marginLeftForRadioInputLabel, ";font-size:1rem;font-family:inherit;display:flex;align-items:center;", props => getDefaultThemeLabelColor(props), ";" + ("" ));
|
|
51
|
-
const AdditionalTextWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
52
48
|
target: "e1x57rfz6"
|
|
53
|
-
} )("grid-area:
|
|
54
|
-
const
|
|
49
|
+
} )("grid-area:label;margin-left:", designSystem.designTokens.marginLeftForRadioInputLabel, ";font-size:1rem;font-family:inherit;display:flex;align-items:center;" + ("" ));
|
|
50
|
+
const AdditionalTextWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
55
51
|
target: "e1x57rfz5"
|
|
52
|
+
} )("grid-area:content;margin-left:", designSystem.designTokens.spacing10, ";font-size:1rem;font-family:inherit;" + ("" ));
|
|
53
|
+
const RadioInputWrapper = /*#__PURE__*/_styled__default["default"]("div", {
|
|
54
|
+
target: "e1x57rfz4"
|
|
56
55
|
} )({
|
|
57
56
|
name: "z022bx",
|
|
58
57
|
styles: "display:grid;grid-template-columns:auto;grid-template-rows:auto;grid-template-areas:'radio label' '. content'"
|
|
@@ -96,21 +95,6 @@ const getKnobColor = props => {
|
|
|
96
95
|
}
|
|
97
96
|
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
98
97
|
};
|
|
99
|
-
const getLabelBorderColor = props => {
|
|
100
|
-
if (props.isDisabled) {
|
|
101
|
-
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
102
|
-
}
|
|
103
|
-
if (props.isReadOnly) {
|
|
104
|
-
return designSystem.designTokens.borderColorForInputWhenReadonly;
|
|
105
|
-
}
|
|
106
|
-
if (props.hasError) {
|
|
107
|
-
return designSystem.designTokens.borderColorForInputWhenError;
|
|
108
|
-
}
|
|
109
|
-
if (props.hasWarning) {
|
|
110
|
-
return designSystem.designTokens.borderColorForInputWhenWarning;
|
|
111
|
-
}
|
|
112
|
-
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
113
|
-
};
|
|
114
98
|
const getLabelColor = props => {
|
|
115
99
|
if (props.isDisabled) {
|
|
116
100
|
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
@@ -136,43 +120,32 @@ const getLabelCursor = props => {
|
|
|
136
120
|
return 'pointer';
|
|
137
121
|
};
|
|
138
122
|
const RadioOptionKnob = /*#__PURE__*/_styled__default["default"]("div", {
|
|
139
|
-
target: "
|
|
123
|
+
target: "e1x57rfz3"
|
|
140
124
|
} )("width:", designSystem.designTokens.heightForRadioInputOptionWhenChecked, ";height:", designSystem.designTokens.heightForRadioInputOptionWhenChecked, ";border-radius:50%;background-color:", props => getKnobColor(props), ";" + ("" ));
|
|
141
125
|
const RadioOptionBorder = /*#__PURE__*/_styled__default["default"]("div", {
|
|
142
|
-
target: "e1x57rfz3"
|
|
143
|
-
} )("width:", designSystem.designTokens.heightForRadioInputOption, ";height:", designSystem.designTokens.heightForRadioInputOption, ";border-radius:50%;background-color:", designSystem.designTokens.backgroundColorForInput, ";border-width:", designSystem.designTokens.borderForRadioInputOption, ";border-style:solid;border-color:", props => getBorderColor(props), ";display:flex;align-items:center;justify-content:center;" + ("" ));
|
|
144
|
-
const focusStyles = /*#__PURE__*/react.css("&:focus:not(:read-only)+div>", RadioOptionBorder, "{border-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" );
|
|
145
|
-
const Input = /*#__PURE__*/_styled__default["default"]("input", {
|
|
146
126
|
target: "e1x57rfz2"
|
|
147
|
-
} )(
|
|
148
|
-
const getNewThemeHoverAreaStyles = {
|
|
149
|
-
name: "yopin6",
|
|
150
|
-
styles: "width:26px;height:26px;border-radius:50%;border:4px solid transparent"
|
|
151
|
-
} ;
|
|
127
|
+
} )("width:", designSystem.designTokens.heightForRadioInputOption, ";height:", designSystem.designTokens.heightForRadioInputOption, ";border-radius:50%;background-color:", designSystem.designTokens.backgroundColorForInput, ";border-width:", designSystem.designTokens.borderForRadioInputOption, ";border-style:solid;border-color:", props => getBorderColor(props), ";display:flex;align-items:center;justify-content:center;" + ("" ));
|
|
152
128
|
const RadioOptionContainer = /*#__PURE__*/_styled__default["default"]("div", {
|
|
153
129
|
target: "e1x57rfz1"
|
|
154
|
-
} )("display:flex;align-items:center;grid-area:radio;", RadioOptionBorder, "{background-color:", props => props.isDisabled ? designSystem.designTokens.backgroundColorForInputWhenDisabled : designSystem.designTokens.backgroundColorForInput, ";}"
|
|
155
|
-
const
|
|
130
|
+
} )("display:flex;align-items:center;grid-area:radio;width:26px;height:26px;border-radius:50%;border:4px solid transparent;", RadioOptionBorder, "{background-color:", props => props.isDisabled ? designSystem.designTokens.backgroundColorForInputWhenDisabled : designSystem.designTokens.backgroundColorForInput, ";}" + ("" ));
|
|
131
|
+
const getHoverStyles = props => {
|
|
156
132
|
const hoverStyles = /*#__PURE__*/react.css(RadioOptionContainer, "{border-color:", designSystem.designTokens.colorNeutral90, ";}" + ("" ), "" );
|
|
157
133
|
return [!props.isDisabled && !props.isReadOnly &&
|
|
158
134
|
/*#__PURE__*/
|
|
159
135
|
/* prettier-ignore */
|
|
160
136
|
react.css("&\f:hover ", hoverStyles, ";" + ("" ), "" ), props.isHovered && hoverStyles];
|
|
161
137
|
};
|
|
162
|
-
const getDefaultThemeHoverStyles = props => /*#__PURE__*/react.css("&:hover ", RadioOptionBorder, "{border-color:", getLabelBorderColor(props), ";}" + ("" ), "" );
|
|
163
138
|
const RadioOptionLabel = /*#__PURE__*/_styled__default["default"]("label", {
|
|
164
139
|
target: "e1x57rfz0"
|
|
165
140
|
} )("align-items:center;color:", props => getLabelColor(props), ";cursor:", props => getLabelCursor(props), ";display:flex;", props => {
|
|
166
|
-
var _context
|
|
167
|
-
return !props.isReadOnly ? _concatInstanceProperty__default["default"](_context =
|
|
168
|
-
}, " ", props =>
|
|
141
|
+
var _context;
|
|
142
|
+
return !props.isReadOnly ? _concatInstanceProperty__default["default"](_context = ":focus-within ".concat(LabelTextWrapper, " {\n outline: auto 2px ")).call(_context, designSystem.designTokens.borderColorForInputWhenFocused, ";\n outline-offset: 2px;\n }") : '';
|
|
143
|
+
}, " ", props => getHoverStyles(props), ";" + ("" ));
|
|
169
144
|
|
|
170
145
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
171
146
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$1(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
172
147
|
const Option = props => {
|
|
173
148
|
var _props$components;
|
|
174
|
-
const _useTheme = designSystem.useTheme(),
|
|
175
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
176
149
|
const labelProps = props.id ? {
|
|
177
150
|
htmlFor: props.id
|
|
178
151
|
} : {};
|
|
@@ -184,8 +157,7 @@ const Option = props => {
|
|
|
184
157
|
hasWarning: props.hasWarning,
|
|
185
158
|
isHovered: props.isHovered,
|
|
186
159
|
isReadOnly: props.isReadOnly,
|
|
187
|
-
isChecked: props.isChecked
|
|
188
|
-
isNewTheme
|
|
160
|
+
isChecked: props.isChecked
|
|
189
161
|
};
|
|
190
162
|
return jsxRuntime.jsx(RadioOptionLabel, _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
191
163
|
role: "radio",
|
|
@@ -194,7 +166,7 @@ const Option = props => {
|
|
|
194
166
|
onBlur: props.onBlur
|
|
195
167
|
}, stylesProps), utils.filterInvalidAttributes(labelProps)), {}, {
|
|
196
168
|
children: jsxRuntime.jsxs(RadioInputWrapper, {
|
|
197
|
-
children: [jsxRuntime.jsx(
|
|
169
|
+
children: [jsxRuntime.jsx("input", _objectSpread$1({
|
|
198
170
|
css: inputUtils.accessibleHiddenInputStyles,
|
|
199
171
|
id: props.id,
|
|
200
172
|
name: props.name,
|
|
@@ -203,20 +175,16 @@ const Option = props => {
|
|
|
203
175
|
disabled: props.isDisabled,
|
|
204
176
|
checked: props.isChecked,
|
|
205
177
|
type: "radio",
|
|
206
|
-
readOnly: props.isReadOnly
|
|
207
|
-
"aria-readonly": props.isReadOnly,
|
|
208
|
-
isNewTheme: isNewTheme
|
|
178
|
+
readOnly: props.isReadOnly
|
|
209
179
|
}, utils.filterDataAttributes(props))), jsxRuntime.jsx(RadioOptionContainer, _objectSpread$1(_objectSpread$1({}, stylesProps), {}, {
|
|
210
180
|
children: jsxRuntime.jsx(RadioOptionBorder, _objectSpread$1(_objectSpread$1({}, stylesProps), {}, {
|
|
211
181
|
children: props.isChecked ? jsxRuntime.jsx(RadioOptionKnob, _objectSpread$1({}, stylesProps)) : null
|
|
212
182
|
}))
|
|
213
183
|
})), jsxRuntime.jsx(LabelTextWrapper, {
|
|
214
184
|
isDisabled: props.isDisabled,
|
|
215
|
-
isNewTheme: isNewTheme,
|
|
216
185
|
children: props.children
|
|
217
186
|
}), props.additionalContent && jsxRuntime.jsx(AdditionalTextWrapper, {
|
|
218
187
|
isDisabled: props.isDisabled,
|
|
219
|
-
isNewTheme: isNewTheme,
|
|
220
188
|
children: jsxRuntime.jsx(SpacingsInset__default["default"], {
|
|
221
189
|
scale: "xs",
|
|
222
190
|
children: props.additionalContent
|
|
@@ -297,7 +265,7 @@ Group.defaultProps = defaultProps;
|
|
|
297
265
|
var Group$1 = Group;
|
|
298
266
|
|
|
299
267
|
// NOTE: This string will be replaced on build time with the package version.
|
|
300
|
-
var version = "16.1.
|
|
268
|
+
var version = "16.1.1";
|
|
301
269
|
|
|
302
270
|
const RadioInput = {
|
|
303
271
|
Group: Group$1,
|