@pedidopago/ui 1.7.26 → 1.8.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/dist/components/Alert/alert.test.js +1 -85
- package/dist/components/Alert/index.js +1 -63
- package/dist/components/Alert/styles.js +1 -32
- package/dist/components/Avatar/avatar.test.js +1 -67
- package/dist/components/Avatar/index.js +1 -94
- package/dist/components/Avatar/styles.js +1 -51
- package/dist/components/Badge/badge.test.js +1 -71
- package/dist/components/Badge/index.js +2 -43
- package/dist/components/Badge/styles.js +1 -33
- package/dist/components/Button/Button.test.js +1 -154
- package/dist/components/Button/index.js +1 -87
- package/dist/components/Button/styles.js +1 -112
- package/dist/components/Card/card.test.js +1 -30
- package/dist/components/Card/index.js +1 -44
- package/dist/components/Card/styles.js +1 -16
- package/dist/components/CheckboxInput/checkbox-input.test.js +1 -170
- package/dist/components/CheckboxInput/components/MultipleCheckbox.js +1 -205
- package/dist/components/CheckboxInput/index.js +1 -94
- package/dist/components/CheckboxInput/styles.js +1 -34
- package/dist/components/ChoiceList/index.d.ts +6 -0
- package/dist/components/ChoiceList/index.d.ts.map +1 -0
- package/dist/components/ChoiceList/index.js +1 -0
- package/dist/components/ChoiceList/styles.d.ts +22 -0
- package/dist/components/ChoiceList/styles.d.ts.map +1 -0
- package/dist/components/ChoiceList/styles.js +1 -0
- package/dist/components/ChoiceList/types.d.ts +24 -0
- package/dist/components/ChoiceList/types.d.ts.map +1 -0
- package/dist/components/ChoiceList/types.js +1 -0
- package/dist/components/CollapseCard/ExpandButton/index.js +1 -40
- package/dist/components/CollapseCard/ExpandButton/styles.js +1 -16
- package/dist/components/CollapseCard/expand-button.test.js +1 -161
- package/dist/components/CollapseCard/index.js +1 -98
- package/dist/components/CollapseCard/styles.js +1 -26
- package/dist/components/ColorPicker/colorpicker.test.js +1 -64
- package/dist/components/ColorPicker/components/ColorHue.js +1 -44
- package/dist/components/ColorPicker/components/ColorInput.js +1 -63
- package/dist/components/ColorPicker/components/ColorPickerBox.js +1 -52
- package/dist/components/ColorPicker/components/ColorPointer.js +1 -25
- package/dist/components/ColorPicker/components/ColorSelector.js +1 -107
- package/dist/components/ColorPicker/hooks/useCachedCallback.js +1 -16
- package/dist/components/ColorPicker/hooks/useHsva.js +1 -53
- package/dist/components/ColorPicker/index.js +1 -93
- package/dist/components/ColorPicker/styles.js +1 -46
- package/dist/components/ColorPicker/utils/checkers.js +1 -55
- package/dist/components/ColorPicker/utils/conversors.js +2 -243
- package/dist/components/ColorPicker/utils/parsers.js +10 -108
- package/dist/components/ComposeIcon/index.js +2 -48
- package/dist/components/ComposeIcon/styles.js +1 -53
- package/dist/components/DateInput/DateInput-example.js +7 -45
- package/dist/components/DateInput/components/ModalWrapper/index.js +1 -35
- package/dist/components/DateInput/components/ModalWrapper/styles.js +1 -21
- package/dist/components/DateInput/dateInput.test.js +2 -43
- package/dist/components/DateInput/index.js +2 -104
- package/dist/components/DateInput/styles.js +1 -18
- package/dist/components/DatePicker/components/DatePickerContent.js +2 -222
- package/dist/components/DatePicker/components/DateYearPicker.js +1 -102
- package/dist/components/DatePicker/datepicker.test.js +1 -120
- package/dist/components/DatePicker/index.js +1 -236
- package/dist/components/DatePicker/styles.js +1 -88
- package/dist/components/DatePicker/utils/getMonthName.js +1 -11
- package/dist/components/Dialog/dialog-example.js +1 -46
- package/dist/components/Dialog/dialog.test.js +1 -68
- package/dist/components/Dialog/index.js +2 -100
- package/dist/components/Dialog/styles.js +1 -31
- package/dist/components/Dropzone/dropzone.test.js +1 -69
- package/dist/components/Dropzone/index.js +1 -289
- package/dist/components/Dropzone/styles.js +1 -75
- package/dist/components/Dropzone/utils/accepts.js +2 -27
- package/dist/components/EmojiPicker/Emote/index.js +2 -24
- package/dist/components/EmojiPicker/Emote/styles.js +1 -27
- package/dist/components/EmojiPicker/EmotePickerData/constants.js +1 -51
- package/dist/components/EmojiPicker/EmotePickerData/index.js +2 -159
- package/dist/components/EmojiPicker/EmotePickerData/styles.js +1 -57
- package/dist/components/EmojiPicker/EmotePickerData/utils.js +1 -41
- package/dist/components/EmojiPicker/Example/EmotePickerExample.js +1 -43
- package/dist/components/EmojiPicker/animation.js +1 -43
- package/dist/components/EmojiPicker/index.js +1 -169
- package/dist/components/EmojiPicker/styles.js +1 -21
- package/dist/components/Flex/flex.test.js +1 -336
- package/dist/components/Flex/index.js +1 -49
- package/dist/components/Flex/styles.js +1 -25
- package/dist/components/Grid/grid.test.js +1 -134
- package/dist/components/Grid/index.js +1 -51
- package/dist/components/Grid/styles.js +1 -48
- package/dist/components/Icon/data/beauty.js +2 -206
- package/dist/components/Icon/data/dash.js +2 -2
- package/dist/components/Icon/data/ecommerce.js +2 -94
- package/dist/components/Icon/data/form.js +2 -248
- package/dist/components/Icon/data/health.js +2 -255
- package/dist/components/Icon/data/illustrations.js +2 -318
- package/dist/components/Icon/data/men.js +2 -52
- package/dist/components/Icon/data/payment.js +2 -94
- package/dist/components/Icon/data/pedidoPago.js +2 -45
- package/dist/components/Icon/data/physicalPerfomance.js +2 -283
- package/dist/components/Icon/data/social.js +2 -24
- package/dist/components/Icon/data/status.js +2 -115
- package/dist/components/Icon/data/summer.js +2 -52
- package/dist/components/Icon/data/woman.js +2 -80
- package/dist/components/Icon/icon.test.js +1 -57
- package/dist/components/Icon/index.js +1 -53
- package/dist/components/Icon/scripts/build.js +9 -104
- package/dist/components/Icon/scripts/extractor.js +2 -33
- package/dist/components/Icon/scripts/run-build.js +2 -7
- package/dist/components/Icon/scripts/writers.js +3 -34
- package/dist/components/Icon/styles.js +1 -22
- package/dist/components/Icon/utils/allIcons.js +1 -28
- package/dist/components/Icon/utils/iconExists.js +1 -13
- package/dist/components/IconItem/IconItem.test.js +1 -58
- package/dist/components/IconItem/index.js +1 -52
- package/dist/components/IconItem/styles.js +1 -43
- package/dist/components/Illustration/illustration.test.js +4 -50
- package/dist/components/Illustration/index.js +2 -65
- package/dist/components/Illustration/styles.js +1 -65
- package/dist/components/ImageItem/imageFake.js +1 -25
- package/dist/components/ImageItem/index.js +2 -66
- package/dist/components/ImageItem/input.test.js +1 -85
- package/dist/components/ImageItem/styles.js +1 -61
- package/dist/components/Input/index.js +1 -163
- package/dist/components/Input/input.test.js +1 -120
- package/dist/components/Input/styles.js +1 -177
- package/dist/components/Label/index.js +1 -45
- package/dist/components/Label/label.test.js +1 -83
- package/dist/components/Label/styles.js +1 -21
- package/dist/components/List/index.js +1 -39
- package/dist/components/List/list.test.js +1 -64
- package/dist/components/List/styles.js +1 -23
- package/dist/components/Modal/ModalExample.js +1 -70
- package/dist/components/Modal/index.js +1 -145
- package/dist/components/Modal/modal.test.js +1 -179
- package/dist/components/Modal/styles.js +1 -33
- package/dist/components/MultipleSelect/MultipleSelect.test.js +1 -334
- package/dist/components/MultipleSelect/animations.js +1 -25
- package/dist/components/MultipleSelect/components/InputWrapper/index.js +1 -26
- package/dist/components/MultipleSelect/components/OptionsArea/index.js +1 -244
- package/dist/components/MultipleSelect/components/OptionsArea/styles.js +1 -68
- package/dist/components/MultipleSelect/components/SelectArea/ButtonsArea.js +1 -27
- package/dist/components/MultipleSelect/components/SelectArea/SelectAreaWrapper.js +1 -37
- package/dist/components/MultipleSelect/components/SelectArea/SelectedOptionsArea.js +1 -49
- package/dist/components/MultipleSelect/components/SelectArea/index.js +1 -100
- package/dist/components/MultipleSelect/components/SelectArea/styles.js +1 -36
- package/dist/components/MultipleSelect/components/index.js +1 -38
- package/dist/components/MultipleSelect/index.js +1 -209
- package/dist/components/NewSelect/Examples/constants.js +1 -56
- package/dist/components/NewSelect/Examples/index.js +1 -161
- package/dist/components/NewSelect/components/Chip/index.js +1 -36
- package/dist/components/NewSelect/components/Chip/styles.js +1 -24
- package/dist/components/NewSelect/components/OptionsSelect/styles.js +1 -21
- package/dist/components/NewSelect/components/SelectInputSearch/index.js +1 -24
- package/dist/components/NewSelect/components/SelectItem/index.js +1 -22
- package/dist/components/NewSelect/components/SelectItem/styles.js +1 -24
- package/dist/components/NewSelect/index.js +1 -18
- package/dist/components/NewSelect/multiple/index.js +1 -246
- package/dist/components/NewSelect/newSelect.test.js +1 -108
- package/dist/components/NewSelect/single/index.js +1 -183
- package/dist/components/NewSelect/styles.js +1 -44
- package/dist/components/Observer/index.js +1 -59
- package/dist/components/Observer/observer.test.js +2 -43
- package/dist/components/Pagination/hooks/usePagination.js +1 -57
- package/dist/components/Pagination/index.js +1 -174
- package/dist/components/Pagination/pagination.test.js +1 -118
- package/dist/components/Pagination/styles.js +1 -78
- package/dist/components/Progress/Circle/index.js +1 -102
- package/dist/components/Progress/Circle/styles.js +1 -69
- package/dist/components/Progress/Linear/index.js +1 -62
- package/dist/components/Progress/Linear/styles.js +1 -66
- package/dist/components/Progress/getSteps.js +1 -17
- package/dist/components/Progress/index.js +1 -39
- package/dist/components/Progress/progress.test.js +1 -109
- package/dist/components/Radio/components/RadioGroup/index.d.ts +5 -0
- package/dist/components/Radio/components/RadioGroup/index.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/index.js +1 -0
- package/dist/components/Radio/components/RadioGroup/styles.d.ts +19 -0
- package/dist/components/Radio/components/RadioGroup/styles.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/styles.js +1 -0
- package/dist/components/Radio/components/RadioGroup/types.d.ts +17 -0
- package/dist/components/Radio/components/RadioGroup/types.d.ts.map +1 -0
- package/dist/components/Radio/components/RadioGroup/types.js +1 -0
- package/dist/components/Radio/index.d.ts +5 -0
- package/dist/components/Radio/index.d.ts.map +1 -0
- package/dist/components/Radio/index.js +1 -0
- package/dist/components/Radio/styles.d.ts +10 -0
- package/dist/components/Radio/styles.d.ts.map +1 -0
- package/dist/components/Radio/styles.js +1 -0
- package/dist/components/Radio/types.d.ts +6 -0
- package/dist/components/Radio/types.d.ts.map +1 -0
- package/dist/components/Radio/types.js +1 -0
- package/dist/components/Rating/index.js +1 -133
- package/dist/components/Rating/rating.test.js +1 -63
- package/dist/components/Rating/styles.js +1 -27
- package/dist/components/ReactPortal/index.js +1 -43
- package/dist/components/ReactPortal/reactPortal.test.js +1 -21
- package/dist/components/ReactPortal/utils/createWrapperAndApprendToBody.js +1 -12
- package/dist/components/Select/components/OptionsSelect/index.js +1 -73
- package/dist/components/Select/components/OptionsSelect/styles.js +1 -21
- package/dist/components/Select/index.js +4 -247
- package/dist/components/Select/select.test.js +1 -58
- package/dist/components/Select/styles.js +1 -46
- package/dist/components/Skeleton/index.js +1 -28
- package/dist/components/Skeleton/skeleton.test.js +1 -90
- package/dist/components/Skeleton/styles.js +1 -27
- package/dist/components/Slider/SliderExample.js +1 -52
- package/dist/components/Slider/components/SliderPointer.js +1 -39
- package/dist/components/Slider/components/SliderRail.js +1 -116
- package/dist/components/Slider/components/SliderSelector.js +1 -173
- package/dist/components/Slider/hooks/useEventCallback.js +1 -16
- package/dist/components/Slider/index.js +1 -137
- package/dist/components/Slider/slider.test.js +1 -121
- package/dist/components/Slider/styles.js +1 -69
- package/dist/components/Spinner/index.js +1 -26
- package/dist/components/Spinner/spinner.test.js +1 -45
- package/dist/components/Spinner/styles.js +1 -23
- package/dist/components/Steps/components/StepIcon/index.js +1 -50
- package/dist/components/Steps/components/StepIcon/styles.js +1 -42
- package/dist/components/Steps/components/StepIcon/utils.js +1 -22
- package/dist/components/Steps/index.js +1 -116
- package/dist/components/Steps/steps.test.js +1 -53
- package/dist/components/Steps/styles.js +1 -96
- package/dist/components/Steps/utils.js +1 -15
- package/dist/components/Switch/index.js +1 -73
- package/dist/components/Switch/styles.js +1 -58
- package/dist/components/Switch/switch.test.js +2 -115
- package/dist/components/Table/components/MenuItem.js +1 -59
- package/dist/components/Table/components/TableSkeleton.js +1 -39
- package/dist/components/Table/components/animations.js +1 -24
- package/dist/components/Table/index.js +2 -253
- package/dist/components/Table/styles.js +1 -49
- package/dist/components/Table/table.test.js +1 -114
- package/dist/components/Tabs/TabsExample.js +1 -64
- package/dist/components/Tabs/components/Tab.js +1 -49
- package/dist/components/Tabs/components/TabPanel.js +1 -25
- package/dist/components/Tabs/components/Tabs.js +1 -107
- package/dist/components/Tabs/index.js +1 -26
- package/dist/components/Tabs/styles.js +1 -61
- package/dist/components/Tabs/tabs.test.js +1 -146
- package/dist/components/Tag/index.js +1 -53
- package/dist/components/Tag/styles.js +1 -34
- package/dist/components/Tag/tag.test.js +1 -64
- package/dist/components/TextAreaInput/index.js +1 -74
- package/dist/components/TextAreaInput/styles.js +1 -53
- package/dist/components/TextAreaInput/text-area-input.test.js +1 -81
- package/dist/components/Thumbnail/index.js +1 -125
- package/dist/components/Thumbnail/styles.js +1 -47
- package/dist/components/Thumbnail/thumbnail.test.js +1 -66
- package/dist/components/Thumbnail/utils/index.js +1 -27
- package/dist/components/Thumbnail/utils/validate-file-size.js +1 -10
- package/dist/components/Thumbnail/utils/validate-file-type.js +1 -9
- package/dist/components/TimeInput/constants.js +1 -29
- package/dist/components/TimeInput/index.js +1 -288
- package/dist/components/TimeInput/styles.js +1 -34
- package/dist/components/TimeInput/utils.js +1 -94
- package/dist/components/Timeline/components/Timeline.js +1 -17
- package/dist/components/Timeline/components/TimelineContent.js +1 -61
- package/dist/components/Timeline/components/TimelineItem.js +1 -25
- package/dist/components/Timeline/components/TimelineSeparator.js +1 -20
- package/dist/components/Timeline/index.js +1 -33
- package/dist/components/Timeline/styles.js +1 -37
- package/dist/components/Timeline/timeline.test.js +1 -138
- package/dist/components/Toast/button-example.js +1 -31
- package/dist/components/Toast/components/Toast.js +1 -79
- package/dist/components/Toast/contexts/ToastProvider.js +1 -72
- package/dist/components/Toast/hooks/useToast.js +1 -18
- package/dist/components/Toast/index.js +1 -111
- package/dist/components/Toast/styles.js +1 -36
- package/dist/components/Toast/toast.test.js +1 -129
- package/dist/components/Tooltip/components/TooltipLabel.js +1 -71
- package/dist/components/Tooltip/example.js +1 -27
- package/dist/components/Tooltip/index.js +1 -187
- package/dist/components/Tooltip/styles.js +1 -20
- package/dist/components/Typography/index.js +1 -37
- package/dist/components/Typography/styles.js +1 -15
- package/dist/components/Typography/typography.test.js +1 -288
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -548
- package/dist/shared/animations/opacityAnimation.js +1 -21
- package/dist/shared/assets/emotes.js +1 -1
- package/dist/shared/components/FocusLock/index.js +5 -86
- package/dist/shared/formatters/format-number.js +5 -41
- package/dist/shared/global.js +1 -8
- package/dist/shared/hooks/devices.js +1 -14
- package/dist/shared/hooks/useBreakpoints.js +2 -95
- package/dist/shared/hooks/useDebounce.js +1 -35
- package/dist/shared/hooks/useDevices.js +2 -42
- package/dist/shared/hooks/useDisableBodyScroll.js +5 -52
- package/dist/shared/hooks/useDraggableScroll/index.js +5 -65
- package/dist/shared/hooks/useKeyPress.js +1 -18
- package/dist/shared/hooks/useObserver.js +2 -29
- package/dist/shared/hooks/useOnClickOutside.js +1 -30
- package/dist/shared/hooks/useReposition/index.js +2 -53
- package/dist/shared/hooks/useSystemTheme.js +1 -38
- package/dist/shared/hooks/useWindowSize.js +1 -36
- package/dist/shared/tests/test-utils.js +1 -31
- package/dist/shared/theme/button-example.js +1 -31
- package/dist/shared/theme/contexts/ThemeContext.js +1 -90
- package/dist/shared/theme/hooks/useColorMode.js +1 -18
- package/dist/shared/theme/hooks/useColorModeValue.js +1 -13
- package/dist/shared/theme/hooks/useTheme.js +1 -17
- package/dist/shared/theme/index.js +1 -67
- package/dist/shared/theme/objects/breakpoints.js +1 -15
- package/dist/shared/theme/objects/colors.js +1 -177
- package/dist/shared/theme/objects/shadows.js +1 -19
- package/dist/shared/theme/objects/sizes.js +6 -33
- package/dist/shared/theme/objects/spaces.js +1 -75
- package/dist/shared/theme/objects/transitions.js +1 -10
- package/dist/shared/theme/objects/typography.js +1 -20
- package/dist/shared/theme/objects/z-indexes.js +1 -20
- package/dist/shared/theme/theme.js +1 -36
- package/dist/shared/theme/theme.test.js +1 -94
- package/dist/shared/theme/utils/extendTheme.js +1 -25
- package/dist/shared/theme/utils/localStorageController.js +1 -21
- package/dist/styled.d.js +1 -3
- package/dist/utils/GenerateKey.js +3 -18
- package/dist/utils/brightnessColorChange.js +2 -17
- package/dist/utils/colorCheck.js +6 -64
- package/dist/utils/colorFunctions.js +1 -39
- package/dist/utils/colorToGray.js +2 -64
- package/dist/utils/customColorMode.js +1 -11
- package/dist/utils/file.js +5 -124
- package/dist/utils/formatters/bytes.js +2 -17
- package/dist/utils/formatters/capitalize.js +2 -11
- package/dist/utils/formatters/cep.js +3 -18
- package/dist/utils/formatters/cnpj.js +4 -38
- package/dist/utils/formatters/color.js +12 -101
- package/dist/utils/formatters/cpf.js +16 -85
- package/dist/utils/formatters/credit-card.js +5 -54
- package/dist/utils/formatters/email.js +1 -8
- package/dist/utils/formatters/index.js +1 -170
- package/dist/utils/formatters/name.js +4 -31
- package/dist/utils/formatters/number.js +5 -14
- package/dist/utils/formatters/passport.js +5 -33
- package/dist/utils/formatters/phone.js +17 -214
- package/dist/utils/formatters/price.js +3 -21
- package/dist/utils/formatters/rg.js +3 -18
- package/dist/utils/formatters/strings.js +4 -27
- package/dist/utils/fuctionsColors.js +1 -39
- package/dist/utils/generateUUID.js +1 -13
- package/dist/utils/getColorValue.js +2 -23
- package/dist/utils/getSvg.js +1 -17
- package/dist/utils/getValuesBySize.js +1 -9
- package/dist/utils/invertColor.js +4 -40
- package/package.json +2 -1
|
@@ -1,170 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _testUtils = require("../../shared/tests/test-utils");
|
|
4
|
-
require("@testing-library/jest-dom");
|
|
5
|
-
var _react = require("@testing-library/react");
|
|
6
|
-
var _ = _interopRequireDefault(require("."));
|
|
7
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
11
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
-
var mockPropCheckboxChildren = [{
|
|
16
|
-
label: 'Children-1',
|
|
17
|
-
value: 'children-1',
|
|
18
|
-
id: 'children-1'
|
|
19
|
-
}, {
|
|
20
|
-
label: 'Children-2',
|
|
21
|
-
value: 'children-2',
|
|
22
|
-
id: 'children-2'
|
|
23
|
-
}, {
|
|
24
|
-
label: 'Children-3',
|
|
25
|
-
value: 'children-3',
|
|
26
|
-
id: 'children-3'
|
|
27
|
-
}];
|
|
28
|
-
var makeSut = function makeSut(props) {
|
|
29
|
-
var sut = (0, _testUtils.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_.default, _objectSpread({}, props)));
|
|
30
|
-
var checkbox = sut.container.querySelector('input');
|
|
31
|
-
var label = sut.container.querySelector('label');
|
|
32
|
-
return {
|
|
33
|
-
sut: sut,
|
|
34
|
-
checkbox: checkbox,
|
|
35
|
-
label: label
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
describe('CheckboxInput', function () {
|
|
39
|
-
it('should render input with type checkbox', function () {
|
|
40
|
-
var _makeSut = makeSut(),
|
|
41
|
-
checkbox = _makeSut.checkbox;
|
|
42
|
-
expect(checkbox === null || checkbox === void 0 ? void 0 : checkbox.getAttribute('type')).toBe('checkbox');
|
|
43
|
-
});
|
|
44
|
-
it('should must disable checkbox when isDisabled is true', function () {
|
|
45
|
-
var _makeSut2 = makeSut({
|
|
46
|
-
isDisabled: true
|
|
47
|
-
}),
|
|
48
|
-
checkbox = _makeSut2.checkbox;
|
|
49
|
-
expect(checkbox).toBeDisabled();
|
|
50
|
-
});
|
|
51
|
-
it('should not render label if label prop not provided', function () {
|
|
52
|
-
var _makeSut3 = makeSut({
|
|
53
|
-
label: ''
|
|
54
|
-
}),
|
|
55
|
-
label = _makeSut3.label;
|
|
56
|
-
expect(label).not.toBeInTheDocument();
|
|
57
|
-
});
|
|
58
|
-
it('should render label element with correct label prop value', function () {
|
|
59
|
-
var labelValue = 'correct_label_value';
|
|
60
|
-
var _makeSut4 = makeSut({
|
|
61
|
-
label: labelValue
|
|
62
|
-
}),
|
|
63
|
-
label = _makeSut4.label;
|
|
64
|
-
expect(label.innerHTML).toBe(labelValue);
|
|
65
|
-
});
|
|
66
|
-
it('should select checkbox on click in label element', function () {
|
|
67
|
-
var _makeSut5 = makeSut({
|
|
68
|
-
id: 'any_id',
|
|
69
|
-
label: 'any_label'
|
|
70
|
-
}),
|
|
71
|
-
label = _makeSut5.label,
|
|
72
|
-
checkbox = _makeSut5.checkbox;
|
|
73
|
-
_react.fireEvent.click(label);
|
|
74
|
-
expect(checkbox).toBeChecked();
|
|
75
|
-
});
|
|
76
|
-
it('should render multiple checkbox', function () {
|
|
77
|
-
var _makeSut6 = makeSut({
|
|
78
|
-
id: 'any_id',
|
|
79
|
-
label: 'any_label',
|
|
80
|
-
isMultiple: true,
|
|
81
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
82
|
-
}),
|
|
83
|
-
sut = _makeSut6.sut;
|
|
84
|
-
expect(sut.getByRole('list')).toBeInTheDocument();
|
|
85
|
-
});
|
|
86
|
-
it('should render multiple checkbox with childrens', function () {
|
|
87
|
-
var _makeSut7 = makeSut({
|
|
88
|
-
id: 'any_id',
|
|
89
|
-
label: 'any_label',
|
|
90
|
-
isMultiple: true,
|
|
91
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
92
|
-
}),
|
|
93
|
-
sut = _makeSut7.sut;
|
|
94
|
-
expect(sut.getAllByRole('listitem')).toBeTruthy();
|
|
95
|
-
});
|
|
96
|
-
it('should render multiple checkbox with parent label', function () {
|
|
97
|
-
var _makeSut8 = makeSut({
|
|
98
|
-
id: 'any_id',
|
|
99
|
-
label: 'any_label',
|
|
100
|
-
isMultiple: true,
|
|
101
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
102
|
-
}),
|
|
103
|
-
sut = _makeSut8.sut;
|
|
104
|
-
expect(sut.getByLabelText('any_label')).toBeInTheDocument();
|
|
105
|
-
});
|
|
106
|
-
it('should render multiple checkbox with children label', function () {
|
|
107
|
-
var _makeSut9 = makeSut({
|
|
108
|
-
id: 'any_id',
|
|
109
|
-
label: 'any_label',
|
|
110
|
-
isMultiple: true,
|
|
111
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
112
|
-
}),
|
|
113
|
-
sut = _makeSut9.sut;
|
|
114
|
-
mockPropCheckboxChildren.forEach(function (item) {
|
|
115
|
-
expect(sut.getByLabelText(item.label)).toBeInTheDocument();
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
it('should disabled multiple checkbox with isDisabled are provided', function () {
|
|
119
|
-
var _makeSut10 = makeSut({
|
|
120
|
-
id: 'any_id',
|
|
121
|
-
label: 'any_label',
|
|
122
|
-
isMultiple: true,
|
|
123
|
-
checkboxChildren: mockPropCheckboxChildren,
|
|
124
|
-
isDisabled: true
|
|
125
|
-
}),
|
|
126
|
-
sut = _makeSut10.sut,
|
|
127
|
-
checkbox = _makeSut10.checkbox;
|
|
128
|
-
var checkboxChildrens = sut.getAllByRole('listitem');
|
|
129
|
-
checkboxChildrens.forEach(function (children) {
|
|
130
|
-
children.querySelectorAll('input').forEach(function (input) {
|
|
131
|
-
expect(input).toBeDisabled();
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
expect(checkbox).toBeDisabled();
|
|
135
|
-
});
|
|
136
|
-
it('should checked childrens on click parent checkbox', function () {
|
|
137
|
-
var _makeSut11 = makeSut({
|
|
138
|
-
id: 'any_id',
|
|
139
|
-
label: 'any_label',
|
|
140
|
-
isMultiple: true,
|
|
141
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
142
|
-
}),
|
|
143
|
-
sut = _makeSut11.sut,
|
|
144
|
-
checkbox = _makeSut11.checkbox;
|
|
145
|
-
_react.fireEvent.click(checkbox);
|
|
146
|
-
var checkboxChildrens = sut.getAllByRole('listitem');
|
|
147
|
-
checkboxChildrens.forEach(function (children) {
|
|
148
|
-
children.querySelectorAll('input').forEach(function (input) {
|
|
149
|
-
expect(input).toBeChecked();
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
it('should unchecked childrens on click checked parent checkbox', function () {
|
|
154
|
-
var _makeSut12 = makeSut({
|
|
155
|
-
id: 'any_id',
|
|
156
|
-
label: 'any_label',
|
|
157
|
-
isMultiple: true,
|
|
158
|
-
checkboxChildren: mockPropCheckboxChildren
|
|
159
|
-
}),
|
|
160
|
-
sut = _makeSut12.sut,
|
|
161
|
-
checkbox = _makeSut12.checkbox;
|
|
162
|
-
_react.fireEvent.doubleClick(checkbox);
|
|
163
|
-
var checkboxChildrens = sut.getAllByRole('listitem');
|
|
164
|
-
checkboxChildrens.forEach(function (children) {
|
|
165
|
-
children.querySelectorAll('input').forEach(function (input) {
|
|
166
|
-
expect(input).not.toBeChecked();
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
1
|
+
"use strict";var _testUtils=require("../../shared/tests/test-utils");require("@testing-library/jest-dom");var _react=require("@testing-library/react"),_=_interopRequireDefault(require(".")),_jsxRuntime=require("react/jsx-runtime");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}var mockPropCheckboxChildren=[{label:"Children-1",value:"children-1",id:"children-1"},{label:"Children-2",value:"children-2",id:"children-2"},{label:"Children-3",value:"children-3",id:"children-3"}],makeSut=function(props){var sut=(0,_testUtils.render)(/*#__PURE__*/(0,_jsxRuntime.jsx)(_.default,_objectSpread({},props))),checkbox=sut.container.querySelector("input"),label=sut.container.querySelector("label");return{sut:sut,checkbox:checkbox,label:label}};describe("CheckboxInput",function(){it("should render input with type checkbox",function(){var _makeSut=makeSut(),checkbox=_makeSut.checkbox;expect(null===checkbox||void 0===checkbox?void 0:checkbox.getAttribute("type")).toBe("checkbox")}),it("should must disable checkbox when isDisabled is true",function(){var _makeSut2=makeSut({isDisabled:!0}),checkbox=_makeSut2.checkbox;expect(checkbox).toBeDisabled()}),it("should not render label if label prop not provided",function(){var _makeSut3=makeSut({label:""}),label=_makeSut3.label;expect(label).not.toBeInTheDocument()}),it("should render label element with correct label prop value",function(){var labelValue="correct_label_value",_makeSut4=makeSut({label:labelValue}),label=_makeSut4.label;expect(label.innerHTML).toBe(labelValue)}),it("should select checkbox on click in label element",function(){var _makeSut5=makeSut({id:"any_id",label:"any_label"}),label=_makeSut5.label,checkbox=_makeSut5.checkbox;_react.fireEvent.click(label),expect(checkbox).toBeChecked()}),it("should render multiple checkbox",function(){var _makeSut6=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut6.sut;expect(sut.getByRole("list")).toBeInTheDocument()}),it("should render multiple checkbox with childrens",function(){var _makeSut7=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut7.sut;expect(sut.getAllByRole("listitem")).toBeTruthy()}),it("should render multiple checkbox with parent label",function(){var _makeSut8=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut8.sut;expect(sut.getByLabelText("any_label")).toBeInTheDocument()}),it("should render multiple checkbox with children label",function(){var _makeSut9=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut9.sut;mockPropCheckboxChildren.forEach(function(item){expect(sut.getByLabelText(item.label)).toBeInTheDocument()})}),it("should disabled multiple checkbox with isDisabled are provided",function(){var _makeSut10=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren,isDisabled:!0}),sut=_makeSut10.sut,checkbox=_makeSut10.checkbox,checkboxChildrens=sut.getAllByRole("listitem");checkboxChildrens.forEach(function(children){children.querySelectorAll("input").forEach(function(input){expect(input).toBeDisabled()})}),expect(checkbox).toBeDisabled()}),it("should checked childrens on click parent checkbox",function(){var _makeSut11=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut11.sut,checkbox=_makeSut11.checkbox;_react.fireEvent.click(checkbox);var checkboxChildrens=sut.getAllByRole("listitem");checkboxChildrens.forEach(function(children){children.querySelectorAll("input").forEach(function(input){expect(input).toBeChecked()})})}),it("should unchecked childrens on click checked parent checkbox",function(){var _makeSut12=makeSut({id:"any_id",label:"any_label",isMultiple:!0,checkboxChildren:mockPropCheckboxChildren}),sut=_makeSut12.sut,checkbox=_makeSut12.checkbox;_react.fireEvent.doubleClick(checkbox);var checkboxChildrens=sut.getAllByRole("listitem");checkboxChildrens.forEach(function(children){children.querySelectorAll("input").forEach(function(input){expect(input).not.toBeChecked()})})})});
|
|
@@ -1,205 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
10
|
-
var _styles = require("../styles");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
var _excluded = ["id", "label", "color", "checkboxChildren", "isDisabled", "onChangeValue"];
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
22
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
24
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
26
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
27
|
-
var MultipleCheckbox = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
28
|
-
var id = _ref.id,
|
|
29
|
-
label = _ref.label,
|
|
30
|
-
color = _ref.color,
|
|
31
|
-
checkboxChildren = _ref.checkboxChildren,
|
|
32
|
-
isDisabled = _ref.isDisabled,
|
|
33
|
-
onChangeValue = _ref.onChangeValue,
|
|
34
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
var _useState = (0, _react.useState)(false),
|
|
36
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
-
hasDeselectedChildren = _useState2[0],
|
|
38
|
-
setHasDeselectedChildren = _useState2[1];
|
|
39
|
-
var _useState3 = (0, _react.useState)(false),
|
|
40
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
-
parentChecked = _useState4[0],
|
|
42
|
-
setParentChecked = _useState4[1];
|
|
43
|
-
var _useState5 = (0, _react.useState)(false),
|
|
44
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
45
|
-
isvisibleOptions = _useState6[0],
|
|
46
|
-
setIsVisibleOptions = _useState6[1];
|
|
47
|
-
var _useState7 = (0, _react.useState)([]),
|
|
48
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
49
|
-
childrenData = _useState8[0],
|
|
50
|
-
setChildrenData = _useState8[1];
|
|
51
|
-
(0, _react.useEffect)(function () {
|
|
52
|
-
var haveDeselectedChildrens = childrenData.some(function (data) {
|
|
53
|
-
return data.hasSelected === true;
|
|
54
|
-
});
|
|
55
|
-
var hasAllChildrensSelected = childrenData.every(function (data) {
|
|
56
|
-
return data.hasSelected === true;
|
|
57
|
-
});
|
|
58
|
-
var selectedChildrens = childrenData.filter(function (children) {
|
|
59
|
-
return children.hasSelected !== false;
|
|
60
|
-
}).map(function (children) {
|
|
61
|
-
return {
|
|
62
|
-
label: children.label,
|
|
63
|
-
value: children.value,
|
|
64
|
-
id: children.id
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(selectedChildrens);
|
|
68
|
-
if (haveDeselectedChildrens) {
|
|
69
|
-
if (hasAllChildrensSelected) {
|
|
70
|
-
setHasDeselectedChildren(false);
|
|
71
|
-
} else {
|
|
72
|
-
setHasDeselectedChildren(true);
|
|
73
|
-
}
|
|
74
|
-
setParentChecked(true);
|
|
75
|
-
} else {
|
|
76
|
-
setParentChecked(false);
|
|
77
|
-
}
|
|
78
|
-
}, [childrenData, onChangeValue]);
|
|
79
|
-
(0, _react.useEffect)(function () {
|
|
80
|
-
var childrensState = checkboxChildren.map(function (children) {
|
|
81
|
-
return _objectSpread(_objectSpread({}, children), {}, {
|
|
82
|
-
hasSelected: false
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
setChildrenData(childrensState);
|
|
86
|
-
}, [checkboxChildren]);
|
|
87
|
-
function checkedAll() {
|
|
88
|
-
if (isvisibleOptions) {
|
|
89
|
-
setIsVisibleOptions(false);
|
|
90
|
-
}
|
|
91
|
-
setChildrenData(function (state) {
|
|
92
|
-
return state.map(function (children) {
|
|
93
|
-
return _objectSpread(_objectSpread({}, children), {}, {
|
|
94
|
-
hasSelected: true
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function deselectAll() {
|
|
100
|
-
setChildrenData(function (state) {
|
|
101
|
-
return state.map(function (children) {
|
|
102
|
-
return _objectSpread(_objectSpread({}, children), {}, {
|
|
103
|
-
hasSelected: false
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function handleParentChange(event) {
|
|
109
|
-
var checked = event.target.checked;
|
|
110
|
-
setParentChecked(function (v) {
|
|
111
|
-
return !v;
|
|
112
|
-
});
|
|
113
|
-
if (checked) {
|
|
114
|
-
checkedAll();
|
|
115
|
-
} else {
|
|
116
|
-
deselectAll();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
function handleChildrenChange(event, id) {
|
|
120
|
-
var checked = event.target.checked;
|
|
121
|
-
setChildrenData(function (state) {
|
|
122
|
-
return state.map(function (children) {
|
|
123
|
-
if (id === children.id) {
|
|
124
|
-
children.hasSelected = !!checked;
|
|
125
|
-
}
|
|
126
|
-
return children;
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
function handleRenderParentIcon() {
|
|
131
|
-
if (!parentChecked) {
|
|
132
|
-
return null;
|
|
133
|
-
} else if (hasDeselectedChildren) {
|
|
134
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
135
|
-
name: "minus",
|
|
136
|
-
color: "neutral.white",
|
|
137
|
-
size: 20
|
|
138
|
-
});
|
|
139
|
-
} else {
|
|
140
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
141
|
-
name: "check",
|
|
142
|
-
color: "neutral.white",
|
|
143
|
-
size: 20
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.MultipleWrapper, {
|
|
148
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Wrapper, {
|
|
149
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.CheckBoxWrapper, {
|
|
150
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
151
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Checkbox, _objectSpread({
|
|
152
|
-
ref: ref,
|
|
153
|
-
id: id,
|
|
154
|
-
type: "checkbox",
|
|
155
|
-
color: color,
|
|
156
|
-
checked: parentChecked,
|
|
157
|
-
onChange: handleParentChange,
|
|
158
|
-
disabled: isDisabled
|
|
159
|
-
}, rest)), handleRenderParentIcon()]
|
|
160
|
-
})
|
|
161
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Label, {
|
|
162
|
-
htmlFor: id,
|
|
163
|
-
isDisabled: isDisabled,
|
|
164
|
-
children: label
|
|
165
|
-
})]
|
|
166
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ChildrensWrapper, {
|
|
167
|
-
role: "list",
|
|
168
|
-
children: childrenData.map(function (_ref2) {
|
|
169
|
-
var label = _ref2.label,
|
|
170
|
-
id = _ref2.id,
|
|
171
|
-
value = _ref2.value,
|
|
172
|
-
hasSelected = _ref2.hasSelected;
|
|
173
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Wrapper, {
|
|
174
|
-
role: "listitem",
|
|
175
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.CheckBoxWrapper, {
|
|
176
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
177
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Checkbox, {
|
|
178
|
-
type: "checkbox",
|
|
179
|
-
disabled: isDisabled,
|
|
180
|
-
id: id,
|
|
181
|
-
color: color,
|
|
182
|
-
checked: hasSelected,
|
|
183
|
-
onChange: function onChange(event) {
|
|
184
|
-
return handleChildrenChange(event, id);
|
|
185
|
-
}
|
|
186
|
-
}), hasSelected ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
187
|
-
size: 20,
|
|
188
|
-
name: "check",
|
|
189
|
-
color: "neutral.white"
|
|
190
|
-
}) : '']
|
|
191
|
-
})
|
|
192
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Label, {
|
|
193
|
-
htmlFor: id,
|
|
194
|
-
isDisabled: isDisabled,
|
|
195
|
-
color: color,
|
|
196
|
-
children: label
|
|
197
|
-
})]
|
|
198
|
-
}, value);
|
|
199
|
-
})
|
|
200
|
-
})]
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
MultipleCheckbox.displayName = 'MultipleCheckbox';
|
|
204
|
-
var _default = MultipleCheckbox;
|
|
205
|
-
exports.default = _default;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_Icon=_interopRequireDefault(require("../../Icon")),_styles=require("../styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["id","label","color","checkboxChildren","isDisabled","onChangeValue"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var MultipleCheckbox=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){function checkedAll(){isvisibleOptions&&setIsVisibleOptions(!1),setChildrenData(function(state){return state.map(function(children){return _objectSpread(_objectSpread({},children),{},{hasSelected:!0})})})}function deselectAll(){setChildrenData(function(state){return state.map(function(children){return _objectSpread(_objectSpread({},children),{},{hasSelected:!1})})})}function handleChildrenChange(event,id){var checked=event.target.checked;setChildrenData(function(state){return state.map(function(children){return id===children.id&&(children.hasSelected=!!checked),children})})}var id=_ref.id,label=_ref.label,color=_ref.color,checkboxChildren=_ref.checkboxChildren,isDisabled=_ref.isDisabled,onChangeValue=_ref.onChangeValue,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)(!1),_useState2=_slicedToArray(_useState,2),hasDeselectedChildren=_useState2[0],setHasDeselectedChildren=_useState2[1],_useState3=(0,_react.useState)(!1),_useState4=_slicedToArray(_useState3,2),parentChecked=_useState4[0],setParentChecked=_useState4[1],_useState5=(0,_react.useState)(!1),_useState6=_slicedToArray(_useState5,2),isvisibleOptions=_useState6[0],setIsVisibleOptions=_useState6[1],_useState7=(0,_react.useState)([]),_useState8=_slicedToArray(_useState7,2),childrenData=_useState8[0],setChildrenData=_useState8[1];return(0,_react.useEffect)(function(){var haveDeselectedChildrens=childrenData.some(function(data){return!0===data.hasSelected}),hasAllChildrensSelected=childrenData.every(function(data){return!0===data.hasSelected}),selectedChildrens=childrenData.filter(function(children){return!1!==children.hasSelected}).map(function(children){return{label:children.label,value:children.value,id:children.id}});null===onChangeValue||void 0===onChangeValue?void 0:onChangeValue(selectedChildrens),haveDeselectedChildrens?(hasAllChildrensSelected?setHasDeselectedChildren(!1):setHasDeselectedChildren(!0),setParentChecked(!0)):setParentChecked(!1)},[childrenData,onChangeValue]),(0,_react.useEffect)(function(){var childrensState=checkboxChildren.map(function(children){return _objectSpread(_objectSpread({},children),{},{hasSelected:!1})});setChildrenData(childrensState)},[checkboxChildren]),/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.MultipleWrapper,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.Wrapper,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CheckBoxWrapper,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Checkbox,_objectSpread({ref:ref,id:id,type:"checkbox",color:color,checked:parentChecked,onChange:function(event){var checked=event.target.checked;setParentChecked(function(v){return!v}),checked?checkedAll():deselectAll()},disabled:isDisabled},rest)),function(){return parentChecked?hasDeselectedChildren?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"minus",color:"neutral.white",size:20}):/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:"check",color:"neutral.white",size:20}):null}()]})}),label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Label,{htmlFor:id,isDisabled:isDisabled,children:label})]}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ChildrensWrapper,{role:"list",children:childrenData.map(function(_ref2){var label=_ref2.label,id=_ref2.id,value=_ref2.value,hasSelected=_ref2.hasSelected;return/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.Wrapper,{role:"listitem",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.CheckBoxWrapper,{children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Checkbox,{type:"checkbox",disabled:isDisabled,id:id,color:color,checked:hasSelected,onChange:function onChange(event){return handleChildrenChange(event,id)}}),hasSelected?/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{size:20,name:"check",color:"neutral.white"}):""]})}),label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Label,{htmlFor:id,isDisabled:isDisabled,color:color,children:label})]},value)})})]})});MultipleCheckbox.displayName="MultipleCheckbox";var _default=MultipleCheckbox;exports.default=_default;
|
|
@@ -1,94 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _MultipleCheckbox = _interopRequireDefault(require("./components/MultipleCheckbox"));
|
|
10
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
11
|
-
var _styles = require("./styles");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
var _excluded = ["label", "id", "isDisabled", "isInderteminate", "defaultIsChecked", "isMultiple", "color", "checkboxChildren", "onChangeValue"];
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
24
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
25
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
var CheckboxInput = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
29
|
-
var label = _ref.label,
|
|
30
|
-
id = _ref.id,
|
|
31
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
32
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
33
|
-
_ref$isInderteminate = _ref.isInderteminate,
|
|
34
|
-
isInderteminate = _ref$isInderteminate === void 0 ? false : _ref$isInderteminate,
|
|
35
|
-
defaultIsChecked = _ref.defaultIsChecked,
|
|
36
|
-
isMultiple = _ref.isMultiple,
|
|
37
|
-
color = _ref.color,
|
|
38
|
-
checkboxChildren = _ref.checkboxChildren,
|
|
39
|
-
onChangeValue = _ref.onChangeValue,
|
|
40
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
41
|
-
var _useState = (0, _react.useState)(defaultIsChecked || false),
|
|
42
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
-
checked = _useState2[0],
|
|
44
|
-
setChecked = _useState2[1];
|
|
45
|
-
var inputRef = (0, _react.useRef)(null);
|
|
46
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
47
|
-
return inputRef.current;
|
|
48
|
-
});
|
|
49
|
-
(0, _react.useEffect)(function () {
|
|
50
|
-
setChecked(defaultIsChecked || false);
|
|
51
|
-
}, [defaultIsChecked]);
|
|
52
|
-
function handleChange(e) {
|
|
53
|
-
if (e !== null && e !== void 0 && e.currentTarget) {
|
|
54
|
-
setChecked(e.currentTarget.checked);
|
|
55
|
-
onChangeValue === null || onChangeValue === void 0 ? void 0 : onChangeValue(e.currentTarget.checked);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (isMultiple && checkboxChildren) {
|
|
59
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MultipleCheckbox.default, {
|
|
60
|
-
ref: inputRef,
|
|
61
|
-
checkboxChildren: checkboxChildren,
|
|
62
|
-
id: id,
|
|
63
|
-
color: color,
|
|
64
|
-
label: label,
|
|
65
|
-
isDisabled: isDisabled,
|
|
66
|
-
onChangeValue: onChangeValue
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Wrapper, {
|
|
70
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.CheckboxWrapper, {
|
|
71
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Checkbox, _objectSpread({
|
|
72
|
-
ref: inputRef,
|
|
73
|
-
type: "checkbox",
|
|
74
|
-
id: id,
|
|
75
|
-
color: color,
|
|
76
|
-
checked: checked,
|
|
77
|
-
onChange: handleChange,
|
|
78
|
-
disabled: isDisabled
|
|
79
|
-
}, rest)), checked && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
80
|
-
name: isInderteminate ? 'minus' : 'check',
|
|
81
|
-
size: 16,
|
|
82
|
-
color: "#fff"
|
|
83
|
-
})]
|
|
84
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Label, {
|
|
85
|
-
isDisabled: isDisabled,
|
|
86
|
-
htmlFor: id,
|
|
87
|
-
color: color,
|
|
88
|
-
children: label
|
|
89
|
-
})]
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
CheckboxInput.displayName = 'CheckboxInput';
|
|
93
|
-
var _default = CheckboxInput;
|
|
94
|
-
exports.default = _default;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=require("react"),_MultipleCheckbox=_interopRequireDefault(require("./components/MultipleCheckbox")),_Icon=_interopRequireDefault(require("../Icon")),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["label","id","isDisabled","isInderteminate","defaultIsChecked","isMultiple","color","checkboxChildren","onChangeValue"];function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var CheckboxInput=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){var label=_ref.label,id=_ref.id,_ref$isDisabled=_ref.isDisabled,isDisabled=void 0!==_ref$isDisabled&&_ref$isDisabled,_ref$isInderteminate=_ref.isInderteminate,defaultIsChecked=_ref.defaultIsChecked,isMultiple=_ref.isMultiple,color=_ref.color,checkboxChildren=_ref.checkboxChildren,onChangeValue=_ref.onChangeValue,rest=_objectWithoutProperties(_ref,_excluded),_useState=(0,_react.useState)(defaultIsChecked||!1),_useState2=_slicedToArray(_useState,2),checked=_useState2[0],setChecked=_useState2[1],inputRef=(0,_react.useRef)(null);return(0,_react.useImperativeHandle)(ref,function(){return inputRef.current}),(0,_react.useEffect)(function(){setChecked(defaultIsChecked||!1)},[defaultIsChecked]),isMultiple&&checkboxChildren?/*#__PURE__*/(0,_jsxRuntime.jsx)(_MultipleCheckbox.default,{ref:inputRef,checkboxChildren:checkboxChildren,id:id,color:color,label:label,isDisabled:isDisabled,onChangeValue:onChangeValue}):/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.Wrapper,{children:[/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.CheckboxWrapper,{children:[/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Checkbox,_objectSpread({ref:inputRef,type:"checkbox",id:id,color:color,checked:checked,onChange:function(e){null!==e&&void 0!==e&&e.currentTarget&&(setChecked(e.currentTarget.checked),null===onChangeValue||void 0===onChangeValue?void 0:onChangeValue(e.currentTarget.checked))},disabled:isDisabled},rest)),checked&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_Icon.default,{name:void 0!==_ref$isInderteminate&&_ref$isInderteminate?"minus":"check",size:16,color:"#fff"})]}),label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.Label,{isDisabled:isDisabled,htmlFor:id,color:color,children:label})]})});CheckboxInput.displayName="CheckboxInput";var _default=CheckboxInput;exports.default=_default;
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Wrapper = exports.MultipleWrapper = exports.Label = exports.ChildrensWrapper = exports.CheckboxWrapper = exports.Checkbox = exports.CheckBoxWrapper = void 0;
|
|
7
|
-
var _react = require("@emotion/react");
|
|
8
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
12
|
-
var Wrapper = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));
|
|
13
|
-
exports.Wrapper = Wrapper;
|
|
14
|
-
var CheckboxWrapper = _styled.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n position: relative;\n svg {\n position: absolute;\n pointer-events: none;\n top: 2;\n left: 2;\n }\n"])));
|
|
15
|
-
exports.CheckboxWrapper = CheckboxWrapper;
|
|
16
|
-
var Checkbox = _styled.default.input(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
17
|
-
var theme = _ref.theme,
|
|
18
|
-
disabled = _ref.disabled,
|
|
19
|
-
color = _ref.color;
|
|
20
|
-
return (0, _react.css)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 0;\n box-sizing: border-box;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 6px;\n cursor: ", ";\n border: 2px solid ", ";\n transform: all ease 0.2s;\n\n :hover,\n :focus {\n border-color: ", ";\n }\n\n :checked {\n :hover,\n :focus {\n filter: brightness(0.8);\n }\n\n border-color: transparent;\n background: ", ";\n }\n\n :disabled {\n border-color: ", ";\n background-color: ", ";\n\n &:hover {\n background-color: ", ";\n }\n }\n "])), disabled && 'not-allowed', theme.colors.neutral.neutral3, theme.colors.neutral.neutral5, color || theme.colors.primary.default, theme.colors.tertiary.default, theme.colors.tertiary.disabled, theme.colors.tertiary.disabled);
|
|
21
|
-
});
|
|
22
|
-
exports.Checkbox = Checkbox;
|
|
23
|
-
var Label = _styled.default.label(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref2) {
|
|
24
|
-
var theme = _ref2.theme,
|
|
25
|
-
isDisabled = _ref2.isDisabled;
|
|
26
|
-
return (0, _react.css)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n font-weight: 500;\n color: ", ";\n "])), isDisabled ? theme.colors.neutral.neutral2 : theme.colors.neutral.neutral6);
|
|
27
|
-
});
|
|
28
|
-
exports.Label = Label;
|
|
29
|
-
var ChildrensWrapper = _styled.default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n margin-top: 8px;\n margin-left: 24px;\n flex-direction: column;\n gap: 8px;\n"])));
|
|
30
|
-
exports.ChildrensWrapper = ChildrensWrapper;
|
|
31
|
-
var CheckBoxWrapper = _styled.default.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n svg {\n box-sizing: border-box;\n padding: 2px;\n pointer-events: none;\n position: absolute;\n top: 0;\n left: 0;\n }\n"])));
|
|
32
|
-
exports.CheckBoxWrapper = CheckBoxWrapper;
|
|
33
|
-
var MultipleWrapper = _styled.default.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"])));
|
|
34
|
-
exports.MultipleWrapper = MultipleWrapper;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Wrapper=exports.MultipleWrapper=exports.Label=exports.ChildrensWrapper=exports.CheckboxWrapper=exports.Checkbox=exports.CheckBoxWrapper=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var Wrapper=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n gap: 4px;\n"])));exports.Wrapper=Wrapper;var CheckboxWrapper=_styled.default.div(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n position: relative;\n svg {\n position: absolute;\n pointer-events: none;\n top: 2;\n left: 2;\n }\n"])));exports.CheckboxWrapper=CheckboxWrapper;var Checkbox=_styled.default.input(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n ","\n"])),function(_ref){var theme=_ref.theme,disabled=_ref.disabled,color=_ref.color;return(0,_react.css)(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n margin: 0;\n box-sizing: border-box;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 6px;\n cursor: ",";\n border: 2px solid ",";\n transform: all ease 0.2s;\n\n :hover,\n :focus {\n border-color: ",";\n }\n\n :checked {\n :hover,\n :focus {\n filter: brightness(0.8);\n }\n\n border-color: transparent;\n background: ",";\n }\n\n :disabled {\n border-color: ",";\n background-color: ",";\n\n &:hover {\n background-color: ",";\n }\n }\n "])),disabled&&"not-allowed",theme.colors.neutral.neutral3,theme.colors.neutral.neutral5,color||theme.colors.primary.default,theme.colors.tertiary.default,theme.colors.tertiary.disabled,theme.colors.tertiary.disabled)});exports.Checkbox=Checkbox;var Label=_styled.default.label(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n ","\n"])),function(_ref2){var theme=_ref2.theme,isDisabled=_ref2.isDisabled;return(0,_react.css)(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n font-weight: 500;\n color: ",";\n "])),isDisabled?theme.colors.neutral.neutral2:theme.colors.neutral.neutral6)});exports.Label=Label;var ChildrensWrapper=_styled.default.div(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n display: flex;\n margin-top: 8px;\n margin-left: 24px;\n flex-direction: column;\n gap: 8px;\n"])));exports.ChildrensWrapper=ChildrensWrapper;var CheckBoxWrapper=_styled.default.div(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n svg {\n box-sizing: border-box;\n padding: 2px;\n pointer-events: none;\n position: absolute;\n top: 0;\n left: 0;\n }\n"])));exports.CheckBoxWrapper=CheckBoxWrapper;var MultipleWrapper=_styled.default.div(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n"])));exports.MultipleWrapper=MultipleWrapper;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { ChoiceListContext, ChoiceListProps } from './types';
|
|
3
|
+
export declare const RadioGroup: import("react").Context<ChoiceListContext>;
|
|
4
|
+
declare const ChoiceList: FC<ChoiceListProps>;
|
|
5
|
+
export default ChoiceList;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ChoiceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,EAAE,EAAsD,MAAM,OAAO,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG7D,eAAO,MAAM,UAAU,4CAA4D,CAAC;AAEpF,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAgEnC,CAAC;AAIF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.RadioGroup=void 0;var _react=require("react"),_styles=require("./styles"),_jsxRuntime=require("react/jsx-runtime"),_excluded=["children","radiosName","isDisabled","alignDirection","label","helpText","onChangeValue","alert"];function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key=_toPropertyKey(key),key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return"symbol"===_typeof(key)?key:key+""}function _toPrimitive(input,hint){if("object"!==_typeof(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(prim!==void 0){var res=prim.call(input,hint||"default");if("object"!==_typeof(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}function _objectWithoutProperties(source,excluded){if(null==source)return{};var key,i,target=_objectWithoutPropertiesLoose(source,excluded);if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++)key=sourceSymbolKeys[i],0<=excluded.indexOf(key)||Object.prototype.propertyIsEnumerable.call(source,key)&&(target[key]=source[key])}return target}function _objectWithoutPropertiesLoose(source,excluded){if(null==source)return{};var key,i,target={},sourceKeys=Object.keys(source);for(i=0;i<sourceKeys.length;i++)key=sourceKeys[i],0<=excluded.indexOf(key)||(target[key]=source[key]);return target}var RadioGroup=/*#__PURE__*/(0,_react.createContext)({});exports.RadioGroup=RadioGroup;var ChoiceList=/*#__PURE__*/(0,_react.forwardRef)(function(_ref,ref){var children=_ref.children,radiosName=_ref.radiosName,isDisabled=_ref.isDisabled,_ref$alignDirection=_ref.alignDirection,alignDirection=void 0===_ref$alignDirection?"column":_ref$alignDirection,label=_ref.label,helpText=_ref.helpText,onChangeValue=_ref.onChangeValue,alert=_ref.alert,rest=_objectWithoutProperties(_ref,_excluded),handleRadioClick=function(value){if(radioRef.current){var _nativeInputValueSett,nativeInputValueSetter=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value");null===nativeInputValueSetter||void 0===nativeInputValueSetter||null===(_nativeInputValueSett=nativeInputValueSetter.set)||void 0===_nativeInputValueSett?void 0:_nativeInputValueSett.call(radioRef.current,value||"");var event=new Event("input",{bubbles:!0});radioRef.current.dispatchEvent(event)}null===onChangeValue||void 0===onChangeValue?void 0:onChangeValue(value)},radioRef=(0,_react.useRef)(null);return(0,_react.useImperativeHandle)(ref,function(){return radioRef.current}),(0,_react.useEffect)(function(){var _document,_document$querySelect,radios=null===(_document=document)||void 0===_document||null===(_document$querySelect=_document.querySelectorAll)||void 0===_document$querySelect?void 0:_document$querySelect.call(_document,"input[name=\"".concat(radiosName,"\"]"));radios.forEach(function(radio){radio.checked=radio.value===rest.defaultValue}),handleRadioClick(rest.defaultValue)},[rest.defaultValue]),/*#__PURE__*/(0,_jsxRuntime.jsx)(RadioGroup.Provider,{value:{handleRadioClick:handleRadioClick,groupName:radiosName,isDisabled:isDisabled},children:/*#__PURE__*/(0,_jsxRuntime.jsxs)(_styles.ChoiceWrapper,{role:"radiogroup",children:[/*#__PURE__*/(0,_jsxRuntime.jsx)("input",_objectSpread({style:{display:"none"},ref:radioRef},rest)),label&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ChoiceLabel,{children:label}),/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.ListWrapper,{alignDirection:alignDirection,children:children}),helpText&&/*#__PURE__*/(0,_jsxRuntime.jsx)(_styles.HelpText,{alert:alert,children:helpText})]})})});ChoiceList.displayName="ChoiceList";var _default=ChoiceList;exports.default=_default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IStyledRadioInput } from './types';
|
|
3
|
+
import { InputAlertTypes } from '../Input/types';
|
|
4
|
+
export declare const ChoiceWrapper: import("@emotion/styled").StyledComponent<{
|
|
5
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
6
|
+
as?: import("react").ElementType<any> | undefined;
|
|
7
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
8
|
+
export declare const ListWrapper: import("@emotion/styled").StyledComponent<{
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
as?: import("react").ElementType<any> | undefined;
|
|
11
|
+
} & IStyledRadioInput, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
12
|
+
export declare const ChoiceLabel: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
+
as?: import("react").ElementType<any> | undefined;
|
|
15
|
+
} & IStyledRadioInput, import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, {}>;
|
|
16
|
+
export declare const HelpText: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any> | undefined;
|
|
19
|
+
} & {
|
|
20
|
+
alert: InputAlertTypes | undefined;
|
|
21
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
22
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/components/ChoiceList/styles.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,eAAO,MAAM,aAAa;;;yGAAe,CAAC;AAE1C,eAAO,MAAM,WAAW;;;6HAOvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;sIASvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;WAAwB,eAAe,GAAG,SAAS;2GAQvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ListWrapper=exports.HelpText=exports.ChoiceWrapper=exports.ChoiceLabel=void 0;var _templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_react=require("@emotion/react"),_styled=_interopRequireDefault(require("@emotion/styled"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _taggedTemplateLiteral(strings,raw){return raw||(raw=strings.slice(0)),Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}))}var ChoiceWrapper=_styled.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral([""])));exports.ChoiceWrapper=ChoiceWrapper;var ListWrapper=_styled.default.div(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n ","\n"])),function(_ref){var _ref$alignDirection=_ref.alignDirection,alignDirection=void 0===_ref$alignDirection?"row":_ref$alignDirection;return(0,_react.css)(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n display: flex;\n flex-direction: ",";\n flex-wrap: wrap;\n gap: 12px;\n "])),alignDirection)});exports.ListWrapper=ListWrapper;var ChoiceLabel=_styled.default.label(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n"])),function(_ref2){var colors=_ref2.theme.colors;return(0,_react.css)(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n display: block;\n font-weight: 500;\n font-size: 16px;\n line-height: 24px;\n color: ",";\n margin-bottom: 16px;\n "])),colors.neutral.black)});exports.ChoiceLabel=ChoiceLabel;var HelpText=_styled.default.span(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n font-size: ",";\n\n color: ",";\n padding: 0 20px;\n"])),function(props){return props.theme.fontSizes.xxs},function(props){return props.alert&&"success"!==props.alert?props.theme.colors[props.alert].default:props.theme.colors.neutral.neutral4});exports.HelpText=HelpText;
|