@rovula/ui 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.css +155 -495
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/ActionButton/ActionButton.stories.d.ts +7 -7
- package/dist/cjs/types/components/Button/Button.d.ts +1 -1
- package/dist/cjs/types/components/Button/Button.styles.d.ts +1 -1
- package/dist/cjs/types/components/Button/Buttons.stories.d.ts +13 -13
- package/dist/cjs/types/components/Checkbox/Checkbox.stories.d.ts +60 -60
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +64 -64
- package/dist/cjs/types/components/Icon/Icon.d.ts +11 -0
- package/dist/cjs/types/components/Icon/Icon.stories.d.ts +508 -0
- package/dist/cjs/types/components/Icon/Icon.styles.d.ts +4 -0
- package/dist/cjs/types/components/Input/Input.stories.d.ts +115 -115
- package/dist/cjs/types/components/Label/Label.stories.d.ts +51 -51
- package/dist/cjs/types/components/RadioGroup/RadioGroup.stories.d.ts +54 -54
- package/dist/cjs/types/components/Search/Search.stories.d.ts +64 -64
- package/dist/cjs/types/components/Slider/Slider.d.ts +5 -0
- package/dist/cjs/types/components/Slider/Slider.stories.d.ts +303 -0
- package/dist/cjs/types/components/Switch/Switch.d.ts +4 -0
- package/dist/cjs/types/components/Switch/Switch.stories.d.ts +305 -0
- package/dist/cjs/types/components/Table/Table.stories.d.ts +7 -7
- package/dist/cjs/types/components/Tabs/Tabs.d.ts +12 -3
- package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +18 -0
- package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +62 -62
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +1 -1
- package/dist/cjs/types/icons/heroIconConfig.d.ts +1 -0
- package/dist/cjs/types/icons/iconConfig.d.ts +2 -0
- package/dist/cjs/types/icons/iconRegistry.d.ts +19 -0
- package/dist/cjs/types/icons/index.d.ts +1 -0
- package/dist/cjs/types/icons/material-icon/outline/ChevronDownIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/CollapseContentIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ContentCopyIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ContentPasteIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/DataTableIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ExpandCircleDownIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ExpandCircleRightIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ExpandCircleUpIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/ExpandContentIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/InterestsIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/SaveIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/TableChartIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/outline/index.d.ts +12 -0
- package/dist/cjs/types/icons/material-icon/solid/ChevronDownIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/CollapseContentIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ContentCopyIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ContentPasteIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/DataTableIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ExpandCircleDownIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ExpandCircleRightIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ExpandCircleUpIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/ExpandContentIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/InterestsIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/SaveIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/TableChartIcon.d.ts +3 -0
- package/dist/cjs/types/icons/material-icon/solid/index.d.ts +12 -0
- package/dist/cjs/types/icons/materialIconConfig.d.ts +1 -0
- package/dist/cjs/types/icons/type.d.ts +8 -0
- package/dist/cjs/types/icons/utils.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +4 -0
- package/dist/components/ActionButton/ActionButton.js +8 -19
- package/dist/components/ActionButton/ActionButton.stories.js +12 -22
- package/dist/components/ActionButton/ActionButton.styles.js +33 -8
- package/dist/components/AlertDialog/Alert.stories.js +5 -16
- package/dist/components/AlertDialog/AlertDialog.js +27 -38
- package/dist/components/Avatar/Avatar.js +7 -8
- package/dist/components/Avatar/Avatar.stories.js +11 -22
- package/dist/components/Avatar/Avatar.styles.js +1 -1
- package/dist/components/Avatar/AvatarBase.js +9 -20
- package/dist/components/Avatar/AvatarGroup.js +9 -10
- package/dist/components/Avatar/AvatarGroup.stories.js +9 -20
- package/dist/components/Button/Button.js +4 -15
- package/dist/components/Button/Button.styles.js +1 -1
- package/dist/components/Button/Buttons.stories.js +18 -29
- package/dist/components/Calendar/Calendar.js +3 -14
- package/dist/components/Calendar/Calendar.stories.js +6 -17
- package/dist/components/Checkbox/Checkbox.js +3 -14
- package/dist/components/Checkbox/Checkbox.stories.js +12 -23
- package/dist/components/Collapsible/Collapsible.js +14 -17
- package/dist/components/Collapsible/Collapsible.stories.js +9 -20
- package/dist/components/Collapsible/Collapsible.styles.js +4 -4
- package/dist/components/Collapsible/CollapsibleContext.js +9 -10
- package/dist/components/DataTable/DataTable.js +25 -26
- package/dist/components/DataTable/DataTable.stories.js +10 -21
- package/dist/components/DatePicker/DatePicker.js +4 -20
- package/dist/components/DatePicker/DatePicker.stories.js +6 -17
- package/dist/components/Dialog/Dialog.js +22 -33
- package/dist/components/Dialog/Dialog.stories.js +8 -19
- package/dist/components/Dropdown/Dropdown.js +26 -37
- package/dist/components/Dropdown/Dropdown.stories.js +36 -55
- package/dist/components/Dropdown/Dropdown.styles.js +3 -3
- package/dist/components/Form/Form.js +26 -87
- package/dist/components/Form/Text.js +2 -3
- package/dist/components/Form/TextInput.js +2 -3
- package/dist/components/Icon/Icon.js +37 -0
- package/dist/components/Icon/Icon.stories.js +356 -0
- package/dist/components/Icon/Icon.styles.js +25 -0
- package/dist/components/Input/Input.js +9 -20
- package/dist/components/Input/Input.stories.js +6 -17
- package/dist/components/Input/Input.styles.js +1 -1
- package/dist/components/Label/Label.js +3 -14
- package/dist/components/Label/Label.stories.js +5 -16
- package/dist/components/Label/Label.styles.js +1 -1
- package/dist/components/Loading/Loading.js +5 -17
- package/dist/components/Loading/Loading.stories.js +6 -17
- package/dist/components/Navbar/Navbar.js +3 -4
- package/dist/components/Navbar/Navbar.stories.js +8 -19
- package/dist/components/Popover/Popover.js +5 -16
- package/dist/components/Popover/Popover.stories.js +5 -16
- package/dist/components/ProgressBar/ProgressBar.js +8 -9
- package/dist/components/ProgressBar/ProgressBar.stories.js +14 -27
- package/dist/components/RadioGroup/RadioGroup.js +6 -17
- package/dist/components/RadioGroup/RadioGroup.stories.js +9 -20
- package/dist/components/Search/Search.js +2 -13
- package/dist/components/Search/Search.stories.js +10 -21
- package/dist/components/Slider/Slider.js +22 -0
- package/dist/components/Slider/Slider.stories.js +33 -0
- package/dist/components/Switch/Switch.js +22 -0
- package/dist/components/Switch/Switch.stories.js +32 -0
- package/dist/components/Table/Datagrid.js +2 -3
- package/dist/components/Table/Table.js +24 -35
- package/dist/components/Table/Table.stories.js +5 -16
- package/dist/components/Tabs/Tabs.js +56 -9
- package/dist/components/Tabs/Tabs.stories.js +13 -24
- package/dist/components/Text/Text.js +3 -4
- package/dist/components/Text/Text.stories.js +12 -23
- package/dist/components/TextInput/TextInput.js +30 -41
- package/dist/components/TextInput/TextInput.stories.js +17 -28
- package/dist/components/TextInput/TextInput.styles.js +7 -7
- package/dist/components/ThemeToggle.js +3 -3
- package/dist/esm/bundle.css +155 -495
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/ActionButton/ActionButton.stories.d.ts +7 -7
- package/dist/esm/types/components/Button/Button.d.ts +1 -1
- package/dist/esm/types/components/Button/Button.styles.d.ts +1 -1
- package/dist/esm/types/components/Button/Buttons.stories.d.ts +13 -13
- package/dist/esm/types/components/Checkbox/Checkbox.stories.d.ts +60 -60
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +64 -64
- package/dist/esm/types/components/Icon/Icon.d.ts +11 -0
- package/dist/esm/types/components/Icon/Icon.stories.d.ts +508 -0
- package/dist/esm/types/components/Icon/Icon.styles.d.ts +4 -0
- package/dist/esm/types/components/Input/Input.stories.d.ts +115 -115
- package/dist/esm/types/components/Label/Label.stories.d.ts +51 -51
- package/dist/esm/types/components/RadioGroup/RadioGroup.stories.d.ts +54 -54
- package/dist/esm/types/components/Search/Search.stories.d.ts +64 -64
- package/dist/esm/types/components/Slider/Slider.d.ts +5 -0
- package/dist/esm/types/components/Slider/Slider.stories.d.ts +303 -0
- package/dist/esm/types/components/Switch/Switch.d.ts +4 -0
- package/dist/esm/types/components/Switch/Switch.stories.d.ts +305 -0
- package/dist/esm/types/components/Table/Table.stories.d.ts +7 -7
- package/dist/esm/types/components/Tabs/Tabs.d.ts +12 -3
- package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +18 -0
- package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +62 -62
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +1 -1
- package/dist/esm/types/icons/heroIconConfig.d.ts +1 -0
- package/dist/esm/types/icons/iconConfig.d.ts +2 -0
- package/dist/esm/types/icons/iconRegistry.d.ts +19 -0
- package/dist/esm/types/icons/index.d.ts +1 -0
- package/dist/esm/types/icons/material-icon/outline/ChevronDownIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/CollapseContentIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ContentCopyIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ContentPasteIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/DataTableIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ExpandCircleDownIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ExpandCircleRightIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ExpandCircleUpIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/ExpandContentIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/InterestsIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/SaveIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/TableChartIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/outline/index.d.ts +12 -0
- package/dist/esm/types/icons/material-icon/solid/ChevronDownIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/CollapseContentIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ContentCopyIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ContentPasteIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/DataTableIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ExpandCircleDownIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ExpandCircleRightIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ExpandCircleUpIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/ExpandContentIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/InterestsIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/SaveIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/TableChartIcon.d.ts +3 -0
- package/dist/esm/types/icons/material-icon/solid/index.d.ts +12 -0
- package/dist/esm/types/icons/materialIconConfig.d.ts +1 -0
- package/dist/esm/types/icons/type.d.ts +8 -0
- package/dist/esm/types/icons/utils.d.ts +1 -0
- package/dist/esm/types/index.d.ts +4 -0
- package/dist/icons/heroIconConfig.js +13 -0
- package/dist/icons/iconConfig.js +2 -0
- package/dist/icons/iconRegistry.js +47 -0
- package/dist/icons/index.js +1 -0
- package/dist/icons/material-icon/outline/ChevronDownIcon.js +3 -0
- package/dist/icons/material-icon/outline/CollapseContentIcon.js +3 -0
- package/dist/icons/material-icon/outline/ContentCopyIcon.js +3 -0
- package/dist/icons/material-icon/outline/ContentPasteIcon.js +3 -0
- package/dist/icons/material-icon/outline/DataTableIcon.js +3 -0
- package/dist/icons/material-icon/outline/ExpandCircleDownIcon.js +3 -0
- package/dist/icons/material-icon/outline/ExpandCircleRightIcon.js +3 -0
- package/dist/icons/material-icon/outline/ExpandCircleUpIcon.js +3 -0
- package/dist/icons/material-icon/outline/ExpandContentIcon.js +3 -0
- package/dist/icons/material-icon/outline/InterestsIcon.js +3 -0
- package/dist/icons/material-icon/outline/SaveIcon.js +3 -0
- package/dist/icons/material-icon/outline/TableChartIcon.js +3 -0
- package/dist/icons/material-icon/outline/index.js +12 -0
- package/dist/icons/material-icon/solid/ChevronDownIcon.js +3 -0
- package/dist/icons/material-icon/solid/CollapseContentIcon.js +3 -0
- package/dist/icons/material-icon/solid/ContentCopyIcon.js +3 -0
- package/dist/icons/material-icon/solid/ContentPasteIcon.js +3 -0
- package/dist/icons/material-icon/solid/DataTableIcon.js +3 -0
- package/dist/icons/material-icon/solid/ExpandCircleDownIcon.js +3 -0
- package/dist/icons/material-icon/solid/ExpandCircleRightIcon.js +3 -0
- package/dist/icons/material-icon/solid/ExpandCircleUpIcon.js +3 -0
- package/dist/icons/material-icon/solid/ExpandContentIcon.js +3 -0
- package/dist/icons/material-icon/solid/InterestsIcon.js +3 -0
- package/dist/icons/material-icon/solid/SaveIcon.js +3 -0
- package/dist/icons/material-icon/solid/TableChartIcon.js +3 -0
- package/dist/icons/material-icon/solid/index.js +12 -0
- package/dist/icons/materialIconConfig.js +13 -0
- package/dist/icons/type.js +1 -0
- package/dist/icons/utils.js +6 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.js +4 -0
- package/dist/src/theme/global.css +187 -619
- package/dist/stories/ColorGroupPreview.js +6 -9
- package/dist/stories/ColorPreview.js +1 -2
- package/dist/theme/presets/colors.js +2 -1
- package/dist/utils/cn.js +1 -5
- package/dist/utils/datetime.js +12 -12
- package/package.json +3 -1
- package/src/components/ActionButton/ActionButton.stories.tsx +32 -13
- package/src/components/ActionButton/ActionButton.styles.ts +33 -8
- package/src/components/DataTable/DataTable.tsx +2 -2
- package/src/components/Icon/Icon.stories.tsx +450 -0
- package/src/components/Icon/Icon.styles.ts +26 -0
- package/src/components/Icon/Icon.tsx +67 -0
- package/src/components/Slider/Slider.stories.tsx +47 -0
- package/src/components/Slider/Slider.tsx +32 -0
- package/src/components/Switch/Switch.stories.tsx +46 -0
- package/src/components/Switch/Switch.tsx +32 -0
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +99 -12
- package/src/icons/heroIconConfig.ts +23 -0
- package/src/icons/iconConfig.ts +2 -0
- package/src/icons/iconRegistry.ts +76 -0
- package/src/icons/index.ts +1 -0
- package/src/icons/material-icon/outline/ChevronDownIcon.tsx +22 -0
- package/src/icons/material-icon/outline/CollapseContentIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ContentCopyIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ContentPasteIcon.tsx +20 -0
- package/src/icons/material-icon/outline/DataTableIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ExpandCircleDownIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ExpandCircleRightIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ExpandCircleUpIcon.tsx +20 -0
- package/src/icons/material-icon/outline/ExpandContentIcon.tsx +20 -0
- package/src/icons/material-icon/outline/InterestsIcon.tsx +20 -0
- package/src/icons/material-icon/outline/SaveIcon.tsx +20 -0
- package/src/icons/material-icon/outline/TableChartIcon.tsx +20 -0
- package/src/icons/material-icon/outline/index.ts +12 -0
- package/src/icons/material-icon/solid/ChevronDownIcon.tsx +22 -0
- package/src/icons/material-icon/solid/CollapseContentIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ContentCopyIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ContentPasteIcon.tsx +20 -0
- package/src/icons/material-icon/solid/DataTableIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ExpandCircleDownIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ExpandCircleRightIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ExpandCircleUpIcon.tsx +20 -0
- package/src/icons/material-icon/solid/ExpandContentIcon.tsx +20 -0
- package/src/icons/material-icon/solid/InterestsIcon.tsx +20 -0
- package/src/icons/material-icon/solid/SaveIcon.tsx +20 -0
- package/src/icons/material-icon/solid/TableChartIcon.tsx +20 -0
- package/src/icons/material-icon/solid/index.ts +12 -0
- package/src/icons/materialIconConfig.tsx +23 -0
- package/src/icons/type.ts +11 -0
- package/src/icons/utils.ts +6 -0
- package/src/index.ts +5 -0
- package/src/theme/presets/colors.js +2 -1
- package/dist/cjs/types/components/ActionButton/ActionButton.styles copy.d.ts +0 -6
- package/dist/cjs/types/components/Button/Button.styles copy.d.ts +0 -7
- package/dist/components/ActionButton/ActionButton.styles copy.js +0 -90
- package/dist/components/Button/Button.styles copy.js +0 -210
- package/dist/esm/types/components/ActionButton/ActionButton.styles copy.d.ts +0 -6
- package/dist/esm/types/components/Button/Button.styles copy.d.ts +0 -7
- package/src/_theme/global copy.css +0 -761
- package/src/_theme/global.css +0 -39
- package/src/_theme/main-preset.js +0 -239
- package/src/_theme/plugins/utilities/typography.js +0 -81
- package/src/_theme/presets/colors copy 2.js +0 -319
- package/src/_theme/presets/colors copy.js +0 -229
- package/src/_theme/presets/colors.js +0 -94
- package/src/_theme/theme.d.ts +0 -69
- package/src/_theme/variables/base/button.css +0 -334
- package/src/_theme/variables/base/components copy.css +0 -19
- package/src/_theme/variables/default/colors.css +0 -292
- package/src/_theme/variables/default/typography.css +0 -178
- package/src/_theme/variables/xspector/colors.css +0 -468
- package/src/_theme/variables/xspector/typography.css +0 -178
- package/src/components/ActionButton/ActionButton.styles copy.ts +0 -95
- package/src/components/Button/Button.styles copy.ts +0 -214
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch";
|
|
16
|
+
import { cn } from "@/utils/cn";
|
|
17
|
+
const Switch = React.forwardRef((_a, ref) => {
|
|
18
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
19
|
+
return (_jsx(SwitchPrimitives.Root, Object.assign({ className: cn("peer inline-flex h-3 w-[32px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-secondary-active/[0.32] data-[state=unchecked]:bg-tertiary-active/[0.32]", className) }, props, { ref: ref, children: _jsx(SwitchPrimitives.Thumb, { className: cn("pointer-events-none block size-4 rounded-full bg-secondary-active shadow-lg ring-0", "transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:-translate-x-[2px] data-[state=unchecked]:bg-tertiary-active") }) })));
|
|
20
|
+
});
|
|
21
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
22
|
+
export { Switch };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch } from "./Switch";
|
|
3
|
+
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Switch",
|
|
6
|
+
component: Switch,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
parameters: {
|
|
9
|
+
// More on how to position stories at: https://storybook.js.org/docs/7.0/react/configure/story-layout
|
|
10
|
+
layout: "fullscreen",
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
export const Default = {
|
|
18
|
+
args: {
|
|
19
|
+
defaultValue: [50],
|
|
20
|
+
max: 100,
|
|
21
|
+
step: 1,
|
|
22
|
+
name: "test",
|
|
23
|
+
minStepsBetweenThumbs: 1,
|
|
24
|
+
disabled: false,
|
|
25
|
+
inverted: false,
|
|
26
|
+
},
|
|
27
|
+
render: (args) => {
|
|
28
|
+
console.log("args ", args);
|
|
29
|
+
const props = Object.assign({}, args);
|
|
30
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Switch, Object.assign({}, props)) }));
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return (_jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map(function (column, index) { return (_jsx("th", { children: column.header }, index)); }) }) }), _jsx("tbody", { children: data.map(function (row, rowIndex) { return (_jsx("tr", { children: columns.map(function (column, colIndex) { return (_jsx("td", { children: row[column.accessor] }, colIndex)); }) }, rowIndex)); }) })] }));
|
|
2
|
+
const Table = ({ columns, data }) => {
|
|
3
|
+
return (_jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column, index) => (_jsx("th", { children: column.header }, index))) }) }), _jsx("tbody", { children: data.map((row, rowIndex) => (_jsx("tr", { children: columns.map((column, colIndex) => (_jsx("td", { children: row[column.accessor] }, colIndex))) }, rowIndex))) })] }));
|
|
5
4
|
};
|
|
6
5
|
export default Table;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
2
|
var t = {};
|
|
14
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -23,44 +12,44 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
13
|
import * as React from "react";
|
|
25
14
|
import { cn } from "@/utils/cn";
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
return (_jsx("div", { className: "relative h-full w-full overflow-auto", ref: rootRef, children: _jsx("table",
|
|
15
|
+
const Table = React.forwardRef((_a, ref) => {
|
|
16
|
+
var { className, rootRef } = _a, props = __rest(_a, ["className", "rootRef"]);
|
|
17
|
+
return (_jsx("div", { className: "relative h-full w-full overflow-auto", ref: rootRef, children: _jsx("table", Object.assign({ ref: ref, className: cn("w-full caption-bottom text-sm border-collapse", className) }, props)) }));
|
|
29
18
|
});
|
|
30
19
|
Table.displayName = "Table";
|
|
31
|
-
|
|
32
|
-
var className = _a
|
|
33
|
-
return (_jsx("thead",
|
|
20
|
+
const TableHeader = React.forwardRef((_a, ref) => {
|
|
21
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
22
|
+
return (_jsx("thead", Object.assign({ ref: ref, className: cn("[&_tr]:border-b bg-secondary-80", className) }, props)));
|
|
34
23
|
});
|
|
35
24
|
TableHeader.displayName = "TableHeader";
|
|
36
|
-
|
|
37
|
-
var className = _a
|
|
38
|
-
return (_jsx("tbody",
|
|
25
|
+
const TableBody = React.forwardRef((_a, ref) => {
|
|
26
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
27
|
+
return (_jsx("tbody", Object.assign({ ref: ref, className: cn("[&_tr:last-child]:border-0", className) }, props)));
|
|
39
28
|
});
|
|
40
29
|
TableBody.displayName = "TableBody";
|
|
41
|
-
|
|
42
|
-
var className = _a
|
|
43
|
-
return (_jsx("tfoot",
|
|
30
|
+
const TableFooter = React.forwardRef((_a, ref) => {
|
|
31
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
32
|
+
return (_jsx("tfoot", Object.assign({ ref: ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className) }, props)));
|
|
44
33
|
});
|
|
45
34
|
TableFooter.displayName = "TableFooter";
|
|
46
|
-
|
|
47
|
-
var className = _a
|
|
48
|
-
return (_jsx("tr",
|
|
35
|
+
const TableRow = React.forwardRef((_a, ref) => {
|
|
36
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
37
|
+
return (_jsx("tr", Object.assign({ ref: ref, className: cn("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-grey-20", className) }, props)));
|
|
49
38
|
});
|
|
50
39
|
TableRow.displayName = "TableRow";
|
|
51
|
-
|
|
52
|
-
var className = _a
|
|
53
|
-
return (_jsx("th",
|
|
40
|
+
const TableHead = React.forwardRef((_a, ref) => {
|
|
41
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
42
|
+
return (_jsx("th", Object.assign({ ref: ref, className: cn(" h-12 py-3 px-6 text-left align-middle typography-body2 text-text-grey-dark [&:has([role=checkbox])]:pr-4 [&:has([role=checkbox])]:w-4", className) }, props)));
|
|
54
43
|
});
|
|
55
44
|
TableHead.displayName = "TableHead";
|
|
56
|
-
|
|
57
|
-
var className = _a
|
|
58
|
-
return (_jsx("td",
|
|
45
|
+
const TableCell = React.forwardRef((_a, ref) => {
|
|
46
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
47
|
+
return (_jsx("td", Object.assign({ ref: ref, className: cn(" py-3 px-6 text-left align-middle typography-body3 text-text-grey-dark [&:has([role=checkbox])]:pr-4 [&:has([role=checkbox])]:w-4", className) }, props)));
|
|
59
48
|
});
|
|
60
49
|
TableCell.displayName = "TableCell";
|
|
61
|
-
|
|
62
|
-
var className = _a
|
|
63
|
-
return (_jsx("caption",
|
|
50
|
+
const TableCaption = React.forwardRef((_a, ref) => {
|
|
51
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
52
|
+
return (_jsx("caption", Object.assign({ ref: ref, className: cn("mt-4 text-sm text-muted-foreground", className) }, props)));
|
|
64
53
|
});
|
|
65
54
|
TableCaption.displayName = "TableCaption";
|
|
66
55
|
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow, } from "./Table";
|
|
14
|
-
|
|
3
|
+
const meta = {
|
|
15
4
|
title: "Components/Table",
|
|
16
5
|
component: Table,
|
|
17
6
|
tags: ["autodocs"],
|
|
@@ -19,14 +8,14 @@ var meta = {
|
|
|
19
8
|
layout: "fullscreen",
|
|
20
9
|
},
|
|
21
10
|
decorators: [
|
|
22
|
-
|
|
11
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
23
12
|
],
|
|
24
13
|
};
|
|
25
14
|
export default meta;
|
|
26
|
-
export
|
|
15
|
+
export const Default = {
|
|
27
16
|
args: {},
|
|
28
|
-
render:
|
|
29
|
-
|
|
17
|
+
render: (args) => {
|
|
18
|
+
const props = Object.assign({}, args);
|
|
30
19
|
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(Table, { children: [_jsx(TableCaption, { children: "A list of your recent invoices." }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "w-[100px]", children: "Invoice" }), _jsx(TableHead, { children: "Status" }), _jsx(TableHead, { children: "Method" }), _jsx(TableHead, { className: "text-right", children: "Amount" })] }) }), _jsxs(TableBody, { children: [_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] }), _jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: "INV001" }), _jsx(TableCell, { children: "Paid" }), _jsx(TableCell, { children: "Credit Card" }), _jsx(TableCell, { className: "text-right", children: "$250.00" })] })] })] }) }));
|
|
31
20
|
},
|
|
32
21
|
};
|
|
@@ -1,14 +1,61 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useEffect } from "react";
|
|
3
4
|
import { cn } from "@/utils/cn";
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const Tabs = ({ tabs = [], initialTab = 0, tabBarSize = 38, enableBorderLine = true, tabMode = "start", className, tabBarClassName, tabButtonClassName, tabButtonActiveClassName, tabContentClassName, borderSliderClassname, }) => {
|
|
6
|
+
var _a;
|
|
7
|
+
const [activeTab, setActiveTab] = useState(initialTab);
|
|
8
|
+
const [sliderStyle, setSliderStyle] = useState({
|
|
9
|
+
width: "0px",
|
|
10
|
+
transform: "translateX(0px)",
|
|
11
|
+
});
|
|
12
|
+
const tabRefs = useRef([]);
|
|
13
|
+
const isInitialMount = useRef(true);
|
|
14
|
+
const updateSliderStyle = () => {
|
|
15
|
+
const activeTabElement = tabRefs.current[activeTab];
|
|
16
|
+
if (activeTabElement) {
|
|
17
|
+
setSliderStyle({
|
|
18
|
+
width: `${activeTabElement.offsetWidth}px`,
|
|
19
|
+
transform: `translateX(${activeTabElement.offsetLeft}px)`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (isInitialMount.current) {
|
|
25
|
+
isInitialMount.current = false;
|
|
26
|
+
// Set initial position without animation
|
|
27
|
+
const activeTabElement = tabRefs.current[activeTab];
|
|
28
|
+
if (activeTabElement) {
|
|
29
|
+
setSliderStyle({
|
|
30
|
+
width: "0px",
|
|
31
|
+
transform: `translateX(${activeTabElement.offsetLeft + activeTabElement.offsetWidth / 2}px)`,
|
|
32
|
+
});
|
|
33
|
+
// Trigger reflow
|
|
34
|
+
setTimeout(() => {
|
|
35
|
+
updateSliderStyle();
|
|
36
|
+
}, 50);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
updateSliderStyle();
|
|
41
|
+
}
|
|
42
|
+
// const handleResize = () => {
|
|
43
|
+
// updateSliderStyle();
|
|
44
|
+
// };
|
|
45
|
+
// window.addEventListener("resize", handleResize);
|
|
46
|
+
// return () => window.removeEventListener("resize", handleResize);
|
|
47
|
+
}, [activeTab, tabs, tabMode]);
|
|
48
|
+
return (_jsxs("div", { className: cn("w-full", className), children: [_jsxs("div", { className: cn(`relative flex gap-6 h-[${tabBarSize}px] box-border`, {
|
|
49
|
+
[`border-b-[1px] border-base-stroke`]: enableBorderLine,
|
|
50
|
+
"gap-0": tabMode === "justify",
|
|
51
|
+
}, tabBarClassName), style: {
|
|
52
|
+
justifyContent: tabMode === "justify" ? "stretch" : tabMode,
|
|
53
|
+
}, role: "tablist", children: [tabs.map((tab, index) => (_jsxs("button", { ref: (el) => (tabRefs.current[index] = el), role: "tab", "aria-selected": index === activeTab, "aria-controls": `tab-content-${index}`, id: `tab-${index}`, className: cn("flex justify-center flex-row items-center py-4 px-1 cursor-pointer transition-colors duration-300 box-border gap-3", {
|
|
54
|
+
"typography-small3 text-text-dark": index === activeTab,
|
|
55
|
+
"typography-small1 text-text-grey-light hover:text-text-grey-dark active:text-text-dark": index !== activeTab,
|
|
56
|
+
[tabButtonClassName !== null && tabButtonClassName !== void 0 ? tabButtonClassName : ""]: true,
|
|
57
|
+
[tabButtonActiveClassName !== null && tabButtonActiveClassName !== void 0 ? tabButtonActiveClassName : ""]: index === activeTab,
|
|
58
|
+
"flex-1": tabMode === "justify",
|
|
59
|
+
}), onClick: () => setActiveTab(index), children: [tab.startTabContent, tab.label, tab.endTabContent] }, index))), _jsx("div", { className: cn(`absolute -bottom-[1px] h-[1px] bg-primary transition-all duration-300 ease-in-out`, borderSliderClassname), style: sliderStyle })] }), _jsx("div", { className: cn("mt-4", tabContentClassName), role: "tabpanel", id: `tab-content-${activeTab}`, "aria-labelledby": `tab-${activeTab}`, children: (_a = tabs[activeTab]) === null || _a === void 0 ? void 0 : _a.content })] }));
|
|
13
60
|
};
|
|
14
61
|
export default Tabs;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import Tabs from "./Tabs";
|
|
14
3
|
import { ChevronDownIcon, ArchiveBoxIcon } from "@heroicons/react/16/solid";
|
|
15
|
-
|
|
4
|
+
const meta = {
|
|
16
5
|
title: "Components/Tabs",
|
|
17
6
|
component: Tabs,
|
|
18
7
|
tags: ["autodocs"],
|
|
@@ -20,11 +9,11 @@ var meta = {
|
|
|
20
9
|
layout: "fullscreen",
|
|
21
10
|
},
|
|
22
11
|
decorators: [
|
|
23
|
-
|
|
12
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
24
13
|
],
|
|
25
14
|
};
|
|
26
15
|
export default meta;
|
|
27
|
-
|
|
16
|
+
const tabs = [
|
|
28
17
|
{
|
|
29
18
|
label: "Tab1",
|
|
30
19
|
content: _jsx("p", { children: "Tab 1 content" }),
|
|
@@ -38,23 +27,23 @@ var tabs = [
|
|
|
38
27
|
content: _jsx("p", { children: "Tab 3 content" }),
|
|
39
28
|
},
|
|
40
29
|
];
|
|
41
|
-
export
|
|
30
|
+
export const Default = {
|
|
42
31
|
args: {
|
|
43
32
|
initialTab: 0,
|
|
44
|
-
tabs
|
|
33
|
+
tabs,
|
|
45
34
|
},
|
|
46
|
-
render:
|
|
47
|
-
|
|
48
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs,
|
|
35
|
+
render: (args) => {
|
|
36
|
+
const props = Object.assign({}, args);
|
|
37
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs, Object.assign({ tabs: tabs }, props)) }));
|
|
49
38
|
},
|
|
50
39
|
};
|
|
51
|
-
export
|
|
40
|
+
export const CustomTab = {
|
|
52
41
|
args: {
|
|
53
42
|
initialTab: 0,
|
|
54
|
-
tabs: tabs.map(
|
|
43
|
+
tabs: tabs.map((tab) => (Object.assign(Object.assign({}, tab), { startTabContent: _jsx(ArchiveBoxIcon, { className: "size-3 " }), endTabContent: _jsx(ChevronDownIcon, { className: "size-3" }) }))),
|
|
55
44
|
},
|
|
56
|
-
render:
|
|
57
|
-
|
|
58
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs,
|
|
45
|
+
render: (args) => {
|
|
46
|
+
const props = Object.assign({}, args);
|
|
47
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Tabs, Object.assign({ tabs: tabs }, props)) }));
|
|
59
48
|
},
|
|
60
49
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from "@/utils/cn";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
|
-
|
|
5
|
+
const textVariants = cva(["text-foreground"], {
|
|
6
6
|
variants: {
|
|
7
7
|
color: {
|
|
8
8
|
primary: "text-primary",
|
|
@@ -16,8 +16,7 @@ var textVariants = cva(["text-foreground"], {
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
// TODO font, fontBold, elipt
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (_jsx(Tag, { className: cn("typography-".concat(variant), textVariants({ color: color }), className), style: style, children: children }));
|
|
19
|
+
const Text = forwardRef(({ variant = "body1", tag: Tag = "p", children, className = "", color, style, }) => {
|
|
20
|
+
return (_jsx(Tag, { className: cn(`typography-${variant}`, textVariants({ color }), className), style: style, children: children }));
|
|
22
21
|
});
|
|
23
22
|
export default Text;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import Text from "./Text";
|
|
14
3
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
15
|
-
|
|
4
|
+
const meta = {
|
|
16
5
|
title: "Components/Text",
|
|
17
6
|
component: Text,
|
|
18
7
|
tags: ["autodocs"],
|
|
@@ -21,11 +10,11 @@ var meta = {
|
|
|
21
10
|
layout: "fullscreen",
|
|
22
11
|
},
|
|
23
12
|
decorators: [
|
|
24
|
-
|
|
13
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
25
14
|
],
|
|
26
15
|
};
|
|
27
16
|
export default meta;
|
|
28
|
-
|
|
17
|
+
const variant = [
|
|
29
18
|
"h1",
|
|
30
19
|
"h2",
|
|
31
20
|
"h3",
|
|
@@ -52,7 +41,7 @@ var variant = [
|
|
|
52
41
|
"buttonL",
|
|
53
42
|
"buttonMS",
|
|
54
43
|
];
|
|
55
|
-
|
|
44
|
+
const color = [
|
|
56
45
|
"primary",
|
|
57
46
|
"secondary",
|
|
58
47
|
"tertiary",
|
|
@@ -61,17 +50,17 @@ var color = [
|
|
|
61
50
|
"warning",
|
|
62
51
|
"error",
|
|
63
52
|
];
|
|
64
|
-
export
|
|
53
|
+
export const Default = {
|
|
65
54
|
args: {},
|
|
66
|
-
render:
|
|
67
|
-
|
|
68
|
-
return (_jsx("div", { className: "flex flex-col gap-2 gap-y-6 w-full", children: variant.map(
|
|
55
|
+
render: (args) => {
|
|
56
|
+
const props = Object.assign({}, args);
|
|
57
|
+
return (_jsx("div", { className: "flex flex-col gap-2 gap-y-6 w-full", children: variant.map((value) => (_jsxs("div", { className: "flex flex-row ", children: [_jsx("div", { className: "w-[200px]", children: _jsx(Text, { variant: value, children: value }) }), _jsx("div", { className: "w-full", children: _jsx(Text, { variant: value, children: "Lorem ipsum dolor sit amet, adipiscing elit." }) })] }, value))) }));
|
|
69
58
|
},
|
|
70
59
|
};
|
|
71
|
-
export
|
|
60
|
+
export const Color = {
|
|
72
61
|
args: {},
|
|
73
|
-
render:
|
|
74
|
-
|
|
75
|
-
return (_jsx("div", { className: "flex flex-col gap-2 gap-y-6 w-full", children: color.map(
|
|
62
|
+
render: (args) => {
|
|
63
|
+
const props = Object.assign({}, args);
|
|
64
|
+
return (_jsx("div", { className: "flex flex-col gap-2 gap-y-6 w-full", children: color.map((color, i) => (_jsxs("div", { className: "flex flex-row ", children: [_jsx("div", { className: "w-[400px]", children: _jsx(Text, { variant: variant === null || variant === void 0 ? void 0 : variant[i], color: color, children: color }) }), _jsx("div", { className: "w-full", children: _jsx(Text, { variant: variant === null || variant === void 0 ? void 0 : variant[i], color: color, children: "Lorem ipsum dolor sit amet, adipiscing elit." }) })] }, color))) }));
|
|
76
65
|
},
|
|
77
66
|
};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
2
|
var t = {};
|
|
14
3
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -25,47 +14,47 @@ import { forwardRef, useImperativeHandle, useRef, } from "react";
|
|
|
25
14
|
import { helperTextVariant, iconSearchWrapperVariant, iconVariant, iconWrapperVariant, inputVariant, labelVariant, sectionIconWrapperVariant, } from "./TextInput.styles";
|
|
26
15
|
import { XCircleIcon, ExclamationCircleIcon, MagnifyingGlassIcon, } from "@heroicons/react/16/solid";
|
|
27
16
|
import { cn } from "@/utils/cn";
|
|
28
|
-
export
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
size
|
|
36
|
-
rounded
|
|
37
|
-
variant
|
|
38
|
-
fullwidth
|
|
39
|
-
disabled
|
|
40
|
-
error
|
|
41
|
-
hasSearchIcon
|
|
17
|
+
export const TextInput = forwardRef((_a, ref) => {
|
|
18
|
+
var { id, label, size = "md", rounded = "normal", variant = "outline", type = "text", helperText, errorMessage, fullwidth = true, disabled = false, error = false, required = true, hasClearIcon = true, hasSearchIcon = false, startIcon, endIcon, labelClassName } = _a, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "type", "helperText", "errorMessage", "fullwidth", "disabled", "error", "required", "hasClearIcon", "hasSearchIcon", "startIcon", "endIcon", "labelClassName"]);
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
const _id = id || `${type}-${label}-input`;
|
|
21
|
+
const hasLeftSectionIcon = !!startIcon;
|
|
22
|
+
const hasRightSectionIcon = !!endIcon;
|
|
23
|
+
const inputClassname = inputVariant({
|
|
24
|
+
size,
|
|
25
|
+
rounded,
|
|
26
|
+
variant,
|
|
27
|
+
fullwidth,
|
|
28
|
+
disabled,
|
|
29
|
+
error,
|
|
30
|
+
hasSearchIcon,
|
|
42
31
|
hasClearIcon: hasRightSectionIcon ? false : hasClearIcon,
|
|
43
32
|
leftSectionIcon: hasLeftSectionIcon,
|
|
44
33
|
rightSectionIcon: hasRightSectionIcon,
|
|
45
34
|
});
|
|
46
|
-
|
|
47
|
-
size
|
|
48
|
-
disabled
|
|
49
|
-
error
|
|
50
|
-
hasSearchIcon
|
|
35
|
+
const labelClassname = labelVariant({
|
|
36
|
+
size,
|
|
37
|
+
disabled,
|
|
38
|
+
error,
|
|
39
|
+
hasSearchIcon,
|
|
51
40
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
41
|
+
const helperTextClassname = helperTextVariant({ size, error, disabled });
|
|
42
|
+
const iconWrapperClassname = iconWrapperVariant({ size });
|
|
43
|
+
const iconSearchWrapperClassname = iconSearchWrapperVariant({ size });
|
|
44
|
+
const iconClassname = iconVariant({ size });
|
|
56
45
|
// TODO startIcon
|
|
57
|
-
|
|
58
|
-
size
|
|
59
|
-
rounded
|
|
60
|
-
error
|
|
46
|
+
const endIconWrapperClassname = sectionIconWrapperVariant({
|
|
47
|
+
size,
|
|
48
|
+
rounded,
|
|
49
|
+
error,
|
|
61
50
|
});
|
|
62
|
-
useImperativeHandle(ref,
|
|
63
|
-
|
|
51
|
+
useImperativeHandle(ref, () => inputRef === null || inputRef === void 0 ? void 0 : inputRef.current);
|
|
52
|
+
const handleClearInput = () => {
|
|
64
53
|
if (inputRef.current) {
|
|
65
54
|
inputRef.current.value = "";
|
|
66
55
|
}
|
|
67
56
|
};
|
|
68
|
-
return (_jsxs("div", { className:
|
|
57
|
+
return (_jsxs("div", { className: `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, children: [_jsxs("div", { className: "relative", children: [hasSearchIcon && (_jsx("div", { className: iconSearchWrapperClassname, children: _jsx(MagnifyingGlassIcon, { className: iconClassname }) })), _jsx("input", Object.assign({}, props, { placeholder: " ", ref: inputRef, type: type, id: _id, disabled: disabled, className: cn(inputClassname, props.className) })), hasClearIcon && !hasRightSectionIcon && (_jsx("div", { className: iconWrapperClassname, children: _jsx(XCircleIcon, { type: "button", className: iconClassname, onMouseDown: handleClearInput }) })), hasRightSectionIcon && (_jsx("div", { className: endIconWrapperClassname, children: endIcon })), _jsxs("label", { htmlFor: _id, className: cn(labelClassname, labelClassName), children: [label, " ", required && (_jsx("span", { className: cn("text-error", {
|
|
69
58
|
"text-input-disable-text": disabled,
|
|
70
59
|
}), children: "*" }))] })] }), (errorMessage || helperText) && (_jsxs("span", { className: helperTextClassname, children: [_jsx(ExclamationCircleIcon, { width: 16, height: 16, className: error ? "fill-error" : "" }), " ", errorMessage || helperText] }))] }));
|
|
71
60
|
});
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { useRef } from "react";
|
|
14
3
|
import TextInput from "./TextInput";
|
|
15
4
|
import { CalendarIcon } from "@heroicons/react/16/solid";
|
|
16
5
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
17
|
-
|
|
6
|
+
const meta = {
|
|
18
7
|
title: "Components/TextInput",
|
|
19
8
|
component: TextInput,
|
|
20
9
|
tags: ["autodocs"],
|
|
@@ -23,52 +12,52 @@ var meta = {
|
|
|
23
12
|
layout: "fullscreen",
|
|
24
13
|
},
|
|
25
14
|
decorators: [
|
|
26
|
-
|
|
15
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full bg-[rgb(var(--base-bg-2))] ", children: _jsx(Story, {}) })),
|
|
27
16
|
],
|
|
28
17
|
};
|
|
29
18
|
export default meta;
|
|
30
|
-
export
|
|
19
|
+
export const Default = {
|
|
31
20
|
args: {
|
|
32
21
|
label: "Lorem Ipsum",
|
|
33
22
|
// value: "Lorem Ipsum",
|
|
34
23
|
fullwidth: true,
|
|
35
24
|
},
|
|
36
|
-
render:
|
|
25
|
+
render: (args) => {
|
|
37
26
|
console.log("args ", args);
|
|
38
|
-
|
|
39
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput,
|
|
27
|
+
const props = Object.assign({}, args);
|
|
28
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput, Object.assign({ id: "1", size: "lg" }, args)), _jsx(TextInput, Object.assign({ id: "2", size: "md" }, args)), _jsx(TextInput, Object.assign({ id: "3", size: "sm" }, args))] }));
|
|
40
29
|
},
|
|
41
30
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return (_jsx(TextInput,
|
|
31
|
+
const InputWithRef = (props) => {
|
|
32
|
+
const inputRef = useRef(null);
|
|
33
|
+
return (_jsx(TextInput, Object.assign({ id: "1", size: "lg" }, props, { ref: inputRef, labelClassName: "peer-focus:bg-red-500", onKeyDown: (e) => {
|
|
45
34
|
var _a, _b;
|
|
46
35
|
if (e.code === "Enter") {
|
|
47
36
|
(_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
48
37
|
}
|
|
49
38
|
} })));
|
|
50
39
|
};
|
|
51
|
-
export
|
|
40
|
+
export const CustomLabel = {
|
|
52
41
|
args: {
|
|
53
42
|
label: "Lorem Ipsum",
|
|
54
43
|
// value: "Lorem Ipsum",
|
|
55
44
|
fullwidth: true,
|
|
56
45
|
},
|
|
57
|
-
render:
|
|
46
|
+
render: (args) => {
|
|
58
47
|
console.log("args ", args);
|
|
59
|
-
|
|
60
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput,
|
|
48
|
+
const props = Object.assign({}, args);
|
|
49
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput, Object.assign({ id: "1", size: "lg" }, args, { labelClassName: "peer-focus:bg-red-500" })), _jsx(InputWithRef, Object.assign({ id: "2", size: "md" }, args)), _jsx(TextInput, Object.assign({ id: "3", size: "sm" }, args))] }));
|
|
61
50
|
},
|
|
62
51
|
};
|
|
63
|
-
export
|
|
52
|
+
export const FuctionInput = {
|
|
64
53
|
args: {
|
|
65
54
|
label: "Placeholder Text",
|
|
66
55
|
value: "dsdsds",
|
|
67
56
|
disabled: true,
|
|
68
57
|
},
|
|
69
|
-
render:
|
|
58
|
+
render: (args) => {
|
|
70
59
|
console.log("args ", args);
|
|
71
|
-
|
|
72
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput,
|
|
60
|
+
const props = Object.assign({}, args);
|
|
61
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextInput, Object.assign({ id: "1", size: "lg" }, args, { endIcon: _jsx(CalendarIcon, { className: "size-full", fill: "inherit" }) })), _jsx(TextInput, Object.assign({ id: "2", size: "md" }, args, { endIcon: _jsx(CalendarIcon, { className: "size-full", fill: "inherit" }) })), _jsx(TextInput, Object.assign({ id: "3", size: "sm" }, args, { endIcon: _jsx(CalendarIcon, { className: "size-full", fill: "inherit" }) }))] }));
|
|
73
62
|
},
|
|
74
63
|
};
|