@refraktor/core 0.0.4 → 0.0.5
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/build/components/progress-circle/progress-circle.d.ts.map +1 -1
- package/build/components/progress-circle/progress-circle.js +6 -6
- package/build/components/progress-circle/progress-circle.styles.d.ts +2 -7
- package/build/components/progress-circle/progress-circle.styles.d.ts.map +1 -1
- package/build/components/progress-circle/progress-circle.styles.js +2 -23
- package/build/components/progress-circle/progress-circle.types.d.ts +4 -3
- package/build/components/progress-circle/progress-circle.types.d.ts.map +1 -1
- package/build/components/slider/slider.d.ts.map +1 -1
- package/build/components/slider/slider.js +69 -20
- package/build/components/tooltip/tooltip.js +1 -1
- package/build/style.css +2 -2
- package/package.json +30 -3
- package/.turbo/turbo-build.log +0 -4
- package/refraktor-core-0.0.1-alpha.0.tgz +0 -0
- package/src/components/accordion/accordion-control/accordion-control.tsx +0 -156
- package/src/components/accordion/accordion-control/index.ts +0 -1
- package/src/components/accordion/accordion-item/accordion-item.tsx +0 -40
- package/src/components/accordion/accordion-item/index.ts +0 -1
- package/src/components/accordion/accordion-panel/accordion-panel.tsx +0 -58
- package/src/components/accordion/accordion-panel/index.ts +0 -1
- package/src/components/accordion/accordion.context.ts +0 -93
- package/src/components/accordion/accordion.styles.ts +0 -60
- package/src/components/accordion/accordion.test.tsx +0 -174
- package/src/components/accordion/accordion.tsx +0 -203
- package/src/components/accordion/accordion.types.ts +0 -126
- package/src/components/accordion/index.ts +0 -17
- package/src/components/avatar/avatar-group/avatar-group.tsx +0 -73
- package/src/components/avatar/avatar-group/index.ts +0 -1
- package/src/components/avatar/avatar.styles.ts +0 -11
- package/src/components/avatar/avatar.tsx +0 -142
- package/src/components/avatar/avatar.types.ts +0 -86
- package/src/components/avatar/index.ts +0 -8
- package/src/components/badge/badge.styles.ts +0 -21
- package/src/components/badge/badge.tsx +0 -62
- package/src/components/badge/badge.types.ts +0 -40
- package/src/components/badge/index.ts +0 -2
- package/src/components/breadcrumbs/breadcrumbs.styles.ts +0 -55
- package/src/components/breadcrumbs/breadcrumbs.test.tsx +0 -136
- package/src/components/breadcrumbs/breadcrumbs.tsx +0 -199
- package/src/components/breadcrumbs/breadcrumbs.types.ts +0 -78
- package/src/components/breadcrumbs/breadcrumbs.utils.ts +0 -70
- package/src/components/breadcrumbs/index.ts +0 -6
- package/src/components/button/button.styles.ts +0 -28
- package/src/components/button/button.test.tsx +0 -57
- package/src/components/button/button.tsx +0 -110
- package/src/components/button/button.types.ts +0 -69
- package/src/components/button/index.ts +0 -2
- package/src/components/checkbox/checkbox-group/checkbox-group.tsx +0 -93
- package/src/components/checkbox/checkbox-group/index.ts +0 -1
- package/src/components/checkbox/checkbox.context.ts +0 -14
- package/src/components/checkbox/checkbox.styles.ts +0 -49
- package/src/components/checkbox/checkbox.test.tsx +0 -80
- package/src/components/checkbox/checkbox.tsx +0 -192
- package/src/components/checkbox/checkbox.types.ts +0 -125
- package/src/components/checkbox/index.ts +0 -10
- package/src/components/chip/chip-group/chip-group.tsx +0 -107
- package/src/components/chip/chip-group/index.ts +0 -1
- package/src/components/chip/chip.context.ts +0 -15
- package/src/components/chip/chip.styles.ts +0 -36
- package/src/components/chip/chip.test.tsx +0 -197
- package/src/components/chip/chip.tsx +0 -208
- package/src/components/chip/chip.types.ts +0 -134
- package/src/components/chip/index.ts +0 -10
- package/src/components/color-swatch/color-swatch.styles.ts +0 -11
- package/src/components/color-swatch/color-swatch.test.tsx +0 -80
- package/src/components/color-swatch/color-swatch.tsx +0 -84
- package/src/components/color-swatch/color-swatch.types.ts +0 -46
- package/src/components/color-swatch/index.ts +0 -2
- package/src/components/drawer/drawer-body/drawer-body.tsx +0 -29
- package/src/components/drawer/drawer-body/index.ts +0 -1
- package/src/components/drawer/drawer-close/drawer-close.tsx +0 -43
- package/src/components/drawer/drawer-close/index.ts +0 -1
- package/src/components/drawer/drawer-content/drawer-content.tsx +0 -135
- package/src/components/drawer/drawer-content/index.ts +0 -1
- package/src/components/drawer/drawer-header/drawer-header.tsx +0 -40
- package/src/components/drawer/drawer-header/index.ts +0 -1
- package/src/components/drawer/drawer-overlay/drawer-overlay.tsx +0 -87
- package/src/components/drawer/drawer-overlay/index.ts +0 -1
- package/src/components/drawer/drawer-root/drawer-root.tsx +0 -93
- package/src/components/drawer/drawer-root/index.ts +0 -1
- package/src/components/drawer/drawer.context.ts +0 -26
- package/src/components/drawer/drawer.styles.ts +0 -32
- package/src/components/drawer/drawer.test.tsx +0 -274
- package/src/components/drawer/drawer.tsx +0 -58
- package/src/components/drawer/drawer.types.ts +0 -192
- package/src/components/drawer/index.ts +0 -18
- package/src/components/drawer/use-drawer.ts +0 -94
- package/src/components/file-input/file-input.test.tsx +0 -134
- package/src/components/file-input/file-input.tsx +0 -224
- package/src/components/file-input/file-input.types.ts +0 -78
- package/src/components/file-input/file-input.utils.test.ts +0 -36
- package/src/components/file-input/file-input.utils.ts +0 -130
- package/src/components/file-input/index.ts +0 -2
- package/src/components/for/for.test.tsx +0 -66
- package/src/components/for/for.tsx +0 -53
- package/src/components/for/for.types.ts +0 -40
- package/src/components/for/index.ts +0 -2
- package/src/components/index.ts +0 -35
- package/src/components/input/index.ts +0 -2
- package/src/components/input/input-description/index.ts +0 -2
- package/src/components/input/input-description/input-description.tsx +0 -36
- package/src/components/input/input-error/index.ts +0 -2
- package/src/components/input/input-error/input-error.tsx +0 -36
- package/src/components/input/input-field/index.ts +0 -1
- package/src/components/input/input-field/input-field.styles.ts +0 -23
- package/src/components/input/input-field/input-field.tsx +0 -94
- package/src/components/input/input-label/index.ts +0 -2
- package/src/components/input/input-label/input-label.tsx +0 -47
- package/src/components/input/input-wrapper/index.ts +0 -2
- package/src/components/input/input-wrapper/input-wrapper.tsx +0 -43
- package/src/components/input/input.tsx +0 -71
- package/src/components/input/input.types.ts +0 -111
- package/src/components/loader/index.ts +0 -2
- package/src/components/loader/loader.tsx +0 -89
- package/src/components/loader/loader.types.ts +0 -33
- package/src/components/menu/index.ts +0 -24
- package/src/components/menu/menu-dropdown/index.ts +0 -1
- package/src/components/menu/menu-dropdown/menu-dropdown.tsx +0 -220
- package/src/components/menu/menu-item/index.ts +0 -1
- package/src/components/menu/menu-item/menu-item.tsx +0 -126
- package/src/components/menu/menu-label/index.ts +0 -1
- package/src/components/menu/menu-label/menu-label.tsx +0 -30
- package/src/components/menu/menu-separator/index.ts +0 -1
- package/src/components/menu/menu-separator/menu-separator.tsx +0 -28
- package/src/components/menu/menu-sub/index.ts +0 -1
- package/src/components/menu/menu-sub/menu-sub.tsx +0 -117
- package/src/components/menu/menu-sub-dropdown/index.ts +0 -1
- package/src/components/menu/menu-sub-dropdown/menu-sub-dropdown.tsx +0 -221
- package/src/components/menu/menu-sub-trigger/index.ts +0 -1
- package/src/components/menu/menu-sub-trigger/menu-sub-trigger.tsx +0 -164
- package/src/components/menu/menu-trigger/index.ts +0 -1
- package/src/components/menu/menu-trigger/menu-trigger.tsx +0 -98
- package/src/components/menu/menu.context.ts +0 -162
- package/src/components/menu/menu.test.tsx +0 -136
- package/src/components/menu/menu.tsx +0 -133
- package/src/components/menu/menu.types.ts +0 -291
- package/src/components/menu/use-menu.ts +0 -204
- package/src/components/modal/index.ts +0 -18
- package/src/components/modal/modal-body/index.ts +0 -1
- package/src/components/modal/modal-body/modal-body.tsx +0 -29
- package/src/components/modal/modal-close/index.ts +0 -1
- package/src/components/modal/modal-close/modal-close.tsx +0 -43
- package/src/components/modal/modal-content/index.ts +0 -1
- package/src/components/modal/modal-content/modal-content.tsx +0 -119
- package/src/components/modal/modal-header/index.ts +0 -1
- package/src/components/modal/modal-header/modal-header.tsx +0 -40
- package/src/components/modal/modal-overlay/index.ts +0 -1
- package/src/components/modal/modal-overlay/modal-overlay.tsx +0 -87
- package/src/components/modal/modal-root/index.ts +0 -1
- package/src/components/modal/modal-root/modal-root.tsx +0 -93
- package/src/components/modal/modal.context.ts +0 -26
- package/src/components/modal/modal.test.tsx +0 -316
- package/src/components/modal/modal.tsx +0 -58
- package/src/components/modal/modal.types.ts +0 -189
- package/src/components/modal/use-modal.ts +0 -94
- package/src/components/number-input/index.ts +0 -2
- package/src/components/number-input/number-input.styles.ts +0 -37
- package/src/components/number-input/number-input.test.tsx +0 -22
- package/src/components/number-input/number-input.tsx +0 -381
- package/src/components/number-input/number-input.types.ts +0 -58
- package/src/components/pagination/index.ts +0 -7
- package/src/components/pagination/pagination.styles.ts +0 -84
- package/src/components/pagination/pagination.test.tsx +0 -117
- package/src/components/pagination/pagination.tsx +0 -371
- package/src/components/pagination/pagination.types.ts +0 -95
- package/src/components/pagination/pagination.utils.ts +0 -88
- package/src/components/password-input/index.ts +0 -2
- package/src/components/password-input/password-input.test.tsx +0 -72
- package/src/components/password-input/password-input.tsx +0 -85
- package/src/components/password-input/password-input.types.ts +0 -30
- package/src/components/pin-input/index.ts +0 -2
- package/src/components/pin-input/pin-input.test.tsx +0 -149
- package/src/components/pin-input/pin-input.tsx +0 -473
- package/src/components/pin-input/pin-input.types.ts +0 -78
- package/src/components/popover/index.ts +0 -12
- package/src/components/popover/popover-dropdown/index.ts +0 -1
- package/src/components/popover/popover-dropdown/popover-dropdown.tsx +0 -94
- package/src/components/popover/popover-trigger/index.ts +0 -1
- package/src/components/popover/popover-trigger/popover-trigger.tsx +0 -49
- package/src/components/popover/popover.context.ts +0 -20
- package/src/components/popover/popover.tsx +0 -113
- package/src/components/popover/popover.types.ts +0 -137
- package/src/components/popover/use-popover.ts +0 -219
- package/src/components/portal/index.ts +0 -2
- package/src/components/portal/portal.test.tsx +0 -39
- package/src/components/portal/portal.tsx +0 -104
- package/src/components/portal/portal.types.ts +0 -31
- package/src/components/progress/index.ts +0 -2
- package/src/components/progress/progress.styles.ts +0 -25
- package/src/components/progress/progress.test.tsx +0 -107
- package/src/components/progress/progress.tsx +0 -93
- package/src/components/progress/progress.types.ts +0 -52
- package/src/components/progress-circle/index.ts +0 -5
- package/src/components/progress-circle/progress-circle.styles.ts +0 -31
- package/src/components/progress-circle/progress-circle.test.tsx +0 -140
- package/src/components/progress-circle/progress-circle.tsx +0 -124
- package/src/components/progress-circle/progress-circle.types.ts +0 -52
- package/src/components/radio/index.ts +0 -10
- package/src/components/radio/radio-group/index.ts +0 -1
- package/src/components/radio/radio-group/radio-group.tsx +0 -89
- package/src/components/radio/radio.context.ts +0 -14
- package/src/components/radio/radio.styles.ts +0 -49
- package/src/components/radio/radio.test.tsx +0 -75
- package/src/components/radio/radio.tsx +0 -173
- package/src/components/radio/radio.types.ts +0 -126
- package/src/components/scroll-area/index.ts +0 -6
- package/src/components/scroll-area/scroll-area.test.tsx +0 -72
- package/src/components/scroll-area/scroll-area.tsx +0 -70
- package/src/components/scroll-area/scroll-area.types.ts +0 -37
- package/src/components/segmented-control/index.ts +0 -6
- package/src/components/segmented-control/segmented-control.styles.ts +0 -37
- package/src/components/segmented-control/segmented-control.test.tsx +0 -170
- package/src/components/segmented-control/segmented-control.tsx +0 -255
- package/src/components/segmented-control/segmented-control.types.ts +0 -78
- package/src/components/select/index.ts +0 -20
- package/src/components/select/select-dropdown/index.ts +0 -1
- package/src/components/select/select-dropdown/select-dropdown.tsx +0 -299
- package/src/components/select/select-group/index.ts +0 -1
- package/src/components/select/select-group/select-group.tsx +0 -47
- package/src/components/select/select-item/index.ts +0 -1
- package/src/components/select/select-item/select-item.tsx +0 -157
- package/src/components/select/select-root/index.ts +0 -1
- package/src/components/select/select-root/select-root.tsx +0 -333
- package/src/components/select/select-trigger/index.ts +0 -1
- package/src/components/select/select-trigger/select-trigger.tsx +0 -123
- package/src/components/select/select.context.ts +0 -140
- package/src/components/select/select.test.tsx +0 -190
- package/src/components/select/select.tsx +0 -82
- package/src/components/select/select.types.ts +0 -272
- package/src/components/select/use-select.ts +0 -170
- package/src/components/slider/index.ts +0 -7
- package/src/components/slider/slider.styles.ts +0 -37
- package/src/components/slider/slider.tsx +0 -275
- package/src/components/slider/slider.types.ts +0 -82
- package/src/components/switch/index.ts +0 -2
- package/src/components/switch/switch.styles.ts +0 -31
- package/src/components/switch/switch.tsx +0 -132
- package/src/components/switch/switch.types.ts +0 -62
- package/src/components/table/index.ts +0 -24
- package/src/components/table/table-body/index.ts +0 -1
- package/src/components/table/table-body/table-body.tsx +0 -37
- package/src/components/table/table-caption/index.ts +0 -1
- package/src/components/table/table-caption/table-caption.tsx +0 -32
- package/src/components/table/table-cell/index.ts +0 -1
- package/src/components/table/table-cell/table-cell.tsx +0 -33
- package/src/components/table/table-head/index.ts +0 -1
- package/src/components/table/table-head/table-head.tsx +0 -29
- package/src/components/table/table-header-cell/index.ts +0 -1
- package/src/components/table/table-header-cell/table-header-cell.tsx +0 -33
- package/src/components/table/table-row/index.ts +0 -1
- package/src/components/table/table-row/table-row.tsx +0 -30
- package/src/components/table/table.context.ts +0 -18
- package/src/components/table/table.styles.ts +0 -62
- package/src/components/table/table.test.tsx +0 -145
- package/src/components/table/table.tsx +0 -91
- package/src/components/table/table.types.ts +0 -145
- package/src/components/tabs/index.ts +0 -18
- package/src/components/tabs/tabs-list/index.ts +0 -1
- package/src/components/tabs/tabs-list/tabs-list.tsx +0 -42
- package/src/components/tabs/tabs-panel/index.ts +0 -1
- package/src/components/tabs/tabs-panel/tabs-panel.tsx +0 -58
- package/src/components/tabs/tabs-tab/index.ts +0 -1
- package/src/components/tabs/tabs-tab/tabs-tab.tsx +0 -210
- package/src/components/tabs/tabs.context.ts +0 -88
- package/src/components/tabs/tabs.styles.ts +0 -92
- package/src/components/tabs/tabs.test.tsx +0 -167
- package/src/components/tabs/tabs.tsx +0 -137
- package/src/components/tabs/tabs.types.ts +0 -128
- package/src/components/textarea/index.ts +0 -2
- package/src/components/textarea/textarea-field/index.ts +0 -1
- package/src/components/textarea/textarea-field/textarea-field.styles.ts +0 -34
- package/src/components/textarea/textarea-field/textarea-field.tsx +0 -96
- package/src/components/textarea/textarea.tsx +0 -64
- package/src/components/textarea/textarea.types.ts +0 -80
- package/src/components/timeline/index.ts +0 -11
- package/src/components/timeline/timeline-item/index.ts +0 -1
- package/src/components/timeline/timeline-item/timeline-item.tsx +0 -158
- package/src/components/timeline/timeline.context.ts +0 -21
- package/src/components/timeline/timeline.styles.ts +0 -135
- package/src/components/timeline/timeline.test.tsx +0 -150
- package/src/components/timeline/timeline.tsx +0 -124
- package/src/components/timeline/timeline.types.ts +0 -91
- package/src/components/tooltip/index.ts +0 -8
- package/src/components/tooltip/tooltip.tsx +0 -164
- package/src/components/tooltip/tooltip.types.ts +0 -104
- package/src/components/tooltip/use-tooltip.ts +0 -200
- package/src/components/transition/index.ts +0 -11
- package/src/components/transition/transition.test.tsx +0 -126
- package/src/components/transition/transition.tsx +0 -441
- package/src/components/transition/transition.types.ts +0 -97
- package/src/components/transition/transitions.ts +0 -140
- package/src/icons/check.tsx +0 -25
- package/src/icons/chevron.tsx +0 -46
- package/src/icons/eye-off.tsx +0 -30
- package/src/icons/eye.tsx +0 -24
- package/src/icons/index.ts +0 -7
- package/src/icons/minus.tsx +0 -24
- package/src/icons/types.ts +0 -9
- package/src/icons/user.tsx +0 -18
- package/src/icons/x.tsx +0 -35
- package/src/index.ts +0 -5
- package/src/style.css +0 -334
- package/src/theme/ThemeProvider/ThemeProvider.tsx +0 -111
- package/src/theme/ThemeProvider/context.ts +0 -7
- package/src/theme/ThemeProvider/generateVariables.test.ts +0 -49
- package/src/theme/ThemeProvider/generateVariables.ts +0 -124
- package/src/theme/ThemeProvider/index.ts +0 -3
- package/src/theme/ThemeProvider/types.ts +0 -37
- package/src/theme/createTheme/createTheme.ts +0 -41
- package/src/theme/createTheme/index.ts +0 -7
- package/src/theme/createTheme/types.ts +0 -62
- package/src/theme/defaults/colors.ts +0 -203
- package/src/theme/defaults/settings.ts +0 -8
- package/src/theme/index.ts +0 -4
- package/src/theme/types.ts +0 -31
- package/src/theme/utils/get-radius.ts +0 -23
- package/src/theme/utils/get-shade.ts +0 -16
- package/src/theme/utils/index.ts +0 -3
- package/src/theme/utils/use-theme.ts +0 -27
- package/src/utils/configs/create-config.ts +0 -15
- package/src/utils/configs/index.ts +0 -3
- package/src/utils/configs/use-class-names.ts +0 -41
- package/src/utils/configs/use-props.ts +0 -55
- package/src/utils/cx/index.ts +0 -6
- package/src/utils/factory/factory.ts +0 -23
- package/src/utils/factory/index.ts +0 -14
- package/src/utils/factory/types.ts +0 -92
- package/src/utils/index.ts +0 -3
- package/src/vitest/index.ts +0 -1
- package/src/vitest/setup.tsx +0 -20
- package/src/vitest/utils.tsx +0 -59
- package/tsconfig.json +0 -13
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.js +0 -19
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { useId, useUncontrolled } from "@refraktor/utils";
|
|
2
|
-
import { useCallback, useEffect } from "react";
|
|
3
|
-
import { useTheme } from "../../theme";
|
|
4
|
-
import {
|
|
5
|
-
createClassNamesConfig,
|
|
6
|
-
createComponentConfig,
|
|
7
|
-
factory,
|
|
8
|
-
useClassNames,
|
|
9
|
-
useProps
|
|
10
|
-
} from "../../utils";
|
|
11
|
-
import { TabsList } from "./tabs-list";
|
|
12
|
-
import { TabsPanel } from "./tabs-panel";
|
|
13
|
-
import {
|
|
14
|
-
getNavigableTabs,
|
|
15
|
-
TabsProvider,
|
|
16
|
-
useTabsRegistry
|
|
17
|
-
} from "./tabs.context";
|
|
18
|
-
import { TabsTab } from "./tabs-tab";
|
|
19
|
-
import { TabsClassNames, TabsFactoryPayload, TabsProps } from "./tabs.types";
|
|
20
|
-
|
|
21
|
-
const defaultProps = {
|
|
22
|
-
orientation: "horizontal",
|
|
23
|
-
activationMode: "automatic",
|
|
24
|
-
loop: true,
|
|
25
|
-
keepMounted: false,
|
|
26
|
-
size: "md",
|
|
27
|
-
radius: "default",
|
|
28
|
-
variant: "underline"
|
|
29
|
-
} satisfies Partial<TabsProps>;
|
|
30
|
-
|
|
31
|
-
const toDomSafeValue = (value: string) =>
|
|
32
|
-
encodeURIComponent(value).replace(/%/g, "-");
|
|
33
|
-
|
|
34
|
-
const Tabs = factory<TabsFactoryPayload>((_props, ref) => {
|
|
35
|
-
const { cx } = useTheme();
|
|
36
|
-
const {
|
|
37
|
-
id,
|
|
38
|
-
children,
|
|
39
|
-
value,
|
|
40
|
-
defaultValue,
|
|
41
|
-
onChange,
|
|
42
|
-
orientation,
|
|
43
|
-
activationMode,
|
|
44
|
-
loop,
|
|
45
|
-
keepMounted,
|
|
46
|
-
size,
|
|
47
|
-
radius,
|
|
48
|
-
variant,
|
|
49
|
-
className,
|
|
50
|
-
classNames,
|
|
51
|
-
...props
|
|
52
|
-
} = useProps("Tabs", defaultProps, _props);
|
|
53
|
-
const classes = useClassNames("Tabs", classNames);
|
|
54
|
-
const _id = useId(id);
|
|
55
|
-
|
|
56
|
-
const [activeValue, setActiveValue, isControlled] = useUncontrolled<string>(
|
|
57
|
-
{
|
|
58
|
-
value,
|
|
59
|
-
defaultValue,
|
|
60
|
-
finalValue: "",
|
|
61
|
-
onChange
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const { registerTab, getTabs } = useTabsRegistry();
|
|
66
|
-
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
if (isControlled || activeValue) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const firstTab = getNavigableTabs(getTabs())[0];
|
|
73
|
-
|
|
74
|
-
if (firstTab) {
|
|
75
|
-
setActiveValue(firstTab.value);
|
|
76
|
-
}
|
|
77
|
-
}, [isControlled, activeValue, getTabs, setActiveValue]);
|
|
78
|
-
|
|
79
|
-
const getTabId = useCallback(
|
|
80
|
-
(tabValue: string) => `${_id}-tab-${toDomSafeValue(tabValue)}`,
|
|
81
|
-
[_id]
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const getPanelId = useCallback(
|
|
85
|
-
(tabValue: string) => `${_id}-panel-${toDomSafeValue(tabValue)}`,
|
|
86
|
-
[_id]
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const getStyles = useCallback(
|
|
90
|
-
(part: keyof TabsClassNames) => classes[part],
|
|
91
|
-
[classes]
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<TabsProvider
|
|
96
|
-
value={{
|
|
97
|
-
value: activeValue,
|
|
98
|
-
onValueChange: setActiveValue,
|
|
99
|
-
orientation,
|
|
100
|
-
activationMode,
|
|
101
|
-
loop,
|
|
102
|
-
keepMounted,
|
|
103
|
-
size,
|
|
104
|
-
radius,
|
|
105
|
-
variant,
|
|
106
|
-
registerTab,
|
|
107
|
-
getTabs,
|
|
108
|
-
getTabId,
|
|
109
|
-
getPanelId,
|
|
110
|
-
getStyles
|
|
111
|
-
}}
|
|
112
|
-
>
|
|
113
|
-
<div
|
|
114
|
-
ref={ref}
|
|
115
|
-
id={_id}
|
|
116
|
-
className={cx(
|
|
117
|
-
"w-full",
|
|
118
|
-
orientation === "vertical" && "flex items-start gap-3",
|
|
119
|
-
classes.root,
|
|
120
|
-
className
|
|
121
|
-
)}
|
|
122
|
-
{...props}
|
|
123
|
-
>
|
|
124
|
-
{children}
|
|
125
|
-
</div>
|
|
126
|
-
</TabsProvider>
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
Tabs.displayName = "@refraktor/core/Tabs";
|
|
131
|
-
Tabs.configure = createComponentConfig<TabsProps>();
|
|
132
|
-
Tabs.classNames = createClassNamesConfig<TabsClassNames>();
|
|
133
|
-
Tabs.List = TabsList;
|
|
134
|
-
Tabs.Tab = TabsTab;
|
|
135
|
-
Tabs.Panel = TabsPanel;
|
|
136
|
-
|
|
137
|
-
export default Tabs;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
-
import { RefraktorRadius, RefraktorSize } from "../../theme";
|
|
3
|
-
import {
|
|
4
|
-
createClassNamesConfig,
|
|
5
|
-
createComponentConfig,
|
|
6
|
-
FactoryPayload
|
|
7
|
-
} from "../../utils";
|
|
8
|
-
import { TabsList } from "./tabs-list";
|
|
9
|
-
import { TabsPanel } from "./tabs-panel";
|
|
10
|
-
import { TabsTab } from "./tabs-tab";
|
|
11
|
-
|
|
12
|
-
export type TabsOrientation = "horizontal" | "vertical";
|
|
13
|
-
export type TabsActivationMode = "automatic" | "manual";
|
|
14
|
-
export type TabsVariant = "pills" | "underline";
|
|
15
|
-
|
|
16
|
-
export type TabsClassNames = {
|
|
17
|
-
root?: string;
|
|
18
|
-
list?: string;
|
|
19
|
-
tab?: string;
|
|
20
|
-
panel?: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export interface TabsProps extends Omit<
|
|
24
|
-
ComponentPropsWithoutRef<"div">,
|
|
25
|
-
"onChange"
|
|
26
|
-
> {
|
|
27
|
-
/** Children containing subcomponents */
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
|
|
30
|
-
/** Active tab value (controlled) */
|
|
31
|
-
value?: string;
|
|
32
|
-
|
|
33
|
-
/** Initial active tab value (uncontrolled) */
|
|
34
|
-
defaultValue?: string;
|
|
35
|
-
|
|
36
|
-
/** Callback called when active tab changes */
|
|
37
|
-
onChange?: (value: string) => void;
|
|
38
|
-
|
|
39
|
-
/** Tabs orientation @default `horizontal` */
|
|
40
|
-
orientation?: TabsOrientation;
|
|
41
|
-
|
|
42
|
-
/** Keyboard activation mode @default `automatic` */
|
|
43
|
-
activationMode?: TabsActivationMode;
|
|
44
|
-
|
|
45
|
-
/** Whether keyboard navigation should wrap around @default `true` */
|
|
46
|
-
loop?: boolean;
|
|
47
|
-
|
|
48
|
-
/** Keep all panels mounted and toggle hidden state @default `false` */
|
|
49
|
-
keepMounted?: boolean;
|
|
50
|
-
|
|
51
|
-
/** The size of tabs @default `md` */
|
|
52
|
-
size?: RefraktorSize;
|
|
53
|
-
|
|
54
|
-
/** The radius used for list and tabs @default `default` */
|
|
55
|
-
radius?: RefraktorRadius;
|
|
56
|
-
|
|
57
|
-
/** Visual style variant @default `underline` */
|
|
58
|
-
variant?: TabsVariant;
|
|
59
|
-
|
|
60
|
-
/** Used for editing root class name */
|
|
61
|
-
className?: string;
|
|
62
|
-
|
|
63
|
-
/** Used for styling different parts of the component */
|
|
64
|
-
classNames?: TabsClassNames;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface TabsListProps extends ComponentPropsWithoutRef<"div"> {
|
|
68
|
-
/** The tab list content */
|
|
69
|
-
children: ReactNode;
|
|
70
|
-
|
|
71
|
-
/** Used for editing root class name */
|
|
72
|
-
className?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface TabsTabProps extends Omit<
|
|
76
|
-
ComponentPropsWithoutRef<"button">,
|
|
77
|
-
"value"
|
|
78
|
-
> {
|
|
79
|
-
/** The tab value used to link with panel */
|
|
80
|
-
value: string;
|
|
81
|
-
|
|
82
|
-
/** Whether the tab is disabled @default `false` */
|
|
83
|
-
disabled?: boolean;
|
|
84
|
-
|
|
85
|
-
/** The tab label */
|
|
86
|
-
children: ReactNode;
|
|
87
|
-
|
|
88
|
-
/** Used for editing root class name */
|
|
89
|
-
className?: string;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export interface TabsPanelProps extends ComponentPropsWithoutRef<"div"> {
|
|
93
|
-
/** Panel value used to match tab */
|
|
94
|
-
value: string;
|
|
95
|
-
|
|
96
|
-
/** Panel content */
|
|
97
|
-
children: ReactNode;
|
|
98
|
-
|
|
99
|
-
/** Used for editing root class name */
|
|
100
|
-
className?: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export interface TabsFactoryPayload extends FactoryPayload {
|
|
104
|
-
props: TabsProps;
|
|
105
|
-
ref: HTMLDivElement;
|
|
106
|
-
compound: {
|
|
107
|
-
configure: ReturnType<typeof createComponentConfig<TabsProps>>;
|
|
108
|
-
classNames: ReturnType<typeof createClassNamesConfig<TabsClassNames>>;
|
|
109
|
-
List: typeof TabsList;
|
|
110
|
-
Tab: typeof TabsTab;
|
|
111
|
-
Panel: typeof TabsPanel;
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface TabsListFactoryPayload extends FactoryPayload {
|
|
116
|
-
props: TabsListProps;
|
|
117
|
-
ref: HTMLDivElement;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export interface TabsTabFactoryPayload extends FactoryPayload {
|
|
121
|
-
props: TabsTabProps;
|
|
122
|
-
ref: HTMLButtonElement;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface TabsPanelFactoryPayload extends FactoryPayload {
|
|
126
|
-
props: TabsPanelProps;
|
|
127
|
-
ref: HTMLDivElement;
|
|
128
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TextareaField } from "./textarea-field";
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { RefraktorSize } from "../../../theme";
|
|
2
|
-
import { InputVariant } from "../../input";
|
|
3
|
-
import { TextareaResize } from "../textarea.types";
|
|
4
|
-
|
|
5
|
-
const sizes: Record<RefraktorSize, string> = {
|
|
6
|
-
xs: "px-2 py-1 text-[8px]",
|
|
7
|
-
sm: "px-2.5 py-1.5 text-[10px]",
|
|
8
|
-
md: "px-3 py-2 text-xs",
|
|
9
|
-
lg: "px-3.5 py-2.5 text-sm",
|
|
10
|
-
xl: "px-4 py-3 text-base"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const getSize = (size: RefraktorSize = "md") => sizes[size];
|
|
14
|
-
|
|
15
|
-
const variants: Record<InputVariant, string> = {
|
|
16
|
-
default:
|
|
17
|
-
"bg-[var(--refraktor-bg)] text-[var(--refraktor-text)] border border-[var(--refraktor-border)]",
|
|
18
|
-
filled: "bg-[var(--refraktor-bg)] text-[var(--refraktor-text)]",
|
|
19
|
-
outline:
|
|
20
|
-
"bg-transparent text-[var(--refraktor-text)] border border-[var(--refraktor-border)]"
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const getVariant = (variant: InputVariant = "default") =>
|
|
24
|
-
variants[variant];
|
|
25
|
-
|
|
26
|
-
const resizes: Record<TextareaResize, string> = {
|
|
27
|
-
none: "resize-none",
|
|
28
|
-
vertical: "resize-y",
|
|
29
|
-
horizontal: "resize-x",
|
|
30
|
-
both: "resize"
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const getResize = (resize: TextareaResize = "vertical") =>
|
|
34
|
-
resizes[resize];
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { createComponentConfig, factory, useProps } from "../../../utils";
|
|
2
|
-
import { useId } from "@refraktor/utils";
|
|
3
|
-
import {
|
|
4
|
-
TextareaFieldFactoryPayload,
|
|
5
|
-
TextareaFieldProps
|
|
6
|
-
} from "../textarea.types";
|
|
7
|
-
import { getSize, getVariant, getResize } from "./textarea-field.styles";
|
|
8
|
-
import { useTheme } from "../../../theme";
|
|
9
|
-
import TextareaAutosize from "react-textarea-autosize";
|
|
10
|
-
|
|
11
|
-
const defaultProps = {
|
|
12
|
-
variant: "default",
|
|
13
|
-
size: "md",
|
|
14
|
-
radius: "default",
|
|
15
|
-
autosize: false,
|
|
16
|
-
minRows: 2
|
|
17
|
-
} satisfies Partial<TextareaFieldProps>;
|
|
18
|
-
|
|
19
|
-
const TextareaField = factory<TextareaFieldFactoryPayload>((_props, ref) => {
|
|
20
|
-
const { cx, getRadius } = useTheme();
|
|
21
|
-
const {
|
|
22
|
-
id,
|
|
23
|
-
variant,
|
|
24
|
-
size,
|
|
25
|
-
radius,
|
|
26
|
-
error,
|
|
27
|
-
className,
|
|
28
|
-
style,
|
|
29
|
-
disabled,
|
|
30
|
-
autosize,
|
|
31
|
-
minRows,
|
|
32
|
-
maxRows,
|
|
33
|
-
resize,
|
|
34
|
-
rows,
|
|
35
|
-
...props
|
|
36
|
-
} = useProps("TextareaField", defaultProps, _props);
|
|
37
|
-
|
|
38
|
-
const _id = useId(id);
|
|
39
|
-
|
|
40
|
-
const resolvedResize = resize ?? (autosize ? "none" : "vertical");
|
|
41
|
-
|
|
42
|
-
const textareaClassName = cx(
|
|
43
|
-
"w-full outline-none border-none bg-transparent p-0",
|
|
44
|
-
"text-[var(--refraktor-text)]",
|
|
45
|
-
"placeholder:text-[var(--refraktor-text-tertiary)]",
|
|
46
|
-
getResize(resolvedResize),
|
|
47
|
-
disabled && "cursor-not-allowed"
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
const wrapperClassName = cx(
|
|
51
|
-
"w-full transition-all refraktor-scrollbar",
|
|
52
|
-
getSize(size),
|
|
53
|
-
getVariant(variant),
|
|
54
|
-
getRadius(radius),
|
|
55
|
-
"focus-within:border-[var(--refraktor-primary)]",
|
|
56
|
-
error && "border-[var(--refraktor-colors-red-6)]",
|
|
57
|
-
disabled && "opacity-50 cursor-not-allowed",
|
|
58
|
-
className
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
if (autosize) {
|
|
62
|
-
return (
|
|
63
|
-
<div className={wrapperClassName} style={style}>
|
|
64
|
-
<TextareaAutosize
|
|
65
|
-
id={_id}
|
|
66
|
-
ref={ref}
|
|
67
|
-
disabled={disabled}
|
|
68
|
-
aria-invalid={error ? true : undefined}
|
|
69
|
-
minRows={minRows}
|
|
70
|
-
maxRows={maxRows}
|
|
71
|
-
className={textareaClassName}
|
|
72
|
-
{...props}
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div className={wrapperClassName} style={style}>
|
|
80
|
-
<textarea
|
|
81
|
-
id={_id}
|
|
82
|
-
ref={ref}
|
|
83
|
-
disabled={disabled}
|
|
84
|
-
aria-invalid={error ? true : undefined}
|
|
85
|
-
rows={rows ?? minRows}
|
|
86
|
-
className={textareaClassName}
|
|
87
|
-
{...props}
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
TextareaField.displayName = "@refraktor/core/TextareaField";
|
|
94
|
-
TextareaField.configure = createComponentConfig<TextareaFieldProps>();
|
|
95
|
-
|
|
96
|
-
export default TextareaField;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useId } from "@refraktor/utils";
|
|
2
|
-
import { createComponentConfig, factory, useProps } from "../../utils";
|
|
3
|
-
import { TextareaFactoryPayload, TextareaProps } from "./textarea.types";
|
|
4
|
-
import { InputWrapper } from "../input/input-wrapper";
|
|
5
|
-
import { TextareaField } from "./textarea-field";
|
|
6
|
-
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
variant: "default",
|
|
9
|
-
size: "md",
|
|
10
|
-
radius: "default"
|
|
11
|
-
} satisfies Partial<TextareaProps>;
|
|
12
|
-
|
|
13
|
-
const Textarea = factory<TextareaFactoryPayload>((_props, ref) => {
|
|
14
|
-
const { id, label, description, error, required, withAsterisk, ...props } =
|
|
15
|
-
useProps("Textarea", defaultProps, _props);
|
|
16
|
-
|
|
17
|
-
const _id = useId(id);
|
|
18
|
-
|
|
19
|
-
const hasWrapper = label || description || error;
|
|
20
|
-
|
|
21
|
-
if (!hasWrapper) {
|
|
22
|
-
return (
|
|
23
|
-
<TextareaField
|
|
24
|
-
ref={ref}
|
|
25
|
-
id={_id}
|
|
26
|
-
required={required}
|
|
27
|
-
error={!!error}
|
|
28
|
-
{...props}
|
|
29
|
-
/>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<InputWrapper
|
|
35
|
-
label={label}
|
|
36
|
-
description={description}
|
|
37
|
-
error={error}
|
|
38
|
-
required={required}
|
|
39
|
-
withAsterisk={withAsterisk}
|
|
40
|
-
inputId={_id}
|
|
41
|
-
>
|
|
42
|
-
<TextareaField
|
|
43
|
-
ref={ref}
|
|
44
|
-
id={_id}
|
|
45
|
-
required={required}
|
|
46
|
-
error={!!error}
|
|
47
|
-
aria-describedby={
|
|
48
|
-
error
|
|
49
|
-
? `${_id}-error`
|
|
50
|
-
: description
|
|
51
|
-
? `${_id}-description`
|
|
52
|
-
: undefined
|
|
53
|
-
}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
</InputWrapper>
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
Textarea.displayName = "@refraktor/core/Textarea";
|
|
61
|
-
Textarea.configure = createComponentConfig<TextareaProps>();
|
|
62
|
-
Textarea.Field = TextareaField;
|
|
63
|
-
|
|
64
|
-
export default Textarea;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
2
|
-
import { RefraktorRadius, RefraktorSize } from "../../theme";
|
|
3
|
-
import { createComponentConfig, FactoryPayload } from "../../utils";
|
|
4
|
-
import { InputWrapperProps, InputVariant } from "../input";
|
|
5
|
-
import { TextareaField } from "./textarea-field";
|
|
6
|
-
|
|
7
|
-
export type TextareaResize = "none" | "vertical" | "horizontal" | "both";
|
|
8
|
-
|
|
9
|
-
export type TextareaFieldClassNames = {
|
|
10
|
-
root?: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export interface TextareaFieldProps extends Omit<
|
|
14
|
-
ComponentPropsWithoutRef<"textarea">,
|
|
15
|
-
"size"
|
|
16
|
-
> {
|
|
17
|
-
/** Textarea variant @default `default` */
|
|
18
|
-
variant?: InputVariant;
|
|
19
|
-
|
|
20
|
-
/** Textarea size @default `md` */
|
|
21
|
-
size?: RefraktorSize;
|
|
22
|
-
|
|
23
|
-
/** Textarea radius @default `default` */
|
|
24
|
-
radius?: RefraktorRadius;
|
|
25
|
-
|
|
26
|
-
/** Error state */
|
|
27
|
-
error?: boolean;
|
|
28
|
-
|
|
29
|
-
/** Used for editing root class name */
|
|
30
|
-
className?: string;
|
|
31
|
-
|
|
32
|
-
/** Class names for sub-elements */
|
|
33
|
-
classNames?: TextareaFieldClassNames;
|
|
34
|
-
|
|
35
|
-
/** Enable auto-resizing based on content @default false */
|
|
36
|
-
autosize?: boolean;
|
|
37
|
-
|
|
38
|
-
/** Minimum number of rows (only works with autosize) @default 2 */
|
|
39
|
-
minRows?: number;
|
|
40
|
-
|
|
41
|
-
/** Maximum number of rows (only works with autosize) */
|
|
42
|
-
maxRows?: number;
|
|
43
|
-
|
|
44
|
-
/** Controls the resize behavior @default `none` when autosize, `vertical` otherwise */
|
|
45
|
-
resize?: TextareaResize;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export interface TextareaProps extends Omit<TextareaFieldProps, "error"> {
|
|
49
|
-
/** Label text */
|
|
50
|
-
label?: ReactNode;
|
|
51
|
-
|
|
52
|
-
/** Description text */
|
|
53
|
-
description?: ReactNode;
|
|
54
|
-
|
|
55
|
-
/** Error message */
|
|
56
|
-
error?: ReactNode;
|
|
57
|
-
|
|
58
|
-
/** Whether the field is required */
|
|
59
|
-
required?: boolean;
|
|
60
|
-
|
|
61
|
-
/** Display an asterisk next to the label */
|
|
62
|
-
withAsterisk?: boolean;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface TextareaFactoryPayload extends FactoryPayload {
|
|
66
|
-
props: TextareaProps;
|
|
67
|
-
ref: HTMLTextAreaElement;
|
|
68
|
-
compound: {
|
|
69
|
-
configure: ReturnType<typeof createComponentConfig<TextareaProps>>;
|
|
70
|
-
Field: typeof TextareaField;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface TextareaFieldFactoryPayload extends FactoryPayload {
|
|
75
|
-
props: TextareaFieldProps;
|
|
76
|
-
ref: HTMLTextAreaElement;
|
|
77
|
-
compound: {
|
|
78
|
-
configure: ReturnType<typeof createComponentConfig<TextareaFieldProps>>;
|
|
79
|
-
};
|
|
80
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as Timeline } from "./timeline";
|
|
2
|
-
export { TimelineItem } from "./timeline-item";
|
|
3
|
-
export type {
|
|
4
|
-
TimelineProps,
|
|
5
|
-
TimelineItemProps,
|
|
6
|
-
TimelineClassNames,
|
|
7
|
-
TimelineOrientation,
|
|
8
|
-
TimelineLineVariant,
|
|
9
|
-
TimelineFactoryPayload,
|
|
10
|
-
TimelineItemFactoryPayload
|
|
11
|
-
} from "./timeline.types";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as TimelineItem } from "./timeline-item";
|