react-restyle-components 0.4.37 → 0.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +1 -3
- package/lib/src/core-components/index.js +1 -1
- package/lib/src/core-components/src/components/Accordion/AccordionSection/Accordion.js +1 -15
- package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionContext.js +1 -6
- package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionSection.js +1 -39
- package/lib/src/core-components/src/components/Accordion/AccordionSection/Header.js +1 -39
- package/lib/src/core-components/src/components/Accordion/AccordionSection/elements.js +57 -94
- package/lib/src/core-components/src/components/Accordion/AccordionSection/hooks/useCurrentAccordionIndex.js +1 -13
- package/lib/src/core-components/src/components/Accordion/AccordionSection/index.js +1 -3
- package/lib/src/core-components/src/components/Accordion/AccordionSection/types.js +1 -9
- package/lib/src/core-components/src/components/Accordion/Collapsible/Collapsible2.component.js +1 -249
- package/lib/src/core-components/src/components/Action/types.js +1 -8
- package/lib/src/core-components/src/components/AlertBanner/AlertBanner.js +1 -45
- package/lib/src/core-components/src/components/AlertBanner/elements.js +45 -120
- package/lib/src/core-components/src/components/AlertBanner/index.js +1 -2
- package/lib/src/core-components/src/components/AlertBanner/types.js +1 -10
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.js +1 -334
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.js +1 -229
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-selected-top-display/auto-complete-filter-multi-select-selected-top-display.component.js +1 -174
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +2 -129
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +1 -55
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +2 -308
- package/lib/src/core-components/src/components/AutoComplete/auto-complete-group-by/auto-complete-group-by.component.js +1 -115
- package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.js +2 -442
- package/lib/src/core-components/src/components/AutoComplete/index.js +1 -8
- package/lib/src/core-components/src/components/Avatar/Avatar.js +14 -148
- package/lib/src/core-components/src/components/Badge/Badge.js +2 -25
- package/lib/src/core-components/src/components/Badge/InnerBadge/Inline.js +1 -25
- package/lib/src/core-components/src/components/Badge/InnerBadge/InnerBadge.js +1 -25
- package/lib/src/core-components/src/components/Badge/InnerBadge/elements.js +32 -78
- package/lib/src/core-components/src/components/Badge/InnerBadge/index.js +1 -1
- package/lib/src/core-components/src/components/Badge/index.js +1 -1
- package/lib/src/core-components/src/components/Badge/types.js +1 -5
- package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +1 -83
- package/lib/src/core-components/src/components/Breadcrumb/elements.js +94 -166
- package/lib/src/core-components/src/components/Breadcrumb/index.js +1 -3
- package/lib/src/core-components/src/components/Breadcrumb/types.js +1 -3
- package/lib/src/core-components/src/components/Button/button.component.js +1 -18
- package/lib/src/core-components/src/components/Button/buttonGroup/buttonGroup.component.js +1 -4
- package/lib/src/core-components/src/components/Button/index.js +1 -2
- package/lib/src/core-components/src/components/Button/types.js +1 -1
- package/lib/src/core-components/src/components/Chip/Chip.js +1 -64
- package/lib/src/core-components/src/components/Chip/elements.js +48 -148
- package/lib/src/core-components/src/components/Chip/index.js +1 -2
- package/lib/src/core-components/src/components/Chip/types.js +1 -4
- package/lib/src/core-components/src/components/Divider/Divider.js +1 -25
- package/lib/src/core-components/src/components/Divider/elements.js +31 -68
- package/lib/src/core-components/src/components/Divider/index.js +1 -2
- package/lib/src/core-components/src/components/Divider/types.js +1 -4
- package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +1 -147
- package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +17 -24
- package/lib/src/core-components/src/components/DynamicGrid/elements.js +100 -162
- package/lib/src/core-components/src/components/DynamicGrid/index.js +1 -3
- package/lib/src/core-components/src/components/DynamicGrid/types.js +1 -28
- package/lib/src/core-components/src/components/DynamicGrid/utils.js +1 -193
- package/lib/src/core-components/src/components/FormField/FormField.js +1 -103
- package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +1 -37
- package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +1 -8
- package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +1 -192
- package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +1 -99
- package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +1 -70
- package/lib/src/core-components/src/components/FormField/components/OtpInput.js +1 -81
- package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +1 -40
- package/lib/src/core-components/src/components/FormField/components/PinInput.js +1 -75
- package/lib/src/core-components/src/components/FormField/components/RadioInput.js +1 -54
- package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +1 -94
- package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +1 -36
- package/lib/src/core-components/src/components/FormField/components/index.js +1 -11
- package/lib/src/core-components/src/components/FormField/css-properties.js +1 -161
- package/lib/src/core-components/src/components/FormField/index.js +1 -2
- package/lib/src/core-components/src/components/Icon/Icon.js +1 -79
- package/lib/src/core-components/src/components/Icon/index.js +1 -2
- package/lib/src/core-components/src/components/Icon/types.js +1 -9
- package/lib/src/core-components/src/components/Loader/loader.component.js +2 -215
- package/lib/src/core-components/src/components/Masonry/Masonry.js +1 -73
- package/lib/src/core-components/src/components/Masonry/elements.js +29 -46
- package/lib/src/core-components/src/components/Masonry/hooks.js +1 -100
- package/lib/src/core-components/src/components/Masonry/index.js +1 -3
- package/lib/src/core-components/src/components/Masonry/types.js +1 -1
- package/lib/src/core-components/src/components/Modal/BasicModal/modal.component.js +1 -116
- package/lib/src/core-components/src/components/Modal/index.js +1 -2
- package/lib/src/core-components/src/components/Modal/modal-confirm/modal-confirm.component.js +1 -147
- package/lib/src/core-components/src/components/Picker/color-picker/color-picker.component.js +1 -12
- package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +1 -40
- package/lib/src/core-components/src/components/Picker/index.js +1 -2
- package/lib/src/core-components/src/components/Selection/index.js +1 -4
- package/lib/src/core-components/src/components/Selection/multi-select/multi-select.component.js +1 -49
- package/lib/src/core-components/src/components/Selection/multi-select-with-field/multi-select-with-field.component.js +1 -58
- package/lib/src/core-components/src/components/Selection/multi-selection-dropdown/multi-selection-dropdown.component.js +1 -43
- package/lib/src/core-components/src/components/Selection/single-select/single-select.component.js +1 -87
- package/lib/src/core-components/src/components/Skeleton/Skeleton.js +1 -51
- package/lib/src/core-components/src/components/Skeleton/elements.js +54 -143
- package/lib/src/core-components/src/components/Skeleton/index.js +1 -2
- package/lib/src/core-components/src/components/Skeleton/types.js +1 -4
- package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +1 -128
- package/lib/src/core-components/src/components/SpeedDial/elements.js +62 -132
- package/lib/src/core-components/src/components/SpeedDial/index.js +1 -2
- package/lib/src/core-components/src/components/SpeedDial/types.js +1 -3
- package/lib/src/core-components/src/components/Stepper2/stepper.component.js +1 -139
- package/lib/src/core-components/src/components/Switch/Switch.js +1 -26
- package/lib/src/core-components/src/components/Switch/elements.js +34 -103
- package/lib/src/core-components/src/components/Switch/index.js +1 -2
- package/lib/src/core-components/src/components/Switch/types.js +1 -3
- package/lib/src/core-components/src/components/Table/Table.js +1 -1100
- package/lib/src/core-components/src/components/Table/elements.js +153 -240
- package/lib/src/core-components/src/components/Table/filters.js +30 -555
- package/lib/src/core-components/src/components/Table/hooks.js +2 -536
- package/lib/src/core-components/src/components/Table/index.js +1 -4
- package/lib/src/core-components/src/components/Table/types.js +1 -1
- package/lib/src/core-components/src/components/Tabs/tabs.component.js +1 -22
- package/lib/src/core-components/src/components/Tags1/Tags.component.js +1 -118
- package/lib/src/core-components/src/components/Tags1/types.js +1 -20
- package/lib/src/core-components/src/components/Timer1/timer.component.js +1 -76
- package/lib/src/core-components/src/components/Toast/Toast.js +1 -50
- package/lib/src/core-components/src/components/Toast/elements.js +41 -122
- package/lib/src/core-components/src/components/Toast/index.js +1 -2
- package/lib/src/core-components/src/components/Toast/types.js +1 -9
- package/lib/src/core-components/src/components/Tooltip/Tooltip.js +1 -200
- package/lib/src/core-components/src/components/Tooltip/elements.js +55 -117
- package/lib/src/core-components/src/components/Tooltip/index.js +1 -2
- package/lib/src/core-components/src/components/Tooltip/types.js +1 -17
- package/lib/src/core-components/src/components/Tooltip/utils.js +1 -140
- package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +1 -303
- package/lib/src/core-components/src/components/TreeSelect/elements.js +117 -216
- package/lib/src/core-components/src/components/TreeSelect/hooks.js +1 -252
- package/lib/src/core-components/src/components/TreeSelect/index.js +1 -3
- package/lib/src/core-components/src/components/TreeSelect/types.js +1 -1
- package/lib/src/core-components/src/components/index.js +1 -30
- package/lib/src/core-components/src/components/pdf/pdf-images.components.js +1 -7
- package/lib/src/core-components/src/components/pdf/pdf-table.components.js +5 -48
- package/lib/src/core-components/src/components/pdf/pdf-typography.components.js +1 -70
- package/lib/src/core-components/src/components/pdf/pdf-wrapped-view.components.js +1 -50
- package/lib/src/core-components/src/core-components/Avatar.js +4 -33
- package/lib/src/core-components/src/core-components/CoreButton/CoreButton.js +1 -10
- package/lib/src/core-components/src/core-components/CoreButton/elements.js +67 -176
- package/lib/src/core-components/src/core-components/CoreButton/index.js +1 -3
- package/lib/src/core-components/src/core-components/CoreButton/types.js +1 -6
- package/lib/src/core-components/src/core-components/CoreButton/utils.js +1 -12
- package/lib/src/core-components/src/core-components/Divider/Divider.js +4 -19
- package/lib/src/core-components/src/core-components/Divider/index.js +1 -1
- package/lib/src/core-components/src/core-components/SelectionCardStrip/index.js +1 -1
- package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js +10 -33
- package/lib/src/core-components/src/core-components/StateLayer.js +3 -5
- package/lib/src/core-components/src/core-components/ToggleCore/elements.js +25 -50
- package/lib/src/core-components/src/core-components/ToggleCore/index.js +1 -2
- package/lib/src/core-components/src/core-components/ToggleCore/toggleCore.js +1 -14
- package/lib/src/core-components/src/core-components/atoms/Input/Input.js +1 -22
- package/lib/src/core-components/src/core-components/atoms/Label/Label.js +1 -21
- package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +1 -19
- package/lib/src/core-components/src/core-components/index.js +1 -3
- package/lib/src/core-components/src/helpers/constants.js +1 -11
- package/lib/src/core-components/src/hooks/index.js +1 -1
- package/lib/src/core-components/src/hooks/outside.hook.js +1 -28
- package/lib/src/core-components/src/index.js +1 -12
- package/lib/src/core-components/src/tc.global.css +1 -0
- package/lib/src/core-components/src/utils/abstracts/breakpoints/index.js +1 -28
- package/lib/src/core-components/src/utils/abstracts/colors/index.js +1 -49
- package/lib/src/core-components/src/utils/abstracts/index.js +1 -5
- package/lib/src/core-components/src/utils/abstracts/space/index.js +1 -26
- package/lib/src/core-components/src/utils/abstracts/theme/ThemeBoundary.js +1 -8
- package/lib/src/core-components/src/utils/abstracts/theme/default-themes.js +1 -30
- package/lib/src/core-components/src/utils/abstracts/theme/index.js +1 -3
- package/lib/src/core-components/src/utils/abstracts/theme/theme.js +1 -30
- package/lib/src/core-components/src/utils/abstracts/theme/types.js +1 -1
- package/lib/src/core-components/src/utils/abstracts/theme/useTheme.js +1 -17
- package/lib/src/core-components/src/utils/abstracts/typography/index.js +1 -25
- package/lib/src/core-components/src/utils/context/DefaultsProvider.js +1 -8
- package/lib/src/core-components/src/utils/context/InternalProvider.js +1 -24
- package/lib/src/core-components/src/utils/context/index.js +1 -2
- package/lib/src/core-components/src/utils/designTokens.js +1 -125
- package/lib/src/core-components/src/utils/helpers/attachSubComponents.js +1 -23
- package/lib/src/core-components/src/utils/helpers/flattenChildren.js +1 -11
- package/lib/src/core-components/src/utils/helpers/getChildByType.js +1 -3
- package/lib/src/core-components/src/utils/helpers/index.js +1 -5
- package/lib/src/core-components/src/utils/helpers/isComponentType.js +1 -16
- package/lib/src/core-components/src/utils/helpers/separateChildrenByType.js +1 -12
- package/lib/src/core-components/src/utils/hooks/index.js +1 -18
- package/lib/src/core-components/src/utils/hooks/useClickOutside.js +1 -18
- package/lib/src/core-components/src/utils/hooks/useCombinedRefs.js +1 -17
- package/lib/src/core-components/src/utils/hooks/useDebouncedCallback.js +1 -12
- package/lib/src/core-components/src/utils/hooks/useDebouncedValue.js +1 -20
- package/lib/src/core-components/src/utils/hooks/useDeprecation.js +1 -40
- package/lib/src/core-components/src/utils/hooks/useDeviceDetect.js +1 -10
- package/lib/src/core-components/src/utils/hooks/useDeviceForm.js +1 -24
- package/lib/src/core-components/src/utils/hooks/useDisableBodyScroll.js +1 -16
- package/lib/src/core-components/src/utils/hooks/useHoverState.js +1 -36
- package/lib/src/core-components/src/utils/hooks/useId.js +1 -7
- package/lib/src/core-components/src/utils/hooks/useIsBrowser.js +1 -11
- package/lib/src/core-components/src/utils/hooks/useMediaQuery.js +1 -16
- package/lib/src/core-components/src/utils/hooks/useOverflow.js +1 -22
- package/lib/src/core-components/src/utils/hooks/useSafeLayoutEffect.js +1 -5
- package/lib/src/core-components/src/utils/hooks/useScrollingUp.js +1 -18
- package/lib/src/core-components/src/utils/hooks/useTrapFocus.js +1 -30
- package/lib/src/core-components/src/utils/hooks/useWindowDimensions.js +1 -23
- package/lib/src/core-components/src/utils/index.js +1 -9
- package/lib/src/core-components/src/utils/stories/Wrappers.js +8 -23
- package/lib/src/core-components/src/utils/stories/cleanProps.js +1 -5
- package/lib/src/core-components/src/utils/stories/index.js +1 -4
- package/lib/src/core-components/src/utils/stories/sleep.js +1 -4
- package/lib/src/core-components/src/utils/stories/view-ports.js +1 -50
- package/lib/src/core-components/src/utils/styling/calcWidthOfColumns.js +1 -5
- package/lib/src/core-components/src/utils/styling/createGridContainer.js +6 -12
- package/lib/src/core-components/src/utils/styling/createTransition.js +2 -7
- package/lib/src/core-components/src/utils/styling/forwardProps.js +1 -10
- package/lib/src/core-components/src/utils/styling/index.js +1 -5
- package/lib/src/core-components/src/utils/styling/pxToRem.js +1 -6
- package/lib/src/core-components/src/utils/testing/getComputedStyle.js +1 -3
- package/lib/src/core-components/src/utils/testing/index.js +1 -1
- package/lib/src/core-components/src/utils/utility.util.js +1 -14
- package/lib/src/core-components/tailwind.config.js +1 -233
- package/lib/src/core-hooks/index.js +1 -3
- package/lib/src/core-hooks/src/useClickOutside/useClickOutside.hook.js +1 -46
- package/lib/src/core-hooks/src/useDebounce/useDebounce.hook.js +1 -30
- package/lib/src/core-hooks/src/usePreventEKey/usePreventEKey.hook.js +1 -8
- package/lib/src/core-utils/index.js +1 -7
- package/lib/src/core-utils/src/calculation/calculation.util.js +1 -89
- package/lib/src/core-utils/src/colors/color.util.js +1 -15
- package/lib/src/core-utils/src/convert/numberToWords/numToWords.util.js +1 -145
- package/lib/src/core-utils/src/convert/typography/camelCaseToTitleCase.util.js +1 -5
- package/lib/src/core-utils/src/form-helper/form-helper.util.js +1 -82
- package/lib/src/core-utils/src/index.js +1 -7
- package/lib/src/core-utils/src/utility/utility.util.js +1 -12
- package/lib/src/core-utils/src/uuid/uuid.util.js +1 -8
- package/package.json +2 -1
- package/lib/src/core-components/src/assets/styles/fontface.css +0 -17
|
@@ -1,186 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
// import {styled,StyledProps} from 'styled-components';
|
|
3
|
-
import { styled } from 'styled-components';
|
|
4
|
-
import { colors, getFontSize, getFontWeight } from '../../utils';
|
|
5
|
-
import { dontForwardProps } from '../../utils';
|
|
6
|
-
const getButtonSize = ({ size }) => ({
|
|
7
|
-
small: `
|
|
1
|
+
"use strict";"use client";import{styled as a}from"styled-components";import{colors as t,getFontSize as l,getFontWeight as g}from"../../utils";import{dontForwardProps as d}from"../../utils";const s=({size:e})=>({small:`
|
|
8
2
|
height: 2rem;
|
|
9
3
|
padding: 0.25rem 1rem;
|
|
10
|
-
`,
|
|
11
|
-
medium: `
|
|
4
|
+
`,medium:`
|
|
12
5
|
height: 3rem;
|
|
13
6
|
padding: 0.75rem 1.75rem;
|
|
14
|
-
`,
|
|
15
|
-
large: `
|
|
7
|
+
`,large:`
|
|
16
8
|
height: 4rem;
|
|
17
9
|
padding: 1rem 1.75rem;
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
default: `
|
|
29
|
-
background: ${themeHover};
|
|
30
|
-
border-color: ${themeHover};
|
|
31
|
-
`,
|
|
32
|
-
outline: `
|
|
33
|
-
background: ${color === 'white' ? 'transparent' : colors.neutralBrightest};
|
|
34
|
-
border-color: ${color === 'primary' ? theme.primary : themeHover};
|
|
35
|
-
color: ${color === 'primary' ? theme.primary : themeHover};
|
|
36
|
-
`,
|
|
37
|
-
flat: `
|
|
38
|
-
background: ${color === 'white' ? 'transparent' : colors.neutralBrightest};
|
|
39
|
-
border-color: ${color === 'white' ? themeHover : colors.neutralBrightest};
|
|
10
|
+
`})[e],u=({theme:e,color:r,variant:n,isMobile:i})=>{if(i)return"";const o={...e,whiteHover:t.neutralBrighter}[`${r}Hover`];return{default:`
|
|
11
|
+
background: ${o};
|
|
12
|
+
border-color: ${o};
|
|
13
|
+
`,outline:`
|
|
14
|
+
background: ${r==="white"?"transparent":t.neutralBrightest};
|
|
15
|
+
border-color: ${r==="primary"?e.primary:o};
|
|
16
|
+
color: ${r==="primary"?e.primary:o};
|
|
17
|
+
`,flat:`
|
|
18
|
+
background: ${r==="white"?"transparent":t.neutralBrightest};
|
|
19
|
+
border-color: ${r==="white"?o:t.neutralBrightest};
|
|
40
20
|
text-decoration: unset;
|
|
41
|
-
color: ${
|
|
42
|
-
`,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
color: ${
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
background: ${
|
|
65
|
-
border-color: ${
|
|
66
|
-
color: ${
|
|
67
|
-
`,
|
|
68
|
-
flat: `
|
|
69
|
-
background: ${color === 'white' ? 'transparent' : colors.neutralBrighter};
|
|
70
|
-
border-color: ${color === 'white' ? themePressed : colors.neutralBrighter};
|
|
71
|
-
color: ${themePressed};
|
|
72
|
-
`,
|
|
73
|
-
text: `
|
|
74
|
-
color: ${themePressed};
|
|
75
|
-
`,
|
|
76
|
-
}[variant];
|
|
77
|
-
};
|
|
78
|
-
const getDisabledStyle = ({ variant }) => ({
|
|
79
|
-
default: `
|
|
80
|
-
background: ${colors.disabledBackground};
|
|
81
|
-
border-color: ${colors.disabledBackground};
|
|
82
|
-
`,
|
|
83
|
-
outline: `
|
|
84
|
-
border-color: ${colors.disabledText};
|
|
85
|
-
`,
|
|
86
|
-
})[variant];
|
|
87
|
-
const getBaseStyle = ({ theme, color, variant, hasIcon, }) => {
|
|
88
|
-
const themeColor = {
|
|
89
|
-
...theme,
|
|
90
|
-
white: colors.white,
|
|
91
|
-
}[color];
|
|
92
|
-
return {
|
|
93
|
-
default: `
|
|
94
|
-
background: ${themeColor};
|
|
95
|
-
border-color: ${themeColor};
|
|
96
|
-
color: ${{
|
|
97
|
-
primary: theme.textOnPrimary,
|
|
98
|
-
secondary: theme.textOnSecondary,
|
|
99
|
-
white: colors.black,
|
|
100
|
-
}[color]};
|
|
101
|
-
`,
|
|
102
|
-
outline: `
|
|
21
|
+
color: ${o};
|
|
22
|
+
`,text:`
|
|
23
|
+
color: ${o};
|
|
24
|
+
`}[n]},c=({theme:e,color:r,variant:n})=>{const i={...e,whitePressed:t.neutralBright}[`${r}Pressed`];return{default:`
|
|
25
|
+
background: ${i};
|
|
26
|
+
border-color: ${i};
|
|
27
|
+
color: ${{primary:e.textOnPrimary,secondary:e.textOnSecondary,white:t.black}[r]};
|
|
28
|
+
`,outline:`
|
|
29
|
+
background: ${r==="white"?"transparent":t.neutralBrighter};
|
|
30
|
+
border-color: ${i};
|
|
31
|
+
color: ${i};
|
|
32
|
+
`,flat:`
|
|
33
|
+
background: ${r==="white"?"transparent":t.neutralBrighter};
|
|
34
|
+
border-color: ${r==="white"?i:t.neutralBrighter};
|
|
35
|
+
color: ${i};
|
|
36
|
+
`,text:`
|
|
37
|
+
color: ${i};
|
|
38
|
+
`}[n]},m=({variant:e})=>({default:`
|
|
39
|
+
background: ${t.disabledBackground};
|
|
40
|
+
border-color: ${t.disabledBackground};
|
|
41
|
+
`,outline:`
|
|
42
|
+
border-color: ${t.disabledText};
|
|
43
|
+
`})[e],h=({theme:e,color:r,variant:n,hasIcon:i})=>{const o={...e,white:t.white}[r];return{default:`
|
|
44
|
+
background: ${o};
|
|
45
|
+
border-color: ${o};
|
|
46
|
+
color: ${{primary:e.textOnPrimary,secondary:e.textOnSecondary,white:t.black}[r]};
|
|
47
|
+
`,outline:`
|
|
103
48
|
background: transparent;
|
|
104
|
-
color: ${
|
|
105
|
-
border: 2px solid ${
|
|
106
|
-
`,
|
|
107
|
-
flat: `
|
|
49
|
+
color: ${o};
|
|
50
|
+
border: 2px solid ${o};
|
|
51
|
+
`,flat:`
|
|
108
52
|
background: transparent;
|
|
109
|
-
color: ${
|
|
53
|
+
color: ${o};
|
|
110
54
|
border-color: transparent;
|
|
111
|
-
${
|
|
112
|
-
|
|
113
|
-
: ''}
|
|
114
|
-
`,
|
|
115
|
-
text: `
|
|
55
|
+
${i?"":"text-decoration: underline; text-underline-position: under;"}
|
|
56
|
+
`,text:`
|
|
116
57
|
margin: 0;
|
|
117
58
|
padding: 0;
|
|
118
59
|
border: none;
|
|
119
60
|
border-radius: 0.0625rem;
|
|
120
|
-
color: ${
|
|
61
|
+
color: ${o};
|
|
121
62
|
text-decoration: underline;
|
|
122
63
|
text-underline-position: under;
|
|
123
64
|
background: inherit;
|
|
124
65
|
height: initial;
|
|
125
|
-
|
|
126
|
-
}[variant];
|
|
127
|
-
};
|
|
128
|
-
export const iconOnlyStyle = {
|
|
129
|
-
small: `
|
|
66
|
+
`}[n]};export const iconOnlyStyle={small:`
|
|
130
67
|
padding: 0.375rem;
|
|
131
68
|
height: auto;
|
|
132
|
-
`,
|
|
133
|
-
medium: `
|
|
69
|
+
`,medium:`
|
|
134
70
|
padding: 0.75rem;
|
|
135
71
|
height: auto;
|
|
136
|
-
`,
|
|
137
|
-
large: `
|
|
72
|
+
`,large:`
|
|
138
73
|
padding: 1rem;
|
|
139
74
|
height: auto;
|
|
140
|
-
|
|
141
|
-
};
|
|
142
|
-
export const iconOnlyFigmaStyle = {
|
|
143
|
-
small: `
|
|
75
|
+
`},iconOnlyFigmaStyle={small:`
|
|
144
76
|
padding: 0.375rem;
|
|
145
77
|
width: 2rem;
|
|
146
78
|
height: 2rem;
|
|
147
|
-
`,
|
|
148
|
-
medium: `
|
|
79
|
+
`,medium:`
|
|
149
80
|
padding: 0.75rem;
|
|
150
81
|
width: 3rem;
|
|
151
82
|
height: 3rem;
|
|
152
|
-
`,
|
|
153
|
-
large: `
|
|
83
|
+
`,large:`
|
|
154
84
|
padding: 1rem;
|
|
155
85
|
width: 4rem;
|
|
156
86
|
height: 4rem;
|
|
157
|
-
|
|
158
|
-
};
|
|
159
|
-
const getIconButtonPadding = ({ hasIcon, iconSide, size, }) => {
|
|
160
|
-
if (!hasIcon)
|
|
161
|
-
return '';
|
|
162
|
-
if (size !== 'small') {
|
|
163
|
-
return iconSide === 'left'
|
|
164
|
-
? 'padding-left: 1.25rem'
|
|
165
|
-
: 'padding-right: 1.25rem';
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return iconSide === 'left'
|
|
169
|
-
? 'padding-left: 0.75rem'
|
|
170
|
-
: 'padding-right: 0.75rem';
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
export const ButtonElement = styled.button.withConfig(dontForwardProps()) `
|
|
87
|
+
`};const p=({hasIcon:e,iconSide:r,size:n})=>e?n!=="small"?r==="left"?"padding-left: 1.25rem":"padding-right: 1.25rem":r==="left"?"padding-left: 0.75rem":"padding-right: 0.75rem":"";export const ButtonElement=a.button.withConfig(d())`
|
|
174
88
|
font-family: inherit;
|
|
175
|
-
font-weight: ${
|
|
89
|
+
font-weight: ${g("base")};
|
|
176
90
|
font-style: normal;
|
|
177
|
-
font-size: ${({
|
|
91
|
+
font-size: ${({size:e})=>l(e==="large"?3:2)};
|
|
178
92
|
letter-spacing: 0;
|
|
179
93
|
text-align: center;
|
|
180
94
|
white-space: nowrap;
|
|
181
95
|
width: auto;
|
|
182
96
|
|
|
183
|
-
${
|
|
97
|
+
${s};
|
|
184
98
|
|
|
185
99
|
display: flex;
|
|
186
100
|
justify-content: center;
|
|
@@ -190,7 +104,7 @@ export const ButtonElement = styled.button.withConfig(dontForwardProps()) `
|
|
|
190
104
|
border-width: 0.125rem;
|
|
191
105
|
border-radius: 10rem;
|
|
192
106
|
|
|
193
|
-
${
|
|
107
|
+
${h}
|
|
194
108
|
|
|
195
109
|
&:not(:disabled) {
|
|
196
110
|
&:focus {
|
|
@@ -207,47 +121,24 @@ export const ButtonElement = styled.button.withConfig(dontForwardProps()) `
|
|
|
207
121
|
|
|
208
122
|
&:hover {
|
|
209
123
|
cursor: pointer;
|
|
210
|
-
${
|
|
124
|
+
${u}
|
|
211
125
|
}
|
|
212
126
|
&:active {
|
|
213
|
-
${
|
|
127
|
+
${c}
|
|
214
128
|
}
|
|
215
129
|
}
|
|
216
130
|
|
|
217
131
|
&:disabled {
|
|
218
|
-
${
|
|
132
|
+
${m}
|
|
219
133
|
|
|
220
|
-
color: ${
|
|
221
|
-
-webkit-text-fill-color: ${
|
|
134
|
+
color: ${t.disabledText};
|
|
135
|
+
-webkit-text-fill-color: ${t.disabledText};
|
|
222
136
|
cursor: not-allowed;
|
|
223
137
|
}
|
|
224
138
|
|
|
225
|
-
${
|
|
139
|
+
${p};
|
|
226
140
|
|
|
227
|
-
${({
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
}}
|
|
232
|
-
`;
|
|
233
|
-
export const iconMargins = {
|
|
234
|
-
small: {
|
|
235
|
-
left: '0 0.25rem 0 0',
|
|
236
|
-
right: '0 0 0 0.25rem',
|
|
237
|
-
},
|
|
238
|
-
medium: {
|
|
239
|
-
left: '0 0.5rem 0 0',
|
|
240
|
-
right: '0 0 0 0.5rem',
|
|
241
|
-
},
|
|
242
|
-
large: {
|
|
243
|
-
left: '0 0.5rem 0 0',
|
|
244
|
-
right: '0 0 0 0.5rem',
|
|
245
|
-
},
|
|
246
|
-
};
|
|
247
|
-
export const IconWrapper = styled.div.withConfig(dontForwardProps()) `
|
|
248
|
-
margin: ${({ hasChildren, iconSide, size }) => hasChildren
|
|
249
|
-
? iconSide === 'left'
|
|
250
|
-
? iconMargins[size].left
|
|
251
|
-
: iconMargins[size].right
|
|
252
|
-
: '0'};
|
|
141
|
+
${({hasChildren:e,size:r,useFigmaStyles:n})=>{if(!e)return n?iconOnlyFigmaStyle[r]:iconOnlyStyle[r]}}
|
|
142
|
+
`,iconMargins={small:{left:"0 0.25rem 0 0",right:"0 0 0 0.25rem"},medium:{left:"0 0.5rem 0 0",right:"0 0 0 0.5rem"},large:{left:"0 0.5rem 0 0",right:"0 0 0 0.5rem"}},IconWrapper=a.div.withConfig(d())`
|
|
143
|
+
margin: ${({hasChildren:e,iconSide:r,size:n})=>e?r==="left"?iconMargins[n].left:iconMargins[n].right:"0"};
|
|
253
144
|
`;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export const BUTTON_SIZES
|
|
2
|
-
export const BUTTON_VARIANTS = ['default', 'outline', 'flat', 'text'];
|
|
3
|
-
export const BUTTON_COLORS = ['primary', 'secondary', 'white'];
|
|
4
|
-
export const DEFAULT_BUTTON_SIZE = 'medium';
|
|
5
|
-
export const DEFAULT_BUTTON_VARIANT = 'default';
|
|
6
|
-
export const DEFAULT_BUTTON_COLOR = 'primary';
|
|
1
|
+
"use strict";export const BUTTON_SIZES=["small","medium","large"],BUTTON_VARIANTS=["default","outline","flat","text"],BUTTON_COLORS=["primary","secondary","white"],DEFAULT_BUTTON_SIZE="medium",DEFAULT_BUTTON_VARIANT="default",DEFAULT_BUTTON_COLOR="primary";
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IconWrapper } from './elements';
|
|
3
|
-
import { Icon } from '../../components/Icon/Icon';
|
|
4
|
-
export const addIconToChildren = ({ children, size, icons, iconSide, }) => {
|
|
5
|
-
const icon = icons && (_jsx(IconWrapper, { iconSide: iconSide, size: size, hasChildren: !!children, children: _jsx(Icon, { nameIcon: icons?.nameIcon, propsIcon: icons?.propsIcon, className: icons?.className }) }));
|
|
6
|
-
return addToSide({
|
|
7
|
-
children,
|
|
8
|
-
element: icon,
|
|
9
|
-
side: iconSide,
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export const addToSide = ({ children, element, side, }) => (_jsxs(_Fragment, { children: [side === 'left' && element, children, side === 'right' && element] }));
|
|
1
|
+
"use strict";import{jsx as n,Fragment as t,jsxs as m}from"react/jsx-runtime";import{IconWrapper as c}from"./elements";import{Icon as p}from"../../components/Icon/Icon";export const addIconToChildren=({children:r,size:s,icons:o,iconSide:e})=>{const a=o&&n(c,{iconSide:e,size:s,hasChildren:!!r,children:n(p,{nameIcon:o?.nameIcon,propsIcon:o?.propsIcon,className:o?.className})});return addToSide({children:r,element:a,side:e})},addToSide=({children:r,element:s,side:o})=>m(t,{children:[o==="left"&&s,r,o==="right"&&s]});
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import React, { useContext } from 'react';
|
|
4
|
-
import { styled } from 'styled-components';
|
|
5
|
-
import { colors } from '../../utils';
|
|
6
|
-
// import {CardContext} from '../../components/Card/CardContext';
|
|
7
|
-
import { dontForwardProps } from '../../utils';
|
|
8
|
-
const CardContext = React.createContext({
|
|
9
|
-
isInsideCard: false,
|
|
10
|
-
});
|
|
11
|
-
export const StyledDivider = styled.hr.withConfig(dontForwardProps()) `
|
|
1
|
+
"use strict";"use client";import{jsx as o}from"react/jsx-runtime";import e,{useContext as i}from"react";import{styled as s}from"styled-components";import{colors as n}from"../../utils";import{dontForwardProps as d}from"../../utils";const m=e.createContext({isInsideCard:!1});export const StyledDivider=s.hr.withConfig(d())`
|
|
12
2
|
margin: 0;
|
|
13
3
|
border: 0;
|
|
14
|
-
border-top: 1px solid ${
|
|
4
|
+
border-top: 1px solid ${n.neutralBrightest};
|
|
15
5
|
|
|
16
|
-
${({
|
|
17
|
-
`margin-left: -1rem;
|
|
6
|
+
${({isInsideCard:r})=>r&&`margin-left: -1rem;
|
|
18
7
|
margin-right: -1rem;`}
|
|
19
|
-
|
|
20
|
-
export const Divider = (props) => {
|
|
21
|
-
const { isInsideCard } = useContext(CardContext);
|
|
22
|
-
return _jsx(StyledDivider, { isInsideCard: isInsideCard, ...props });
|
|
23
|
-
};
|
|
8
|
+
`,Divider=r=>{const{isInsideCard:t}=i(m);return o(StyledDivider,{isInsideCard:t,...r})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
"use strict";export*from"./Divider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
"use strict";export{SelectionCardStrip}from"./selectionCardStrip";
|
package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { styled } from 'styled-components';
|
|
5
|
-
// import {Card, CardProps} from '../../components/Card';
|
|
6
|
-
import { createTransition, dontForwardProps } from '../../utils';
|
|
7
|
-
import { colors } from '../../utils';
|
|
8
|
-
import { toggleParentStyles } from '../ToggleCore';
|
|
9
|
-
const Card = (props) => {
|
|
10
|
-
return _jsx("div", { ...props });
|
|
11
|
-
};
|
|
12
|
-
const StyledCard = styled(Card).withConfig(dontForwardProps()) `
|
|
1
|
+
"use strict";"use client";import{jsx as t}from"react/jsx-runtime";import s from"react";import{styled as r}from"styled-components";import{createTransition as i,dontForwardProps as n}from"../../utils";import{colors as l}from"../../utils";import{toggleParentStyles as a}from"../ToggleCore";const d=e=>t("div",{...e}),c=r(d).withConfig(n())`
|
|
13
2
|
display: inline-flex;
|
|
14
3
|
align-items: flex-start;
|
|
15
4
|
box-sizing: border-box;
|
|
@@ -17,37 +6,25 @@ const StyledCard = styled(Card).withConfig(dontForwardProps()) `
|
|
|
17
6
|
line-height: 1.3;
|
|
18
7
|
-moz-osx-font-smoothing: grayscale;
|
|
19
8
|
|
|
20
|
-
${()
|
|
21
|
-
properties: ['box-shadow', 'background-color'],
|
|
22
|
-
})}
|
|
9
|
+
${()=>i({properties:["box-shadow","background-color"]})}
|
|
23
10
|
|
|
24
|
-
${
|
|
25
|
-
|
|
26
|
-
const Wrapper = React.forwardRef((props, fRef) => (_jsx(StyledCard, { ref: fRef, element: "label", type: "selection", selected: props.checked || props.focused, ...props })));
|
|
27
|
-
const InternalWrapper = styled.div.withConfig(dontForwardProps()) `
|
|
11
|
+
${a};
|
|
12
|
+
`,f=s.forwardRef((e,o)=>t(c,{ref:o,element:"label",type:"selection",selected:e.checked||e.focused,...e})),p=r.div.withConfig(n())`
|
|
28
13
|
display: flex;
|
|
29
14
|
z-index: 1;
|
|
30
15
|
width: 100%;
|
|
31
16
|
justify-content: center;
|
|
32
17
|
padding: 0.1rem 0 0 0;
|
|
33
|
-
${
|
|
34
|
-
properties: ['color'],
|
|
35
|
-
})};
|
|
18
|
+
${i({properties:["color"]})};
|
|
36
19
|
|
|
37
|
-
${({
|
|
38
|
-
`
|
|
20
|
+
${({isDisabled:e})=>e&&`
|
|
39
21
|
cursor: not-allowed;
|
|
40
|
-
color: ${
|
|
22
|
+
color: ${l.disabledText};
|
|
41
23
|
`}
|
|
42
|
-
${({
|
|
43
|
-
`
|
|
24
|
+
${({disableSvgColorOverride:e,isDisabled:o})=>!e&&`
|
|
44
25
|
svg path {
|
|
45
26
|
fill: none;
|
|
46
|
-
stroke: ${
|
|
27
|
+
stroke: ${o&&l.disabledText};
|
|
47
28
|
}
|
|
48
29
|
`}
|
|
49
|
-
`;
|
|
50
|
-
export const SelectionCardStrip = {
|
|
51
|
-
Wrapper,
|
|
52
|
-
InternalWrapper,
|
|
53
|
-
};
|
|
30
|
+
`;export const SelectionCardStrip={Wrapper:f,InternalWrapper:p};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { tokens } from '../utils/designTokens';
|
|
3
|
-
export const StateLayer = styled.div `
|
|
1
|
+
"use strict";import{styled as o}from"styled-components";import{tokens as t}from"../utils/designTokens";export const StateLayer=o.div`
|
|
4
2
|
position: absolute;
|
|
5
3
|
top: 0;
|
|
6
4
|
right: 0;
|
|
@@ -8,6 +6,6 @@ export const StateLayer = styled.div `
|
|
|
8
6
|
left: 0;
|
|
9
7
|
pointer-events: none;
|
|
10
8
|
z-index: 0;
|
|
11
|
-
background: ${
|
|
12
|
-
opacity: ${
|
|
9
|
+
background: ${t.darkGray||"#4a4a4a"} !important;
|
|
10
|
+
opacity: ${t.stateLayerNone};
|
|
13
11
|
`;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { styled, css } from 'styled-components';
|
|
3
|
-
import { createTransition } from '../../utils';
|
|
4
|
-
import { StateLayer } from '../StateLayer';
|
|
5
|
-
// import {Text} from '../../components/Text';
|
|
6
|
-
const Text = (props) => {
|
|
7
|
-
return _jsx("span", { ...props });
|
|
8
|
-
};
|
|
9
|
-
const baseToggleStyles = css `
|
|
1
|
+
"use strict";import{jsx as r,jsxs as c}from"react/jsx-runtime";import{styled as i,css as o}from"styled-components";import{createTransition as n}from"../../utils";import{StateLayer as a}from"../StateLayer";const p=e=>r("span",{...e}),u=o`
|
|
10
2
|
position: relative;
|
|
11
3
|
display: block;
|
|
12
4
|
box-sizing: border-box;
|
|
@@ -17,18 +9,15 @@ const baseToggleStyles = css `
|
|
|
17
9
|
flex-shrink: 0;
|
|
18
10
|
margin-right: var(--aui-spacing-100);
|
|
19
11
|
|
|
20
|
-
${({
|
|
21
|
-
css `
|
|
12
|
+
${({$showInteraction:e})=>e&&o`
|
|
22
13
|
// Transitions
|
|
23
14
|
&:before,
|
|
24
15
|
[data-aui='icon'],
|
|
25
|
-
${
|
|
26
|
-
${
|
|
16
|
+
${a} {
|
|
17
|
+
${n({properties:["opacity"]})}
|
|
27
18
|
}
|
|
28
19
|
|
|
29
|
-
${
|
|
30
|
-
properties: ['box-shadow', 'background-color', 'color'],
|
|
31
|
-
})}
|
|
20
|
+
${n({properties:["box-shadow","background-color","color"]})}
|
|
32
21
|
|
|
33
22
|
// Support keyboard focus
|
|
34
23
|
&:has(~ input:focus-visible) {
|
|
@@ -40,8 +29,7 @@ const baseToggleStyles = css `
|
|
|
40
29
|
opacity: var(--aui-state-layer-on-disabled);
|
|
41
30
|
}
|
|
42
31
|
`}
|
|
43
|
-
|
|
44
|
-
const StyledCheckbox = styled.span `
|
|
32
|
+
`,s=i.span`
|
|
45
33
|
[data-aui='icon-check'],
|
|
46
34
|
[data-aui='icon-minus'] {
|
|
47
35
|
position: absolute;
|
|
@@ -50,33 +38,28 @@ const StyledCheckbox = styled.span `
|
|
|
50
38
|
transition: opacity 0.15s;
|
|
51
39
|
pointer-events: none;
|
|
52
40
|
}
|
|
53
|
-
${
|
|
41
|
+
${u};
|
|
54
42
|
|
|
55
43
|
border-radius: var(--aui-border-radius-050);
|
|
56
44
|
|
|
57
|
-
${({
|
|
58
|
-
? css `
|
|
45
|
+
${({$checked:e,$indeterminate:d})=>e||d?o`
|
|
59
46
|
box-shadow: 0 0 0 1px var(--aui-inverse-surface) inset;
|
|
60
47
|
background: var(--aui-inverse-surface);
|
|
61
48
|
color: var(--aui-inverse-on-surface);
|
|
62
|
-
`
|
|
63
|
-
: css `
|
|
49
|
+
`:o`
|
|
64
50
|
box-shadow: 0 0 0 1px var(--aui-outline) inset;
|
|
65
51
|
background: var(--aui-surface);
|
|
66
52
|
color: var(--aui-on-surface);
|
|
67
53
|
`}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
${baseToggleStyles};
|
|
54
|
+
`,t=i.span`
|
|
55
|
+
${u};
|
|
71
56
|
|
|
72
57
|
border-radius: var(--aui-border-radius-round);
|
|
73
58
|
background: var(--aui-surface);
|
|
74
59
|
|
|
75
|
-
${({
|
|
76
|
-
? css `
|
|
60
|
+
${({$checked:e})=>e?o`
|
|
77
61
|
box-shadow: 0 0 0 2px var(--aui-inverse-surface) inset;
|
|
78
|
-
`
|
|
79
|
-
: css `
|
|
62
|
+
`:o`
|
|
80
63
|
box-shadow: 0 0 0 1px var(--aui-outline) inset;
|
|
81
64
|
`}
|
|
82
65
|
|
|
@@ -89,14 +72,9 @@ const StyledRadio = styled.span `
|
|
|
89
72
|
top: 0.3125rem;
|
|
90
73
|
left: 0.3125rem;
|
|
91
74
|
background: var(--aui-inverse-surface);
|
|
92
|
-
opacity: ${({
|
|
75
|
+
opacity: ${({$checked:e})=>e?"1":"0"};
|
|
93
76
|
}
|
|
94
|
-
`;
|
|
95
|
-
export const CheckboxToggle = ({ ...props }) => (_jsxs(StyledCheckbox, { ...props, children: [_jsx(StateLayer, {}), _jsx("span", { children: "Icons" })] }));
|
|
96
|
-
export const RadioToggle = (props) => (_jsx(StyledRadio, { ...props, children: _jsx(StateLayer, {}) }));
|
|
97
|
-
export const StyledDescription = styled(Text).attrs({
|
|
98
|
-
size: 2,
|
|
99
|
-
}) `
|
|
77
|
+
`;export const CheckboxToggle=({...e})=>c(s,{...e,children:[r(a,{}),r("span",{children:"Icons"})]}),RadioToggle=e=>r(t,{...e,children:r(a,{})}),StyledDescription=i(p).attrs({size:2})`
|
|
100
78
|
color: var(--aui-on-surface);
|
|
101
79
|
line-height: 1.3;
|
|
102
80
|
|
|
@@ -104,30 +82,27 @@ export const StyledDescription = styled(Text).attrs({
|
|
|
104
82
|
opacity: var(--aui-state-layer-on-disabled);
|
|
105
83
|
cursor: not-allowed;
|
|
106
84
|
}
|
|
107
|
-
|
|
108
|
-
export const HiddenInput = styled.input `
|
|
85
|
+
`,HiddenInput=i.input`
|
|
109
86
|
position: fixed;
|
|
110
87
|
opacity: 0;
|
|
111
88
|
pointer-events: none;
|
|
112
|
-
|
|
113
|
-
/** Add this style snippet to the label containing this ToggleCore component */
|
|
114
|
-
export const toggleParentStyles = css `
|
|
89
|
+
`,toggleParentStyles=o`
|
|
115
90
|
&:not(:has(input:disabled)) {
|
|
116
91
|
&:hover
|
|
117
|
-
${
|
|
118
|
-
${
|
|
92
|
+
${s}
|
|
93
|
+
${a},
|
|
119
94
|
&:hover
|
|
120
|
-
${
|
|
121
|
-
${
|
|
95
|
+
${t}
|
|
96
|
+
${a} {
|
|
122
97
|
opacity: var(--aui-state-layer-hover);
|
|
123
98
|
}
|
|
124
99
|
|
|
125
100
|
&:active
|
|
126
|
-
${
|
|
127
|
-
${
|
|
101
|
+
${s}
|
|
102
|
+
${a},
|
|
128
103
|
&:hover
|
|
129
|
-
${
|
|
130
|
-
${
|
|
104
|
+
${t}
|
|
105
|
+
${a} {
|
|
131
106
|
opacity: var(--aui-state-layer-press);
|
|
132
107
|
}
|
|
133
108
|
}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { toggleParentStyles } from './elements';
|
|
1
|
+
"use strict";export{ToggleCore}from"./toggleCore";export{toggleParentStyles}from"./elements";
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { useId } from '../../utils';
|
|
5
|
-
import { CheckboxToggle, RadioToggle, StyledDescription, HiddenInput, } from './elements';
|
|
6
|
-
/** To apply hover states, apply `toggleParentStyles` to the label containing this component */
|
|
7
|
-
export const ToggleCore = React.forwardRef(({ id, children, checked, isToggleShowing = true, showInteraction = true, onFocusChange, toggleType, indeterminate = false, ...rest }, ref) => {
|
|
8
|
-
const inputId = useId(toggleType, id);
|
|
9
|
-
if (typeof children === 'string') {
|
|
10
|
-
children = _jsx(StyledDescription, { children: children });
|
|
11
|
-
}
|
|
12
|
-
const ToggleComponent = toggleType === 'checkbox' ? CheckboxToggle : RadioToggle;
|
|
13
|
-
return (_jsxs(_Fragment, { children: [isToggleShowing && (_jsx(ToggleComponent, { "$checked": checked ?? false, "$showInteraction": showInteraction, "$indeterminate": indeterminate })), children, _jsx(HiddenInput, { readOnly: true, id: inputId, ref: ref, ...rest, checked: checked, type: toggleType, onFocus: () => onFocusChange?.(true), onBlur: () => onFocusChange?.(false), "aria-checked": indeterminate ? 'mixed' : undefined })] }));
|
|
14
|
-
});
|
|
1
|
+
"use strict";"use client";import{jsx as r,Fragment as u,jsxs as p}from"react/jsx-runtime";import l from"react";import{useId as g}from"../../utils";import{CheckboxToggle as x,RadioToggle as j,StyledDescription as k,HiddenInput as I}from"./elements";export const ToggleCore=l.forwardRef(({id:i,children:e,checked:t,isToggleShowing:a=!0,showInteraction:c=!0,onFocusChange:n,toggleType:o,indeterminate:s=!1,...d},f)=>{const m=g(o,i);return typeof e=="string"&&(e=r(k,{children:e})),p(u,{children:[a&&r(o==="checkbox"?x:j,{$checked:t??!1,$showInteraction:c,$indeterminate:s}),e,r(I,{readOnly:!0,id:m,ref:f,...d,checked:t,type:o,onFocus:()=>n?.(!0),onBlur:()=>n?.(!1),"aria-checked":s?"mixed":void 0})]})});
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import s from '../../../tc.module.css';
|
|
4
|
-
import { cn } from '../../../utils';
|
|
5
|
-
export const Input = React.forwardRef(({ className, error, label, id, onChange, onBlur, onValueChange, onValueBlur, ...props }, ref) => {
|
|
6
|
-
const inputId = id || `input-${Math.random().toString(36).substr(2, 9)}`;
|
|
7
|
-
// Handle onChange - always pass event to onChange, value to onValueChange
|
|
8
|
-
const handleChange = (e) => {
|
|
9
|
-
onChange?.(e);
|
|
10
|
-
onValueChange?.(e.target.value);
|
|
11
|
-
};
|
|
12
|
-
// Handle onBlur - always pass event to onBlur, value to onValueBlur
|
|
13
|
-
const handleBlur = (e) => {
|
|
14
|
-
onBlur?.(e);
|
|
15
|
-
onValueBlur?.(e.target.value);
|
|
16
|
-
};
|
|
17
|
-
return (_jsxs("div", { className: cn(s['w-full']), children: [label && (_jsx("label", { className: cn(s['block'], s['text-sm'], s['font-medium'], s['text-gray-700'], s['dark:text-gray-300'], s['mb-1']), children: label })), _jsx("input", { ref: ref, id: inputId, className: cn(s['w-full'], s['px-4'], s['py-2'], s['border'], s['rounded-lg'], s['transition-colors'], s['bg-white'], s['dark:bg-gray-800'], s['border-gray-300'], s['dark:border-gray-600'], s['text-gray-900'], s['dark:text-gray-100'], s['placeholder-gray-500'], s['dark:placeholder-gray-400'], s['focus:outline-none'], s['focus:ring-2'], s['focus:ring-primary'], s['focus:ring-offset-1'], error && s['border-red-500'], error && s['focus:ring-red-500'], className), style: {
|
|
18
|
-
...props.style,
|
|
19
|
-
'--tw-ring-offset-color': '#ffffff',
|
|
20
|
-
}, onChange: handleChange, onBlur: handleBlur, ...props }), error && (_jsx("p", { className: cn(s['mt-1'], s['text-sm'], s['text-red-600'], s['dark:text-red-400']), children: error }))] }));
|
|
21
|
-
});
|
|
22
|
-
Input.displayName = 'Input';
|
|
1
|
+
"use strict";import{jsx as o,jsxs as y}from"react/jsx-runtime";import h from"react";import r from"../../../tc.module.css";import{cn as a}from"../../../utils";export const Input=h.forwardRef(({className:d,error:e,label:s,id:l,onChange:f,onBlur:i,onValueChange:c,onValueBlur:g,...n},m)=>{const u=l||`input-${Math.random().toString(36).substr(2,9)}`,p=t=>{f?.(t),c?.(t.target.value)},x=t=>{i?.(t),g?.(t.target.value)};return y("div",{className:a(r["w-full"]),children:[s&&o("label",{className:a(r.block,r["text-sm"],r["font-medium"],r["text-gray-700"],r["dark:text-gray-300"],r["mb-1"]),children:s}),o("input",{ref:m,id:u,className:a(r["w-full"],r["px-4"],r["py-2"],r.border,r["rounded-lg"],r["transition-colors"],r["bg-white"],r["dark:bg-gray-800"],r["border-gray-300"],r["dark:border-gray-600"],r["text-gray-900"],r["dark:text-gray-100"],r["placeholder-gray-500"],r["dark:placeholder-gray-400"],r["focus:outline-none"],r["focus:ring-2"],r["focus:ring-primary"],r["focus:ring-offset-1"],e&&r["border-red-500"],e&&r["focus:ring-red-500"],d),style:{...n.style,"--tw-ring-offset-color":"#ffffff"},onChange:p,onBlur:x,...n}),e&&o("p",{className:a(r["mt-1"],r["text-sm"],r["text-red-600"],r["dark:text-red-400"]),children:e})]})});Input.displayName="Input";
|