@conveyorhq/arrow-ds 1.189.0 → 1.190.0
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/package.json +1 -1
- package/public/components/Checkbox/Checkbox.d.ts +2 -1
- package/public/components/Checkbox/Checkbox.js +10 -4
- package/public/css/styles.css +55 -9
- package/public/css/styles.min.css +1 -1
- package/public/css/styles.min.css.map +1 -1
- package/src/components/Checkbox/Checkbox.stories.mdx +15 -2
- package/src/components/Checkbox/Checkbox.tsx +22 -13
- package/src/components/Checkbox/index.css +19 -4
- package/src/components/Checkbox/product.css +22 -7
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ export type CheckboxProps = Omit<InputProps, "checked"> & {
|
|
|
6
6
|
hideRequiredStyles?: boolean;
|
|
7
7
|
isRequired?: boolean;
|
|
8
8
|
checked?: boolean | "indeterminate";
|
|
9
|
+
color?: "brandGreen" | "blue";
|
|
9
10
|
};
|
|
10
11
|
export declare enum CheckboxState {
|
|
11
12
|
CHECKED = "checked",
|
|
@@ -13,6 +14,6 @@ export declare enum CheckboxState {
|
|
|
13
14
|
INDETERMINATE = "indeterminate"
|
|
14
15
|
}
|
|
15
16
|
export declare const Checkbox: {
|
|
16
|
-
({ checked, children, className, disabled, id: idProp, label, onBlur, onChange, onClick, onFocus, hideRequiredStyles, isRequired, tabIndex, theme: themeProp, ...rest }: CheckboxProps): React.JSX.Element;
|
|
17
|
+
({ checked, children, className, disabled, id: idProp, label, onBlur, onChange, onClick, onFocus, hideRequiredStyles, isRequired, tabIndex, theme: themeProp, color, ...rest }: CheckboxProps): React.JSX.Element;
|
|
17
18
|
Group: (props: StackProps) => React.JSX.Element;
|
|
18
19
|
};
|
|
@@ -50,7 +50,7 @@ var CheckboxState;
|
|
|
50
50
|
CheckboxState["UNCHECKED"] = "unchecked";
|
|
51
51
|
CheckboxState["INDETERMINATE"] = "indeterminate";
|
|
52
52
|
})(CheckboxState || (exports.CheckboxState = CheckboxState = {}));
|
|
53
|
-
const Checkbox = ({ checked, children, className, disabled = false, id: idProp, label, onBlur, onChange = () => { }, onClick, onFocus, hideRequiredStyles = true, isRequired = undefined, tabIndex, theme: themeProp, ...rest }) => {
|
|
53
|
+
const Checkbox = ({ checked, children, className, disabled = false, id: idProp, label, onBlur, onChange = () => { }, onClick, onFocus, hideRequiredStyles = true, isRequired = undefined, tabIndex, theme: themeProp, color = "brandGreen", ...rest }) => {
|
|
54
54
|
const { isRequired: isRequiredContext, theme: themeContext } = (0, react_1.useContext)(FormGroupContext_1.FormGroupContext);
|
|
55
55
|
const fallbackId = `checkbox-${(0, react_1.useId)()}`;
|
|
56
56
|
const id = (0, isUndefined_1.default)(idProp) ? fallbackId : idProp;
|
|
@@ -87,6 +87,12 @@ const Checkbox = ({ checked, children, className, disabled = false, id: idProp,
|
|
|
87
87
|
else if (checkedState === CheckboxState.UNCHECKED) {
|
|
88
88
|
updatedChecked = CheckboxState.CHECKED;
|
|
89
89
|
}
|
|
90
|
+
else if (checkedState === CheckboxState.INDETERMINATE) {
|
|
91
|
+
updatedChecked = CheckboxState.INDETERMINATE;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
updatedChecked = CheckboxState.UNCHECKED;
|
|
95
|
+
}
|
|
90
96
|
setCheckedState(updatedChecked);
|
|
91
97
|
if (onChange) {
|
|
92
98
|
onChange(event);
|
|
@@ -103,10 +109,10 @@ const Checkbox = ({ checked, children, className, disabled = false, id: idProp,
|
|
|
103
109
|
};
|
|
104
110
|
const bareCheckbox = (react_1.default.createElement(Box_1.Box, { className: (0, bem_1.bem)(cn, { e: "BoxWrapper" }) },
|
|
105
111
|
react_1.default.createElement(Input_1.Input, { "aria-checked": ariaChecked(), checked: checkedState === CheckboxState.CHECKED, className: (0, bem_1.bem)(cn, { e: "Input" }), disabled: disabled, id: id, onChange: handleChange, type: "checkbox", onFocus: onFocus, onBlur: onBlur, onClick: label ? handleClick : undefined, tabIndex: tabIndex, ...rest }),
|
|
106
|
-
react_1.default.createElement(Box_1.Box, { className: (0, classnames_1.default)((0, bem_1.bem)(cn, { e: "Box" }), (0, bem_1.bem)(cn, { e: "Box", m: theme }), checked && (0, bem_1.bem)(cn, { e: "Box", m: "checked" })) }),
|
|
107
|
-
|
|
112
|
+
react_1.default.createElement(Box_1.Box, { className: (0, classnames_1.default)((0, bem_1.bem)(cn, { e: "Box" }), (0, bem_1.bem)(cn, { e: "Box", m: theme }), (0, bem_1.bem)(cn, { e: "Box", m: color }), checked && (0, bem_1.bem)(cn, { e: "Box", m: "checked" })) }),
|
|
113
|
+
react_1.default.createElement(Icon_1.Icon, { className: (0, classnames_1.default)((0, bem_1.bem)(cn, { e: "Check" }), (0, bem_1.bem)(cn, { e: "Check", m: theme }), checked && (0, bem_1.bem)(cn, { e: "Check", m: "checked" })), icon: checkedState === CheckboxState.INDETERMINATE
|
|
108
114
|
? Icon_1.ICON_TYPE.MINUS
|
|
109
|
-
: Icon_1.ICON_TYPE.CHECK })))
|
|
115
|
+
: Icon_1.ICON_TYPE.CHECK })));
|
|
110
116
|
const checkboxWithLabel = label || children ? (react_1.default.createElement(Label_1.Label, { className: (0, bem_1.bem)(cn, { e: "Label" }), isRequired: calculatedRequired && !hideRequiredStyles },
|
|
111
117
|
bareCheckbox,
|
|
112
118
|
react_1.default.createElement(Text_1.Text, { as: "span", className: (0, classnames_1.default)((0, bem_1.bem)(cn, { e: "LabelText" }), (0, bem_1.bem)(cn, { e: "LabelText", m: theme })) },
|
package/public/css/styles.css
CHANGED
|
@@ -2244,15 +2244,26 @@ override built-in Image component classes */
|
|
|
2244
2244
|
border-color: rgb(134 163 181 / var(--tw-border-opacity));
|
|
2245
2245
|
--tw-bg-opacity: 1;
|
|
2246
2246
|
background-color: rgb(249 251 252 / var(--tw-bg-opacity));
|
|
2247
|
+
transition-duration: 150ms;
|
|
2248
|
+
|
|
2249
|
+
transition-property: background-color, border-color, opacity;
|
|
2247
2250
|
}
|
|
2248
2251
|
|
|
2249
|
-
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked
|
|
2252
|
+
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked,
|
|
2253
|
+
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--brandGreen {
|
|
2250
2254
|
--tw-border-opacity: 1;
|
|
2251
2255
|
border-color: rgb(51 198 159 / var(--tw-border-opacity));
|
|
2252
2256
|
--tw-bg-opacity: 1;
|
|
2253
2257
|
background-color: rgb(51 198 159 / var(--tw-bg-opacity));
|
|
2254
2258
|
}
|
|
2255
2259
|
|
|
2260
|
+
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--blue {
|
|
2261
|
+
--tw-border-opacity: 1;
|
|
2262
|
+
border-color: rgb(13 125 228 / var(--tw-border-opacity));
|
|
2263
|
+
--tw-bg-opacity: 1;
|
|
2264
|
+
background-color: rgb(13 125 228 / var(--tw-bg-opacity));
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2256
2267
|
.ads-Checkbox-Check--product {
|
|
2257
2268
|
--tw-text-opacity: 1;
|
|
2258
2269
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
@@ -2268,13 +2279,21 @@ override built-in Image component classes */
|
|
|
2268
2279
|
.ads-Checkbox.is-disabled .ads-Checkbox-Box--product {
|
|
2269
2280
|
--tw-border-opacity: 1;
|
|
2270
2281
|
border-color: rgb(222 231 238 / var(--tw-border-opacity));
|
|
2282
|
+
transition-duration: 150ms;
|
|
2271
2283
|
}
|
|
2272
2284
|
|
|
2273
|
-
.ads-Checkbox.is-disabled .ads-Checkbox-Box--product.ads-Checkbox-Box--checked
|
|
2285
|
+
.ads-Checkbox.is-disabled .ads-Checkbox-Box--product.ads-Checkbox-Box--checked,
|
|
2286
|
+
.ads-Checkbox.is-disabled
|
|
2287
|
+
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--brandGreen {
|
|
2274
2288
|
--tw-border-opacity: 1;
|
|
2275
|
-
border-color: rgb(
|
|
2276
|
-
|
|
2277
|
-
|
|
2289
|
+
border-color: rgb(51 198 159 / var(--tw-border-opacity));
|
|
2290
|
+
opacity: 0.5;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
.ads-Checkbox.is-disabled
|
|
2294
|
+
.ads-Checkbox-Box--product.ads-Checkbox-Box--checked.ads-Checkbox-Box--blue {
|
|
2295
|
+
--tw-border-opacity: 1;
|
|
2296
|
+
border-color: rgb(13 125 228 / var(--tw-border-opacity));
|
|
2278
2297
|
opacity: 0.5;
|
|
2279
2298
|
}
|
|
2280
2299
|
|
|
@@ -2366,12 +2385,39 @@ override built-in Image component classes */
|
|
|
2366
2385
|
/* Checked */
|
|
2367
2386
|
|
|
2368
2387
|
.ads-Checkbox-Check {
|
|
2388
|
+
pointer-events: none;
|
|
2369
2389
|
position: absolute;
|
|
2390
|
+
top: 0;
|
|
2391
|
+
right: 0;
|
|
2392
|
+
bottom: 0;
|
|
2393
|
+
left: 0;
|
|
2394
|
+
display: flex;
|
|
2395
|
+
align-items: center;
|
|
2396
|
+
justify-content: center;
|
|
2370
2397
|
font-size: 12px;
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2398
|
+
opacity: 0;
|
|
2399
|
+
transition-duration: 150ms;
|
|
2400
|
+
|
|
2401
|
+
transition-property: opacity, -webkit-transform;
|
|
2402
|
+
|
|
2403
|
+
transition-property: opacity, transform;
|
|
2404
|
+
|
|
2405
|
+
transition-property: opacity, transform, -webkit-transform;
|
|
2406
|
+
-webkit-transform: scale(0.5);
|
|
2407
|
+
transform: scale(0.5);
|
|
2408
|
+
}
|
|
2409
|
+
|
|
2410
|
+
.ads-Checkbox-Check--checked {
|
|
2411
|
+
opacity: 1;
|
|
2412
|
+
transition-duration: 150ms;
|
|
2413
|
+
|
|
2414
|
+
transition-property: opacity, -webkit-transform;
|
|
2415
|
+
|
|
2416
|
+
transition-property: opacity, transform;
|
|
2417
|
+
|
|
2418
|
+
transition-property: opacity, transform, -webkit-transform;
|
|
2419
|
+
-webkit-transform: scale(1);
|
|
2420
|
+
transform: scale(1);
|
|
2375
2421
|
}
|
|
2376
2422
|
|
|
2377
2423
|
/* Focused */
|