@pingux/astro 2.82.0-alpha.2 → 2.83.0-alpha.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/lib/cjs/components/Checkbox/Checkbox.styles.js +6 -0
- package/lib/cjs/components/Checkbox/CheckboxBase.js +12 -3
- package/lib/cjs/components/CheckboxField/CheckboxField.js +6 -4
- package/lib/cjs/components/CheckboxField/CheckboxField.stories.d.ts +1 -0
- package/lib/cjs/components/CheckboxField/CheckboxField.stories.js +17 -2
- package/lib/cjs/components/Label/Label.styles.js +4 -1
- package/lib/components/Checkbox/Checkbox.styles.js +6 -0
- package/lib/components/Checkbox/CheckboxBase.js +12 -3
- package/lib/components/CheckboxField/CheckboxField.js +6 -4
- package/lib/components/CheckboxField/CheckboxField.stories.js +14 -0
- package/lib/components/Label/Label.styles.js +4 -1
- package/package.json +1 -1
@@ -13,7 +13,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/e
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
14
14
|
var _visuallyHidden = require("@react-aria/visually-hidden");
|
15
15
|
var _lodash = require("lodash");
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
16
17
|
var _themeUi = require("theme-ui");
|
18
|
+
var _colors = require("../../styles/colors");
|
17
19
|
var _Box = _interopRequireDefault(require("../Box"));
|
18
20
|
var _react2 = require("@emotion/react");
|
19
21
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
@@ -31,6 +33,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
31
33
|
}, props));
|
32
34
|
});
|
33
35
|
var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
36
|
+
var color = props.disabled ? _colors.neutral[80] : _colors.active;
|
34
37
|
return (0, _react2.jsx)("svg", (0, _extends2["default"])({
|
35
38
|
width: "24",
|
36
39
|
height: "24",
|
@@ -46,8 +49,8 @@ var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
|
46
49
|
width: "17",
|
47
50
|
height: "17",
|
48
51
|
rx: "1.5",
|
49
|
-
fill:
|
50
|
-
stroke:
|
52
|
+
fill: color,
|
53
|
+
stroke: color
|
51
54
|
}), (0, _react2.jsx)("rect", {
|
52
55
|
x: "6.5",
|
53
56
|
y: "11",
|
@@ -56,6 +59,10 @@ var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
|
56
59
|
fill: "white"
|
57
60
|
}));
|
58
61
|
};
|
62
|
+
IndeterminateCheckboxIcon.propTypes = {
|
63
|
+
// eslint-disable-next-line react/boolean-prop-naming
|
64
|
+
disabled: _propTypes["default"].bool
|
65
|
+
};
|
59
66
|
|
60
67
|
/**
|
61
68
|
* Renders a visually hidden default checkbox since the Theme UI checkbox does not support
|
@@ -69,7 +76,9 @@ var IndeterminateCheckbox = /*#__PURE__*/(0, _react.forwardRef)(function (props,
|
|
69
76
|
}, props))), (0, _react2.jsx)(_Box["default"], (0, _extends2["default"])({
|
70
77
|
as: IndeterminateCheckboxIcon,
|
71
78
|
mr: 2
|
72
|
-
}, props
|
79
|
+
}, props, {
|
80
|
+
opacity: 1
|
81
|
+
})));
|
73
82
|
});
|
74
83
|
var CheckboxBase = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
75
84
|
/* eslint-disable react/prop-types */
|
@@ -77,12 +77,14 @@ var CheckboxField = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
77
77
|
var helperTextId = (0, _react.useMemo)(function () {
|
78
78
|
return (0, _uuid.v4)();
|
79
79
|
}, []);
|
80
|
-
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({}, (0, _pendoID.getPendoID)(displayName), fieldContainerProps), (0, _react2.jsx)(_.
|
81
|
-
|
82
|
-
},
|
80
|
+
return (0, _react2.jsx)(_.Box, (0, _extends2["default"])({}, (0, _pendoID.getPendoID)(displayName), fieldContainerProps), (0, _react2.jsx)(_.Box, {
|
81
|
+
isRow: true
|
82
|
+
}, (0, _react2.jsx)(_.Checkbox, (0, _extends2["default"])({
|
83
83
|
ref: checkboxRef,
|
84
84
|
"aria-describedby": helperText && helperTextId
|
85
|
-
}, fieldControlInputProps)),
|
85
|
+
}, fieldControlInputProps)), (0, _react2.jsx)(_.Label, (0, _extends2["default"])({
|
86
|
+
variant: "forms.label.checkbox"
|
87
|
+
}, fieldLabelProps), label)), helperText && (0, _react2.jsx)(_.FieldHelperText, {
|
86
88
|
status: status,
|
87
89
|
sx: {
|
88
90
|
pt: 7
|
@@ -9,3 +9,4 @@ export declare const Required: StoryFn<CheckboxFieldProps>;
|
|
9
9
|
export declare const HelperText: StoryFn<CheckboxFieldProps>;
|
10
10
|
export declare const ExpandableAndToggleableIndeterminate: StoryFn<CheckboxFieldProps>;
|
11
11
|
export declare const Indeterminate: StoryFn<CheckboxFieldProps>;
|
12
|
+
export declare const Disabled: StoryFn<CheckboxFieldProps>;
|
@@ -14,7 +14,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
14
14
|
_Object$defineProperty(exports, "__esModule", {
|
15
15
|
value: true
|
16
16
|
});
|
17
|
-
exports["default"] = exports.Required = exports.Indeterminate = exports.HelperText = exports.ExpandableAndToggleableIndeterminate = exports.DefaultSelected = exports.Default = exports.Controlled = void 0;
|
17
|
+
exports["default"] = exports.Required = exports.Indeterminate = exports.HelperText = exports.ExpandableAndToggleableIndeterminate = exports.Disabled = exports.DefaultSelected = exports.Default = exports.Controlled = void 0;
|
18
18
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
19
19
|
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
20
20
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
|
@@ -338,4 +338,19 @@ Indeterminate.parameters = {
|
|
338
338
|
story: 'When a `CheckboxField` is indeterminate, it\'s necessary to control the state in order to determine how it should function when pressed. Here is an example of how to do that.'
|
339
339
|
}
|
340
340
|
}
|
341
|
-
};
|
341
|
+
};
|
342
|
+
var Disabled = function Disabled() {
|
343
|
+
return (0, _react2.jsx)(_index.Box, null, (0, _react2.jsx)(_index.CheckboxField, {
|
344
|
+
isDisabled: true,
|
345
|
+
label: "Disabled"
|
346
|
+
}), (0, _react2.jsx)(_index.CheckboxField, {
|
347
|
+
isDisabled: true,
|
348
|
+
isSelected: true,
|
349
|
+
label: "Disabled"
|
350
|
+
}), (0, _react2.jsx)(_index.CheckboxField, {
|
351
|
+
isDisabled: true,
|
352
|
+
isIndeterminate: true,
|
353
|
+
label: "Disabled"
|
354
|
+
}));
|
355
|
+
};
|
356
|
+
exports.Disabled = Disabled;
|
@@ -75,7 +75,10 @@ label.checkbox = _objectSpread(_objectSpread({}, _Text.text.base), {}, {
|
|
75
75
|
},
|
76
76
|
width: 'max-content',
|
77
77
|
alignItems: 'center',
|
78
|
-
cursor: 'pointer'
|
78
|
+
cursor: 'pointer',
|
79
|
+
'& .is-disabled': {
|
80
|
+
opacity: '1'
|
81
|
+
}
|
79
82
|
});
|
80
83
|
label.radioGroup = _objectSpread(_objectSpread({}, label), {}, {
|
81
84
|
fontWeight: 1
|
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime-corejs3/helpers/esm/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
3
3
|
import { VisuallyHidden } from '@react-aria/visually-hidden';
|
4
4
|
import { omit } from 'lodash';
|
5
|
+
import PropTypes from 'prop-types';
|
5
6
|
import { Checkbox as ThemeUICheckbox } from 'theme-ui';
|
7
|
+
import { active, neutral } from '../../styles/colors';
|
6
8
|
import Box from '../Box';
|
7
9
|
|
8
10
|
/**
|
@@ -20,6 +22,7 @@ var DefaultCheckbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
20
22
|
}, props));
|
21
23
|
});
|
22
24
|
var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
25
|
+
var color = props.disabled ? neutral[80] : active;
|
23
26
|
return ___EmotionJSX("svg", _extends({
|
24
27
|
width: "24",
|
25
28
|
height: "24",
|
@@ -35,8 +38,8 @@ var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
|
35
38
|
width: "17",
|
36
39
|
height: "17",
|
37
40
|
rx: "1.5",
|
38
|
-
fill:
|
39
|
-
stroke:
|
41
|
+
fill: color,
|
42
|
+
stroke: color
|
40
43
|
}), ___EmotionJSX("rect", {
|
41
44
|
x: "6.5",
|
42
45
|
y: "11",
|
@@ -45,6 +48,10 @@ var IndeterminateCheckboxIcon = function IndeterminateCheckboxIcon(props) {
|
|
45
48
|
fill: "white"
|
46
49
|
}));
|
47
50
|
};
|
51
|
+
IndeterminateCheckboxIcon.propTypes = {
|
52
|
+
// eslint-disable-next-line react/boolean-prop-naming
|
53
|
+
disabled: PropTypes.bool
|
54
|
+
};
|
48
55
|
|
49
56
|
/**
|
50
57
|
* Renders a visually hidden default checkbox since the Theme UI checkbox does not support
|
@@ -58,7 +65,9 @@ var IndeterminateCheckbox = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
58
65
|
}, props))), ___EmotionJSX(Box, _extends({
|
59
66
|
as: IndeterminateCheckboxIcon,
|
60
67
|
mr: 2
|
61
|
-
}, props
|
68
|
+
}, props, {
|
69
|
+
opacity: 1
|
70
|
+
})));
|
62
71
|
});
|
63
72
|
var CheckboxBase = /*#__PURE__*/forwardRef(function (props, ref) {
|
64
73
|
/* eslint-disable react/prop-types */
|
@@ -66,12 +66,14 @@ var CheckboxField = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
66
66
|
var helperTextId = useMemo(function () {
|
67
67
|
return uuid();
|
68
68
|
}, []);
|
69
|
-
return ___EmotionJSX(Box, _extends({}, getPendoID(displayName), fieldContainerProps), ___EmotionJSX(
|
70
|
-
|
71
|
-
},
|
69
|
+
return ___EmotionJSX(Box, _extends({}, getPendoID(displayName), fieldContainerProps), ___EmotionJSX(Box, {
|
70
|
+
isRow: true
|
71
|
+
}, ___EmotionJSX(Checkbox, _extends({
|
72
72
|
ref: checkboxRef,
|
73
73
|
"aria-describedby": helperText && helperTextId
|
74
|
-
}, fieldControlInputProps)),
|
74
|
+
}, fieldControlInputProps)), ___EmotionJSX(Label, _extends({
|
75
|
+
variant: "forms.label.checkbox"
|
76
|
+
}, fieldLabelProps), label)), helperText && ___EmotionJSX(FieldHelperText, {
|
75
77
|
status: status,
|
76
78
|
sx: {
|
77
79
|
pt: 7
|
@@ -319,4 +319,18 @@ Indeterminate.parameters = {
|
|
319
319
|
story: 'When a `CheckboxField` is indeterminate, it\'s necessary to control the state in order to determine how it should function when pressed. Here is an example of how to do that.'
|
320
320
|
}
|
321
321
|
}
|
322
|
+
};
|
323
|
+
export var Disabled = function Disabled() {
|
324
|
+
return ___EmotionJSX(Box, null, ___EmotionJSX(CheckboxField, {
|
325
|
+
isDisabled: true,
|
326
|
+
label: "Disabled"
|
327
|
+
}), ___EmotionJSX(CheckboxField, {
|
328
|
+
isDisabled: true,
|
329
|
+
isSelected: true,
|
330
|
+
label: "Disabled"
|
331
|
+
}), ___EmotionJSX(CheckboxField, {
|
332
|
+
isDisabled: true,
|
333
|
+
isIndeterminate: true,
|
334
|
+
label: "Disabled"
|
335
|
+
}));
|
322
336
|
};
|
@@ -70,7 +70,10 @@ label.checkbox = _objectSpread(_objectSpread({}, text.base), {}, {
|
|
70
70
|
},
|
71
71
|
width: 'max-content',
|
72
72
|
alignItems: 'center',
|
73
|
-
cursor: 'pointer'
|
73
|
+
cursor: 'pointer',
|
74
|
+
'& .is-disabled': {
|
75
|
+
opacity: '1'
|
76
|
+
}
|
74
77
|
});
|
75
78
|
label.radioGroup = _objectSpread(_objectSpread({}, label), {}, {
|
76
79
|
fontWeight: 1
|