@redsift/design-system 11.6.0-muiv5-alpha.5 → 11.6.0-muiv5-alpha.6
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/_internal/Alert.d2.ts +54 -0
- package/_internal/Alert2.js +182 -39
- package/_internal/AppBar.d.ts +37 -0
- package/_internal/AppBar.js +240 -29
- package/_internal/AppContainer.d.ts +96 -0
- package/_internal/AppContainer.js +132 -86
- package/_internal/AppContent.d.ts +25 -0
- package/_internal/AppContent.js +84 -17
- package/_internal/Badge.d2.ts +9 -0
- package/_internal/Badge2.js +137 -4
- package/_internal/BreadcrumbItem.d.ts +9 -0
- package/_internal/BreadcrumbItem.js +85 -3
- package/_internal/Breadcrumbs.d2.ts +29 -0
- package/_internal/Breadcrumbs2.js +86 -21
- package/_internal/Button.d2.ts +30 -0
- package/_internal/Button2.js +81 -20
- package/_internal/ButtonGroup.d.ts +41 -0
- package/_internal/ButtonGroup.js +165 -25
- package/_internal/ButtonLink.d.ts +28 -0
- package/_internal/ButtonLink.js +74 -18
- package/_internal/Card.d2.ts +35 -0
- package/_internal/Card2.js +151 -29
- package/_internal/CardActions.d.ts +9 -0
- package/_internal/CardActions.js +38 -3
- package/_internal/CardBody.d.ts +9 -0
- package/_internal/CardBody.js +36 -3
- package/_internal/CardHeader.d.ts +9 -0
- package/_internal/CardHeader.js +77 -3
- package/_internal/Checkbox.d2.ts +68 -0
- package/_internal/Checkbox2.js +234 -58
- package/_internal/CheckboxGroup.d.ts +10 -0
- package/_internal/CheckboxGroup.js +182 -4
- package/_internal/ConditionalWrapper.d.ts +14 -0
- package/_internal/ConditionalWrapper.js +11 -12
- package/_internal/DetailedCard.d.ts +52 -0
- package/_internal/DetailedCard.js +6912 -48
- package/_internal/DetailedCardCollapsibleSectionItems.d.ts +9 -0
- package/_internal/DetailedCardCollapsibleSectionItems.js +58 -3
- package/_internal/DetailedCardHeader.d.ts +9 -0
- package/_internal/DetailedCardHeader.js +61 -3
- package/_internal/DetailedCardSection.d.ts +9 -0
- package/_internal/DetailedCardSection.js +166 -3
- package/_internal/DetailedCardSectionItem.d.ts +9 -0
- package/_internal/DetailedCardSectionItem.js +88 -3
- package/_internal/Flexbox.d2.ts +30 -0
- package/_internal/Flexbox2.js +85 -22
- package/_internal/Grid.d2.ts +32 -0
- package/_internal/Grid2.js +87 -24
- package/_internal/GridItem.d.ts +9 -0
- package/_internal/GridItem.js +34 -3
- package/_internal/Heading.d2.ts +9 -0
- package/_internal/Heading2.js +107 -3
- package/_internal/Icon.d2.ts +10 -0
- package/_internal/Icon2.js +206 -5
- package/_internal/IconButton.d.ts +12 -0
- package/_internal/IconButton.js +71 -3
- package/_internal/IconButtonLink.d.ts +28 -0
- package/_internal/IconButtonLink.js +65 -18
- package/_internal/Item.d2.ts +82 -0
- package/_internal/Item2.js +390 -73
- package/_internal/Link.d2.ts +26 -0
- package/_internal/Link2.js +56 -15
- package/_internal/LinkButton.d.ts +23 -0
- package/_internal/LinkButton.js +56 -13
- package/_internal/Number.d2.ts +69 -0
- package/_internal/Number2.js +103 -61
- package/_internal/NumberField.d.ts +80 -0
- package/_internal/NumberField.js +3959 -65
- package/_internal/Pill.d2.ts +9 -0
- package/_internal/Pill2.js +400 -4
- package/_internal/ProgressBar.d.ts +26 -0
- package/_internal/ProgressBar.js +61 -18
- package/_internal/Radio.d2.ts +66 -0
- package/_internal/Radio2.js +227 -56
- package/_internal/RadioGroup.d.ts +10 -0
- package/_internal/RadioGroup.js +170 -4
- package/_internal/Shield.d2.ts +9 -0
- package/_internal/Shield2.js +220 -4
- package/_internal/SideNavigationMenu.d.ts +9 -0
- package/_internal/SideNavigationMenu.js +586 -4
- package/_internal/{SideNavigationMenuBar.js → SideNavigationMenuBar.d.ts} +1 -1
- package/_internal/SideNavigationMenuItem.d.ts +9 -0
- package/_internal/SideNavigationMenuItem.js +299 -4
- package/_internal/Skeleton.d2.ts +15 -0
- package/_internal/Skeleton2.js +36 -9
- package/_internal/SkeletonCircle.d.ts +9 -0
- package/_internal/SkeletonCircle.js +52 -3
- package/_internal/SkeletonText.d.ts +9 -0
- package/_internal/SkeletonText.js +71 -3
- package/_internal/Spinner.d2.ts +43 -0
- package/_internal/Spinner2.js +319 -29
- package/_internal/Switch.d2.ts +66 -0
- package/_internal/Switch2.js +310 -56
- package/_internal/SwitchGroup.d.ts +10 -0
- package/_internal/SwitchGroup.js +182 -4
- package/_internal/Text.d2.ts +9 -0
- package/_internal/Text2.js +45 -3
- package/_internal/TextArea.d.ts +34 -0
- package/_internal/TextArea.js +430 -20
- package/_internal/TextField.d.ts +29 -0
- package/_internal/TextField.js +463 -19
- package/_internal/alert.d.ts +5 -0
- package/_internal/alert.js +2 -5
- package/_internal/app-bar.d.ts +8 -0
- package/_internal/app-bar.js +2 -8
- package/_internal/app-container.d.ts +9 -0
- package/_internal/app-container.js +3 -9
- package/_internal/app-content.d.ts +5 -0
- package/_internal/app-content.js +2 -5
- package/_internal/app-side-panel.d.ts +11 -0
- package/_internal/app-side-panel.js +3 -11
- package/_internal/badge.d.ts +6 -0
- package/_internal/badge.js +2 -6
- package/_internal/breadcrumb-item.d.ts +5 -0
- package/_internal/breadcrumb-item.js +1 -4
- package/_internal/breadcrumbs.d.ts +6 -0
- package/_internal/breadcrumbs.js +2 -6
- package/_internal/button-group.d.ts +5 -0
- package/_internal/button-group.js +2 -5
- package/_internal/button-link.d.ts +8 -0
- package/_internal/button-link.js +2 -8
- package/_internal/button.d.ts +8 -0
- package/_internal/button.js +3 -8
- package/_internal/card-actions.d.ts +5 -0
- package/_internal/card-actions.js +1 -4
- package/_internal/card-body.d.ts +5 -0
- package/_internal/card-body.js +1 -4
- package/_internal/card-header.d.ts +9 -0
- package/_internal/card-header.js +1 -8
- package/_internal/card.d.ts +11 -0
- package/_internal/card.js +2 -11
- package/_internal/checkbox-group.d.ts +6 -0
- package/_internal/checkbox-group.js +2 -6
- package/_internal/checkbox.d.ts +6 -0
- package/_internal/checkbox.js +2 -6
- package/_internal/colors.d.ts +102 -0
- package/_internal/colors.js +87 -91
- package/_internal/conditional-wrapper.d.ts +2 -0
- package/_internal/conditional-wrapper.js +2 -2
- package/_internal/detailed-card-collapsible-section-items.d.ts +4 -0
- package/_internal/detailed-card-collapsible-section-items.js +1 -3
- package/_internal/detailed-card-header.d.ts +8 -0
- package/_internal/detailed-card-header.js +1 -7
- package/_internal/detailed-card-section-item.d.ts +11 -0
- package/_internal/detailed-card-section-item.js +1 -10
- package/_internal/detailed-card-section.d.ts +7 -0
- package/_internal/detailed-card-section.js +1 -6
- package/_internal/detailed-card.d.ts +16 -0
- package/_internal/detailed-card.js +2 -16
- package/_internal/flexbox.d.ts +5 -0
- package/_internal/flexbox.js +2 -5
- package/_internal/focus-within-group.d.ts +3 -0
- package/_internal/focus-within-group.js +3 -3
- package/_internal/fonts.d.ts +12 -0
- package/_internal/fonts.js +4 -6
- package/_internal/gradient-border.d.ts +19 -0
- package/_internal/gradient-border.js +35 -16
- package/_internal/grid-item.d.ts +5 -0
- package/_internal/grid-item.js +1 -4
- package/_internal/grid.d.ts +6 -0
- package/_internal/grid.js +2 -6
- package/_internal/heading.d.ts +7 -0
- package/_internal/heading.js +2 -6
- package/_internal/icon-button-link.d.ts +8 -0
- package/_internal/icon-button-link.js +2 -8
- package/_internal/icon-button.d.ts +7 -0
- package/_internal/icon-button.js +2 -6
- package/_internal/icon.d.ts +6 -0
- package/_internal/icon.js +2 -6
- package/_internal/item.d.ts +8 -0
- package/_internal/item.js +2 -8
- package/_internal/link-button.d.ts +8 -0
- package/_internal/link-button.js +2 -8
- package/_internal/link.d.ts +8 -0
- package/_internal/link.js +3 -8
- package/_internal/listbox.d.ts +6 -0
- package/_internal/listbox.js +3 -6
- package/_internal/number-field.d.ts +9 -0
- package/_internal/number-field.js +2 -9
- package/_internal/number.d.ts +7 -0
- package/_internal/number.js +2 -7
- package/_internal/pill.d.ts +6 -0
- package/_internal/pill.js +2 -6
- package/_internal/progress-bar.d.ts +5 -0
- package/_internal/progress-bar.js +2 -5
- package/_internal/radio-group.d.ts +6 -0
- package/_internal/radio-group.js +2 -6
- package/_internal/radio.d.ts +6 -0
- package/_internal/radio.js +2 -6
- package/_internal/shared.d.ts +5 -0
- package/_internal/shared.js +2 -5
- package/_internal/shield.d.ts +6 -0
- package/_internal/shield.js +2 -6
- package/_internal/side-navigation-menu-bar.d.ts +9 -0
- package/_internal/side-navigation-menu-bar.js +3 -9
- package/_internal/side-navigation-menu-item.d.ts +8 -0
- package/_internal/side-navigation-menu-item.js +2 -8
- package/_internal/side-navigation-menu.d.ts +8 -0
- package/_internal/side-navigation-menu.js +2 -8
- package/_internal/skeleton-circle.d.ts +7 -0
- package/_internal/skeleton-circle.js +1 -6
- package/_internal/skeleton-text.d.ts +7 -0
- package/_internal/skeleton-text.js +2 -6
- package/_internal/skeleton.d.ts +8 -0
- package/_internal/skeleton.js +1 -7
- package/_internal/spinner.d.ts +5 -0
- package/_internal/spinner.js +2 -5
- package/_internal/styles.d.ts +17 -0
- package/_internal/styles.d2.ts +283 -0
- package/_internal/styles.js +235 -17
- package/_internal/styles2.js +44 -280
- package/_internal/switch-group.d.ts +6 -0
- package/_internal/switch-group.js +2 -6
- package/_internal/switch.d.ts +6 -0
- package/_internal/switch.js +2 -6
- package/_internal/text-area.d.ts +9 -0
- package/_internal/text-area.js +2 -9
- package/_internal/text-field.d.ts +10 -0
- package/_internal/text-field.js +2 -10
- package/_internal/text.d.ts +7 -0
- package/_internal/text.js +2 -6
- package/_internal/theme.d.ts +4 -0
- package/_internal/theme.js +1 -3
- package/_internal/types.d.ts +39 -0
- package/_internal/{types10.js → types.d10.ts} +1 -1
- package/_internal/{types11.js → types.d11.ts} +1 -1
- package/_internal/{types12.js → types.d12.ts} +4 -4
- package/_internal/{types14.js → types.d14.ts} +1 -1
- package/_internal/{types15.js → types.d15.ts} +1 -1
- package/_internal/{types16.js → types.d16.ts} +2 -2
- package/_internal/{types17.js → types.d17.ts} +1 -1
- package/_internal/{types18.js → types.d18.ts} +2 -2
- package/_internal/{types19.js → types.d19.ts} +2 -2
- package/_internal/types.d2.ts +37 -0
- package/_internal/{types20.js → types.d20.ts} +1 -1
- package/_internal/{types21.js → types.d21.ts} +1 -1
- package/_internal/{types22.js → types.d22.ts} +1 -1
- package/_internal/{types23.js → types.d23.ts} +2 -2
- package/_internal/{types24.js → types.d24.ts} +1 -1
- package/_internal/{types25.js → types.d25.ts} +1 -1
- package/_internal/{types26.js → types.d26.ts} +1 -1
- package/_internal/{types27.js → types.d27.ts} +1 -1
- package/_internal/{types28.js → types.d28.ts} +1 -1
- package/_internal/{types29.js → types.d29.ts} +4 -4
- package/_internal/types.d3.ts +23 -0
- package/_internal/{types4.js → types.d4.ts} +2 -2
- package/_internal/{types5.js → types.d5.ts} +1 -1
- package/_internal/{types6.js → types.d6.ts} +1 -1
- package/_internal/{types7.js → types.d7.ts} +3 -3
- package/_internal/{types8.js → types.d8.ts} +1 -1
- package/_internal/types.js +7 -31
- package/_internal/types2.js +18 -29
- package/_internal/types3.js +15 -18
- package/_internal/useAppSidePanel.d.ts +12 -0
- package/_internal/useAppSidePanel.js +331 -6
- package/_internal/useFocusOnList.d.ts +83 -0
- package/_internal/useFocusOnList.js +502 -44
- package/_internal/useListboxItem.d.ts +32 -0
- package/_internal/useListboxItem.js +120 -23
- package/_internal/useSideNavigationMenuBar.d.ts +9 -0
- package/_internal/useSideNavigationMenuBar.js +371 -7
- package/_internal/useTheme.d.ts +13 -0
- package/_internal/useTheme.js +10 -8
- package/index.d.ts +1738 -0
- package/index.js +523 -1674
- package/package.json +2 -2
- /package/_internal/{helpers.js → helpers.d.ts} +0 -0
- /package/_internal/{types13.js → types.d13.ts} +0 -0
- /package/_internal/{types9.js → types.d9.ts} +0 -0
package/_internal/Checkbox2.js
CHANGED
|
@@ -1,68 +1,244 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { C as
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef, useContext, useState, useEffect, useCallback } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { mdiCheckboxMarked, mdiMinusBox, mdiCheckboxBlankOutline } from '@redsift/icons';
|
|
5
|
+
import { C as CheckboxGroupContext } from './context3.js';
|
|
6
|
+
import { w as warnIfNoAccessibleLabelFound } from './warnIfNoAccessibleLabelFound.js';
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { i as baseStyling } from './styles4.js';
|
|
9
|
+
import { u as useFocusRing } from './useFocusRing.js';
|
|
10
|
+
import { u as useTheme } from './useTheme.js';
|
|
11
|
+
import { a as Icon } from './Icon2.js';
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
|
-
* Component
|
|
14
|
+
* Component style.
|
|
9
15
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
16
|
+
const StyledCheckbox = styled.label`
|
|
17
|
+
height: fit-content;
|
|
18
|
+
position: relative;
|
|
19
|
+
width: fit-content;
|
|
20
|
+
${baseStyling}
|
|
21
|
+
|
|
22
|
+
align-items: flex-start;
|
|
23
|
+
background: none;
|
|
24
|
+
border: none;
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
|
|
27
|
+
input {
|
|
28
|
+
height: 100%;
|
|
29
|
+
margin: 0;
|
|
30
|
+
opacity: 0;
|
|
31
|
+
overflow: visible;
|
|
32
|
+
padding: 0;
|
|
33
|
+
position: absolute;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
span.label {
|
|
38
|
+
${_ref => {
|
|
39
|
+
let {
|
|
40
|
+
$isDisabled,
|
|
41
|
+
$isInvalid,
|
|
42
|
+
$theme
|
|
43
|
+
} = _ref;
|
|
44
|
+
return $isDisabled ? css`
|
|
45
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-disabled);
|
|
46
|
+
` : $isInvalid ? css`
|
|
47
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-invalid);
|
|
48
|
+
` : css`
|
|
49
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-default);
|
|
50
|
+
`;
|
|
51
|
+
}}
|
|
52
|
+
|
|
53
|
+
font-family: var(--redsift-typography-body-font-family);
|
|
54
|
+
font-size: var(--redsift-typography-body-font-size);
|
|
55
|
+
font-weight: var(--redsift-typography-body-font-weight);
|
|
56
|
+
line-height: var(--redsift-typography-body-line-height);
|
|
57
|
+
padding-left: 4px;
|
|
58
|
+
padding-right: 16px;
|
|
59
|
+
padding-top: 2px;
|
|
60
|
+
|
|
61
|
+
[dir='rtl'] & {
|
|
62
|
+
padding-left: 16px;
|
|
63
|
+
padding-right: 4px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.redsift-icon {
|
|
68
|
+
box-sizing: content-box;
|
|
69
|
+
padding: 2px;
|
|
70
|
+
width: 24px;
|
|
71
|
+
|
|
72
|
+
${_ref2 => {
|
|
73
|
+
let {
|
|
74
|
+
$isColored,
|
|
75
|
+
$isDisabled,
|
|
76
|
+
$isInvalid,
|
|
77
|
+
$isFocusVisible,
|
|
78
|
+
$theme
|
|
79
|
+
} = _ref2;
|
|
80
|
+
return css`
|
|
81
|
+
${$isDisabled ? css`
|
|
82
|
+
color: var(--redsift-color-${$theme}-components-checkbox-fill-disabled);
|
|
83
|
+
` : $isInvalid ? css`
|
|
84
|
+
color: var(--redsift-color-${$theme}-components-checkbox-fill-invalid);
|
|
85
|
+
` : css`
|
|
86
|
+
color: ${$isColored ? `var(--redsift-color-${$theme}-components-checkbox-fill-default)` : `var(--redsift-color-${$theme}-components-checkbox-fill-uncolored)`};
|
|
87
|
+
`}
|
|
88
|
+
|
|
89
|
+
${$isFocusVisible && !$isDisabled ? css`
|
|
90
|
+
background-color: ${$isColored ? `var(--redsift-color-${$theme}-components-checkbox-fill-default-hover)` : `var(--redsift-color-${$theme}-components-checkbox-fill-uncolored-hover)`};
|
|
91
|
+
` : ''}
|
|
92
|
+
`;
|
|
93
|
+
}}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover,
|
|
97
|
+
&:focus-visible {
|
|
98
|
+
outline: none;
|
|
99
|
+
|
|
100
|
+
${_ref3 => {
|
|
101
|
+
let {
|
|
102
|
+
$isColored,
|
|
103
|
+
$isDisabled,
|
|
104
|
+
$isInvalid,
|
|
105
|
+
$theme
|
|
106
|
+
} = _ref3;
|
|
107
|
+
return !$isDisabled ? css`
|
|
108
|
+
.redsift-icon {
|
|
109
|
+
${$isInvalid ? css`
|
|
110
|
+
background-color: var(--redsift-color-${$theme}-components-checkbox-fill-invalid-hover);
|
|
111
|
+
` : css`
|
|
112
|
+
background-color: ${$isColored ? `var(--redsift-color-${$theme}-components-checkbox-fill-default-hover)` : `var(--redsift-color-${$theme}-components-checkbox-fill-uncolored-hover)`};
|
|
113
|
+
`}
|
|
114
|
+
border-radius: 4px;
|
|
115
|
+
}
|
|
116
|
+
` : '';
|
|
117
|
+
}}
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
|
|
121
|
+
const _excluded = ["aria-label", "aria-labelledby", "autoFocus", "children", "className", "defaultSelected", "inputProps", "inputRef", "isColored", "isDisabled", "isIndeterminate", "isInvalid", "isReadOnly", "isRequired", "isSelected", "name", "onChange", "theme", "value"];
|
|
122
|
+
const COMPONENT_NAME = 'Checkbox';
|
|
123
|
+
const CLASSNAME = 'redsift-checkbox';
|
|
60
124
|
|
|
61
125
|
/**
|
|
62
126
|
* The Checkbox component.
|
|
63
127
|
* Works both inside a CheckboxGroup or as standalone.
|
|
64
128
|
* Can be used as controlled or uncontrolled.
|
|
65
129
|
*/
|
|
66
|
-
|
|
130
|
+
const Checkbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
131
|
+
var _isDisabled, _isReadOnly, _ref;
|
|
132
|
+
const groupState = useContext(CheckboxGroupContext);
|
|
133
|
+
let {
|
|
134
|
+
'aria-label': ariaLabel,
|
|
135
|
+
'aria-labelledby': ariaLabelledby,
|
|
136
|
+
autoFocus,
|
|
137
|
+
children,
|
|
138
|
+
className,
|
|
139
|
+
defaultSelected,
|
|
140
|
+
inputProps,
|
|
141
|
+
inputRef,
|
|
142
|
+
isColored = true,
|
|
143
|
+
isDisabled,
|
|
144
|
+
isIndeterminate,
|
|
145
|
+
isInvalid,
|
|
146
|
+
isReadOnly,
|
|
147
|
+
isRequired,
|
|
148
|
+
isSelected: propsIsSelected,
|
|
149
|
+
name,
|
|
150
|
+
onChange,
|
|
151
|
+
theme: propsTheme,
|
|
152
|
+
value
|
|
153
|
+
} = props,
|
|
154
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
155
|
+
const theme = useTheme(propsTheme);
|
|
156
|
+
const {
|
|
157
|
+
isFocusVisible,
|
|
158
|
+
focusProps
|
|
159
|
+
} = useFocusRing({
|
|
160
|
+
autoFocus
|
|
161
|
+
});
|
|
162
|
+
isDisabled = (_isDisabled = isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : groupState === null || groupState === void 0 ? void 0 : groupState.isDisabled;
|
|
163
|
+
isReadOnly = (_isReadOnly = isReadOnly) !== null && _isReadOnly !== void 0 ? _isReadOnly : groupState === null || groupState === void 0 ? void 0 : groupState.isReadOnly;
|
|
164
|
+
const [isSelected, setSelected] = useState(Boolean((_ref = propsIsSelected !== null && propsIsSelected !== void 0 ? propsIsSelected : defaultSelected) !== null && _ref !== void 0 ? _ref : groupState === null || groupState === void 0 ? void 0 : groupState.value.includes(value)));
|
|
165
|
+
const isControlled = propsIsSelected !== null && propsIsSelected !== undefined;
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
setSelected(Boolean(propsIsSelected !== null && propsIsSelected !== void 0 ? propsIsSelected : defaultSelected));
|
|
168
|
+
}, [propsIsSelected, defaultSelected]);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
if (groupState) {
|
|
171
|
+
setSelected(groupState.value.includes(value));
|
|
172
|
+
}
|
|
173
|
+
}, [groupState === null || groupState === void 0 ? void 0 : groupState.value]);
|
|
174
|
+
warnIfNoAccessibleLabelFound(props, [children], 'Checkbox');
|
|
175
|
+
if (groupState) {
|
|
176
|
+
if (propsIsSelected != null) {
|
|
177
|
+
console.warn('isSelected is unsupported on individual <Checkbox> elements within a <CheckboxGroup> unless the <Checkbox> is controlled. Please apply this prop to the group instead or pass isControlled to the component.');
|
|
178
|
+
}
|
|
179
|
+
if (defaultSelected != null) {
|
|
180
|
+
console.warn('defaultSelected is unsupported on individual <Checkbox> elements within a <CheckboxGroup> unless the <Checkbox> is controlled. Please apply this prop to the group instead or pass isControlled to the component.');
|
|
181
|
+
}
|
|
182
|
+
if (props.value == null) {
|
|
183
|
+
console.warn('A <Checkbox> element within a <CheckboxGroup> requires a `value` property unless the <Checkbox> is controlled.');
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const handleChange = useCallback(event => {
|
|
187
|
+
if (isDisabled || isReadOnly) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (groupState) {
|
|
191
|
+
if (!groupState.value.includes(value)) {
|
|
192
|
+
groupState.addValue(value);
|
|
193
|
+
} else {
|
|
194
|
+
groupState.removeValue(value);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (isControlled) {
|
|
198
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!propsIsSelected, value, name, event, groupState);
|
|
199
|
+
} else {
|
|
200
|
+
setSelected(!isSelected);
|
|
201
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isSelected, value, name, event, groupState);
|
|
202
|
+
}
|
|
203
|
+
}, [onChange, groupState, isSelected, propsIsSelected]);
|
|
204
|
+
return /*#__PURE__*/React__default.createElement(StyledCheckbox, _extends({}, forwardedProps, {
|
|
205
|
+
$isColored: isColored,
|
|
206
|
+
$isDisabled: isDisabled,
|
|
207
|
+
$isFocusVisible: isFocusVisible,
|
|
208
|
+
$isInvalid: isInvalid || isRequired && !(isSelected || isControlled && propsIsSelected),
|
|
209
|
+
$isRequired: isRequired,
|
|
210
|
+
$isSelected: isSelected || isControlled && propsIsSelected,
|
|
211
|
+
$theme: theme,
|
|
212
|
+
className: classNames(Checkbox.className, className),
|
|
213
|
+
ref: ref
|
|
214
|
+
}), isSelected || isControlled && propsIsSelected ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
215
|
+
icon: mdiCheckboxMarked
|
|
216
|
+
}) : isIndeterminate ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
217
|
+
icon: mdiMinusBox
|
|
218
|
+
}) : /*#__PURE__*/React__default.createElement(Icon, {
|
|
219
|
+
icon: mdiCheckboxBlankOutline
|
|
220
|
+
}), children ? /*#__PURE__*/React__default.createElement("span", {
|
|
221
|
+
className: "label"
|
|
222
|
+
}, children) : null, /*#__PURE__*/React__default.createElement("input", _extends({}, inputProps, focusProps, {
|
|
223
|
+
"aria-checked": isSelected || isControlled && propsIsSelected ? 'true' : isIndeterminate ? 'mixed' : 'false',
|
|
224
|
+
"aria-disabled": isDisabled,
|
|
225
|
+
"aria-invalid": isInvalid || isRequired && !(isSelected || isControlled && propsIsSelected),
|
|
226
|
+
"aria-label": ariaLabel,
|
|
227
|
+
"aria-labelledby": ariaLabelledby,
|
|
228
|
+
"aria-readonly": isReadOnly,
|
|
229
|
+
"aria-required": isRequired,
|
|
230
|
+
autoFocus: autoFocus,
|
|
231
|
+
checked: isSelected || isControlled && propsIsSelected ? true : false,
|
|
232
|
+
disabled: isDisabled,
|
|
233
|
+
name: name,
|
|
234
|
+
onChange: handleChange,
|
|
235
|
+
ref: inputRef,
|
|
236
|
+
type: "checkbox",
|
|
237
|
+
value: value
|
|
238
|
+
})));
|
|
239
|
+
});
|
|
240
|
+
Checkbox.className = CLASSNAME;
|
|
241
|
+
Checkbox.displayName = COMPONENT_NAME;
|
|
67
242
|
|
|
68
|
-
export {
|
|
243
|
+
export { Checkbox as C };
|
|
244
|
+
//# sourceMappingURL=Checkbox2.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { b as CheckboxGroupProps } from './types.d8.ts';
|
|
2
|
+
import { C as Comp } from './helpers.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The CheckboxGroup component.
|
|
6
|
+
* Can be used as controlled or uncontrolled.
|
|
7
|
+
*/
|
|
8
|
+
declare const CheckboxGroup: Comp<CheckboxGroupProps, HTMLDivElement>;
|
|
9
|
+
|
|
10
|
+
export { CheckboxGroup as C };
|
|
@@ -1,10 +1,188 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import {
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef, useState, useEffect } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { C as CheckboxGroupContext } from './context3.js';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { i as baseStyling } from './styles4.js';
|
|
7
|
+
import { C as ColorPalette } from './colors.js';
|
|
8
|
+
import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Context props.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Component orientation.
|
|
16
|
+
*/
|
|
17
|
+
const CheckboxGroupOrientation = {
|
|
18
|
+
vertical: 'vertical',
|
|
19
|
+
horizontal: 'horizontal'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Component props.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Component style.
|
|
28
|
+
*/
|
|
29
|
+
const StyledCheckboxGroup = styled.div`
|
|
30
|
+
${baseStyling}
|
|
31
|
+
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
|
|
35
|
+
${_ref => {
|
|
36
|
+
let {
|
|
37
|
+
$orientation
|
|
38
|
+
} = _ref;
|
|
39
|
+
return $orientation === CheckboxGroupOrientation.vertical ? `
|
|
40
|
+
div.redsift-checkbox-group-boxes {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
}
|
|
44
|
+
` : `
|
|
45
|
+
div.redsift-checkbox-group-boxes {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
}}
|
|
52
|
+
|
|
53
|
+
span.redsift-checkbox-group-label {
|
|
54
|
+
font-family: var(--redsift-typography-body-font-family);
|
|
55
|
+
font-weight: var(--redsift-typography-body-font-weight);
|
|
56
|
+
font-size: var(--redsift-typography-body-font-size);
|
|
57
|
+
line-height: var(--redsift-typography-body-line-height);
|
|
58
|
+
|
|
59
|
+
${_ref2 => {
|
|
60
|
+
let {
|
|
61
|
+
$isDisabled,
|
|
62
|
+
$isInvalid,
|
|
63
|
+
$theme
|
|
64
|
+
} = _ref2;
|
|
65
|
+
return $isDisabled ? css`
|
|
66
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-disabled);
|
|
67
|
+
` : $isInvalid ? css`
|
|
68
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-invalid);
|
|
69
|
+
` : css`
|
|
70
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-default);
|
|
71
|
+
`;
|
|
72
|
+
}}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
span.redsift-checkbox-group-description {
|
|
76
|
+
font-family: var(--redsift-typography-helper-font-family);
|
|
77
|
+
font-weight: var(--redsift-typography-helper-font-weight);
|
|
78
|
+
font-size: var(--redsift-typography-helper-font-size);
|
|
79
|
+
line-height: var(--redsift-typography-helper-line-height);
|
|
80
|
+
|
|
81
|
+
${_ref3 => {
|
|
82
|
+
let {
|
|
83
|
+
$isDisabled,
|
|
84
|
+
$isInvalid,
|
|
85
|
+
$theme
|
|
86
|
+
} = _ref3;
|
|
87
|
+
return $isDisabled ? css`
|
|
88
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-disabled);
|
|
89
|
+
` : $isInvalid ? css`
|
|
90
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-invalid);
|
|
91
|
+
` : css`
|
|
92
|
+
color: var(--redsift-color-${$theme}-components-checkbox-text-default);
|
|
93
|
+
`;
|
|
94
|
+
}}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const _excluded = ["children", "className", "color", "defaultValues", "description", "isDisabled", "isInvalid", "isReadOnly", "isRequired", "label", "onChange", "orientation", "theme", "value"];
|
|
99
|
+
const COMPONENT_NAME = 'CheckboxGroup';
|
|
100
|
+
const CLASSNAME = 'redsift-checkbox-group';
|
|
3
101
|
|
|
4
102
|
/**
|
|
5
103
|
* The CheckboxGroup component.
|
|
6
104
|
* Can be used as controlled or uncontrolled.
|
|
7
105
|
*/
|
|
8
|
-
|
|
106
|
+
const CheckboxGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
107
|
+
const {
|
|
108
|
+
children,
|
|
109
|
+
className,
|
|
110
|
+
color = ColorPalette.primary,
|
|
111
|
+
defaultValues,
|
|
112
|
+
description,
|
|
113
|
+
isDisabled,
|
|
114
|
+
isInvalid,
|
|
115
|
+
isReadOnly,
|
|
116
|
+
isRequired,
|
|
117
|
+
label,
|
|
118
|
+
onChange,
|
|
119
|
+
orientation = CheckboxGroupOrientation.vertical,
|
|
120
|
+
theme: propsTheme,
|
|
121
|
+
value
|
|
122
|
+
} = props,
|
|
123
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
124
|
+
const theme = useTheme(propsTheme);
|
|
125
|
+
const [selectedValues, setValue] = useState(value || defaultValues || []);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (value) {
|
|
128
|
+
state.setValue(value);
|
|
129
|
+
}
|
|
130
|
+
}, [value]);
|
|
131
|
+
const state = {
|
|
132
|
+
value: selectedValues,
|
|
133
|
+
isDisabled: isDisabled || false,
|
|
134
|
+
isReadOnly: isReadOnly || false,
|
|
135
|
+
setValue(values) {
|
|
136
|
+
if (isReadOnly || isDisabled) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
setValue(values);
|
|
140
|
+
},
|
|
141
|
+
addValue(value) {
|
|
142
|
+
if (!selectedValues.includes(value)) {
|
|
143
|
+
setValue(selectedValues.concat(value));
|
|
144
|
+
if (onChange) {
|
|
145
|
+
onChange(selectedValues.concat(value));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
removeValue(value) {
|
|
150
|
+
if (selectedValues.includes(value)) {
|
|
151
|
+
setValue(selectedValues.filter(existingValue => existingValue !== value));
|
|
152
|
+
if (onChange) {
|
|
153
|
+
onChange(selectedValues.filter(existingValue => existingValue !== value));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
159
|
+
value: {
|
|
160
|
+
theme
|
|
161
|
+
}
|
|
162
|
+
}, /*#__PURE__*/React__default.createElement(StyledCheckboxGroup, _extends({
|
|
163
|
+
color: color
|
|
164
|
+
}, forwardedProps, {
|
|
165
|
+
$isDisabled: isDisabled,
|
|
166
|
+
$isInvalid: isInvalid || isRequired && selectedValues.length === 0,
|
|
167
|
+
$isReadOnly: isReadOnly,
|
|
168
|
+
$orientation: orientation,
|
|
169
|
+
$theme: theme,
|
|
170
|
+
"aria-disabled": isDisabled,
|
|
171
|
+
className: classNames(CheckboxGroup.className, className),
|
|
172
|
+
ref: ref,
|
|
173
|
+
role: "group"
|
|
174
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
175
|
+
className: `${CheckboxGroup.className}-label`
|
|
176
|
+
}, label, isRequired ? ' *' : null), /*#__PURE__*/React__default.createElement("div", {
|
|
177
|
+
className: `${CheckboxGroup.className}-boxes`
|
|
178
|
+
}, /*#__PURE__*/React__default.createElement(CheckboxGroupContext.Provider, {
|
|
179
|
+
value: state
|
|
180
|
+
}, children)), /*#__PURE__*/React__default.createElement("span", {
|
|
181
|
+
className: `${CheckboxGroup.className}-description`
|
|
182
|
+
}, description)));
|
|
183
|
+
});
|
|
184
|
+
CheckboxGroup.className = CLASSNAME;
|
|
185
|
+
CheckboxGroup.displayName = COMPONENT_NAME;
|
|
9
186
|
|
|
10
|
-
export {
|
|
187
|
+
export { CheckboxGroupOrientation as C, CheckboxGroup as a };
|
|
188
|
+
//# sourceMappingURL=CheckboxGroup.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
|
|
3
|
+
interface ConditionalWrapperProps<T = {}> {
|
|
4
|
+
/** Children to render with or without the wrapper. */
|
|
5
|
+
children: React.ReactElement<T> | null;
|
|
6
|
+
/** Condition to define whether or not the children should be wrapped. */
|
|
7
|
+
condition: boolean;
|
|
8
|
+
/** Wrapper to conditionaly put around the children. */
|
|
9
|
+
wrapper: (children: React.ReactElement<T> | null) => React.ReactElement<T> | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const ConditionalWrapper: React$1.FC<ConditionalWrapperProps>;
|
|
13
|
+
|
|
14
|
+
export { ConditionalWrapperProps as C, ConditionalWrapper as a };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
children
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
3
|
+
const ConditionalWrapper = _ref => {
|
|
4
|
+
let {
|
|
5
|
+
children,
|
|
6
|
+
condition,
|
|
7
|
+
wrapper
|
|
8
|
+
} = _ref;
|
|
9
|
+
return condition ? wrapper(children) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, children);
|
|
10
|
+
};
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export { ConditionalWrapperProps as C, ConditionalWrapper as a };
|
|
12
|
+
export { ConditionalWrapper as C };
|
|
13
|
+
//# sourceMappingURL=ConditionalWrapper.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { D as DetailedCardSectionItemProps } from './types.d12.ts';
|
|
2
|
+
import { D as DetailedCardCollapsibleSectionItemsProps } from './types.d9.ts';
|
|
3
|
+
import { D as DetailedCardHeaderProps } from './types.d10.ts';
|
|
4
|
+
import { D as DetailedCardSectionProps } from './types.d11.ts';
|
|
5
|
+
import { ComponentProps } from 'react';
|
|
6
|
+
import { S as ShieldVariant } from './types.d22.ts';
|
|
7
|
+
import { b as IconProps } from './types.d17.ts';
|
|
8
|
+
import { h as StylingProps } from './styles.d2.ts';
|
|
9
|
+
import { N as NotificationsColorPalette, T as Theme } from './colors.js';
|
|
10
|
+
import { C as Comp } from './helpers.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Component props.
|
|
14
|
+
*/
|
|
15
|
+
interface DetailedCardProps extends ComponentProps<'div'>, StylingProps {
|
|
16
|
+
/** Whether the component is collapsed or not. Used for controlled version. */
|
|
17
|
+
areAllCollapsed?: boolean;
|
|
18
|
+
/** Banner variant. */
|
|
19
|
+
bannerVariant?: 'standard' | 'condensed';
|
|
20
|
+
/** Banner color. */
|
|
21
|
+
color?: NotificationsColorPalette;
|
|
22
|
+
/** Default collapse status. Used for uncontrolled version. */
|
|
23
|
+
defaultAllCollapsed?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />
|
|
26
|
+
* Can also be a ReactElement.
|
|
27
|
+
*/
|
|
28
|
+
icon?: IconProps['icon'];
|
|
29
|
+
/** Whether the card has buttons to collapse and expand all section items. */
|
|
30
|
+
isCollapsible?: boolean;
|
|
31
|
+
/** Whether the card is loading or not. */
|
|
32
|
+
isLoading?: boolean;
|
|
33
|
+
/** Shield to display in place of the banner icon. */
|
|
34
|
+
shield?: ShieldVariant;
|
|
35
|
+
/** Theme. */
|
|
36
|
+
theme?: Theme;
|
|
37
|
+
/** Method to handle component change. */
|
|
38
|
+
onCollapseAll?(areAllCollapsed: boolean): void;
|
|
39
|
+
}
|
|
40
|
+
type StyledDetailedCardProps = Omit<DetailedCardProps, 'color'> & {
|
|
41
|
+
$color: DetailedCardProps['color'];
|
|
42
|
+
$theme: DetailedCardProps['theme'];
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
declare const DetailedCard: Comp<DetailedCardProps, HTMLDivElement> & {
|
|
46
|
+
Header: Comp<DetailedCardHeaderProps, HTMLDivElement>;
|
|
47
|
+
Section: Comp<DetailedCardSectionProps, HTMLDivElement>;
|
|
48
|
+
CollapsibleSectionItems: Comp<DetailedCardCollapsibleSectionItemsProps, HTMLDivElement>;
|
|
49
|
+
SectionItem: Comp<DetailedCardSectionItemProps, HTMLDivElement>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { DetailedCardProps as D, StyledDetailedCardProps as S, DetailedCard as a };
|