react-restyle-components 0.4.46 → 0.4.47
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 -451
- 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 -159
- 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 -1489
- package/lib/src/core-components/src/components/Table/columnReorder.js +36 -332
- package/lib/src/core-components/src/components/Table/columnResize.js +21 -284
- package/lib/src/core-components/src/components/Table/elements.js +173 -277
- 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 -6
- 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/ag-grid/AgGrid.js +1 -1057
- package/lib/src/core-components/src/components/ag-grid/elements.js +396 -790
- package/lib/src/core-components/src/components/ag-grid/hooks.js +4 -1220
- package/lib/src/core-components/src/components/ag-grid/index.js +1 -15
- package/lib/src/core-components/src/components/ag-grid/types.js +1 -6
- package/lib/src/core-components/src/components/index.js +1 -31
- 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 -128
- 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 +1 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { tokens } from '../../utils/designTokens';
|
|
3
|
-
// Animations
|
|
4
|
-
const fadeIn = keyframes `
|
|
1
|
+
"use strict";import{styled as i,css as e,keyframes as n}from"styled-components";import{tokens as a}from"../../utils/designTokens";const c=n`
|
|
5
2
|
from {
|
|
6
3
|
opacity: 0;
|
|
7
4
|
transform: scale(0.3);
|
|
@@ -10,8 +7,7 @@ const fadeIn = keyframes `
|
|
|
10
7
|
opacity: 1;
|
|
11
8
|
transform: scale(1);
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
const fadeOut = keyframes `
|
|
10
|
+
`,p=n`
|
|
15
11
|
from {
|
|
16
12
|
opacity: 1;
|
|
17
13
|
transform: scale(1);
|
|
@@ -20,39 +16,11 @@ const fadeOut = keyframes `
|
|
|
20
16
|
opacity: 0;
|
|
21
17
|
transform: scale(0.3);
|
|
22
18
|
}
|
|
23
|
-
|
|
24
|
-
const backdropFadeIn = keyframes `
|
|
19
|
+
`,x=n`
|
|
25
20
|
from { opacity: 0; }
|
|
26
21
|
to { opacity: 1; }
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const sizeConfig = {
|
|
30
|
-
small: {
|
|
31
|
-
fabSize: 48,
|
|
32
|
-
actionSize: 40,
|
|
33
|
-
iconSize: 24,
|
|
34
|
-
actionIconSize: 20,
|
|
35
|
-
labelFontSize: '12px',
|
|
36
|
-
},
|
|
37
|
-
medium: {
|
|
38
|
-
fabSize: 56,
|
|
39
|
-
actionSize: 48,
|
|
40
|
-
iconSize: 28,
|
|
41
|
-
actionIconSize: 24,
|
|
42
|
-
labelFontSize: '13px',
|
|
43
|
-
},
|
|
44
|
-
large: {
|
|
45
|
-
fabSize: 64,
|
|
46
|
-
actionSize: 56,
|
|
47
|
-
iconSize: 32,
|
|
48
|
-
actionIconSize: 28,
|
|
49
|
-
labelFontSize: '14px',
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
// Variant styles for FAB
|
|
53
|
-
const fabVariantStyles = {
|
|
54
|
-
filled: css `
|
|
55
|
-
background: ${tokens.primary || '#3b82f6'};
|
|
22
|
+
`;export const sizeConfig={small:{fabSize:48,actionSize:40,iconSize:24,actionIconSize:20,labelFontSize:"12px"},medium:{fabSize:56,actionSize:48,iconSize:28,actionIconSize:24,labelFontSize:"13px"},large:{fabSize:64,actionSize:56,iconSize:32,actionIconSize:28,labelFontSize:"14px"}};const l={filled:e`
|
|
23
|
+
background: ${a.primary||"#3b82f6"};
|
|
56
24
|
color: white;
|
|
57
25
|
border: none;
|
|
58
26
|
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
|
|
@@ -61,117 +29,96 @@ const fabVariantStyles = {
|
|
|
61
29
|
background: #2563eb;
|
|
62
30
|
box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
|
|
63
31
|
}
|
|
64
|
-
`,
|
|
65
|
-
outlined: css `
|
|
32
|
+
`,outlined:e`
|
|
66
33
|
background: white;
|
|
67
|
-
color: ${
|
|
68
|
-
border: 2px solid ${
|
|
34
|
+
color: ${a.primary||"#3b82f6"};
|
|
35
|
+
border: 2px solid ${a.primary||"#3b82f6"};
|
|
69
36
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
70
37
|
|
|
71
38
|
&:hover:not(:disabled) {
|
|
72
|
-
background: ${
|
|
39
|
+
background: ${a.primary||"#3b82f6"}10;
|
|
73
40
|
}
|
|
74
|
-
`,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
color: ${tokens.primary || '#3b82f6'};
|
|
41
|
+
`,soft:e`
|
|
42
|
+
background: ${a.primary||"#3b82f6"}15;
|
|
43
|
+
color: ${a.primary||"#3b82f6"};
|
|
78
44
|
border: none;
|
|
79
45
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
|
80
46
|
|
|
81
47
|
&:hover:not(:disabled) {
|
|
82
|
-
background: ${
|
|
48
|
+
background: ${a.primary||"#3b82f6"}25;
|
|
83
49
|
}
|
|
84
|
-
|
|
85
|
-
};
|
|
86
|
-
// Direction styles for actions container
|
|
87
|
-
const getDirectionStyles = (direction) => {
|
|
88
|
-
switch (direction) {
|
|
89
|
-
case 'up':
|
|
90
|
-
return css `
|
|
50
|
+
`},d=o=>{switch(o){case"up":return e`
|
|
91
51
|
flex-direction: column-reverse;
|
|
92
52
|
bottom: 100%;
|
|
93
53
|
left: 50%;
|
|
94
54
|
transform: translateX(-50%);
|
|
95
55
|
padding-bottom: 16px;
|
|
96
|
-
`;
|
|
97
|
-
case 'down':
|
|
98
|
-
return css `
|
|
56
|
+
`;case"down":return e`
|
|
99
57
|
flex-direction: column;
|
|
100
58
|
top: 100%;
|
|
101
59
|
left: 50%;
|
|
102
60
|
transform: translateX(-50%);
|
|
103
61
|
padding-top: 16px;
|
|
104
|
-
`;
|
|
105
|
-
case 'left':
|
|
106
|
-
return css `
|
|
62
|
+
`;case"left":return e`
|
|
107
63
|
flex-direction: row-reverse;
|
|
108
64
|
right: 100%;
|
|
109
65
|
top: 50%;
|
|
110
66
|
transform: translateY(-50%);
|
|
111
67
|
padding-right: 16px;
|
|
112
|
-
`;
|
|
113
|
-
case 'right':
|
|
114
|
-
return css `
|
|
68
|
+
`;case"right":return e`
|
|
115
69
|
flex-direction: row;
|
|
116
70
|
left: 100%;
|
|
117
71
|
top: 50%;
|
|
118
72
|
transform: translateY(-50%);
|
|
119
73
|
padding-left: 16px;
|
|
120
|
-
`;
|
|
121
|
-
default:
|
|
122
|
-
return css `
|
|
74
|
+
`;default:return e`
|
|
123
75
|
flex-direction: column-reverse;
|
|
124
76
|
bottom: 100%;
|
|
125
77
|
left: 50%;
|
|
126
78
|
transform: translateX(-50%);
|
|
127
79
|
padding-bottom: 16px;
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
export const SpeedDialRoot = styled.div `
|
|
80
|
+
`}};export const SpeedDialRoot=i.div`
|
|
132
81
|
position: relative;
|
|
133
|
-
display: ${({
|
|
134
|
-
z-index: ${({
|
|
135
|
-
|
|
136
|
-
export const SpeedDialBackdrop = styled.div `
|
|
82
|
+
display: ${({$hidden:o})=>o?"none":"inline-flex"};
|
|
83
|
+
z-index: ${({$zIndex:o})=>o};
|
|
84
|
+
`,SpeedDialBackdrop=i.div`
|
|
137
85
|
position: fixed;
|
|
138
86
|
inset: 0;
|
|
139
|
-
background: rgba(0, 0, 0, ${({
|
|
140
|
-
z-index: ${({
|
|
141
|
-
pointer-events: ${({
|
|
142
|
-
opacity: ${({
|
|
87
|
+
background: rgba(0, 0, 0, ${({$opacity:o})=>o});
|
|
88
|
+
z-index: ${({$zIndex:o})=>o-1};
|
|
89
|
+
pointer-events: ${({$isOpen:o})=>o?"auto":"none"};
|
|
90
|
+
opacity: ${({$isOpen:o})=>o?1:0};
|
|
143
91
|
transition: opacity 0.2s ease;
|
|
144
|
-
|
|
145
|
-
export const SpeedDialFab = styled.button `
|
|
92
|
+
`,SpeedDialFab=i.button`
|
|
146
93
|
position: relative;
|
|
147
94
|
display: flex;
|
|
148
95
|
align-items: center;
|
|
149
96
|
justify-content: center;
|
|
150
|
-
width: ${({
|
|
151
|
-
height: ${({
|
|
97
|
+
width: ${({$size:o})=>sizeConfig[o].fabSize}px;
|
|
98
|
+
height: ${({$size:o})=>sizeConfig[o].fabSize}px;
|
|
152
99
|
border-radius: 50%;
|
|
153
100
|
cursor: pointer;
|
|
154
101
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
155
102
|
outline: none;
|
|
156
103
|
z-index: 2;
|
|
157
104
|
|
|
158
|
-
${({
|
|
105
|
+
${({$variant:o})=>l[o]}
|
|
159
106
|
|
|
160
107
|
/* Custom colors override */
|
|
161
|
-
${({
|
|
162
|
-
${({
|
|
108
|
+
${({$customBg:o})=>o&&e`background: ${o};`}
|
|
109
|
+
${({$customColor:o})=>o&&e`color: ${o};`}
|
|
163
110
|
|
|
164
111
|
/* Icon rotation */
|
|
165
112
|
& > * {
|
|
166
113
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
167
|
-
${({
|
|
168
|
-
transform: rotate(${
|
|
114
|
+
${({$isOpen:o,$rotateOnToggle:t,$rotationDegrees:r})=>o&&t&&e`
|
|
115
|
+
transform: rotate(${r}deg);
|
|
169
116
|
`}
|
|
170
117
|
}
|
|
171
118
|
|
|
172
119
|
/* Focus ring */
|
|
173
120
|
&:focus-visible {
|
|
174
|
-
box-shadow: 0 0 0 3px ${
|
|
121
|
+
box-shadow: 0 0 0 3px ${a.primary||"#3b82f6"}40;
|
|
175
122
|
}
|
|
176
123
|
|
|
177
124
|
/* Disabled state */
|
|
@@ -188,40 +135,30 @@ export const SpeedDialFab = styled.button `
|
|
|
188
135
|
&:active:not(:disabled) {
|
|
189
136
|
transform: scale(0.95);
|
|
190
137
|
}
|
|
191
|
-
|
|
192
|
-
export const SpeedDialActions = styled.div `
|
|
138
|
+
`,SpeedDialActions=i.div`
|
|
193
139
|
position: absolute;
|
|
194
140
|
display: flex;
|
|
195
141
|
align-items: center;
|
|
196
|
-
gap: ${({
|
|
197
|
-
pointer-events: ${({
|
|
142
|
+
gap: ${({$gap:o})=>o}px;
|
|
143
|
+
pointer-events: ${({$isOpen:o})=>o?"auto":"none"};
|
|
198
144
|
|
|
199
|
-
${({
|
|
200
|
-
|
|
201
|
-
export const SpeedDialActionWrapper = styled.div `
|
|
145
|
+
${({$direction:o})=>d(o)}
|
|
146
|
+
`,SpeedDialActionWrapper=i.div`
|
|
202
147
|
display: flex;
|
|
203
148
|
align-items: center;
|
|
204
149
|
gap: 12px;
|
|
205
150
|
|
|
206
|
-
${({
|
|
207
|
-
|
|
208
|
-
return '';
|
|
209
|
-
if ($direction === 'up' || $direction === 'down') {
|
|
210
|
-
return css `flex-direction: row;`;
|
|
211
|
-
}
|
|
212
|
-
return css `flex-direction: column;`;
|
|
213
|
-
}}
|
|
214
|
-
`;
|
|
215
|
-
export const SpeedDialActionButton = styled.button `
|
|
151
|
+
${({$direction:o,$showLabels:t})=>t?o==="up"||o==="down"?e`flex-direction: row;`:e`flex-direction: column;`:""}
|
|
152
|
+
`,SpeedDialActionButton=i.button`
|
|
216
153
|
display: flex;
|
|
217
154
|
align-items: center;
|
|
218
155
|
justify-content: center;
|
|
219
|
-
width: ${({
|
|
220
|
-
height: ${({
|
|
156
|
+
width: ${({$size:o})=>sizeConfig[o].actionSize}px;
|
|
157
|
+
height: ${({$size:o})=>sizeConfig[o].actionSize}px;
|
|
221
158
|
border-radius: 50%;
|
|
222
159
|
border: none;
|
|
223
|
-
background: ${({
|
|
224
|
-
color: ${({
|
|
160
|
+
background: ${({$customBg:o})=>o||"white"};
|
|
161
|
+
color: ${({$customColor:o})=>o||"#374151"};
|
|
225
162
|
cursor: pointer;
|
|
226
163
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
227
164
|
transition: all 0.2s ease;
|
|
@@ -232,19 +169,17 @@ export const SpeedDialActionButton = styled.button `
|
|
|
232
169
|
opacity: 0;
|
|
233
170
|
transform: scale(0.3);
|
|
234
171
|
|
|
235
|
-
${({
|
|
236
|
-
|
|
237
|
-
animation: ${
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
animation: ${fadeOut} ${$animationDuration * 0.5}ms ease forwards;
|
|
242
|
-
animation-delay: ${$index * ($staggerDelay * 0.3)}ms;
|
|
172
|
+
${({$isOpen:o,$index:t,$staggerDelay:r,$animationDuration:s})=>o?e`
|
|
173
|
+
animation: ${c} ${s}ms ease forwards;
|
|
174
|
+
animation-delay: ${t*r}ms;
|
|
175
|
+
`:e`
|
|
176
|
+
animation: ${p} ${s*.5}ms ease forwards;
|
|
177
|
+
animation-delay: ${t*(r*.3)}ms;
|
|
243
178
|
`}
|
|
244
179
|
|
|
245
180
|
/* Focus ring */
|
|
246
181
|
&:focus-visible {
|
|
247
|
-
box-shadow: 0 0 0 3px ${
|
|
182
|
+
box-shadow: 0 0 0 3px ${a.primary||"#3b82f6"}40;
|
|
248
183
|
}
|
|
249
184
|
|
|
250
185
|
/* Disabled state */
|
|
@@ -262,9 +197,8 @@ export const SpeedDialActionButton = styled.button `
|
|
|
262
197
|
&:active:not(:disabled) {
|
|
263
198
|
transform: scale(0.95);
|
|
264
199
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
font-size: ${({ $size }) => sizeConfig[$size].labelFontSize};
|
|
200
|
+
`,SpeedDialActionLabel=i.span`
|
|
201
|
+
font-size: ${({$size:o})=>sizeConfig[o].labelFontSize};
|
|
268
202
|
font-weight: 500;
|
|
269
203
|
color: #374151;
|
|
270
204
|
white-space: nowrap;
|
|
@@ -275,22 +209,18 @@ export const SpeedDialActionLabel = styled.span `
|
|
|
275
209
|
|
|
276
210
|
/* Animation */
|
|
277
211
|
opacity: 0;
|
|
278
|
-
transform: translateX(${({
|
|
279
|
-
$direction === 'right' ? '-10px' : '0'}) translateY(${({ $direction }) => $direction === 'up' ? '10px' :
|
|
280
|
-
$direction === 'down' ? '-10px' : '0'});
|
|
212
|
+
transform: translateX(${({$direction:o})=>o==="left"?"10px":o==="right"?"-10px":"0"}) translateY(${({$direction:o})=>o==="up"?"10px":o==="down"?"-10px":"0"});
|
|
281
213
|
|
|
282
|
-
${({
|
|
283
|
-
|
|
284
|
-
animation: ${
|
|
285
|
-
animation-delay: ${$index * $staggerDelay + 50}ms;
|
|
214
|
+
${({$isOpen:o,$index:t,$staggerDelay:r})=>o&&e`
|
|
215
|
+
animation: ${c} 150ms ease forwards;
|
|
216
|
+
animation-delay: ${t*r+50}ms;
|
|
286
217
|
`}
|
|
287
|
-
|
|
288
|
-
export const IconWrapper = styled.span `
|
|
218
|
+
`,IconWrapper=i.span`
|
|
289
219
|
display: flex;
|
|
290
220
|
align-items: center;
|
|
291
221
|
justify-content: center;
|
|
292
|
-
width: ${({
|
|
293
|
-
height: ${({
|
|
222
|
+
width: ${({$size:o,$isAction:t})=>t?sizeConfig[o].actionIconSize:sizeConfig[o].iconSize}px;
|
|
223
|
+
height: ${({$size:o,$isAction:t})=>t?sizeConfig[o].actionIconSize:sizeConfig[o].iconSize}px;
|
|
294
224
|
|
|
295
225
|
svg {
|
|
296
226
|
width: 100%;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from './types';
|
|
1
|
+
"use strict";export{SpeedDial}from"./SpeedDial";export*from"./types";
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export const SPEED_DIAL_DIRECTIONS
|
|
2
|
-
export const SPEED_DIAL_SIZES = ['small', 'medium', 'large'];
|
|
3
|
-
export const SPEED_DIAL_VARIANTS = ['filled', 'outlined', 'soft'];
|
|
1
|
+
"use strict";export const SPEED_DIAL_DIRECTIONS=["up","down","left","right"],SPEED_DIAL_SIZES=["small","medium","large"],SPEED_DIAL_VARIANTS=["filled","outlined","soft"];
|
|
@@ -1,139 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import s from '../../tc.module.css';
|
|
3
|
-
import { cn } from '../../utils';
|
|
4
|
-
const DEFAULT_COLORS = {
|
|
5
|
-
completedColor: '#ffae1a',
|
|
6
|
-
activeColor: '#ffae1a',
|
|
7
|
-
pendingColor: '#d1d5db',
|
|
8
|
-
lineColor: '#d1d5db',
|
|
9
|
-
completedTextColor: '#374151',
|
|
10
|
-
activeTextColor: '#ffffff',
|
|
11
|
-
pendingTextColor: '#9ca3af', // gray-400
|
|
12
|
-
};
|
|
13
|
-
const SIZE_CONFIG = {
|
|
14
|
-
sm: { stepSize: 24, fontSize: '0.625rem', padding: 2 },
|
|
15
|
-
md: { stepSize: 32, fontSize: '0.75rem', padding: 4 },
|
|
16
|
-
lg: { stepSize: 40, fontSize: '0.875rem', padding: 6 },
|
|
17
|
-
};
|
|
18
|
-
export const Stepper = ({ className = '', steps, currentStep = 1, onStepClick, size = 'md', colors = {}, showNumbers = true, lineThickness = 2, stepSize, clickable = true, style, orientation = 'horizontal', classNames: customClassNames = {}, styles: customStyles = {}, }) => {
|
|
19
|
-
const mergedColors = { ...DEFAULT_COLORS, ...colors };
|
|
20
|
-
const sizeConfig = SIZE_CONFIG[size];
|
|
21
|
-
const finalStepSize = stepSize || sizeConfig.stepSize;
|
|
22
|
-
const linePosition = sizeConfig.padding + finalStepSize / 2;
|
|
23
|
-
const finalClass = cn(className, s['w-full'], s['px-4'], s['sm:px-8'], customClassNames.container);
|
|
24
|
-
// Helper to get step info
|
|
25
|
-
const getStepInfo = (step, index) => {
|
|
26
|
-
if (typeof step === 'string') {
|
|
27
|
-
return {
|
|
28
|
-
label: step,
|
|
29
|
-
number: index + 1,
|
|
30
|
-
description: undefined,
|
|
31
|
-
status: undefined,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
label: step.label,
|
|
36
|
-
number: step.number ?? index + 1,
|
|
37
|
-
description: step.description,
|
|
38
|
-
status: step.status,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
const Steps = steps?.map((step, index) => {
|
|
42
|
-
const stepInfo = getStepInfo(step, index);
|
|
43
|
-
const stepNumber = stepInfo.number;
|
|
44
|
-
// Determine status
|
|
45
|
-
let status;
|
|
46
|
-
if (stepInfo.status) {
|
|
47
|
-
status = stepInfo.status;
|
|
48
|
-
}
|
|
49
|
-
else if (stepNumber < currentStep) {
|
|
50
|
-
status = 'completed';
|
|
51
|
-
}
|
|
52
|
-
else if (stepNumber === currentStep) {
|
|
53
|
-
status = 'current';
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
status = 'pending';
|
|
57
|
-
}
|
|
58
|
-
// Base step classes
|
|
59
|
-
let stepClass = cn(s['inline-block'], s['transform'], s['-translate-x-1/2'], s['rounded-full'], s['text-center'], s['font-medium'], s['border']);
|
|
60
|
-
// Apply styles based on status
|
|
61
|
-
const stepStyles = {
|
|
62
|
-
width: `${finalStepSize}px`,
|
|
63
|
-
height: `${finalStepSize}px`,
|
|
64
|
-
fontSize: sizeConfig.fontSize,
|
|
65
|
-
position: 'relative',
|
|
66
|
-
zIndex: 10,
|
|
67
|
-
display: 'flex',
|
|
68
|
-
alignItems: 'center',
|
|
69
|
-
justifyContent: 'center',
|
|
70
|
-
borderWidth: '2px',
|
|
71
|
-
borderStyle: 'solid',
|
|
72
|
-
transition: 'all 0.3s ease',
|
|
73
|
-
lineHeight: 1,
|
|
74
|
-
};
|
|
75
|
-
if (status === 'completed') {
|
|
76
|
-
stepStyles.borderColor = mergedColors.completedColor;
|
|
77
|
-
stepStyles.backgroundColor = '#ffffff';
|
|
78
|
-
stepStyles.color = mergedColors.completedTextColor;
|
|
79
|
-
}
|
|
80
|
-
else if (status === 'current') {
|
|
81
|
-
stepStyles.borderColor = mergedColors.activeColor;
|
|
82
|
-
stepStyles.backgroundColor = mergedColors.activeColor;
|
|
83
|
-
stepStyles.color = mergedColors.activeTextColor;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
// pending
|
|
87
|
-
stepStyles.borderColor = mergedColors.pendingColor;
|
|
88
|
-
stepStyles.backgroundColor = '#ffffff';
|
|
89
|
-
stepStyles.color = mergedColors.pendingTextColor;
|
|
90
|
-
}
|
|
91
|
-
if (clickable && onStepClick) {
|
|
92
|
-
stepStyles.cursor = 'pointer';
|
|
93
|
-
}
|
|
94
|
-
return (_jsxs("div", { style: {
|
|
95
|
-
left: steps.length > 1 ? `${(index / (steps.length - 1)) * 100}%` : '50%',
|
|
96
|
-
...customStyles.stepWrapper,
|
|
97
|
-
}, className: cn(s['absolute'], customClassNames.stepWrapper), children: [_jsx("span", { className: cn(stepClass, s['font-arimaRegular'], customClassNames.stepCircle), style: { ...stepStyles, ...customStyles.stepCircle }, onClick: () => {
|
|
98
|
-
if (clickable && onStepClick) {
|
|
99
|
-
onStepClick(stepNumber, step, index);
|
|
100
|
-
}
|
|
101
|
-
}, children: showNumbers ? stepNumber : stepInfo.label }), !showNumbers && stepInfo.description && (_jsx("div", { className: customClassNames.stepDescription, style: {
|
|
102
|
-
position: 'absolute',
|
|
103
|
-
top: `${finalStepSize + 8}px`,
|
|
104
|
-
left: '50%',
|
|
105
|
-
transform: 'translateX(-50%)',
|
|
106
|
-
fontSize: '0.75rem',
|
|
107
|
-
color: status === 'current'
|
|
108
|
-
? mergedColors.activeColor
|
|
109
|
-
: mergedColors.pendingTextColor,
|
|
110
|
-
whiteSpace: 'nowrap',
|
|
111
|
-
...customStyles.stepDescription,
|
|
112
|
-
}, children: stepInfo.description }))] }, `step-${index}-${stepInfo.label}`));
|
|
113
|
-
});
|
|
114
|
-
// Calculate progress width based on current step
|
|
115
|
-
const progressWidth = steps.length > 1
|
|
116
|
-
? `${((currentStep - 1) / (steps.length - 1)) * 100}%`
|
|
117
|
-
: '0%';
|
|
118
|
-
const containerHeight = sizeConfig.padding * 2 + finalStepSize;
|
|
119
|
-
return (_jsx("div", { className: finalClass, style: { ...style, ...customStyles.container }, children: _jsxs("div", { className: cn(s['w-full'], s['relative'], customClassNames.stepsWrapper), style: {
|
|
120
|
-
minHeight: `${containerHeight}px`,
|
|
121
|
-
paddingTop: `${sizeConfig.padding}px`,
|
|
122
|
-
...customStyles.stepsWrapper,
|
|
123
|
-
}, children: [_jsx("div", { className: cn(s['absolute'], s['left-0'], s['w-full'], s['transition-width'], s['ease-in-out'], s['duration-500'], customClassNames.backgroundLine), style: {
|
|
124
|
-
top: `${linePosition}px`,
|
|
125
|
-
height: `${lineThickness}px`,
|
|
126
|
-
backgroundColor: mergedColors.lineColor,
|
|
127
|
-
transform: 'translateY(-50%)',
|
|
128
|
-
zIndex: 0,
|
|
129
|
-
...customStyles.backgroundLine,
|
|
130
|
-
} }), _jsx("div", { className: cn(s['absolute'], s['left-0'], s['transition-width'], s['ease-in-out'], s['duration-500'], customClassNames.progressLine), style: {
|
|
131
|
-
top: `${linePosition}px`,
|
|
132
|
-
width: progressWidth,
|
|
133
|
-
height: `${lineThickness}px`,
|
|
134
|
-
backgroundColor: mergedColors.completedColor,
|
|
135
|
-
transform: 'translateY(-50%)',
|
|
136
|
-
zIndex: 1,
|
|
137
|
-
...customStyles.progressLine,
|
|
138
|
-
} }), _jsx("div", { className: cn(s['relative'], s['sm:block']), style: { zIndex: 2 }, children: Steps })] }) }));
|
|
139
|
-
};
|
|
1
|
+
"use strict";import{jsx as p,jsxs as v}from"react/jsx-runtime";import e from"../../tc.module.css";import{cn as n}from"../../utils";const _={completedColor:"#ffae1a",activeColor:"#ffae1a",pendingColor:"#d1d5db",lineColor:"#d1d5db",completedTextColor:"#374151",activeTextColor:"#ffffff",pendingTextColor:"#9ca3af"},D={sm:{stepSize:24,fontSize:"0.625rem",padding:2},md:{stepSize:32,fontSize:"0.75rem",padding:4},lg:{stepSize:40,fontSize:"0.875rem",padding:6}};export const Stepper=({className:$="",steps:f,currentStep:b=1,onStepClick:m,size:S="md",colors:I={},showNumbers:C=!0,lineThickness:x=2,stepSize:w,clickable:h=!0,style:y,orientation:H="horizontal",classNames:i={},styles:l={}})=>{const o={..._,...I},c=D[S],g=w||c.stepSize,z=c.padding+g/2,T=n($,e["w-full"],e["px-4"],e["sm:px-8"],i.container),k=(r,a)=>typeof r=="string"?{label:r,number:a+1,description:void 0,status:void 0}:{label:r.label,number:r.number??a+1,description:r.description,status:r.status},L=f?.map((r,a)=>{const s=k(r,a),u=s.number;let d;s.status?d=s.status:u<b?d="completed":u===b?d="current":d="pending";let N=n(e["inline-block"],e.transform,e["-translate-x-1/2"],e["rounded-full"],e["text-center"],e["font-medium"],e.border);const t={width:`${g}px`,height:`${g}px`,fontSize:c.fontSize,position:"relative",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"2px",borderStyle:"solid",transition:"all 0.3s ease",lineHeight:1};return d==="completed"?(t.borderColor=o.completedColor,t.backgroundColor="#ffffff",t.color=o.completedTextColor):d==="current"?(t.borderColor=o.activeColor,t.backgroundColor=o.activeColor,t.color=o.activeTextColor):(t.borderColor=o.pendingColor,t.backgroundColor="#ffffff",t.color=o.pendingTextColor),h&&m&&(t.cursor="pointer"),v("div",{style:{left:f.length>1?`${a/(f.length-1)*100}%`:"50%",...l.stepWrapper},className:n(e.absolute,i.stepWrapper),children:[p("span",{className:n(N,e["font-arimaRegular"],i.stepCircle),style:{...t,...l.stepCircle},onClick:()=>{h&&m&&m(u,r,a)},children:C?u:s.label}),!C&&s.description&&p("div",{className:i.stepDescription,style:{position:"absolute",top:`${g+8}px`,left:"50%",transform:"translateX(-50%)",fontSize:"0.75rem",color:d==="current"?o.activeColor:o.pendingTextColor,whiteSpace:"nowrap",...l.stepDescription},children:s.description})]},`step-${a}-${s.label}`)}),W=f.length>1?`${(b-1)/(f.length-1)*100}%`:"0%",j=c.padding*2+g;return p("div",{className:T,style:{...y,...l.container},children:v("div",{className:n(e["w-full"],e.relative,i.stepsWrapper),style:{minHeight:`${j}px`,paddingTop:`${c.padding}px`,...l.stepsWrapper},children:[p("div",{className:n(e.absolute,e["left-0"],e["w-full"],e["transition-width"],e["ease-in-out"],e["duration-500"],i.backgroundLine),style:{top:`${z}px`,height:`${x}px`,backgroundColor:o.lineColor,transform:"translateY(-50%)",zIndex:0,...l.backgroundLine}}),p("div",{className:n(e.absolute,e["left-0"],e["transition-width"],e["ease-in-out"],e["duration-500"],i.progressLine),style:{top:`${z}px`,width:W,height:`${x}px`,backgroundColor:o.completedColor,transform:"translateY(-50%)",zIndex:1,...l.progressLine}}),p("div",{className:n(e.relative,e["sm:block"]),style:{zIndex:2},children:L})]})})};
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import React, { forwardRef } from 'react';
|
|
4
|
-
import { SwitchLabel, LabelContent, LabelText, DescriptionText, HiddenInput, SwitchTrack, SwitchThumb, IconWrapper, } from './elements';
|
|
5
|
-
// Icons
|
|
6
|
-
const CheckIcon = () => (_jsx("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("polyline", { points: "2 6 5 9 10 3" }) }));
|
|
7
|
-
const CloseIcon = () => (_jsxs("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("line", { x1: "3", y1: "3", x2: "9", y2: "9" }), _jsx("line", { x1: "9", y1: "3", x2: "3", y2: "9" })] }));
|
|
8
|
-
export const Switch = forwardRef(function SwitchComponent(props, ref) {
|
|
9
|
-
const { label, labelPosition = 'right', size = 'medium', color = 'primary', checked, defaultChecked, disabled = false, showIcons = false, description, className, id, ...rest } = props;
|
|
10
|
-
// Use internal state if uncontrolled
|
|
11
|
-
const [internalChecked, setInternalChecked] = React.useState(defaultChecked ?? false);
|
|
12
|
-
const isControlled = checked !== undefined;
|
|
13
|
-
const isChecked = isControlled ? checked : internalChecked;
|
|
14
|
-
const handleChange = (e) => {
|
|
15
|
-
if (!isControlled) {
|
|
16
|
-
setInternalChecked(e.target.checked);
|
|
17
|
-
}
|
|
18
|
-
rest.onChange?.(e);
|
|
19
|
-
};
|
|
20
|
-
const switchElement = (_jsxs(_Fragment, { children: [_jsx(HiddenInput, { ref: ref, type: "checkbox", role: "switch", id: id, checked: isChecked, disabled: disabled, onChange: handleChange, "aria-checked": isChecked, ...rest }), _jsxs(SwitchTrack, { "$size": size, "$color": color, "$checked": isChecked, "$disabled": disabled, "$showIcons": showIcons, "aria-hidden": "true", children: [showIcons && (_jsxs(_Fragment, { children: [_jsx(IconWrapper, { "$size": size, "$position": "left", "$visible": isChecked, children: _jsx(CheckIcon, {}) }), _jsx(IconWrapper, { "$size": size, "$position": "right", "$visible": !isChecked, children: _jsx(CloseIcon, {}) })] })), _jsx(SwitchThumb, { "$size": size, "$checked": isChecked })] })] }));
|
|
21
|
-
if (!label && !description) {
|
|
22
|
-
return (_jsx(SwitchLabel, { "$labelPosition": labelPosition, "$disabled": disabled, "data-aui": "switch", className: className, children: switchElement }));
|
|
23
|
-
}
|
|
24
|
-
return (_jsxs(SwitchLabel, { "$labelPosition": labelPosition, "$disabled": disabled, "data-aui": "switch", className: className, htmlFor: id, children: [switchElement, _jsxs(LabelContent, { "$size": size, children: [label && _jsx(LabelText, { "$size": size, children: label }), description && _jsx(DescriptionText, { "$size": size, children: description })] })] }));
|
|
25
|
-
});
|
|
26
|
-
Switch.displayName = 'Switch';
|
|
1
|
+
"use strict";"use client";import{jsx as e,jsxs as s,Fragment as p}from"react/jsx-runtime";import I,{forwardRef as S}from"react";import{SwitchLabel as b,LabelContent as v,LabelText as j,DescriptionText as N,HiddenInput as T,SwitchTrack as F,SwitchThumb as L,IconWrapper as u}from"./elements";const P=()=>e("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e("polyline",{points:"2 6 5 9 10 3"})}),W=()=>s("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("line",{x1:"3",y1:"3",x2:"9",y2:"9"}),e("line",{x1:"9",y1:"3",x2:"3",y2:"9"})]});export const Switch=S(function(w,C){const{label:c,labelPosition:l="right",size:i="medium",color:x="primary",checked:r,defaultChecked:g,disabled:t=!1,showIcons:a=!1,description:o,className:d,id:h,...$}=w,[y,z]=I.useState(g??!1),m=r!==void 0,n=m?r:y,f=s(p,{children:[e(T,{ref:C,type:"checkbox",role:"switch",id:h,checked:n,disabled:t,onChange:k=>{m||z(k.target.checked),$.onChange?.(k)},"aria-checked":n,...$}),s(F,{$size:i,$color:x,$checked:n,$disabled:t,$showIcons:a,"aria-hidden":"true",children:[a&&s(p,{children:[e(u,{$size:i,$position:"left",$visible:n,children:e(P,{})}),e(u,{$size:i,$position:"right",$visible:!n,children:e(W,{})})]}),e(L,{$size:i,$checked:n})]})]});return!c&&!o?e(b,{$labelPosition:l,$disabled:t,"data-aui":"switch",className:d,children:f}):s(b,{$labelPosition:l,$disabled:t,"data-aui":"switch",className:d,htmlFor:h,children:[f,s(v,{$size:i,children:[c&&e(j,{$size:i,children:c}),o&&e(N,{$size:i,children:o})]})]})});Switch.displayName="Switch";
|