@rovula/ui 0.0.21 → 0.0.23
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 +185 -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/Text/Text.d.ts +6 -5
- package/dist/cjs/types/components/Text/Text.stories.d.ts +2 -10
- 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 +57 -10
- package/dist/components/Tabs/Tabs.stories.js +13 -24
- package/dist/components/Text/Text.js +19 -6
- 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 +185 -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/Text/Text.d.ts +6 -5
- package/dist/esm/types/components/Text/Text.stories.d.ts +2 -10
- 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 +35 -8
- package/dist/index.js +4 -0
- package/dist/src/theme/global.css +245 -619
- package/dist/stories/ColorGroupPreview.js +6 -9
- package/dist/stories/ColorPreview.js +1 -2
- package/dist/theme/main-preset.js +24 -0
- package/dist/theme/plugins/utilities/typography.js +9 -0
- package/dist/theme/presets/colors.js +8 -1
- package/dist/theme/tokens/color.css +1 -0
- package/dist/theme/tokens/typography.css +21 -0
- 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/Button/Button.tsx +1 -4
- package/src/components/Collapsible/Collapsible.tsx +1 -1
- 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 +31 -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 +100 -13
- package/src/components/Text/Text.tsx +35 -22
- 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/main-preset.js +24 -0
- package/src/theme/plugins/utilities/typography.js +9 -0
- package/src/theme/presets/colors.js +8 -1
- package/src/theme/tokens/color.css +1 -0
- package/src/theme/tokens/typography.css +21 -0
- 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
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
3
|
import { useState } from "react";
|
|
15
4
|
import { CalendarIcon } from "@heroicons/react/16/solid";
|
|
@@ -17,15 +6,10 @@ import { Calendar } from "../Calendar";
|
|
|
17
6
|
import { Popover, PopoverContent, PopoverTrigger } from "../Popover/Popover";
|
|
18
7
|
import { TextInput } from "../TextInput/TextInput";
|
|
19
8
|
import { format } from "date-fns/format";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var value = [];
|
|
25
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
26
|
-
value[_i] = arguments[_i];
|
|
27
|
-
}
|
|
28
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect.apply(void 0, value);
|
|
9
|
+
const DatePicker = ({ date, onSelect, textInputProps, }) => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
11
|
+
return (_jsx("div", { children: _jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("div", { className: "flex", children: _jsx(TextInput, Object.assign({ fullwidth: true, id: "2", readOnly: true, label: "Date", size: "md", value: date ? format(date, "dd MMM yyyy") : isOpen ? " " : "", hasClearIcon: false, endIcon: _jsx(CalendarIcon, { fill: "inherit" }) }, textInputProps)) }) }), _jsx(PopoverContent, { className: "w-auto p-0", children: _jsx(Calendar, { mode: "single", selected: date, onSelect: (...value) => {
|
|
12
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(...value);
|
|
29
13
|
setIsOpen(false);
|
|
30
14
|
} }) })] }) }));
|
|
31
15
|
};
|
|
@@ -1,19 +1,8 @@
|
|
|
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 React from "react";
|
|
14
3
|
import DatePicker from "./DatePicker";
|
|
15
4
|
// import { Popover, PopoverTrigger, PopoverContent } from "./Popover";
|
|
16
|
-
|
|
5
|
+
const meta = {
|
|
17
6
|
title: "Components/DatePicker",
|
|
18
7
|
component: DatePicker,
|
|
19
8
|
tags: ["autodocs"],
|
|
@@ -21,16 +10,16 @@ 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
|
-
export
|
|
17
|
+
export const Default = {
|
|
29
18
|
args: {},
|
|
30
|
-
render:
|
|
19
|
+
render: (args) => {
|
|
31
20
|
console.log("args ", args);
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
const props = Object.assign({}, args);
|
|
22
|
+
const [date, setDate] = React.useState(undefined);
|
|
34
23
|
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DatePicker, { date: date, onSelect: setDate }) }));
|
|
35
24
|
},
|
|
36
25
|
};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
3
|
var t = {};
|
|
15
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -26,38 +15,38 @@ import * as React from "react";
|
|
|
26
15
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
27
16
|
import { XMarkIcon } from "@heroicons/react/16/solid";
|
|
28
17
|
import { cn } from "@/utils/cn";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var className = _a
|
|
35
|
-
return (_jsx(DialogPrimitive.Overlay,
|
|
18
|
+
const Dialog = DialogPrimitive.Root;
|
|
19
|
+
const DialogTrigger = DialogPrimitive.Trigger;
|
|
20
|
+
const DialogPortal = DialogPrimitive.Portal;
|
|
21
|
+
const DialogClose = DialogPrimitive.Close;
|
|
22
|
+
const DialogOverlay = React.forwardRef((_a, ref) => {
|
|
23
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
+
return (_jsx(DialogPrimitive.Overlay, Object.assign({ ref: ref, className: cn("fixed inset-0 z-50 bg-base-popup-curtain data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className) }, props)));
|
|
36
25
|
});
|
|
37
26
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content,
|
|
27
|
+
const DialogContent = React.forwardRef((_a, ref) => {
|
|
28
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
29
|
+
return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, Object.assign({ ref: ref, className: cn("fixed text-base-popup-foreground left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-base-popup bg-base-popup p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-md", className) }, props, { children: [children, _jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-primary data-[state=open]:text-primary-foreground", children: [_jsx(XMarkIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] }))] }));
|
|
41
30
|
});
|
|
42
31
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
43
|
-
|
|
44
|
-
var className = _a
|
|
45
|
-
return (_jsx("div",
|
|
32
|
+
const DialogHeader = (_a) => {
|
|
33
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
34
|
+
return (_jsx("div", Object.assign({ className: cn("flex flex-col space-y-2 text-center sm:text-left", className) }, props)));
|
|
46
35
|
};
|
|
47
36
|
DialogHeader.displayName = "DialogHeader";
|
|
48
|
-
|
|
49
|
-
var className = _a
|
|
50
|
-
return (_jsx("div",
|
|
37
|
+
const DialogFooter = (_a) => {
|
|
38
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
39
|
+
return (_jsx("div", Object.assign({ className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 ", className) }, props)));
|
|
51
40
|
};
|
|
52
41
|
DialogFooter.displayName = "DialogFooter";
|
|
53
|
-
|
|
54
|
-
var className = _a
|
|
55
|
-
return (_jsx(DialogPrimitive.Title,
|
|
42
|
+
const DialogTitle = React.forwardRef((_a, ref) => {
|
|
43
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
44
|
+
return (_jsx(DialogPrimitive.Title, Object.assign({ ref: ref, className: cn("typography-h5 tracking-tight ", className) }, props)));
|
|
56
45
|
});
|
|
57
46
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
58
|
-
|
|
59
|
-
var className = _a
|
|
60
|
-
return (_jsx(DialogPrimitive.Description,
|
|
47
|
+
const DialogDescription = React.forwardRef((_a, ref) => {
|
|
48
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
49
|
+
return (_jsx(DialogPrimitive.Description, Object.assign({ ref: ref, className: cn("text-sm", className) }, props)));
|
|
61
50
|
});
|
|
62
51
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
63
52
|
export { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
|
|
@@ -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 { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./Dialog";
|
|
14
3
|
import Button from "../Button/Button";
|
|
15
4
|
import { Label } from "../Label/Label";
|
|
16
5
|
import { Input } from "../Input/Input";
|
|
17
|
-
|
|
6
|
+
const meta = {
|
|
18
7
|
title: "Components/Dialog",
|
|
19
8
|
component: Dialog,
|
|
20
9
|
tags: ["autodocs"],
|
|
@@ -22,31 +11,31 @@ var meta = {
|
|
|
22
11
|
layout: "fullscreen",
|
|
23
12
|
},
|
|
24
13
|
decorators: [
|
|
25
|
-
|
|
14
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
26
15
|
],
|
|
27
16
|
};
|
|
28
17
|
export default meta;
|
|
29
|
-
export
|
|
18
|
+
export const Default = {
|
|
30
19
|
args: {
|
|
31
20
|
// label: "Lorem Ipsum",
|
|
32
21
|
// value: "Lorem Ipsum",
|
|
33
22
|
// fullwidth: true,
|
|
34
23
|
},
|
|
35
|
-
render:
|
|
24
|
+
render: (args) => {
|
|
36
25
|
console.log("args ", args);
|
|
37
|
-
|
|
26
|
+
const props = Object.assign({}, args);
|
|
38
27
|
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(Dialog, { children: [_jsx(DialogTrigger, { children: "Open" }), _jsx(DialogContent, { children: _jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Are you absolutely sure?" }), _jsx(DialogDescription, { children: "This action cannot be undone. This will permanently delete your account and remove your data from our servers." })] }) })] }) }));
|
|
39
28
|
},
|
|
40
29
|
};
|
|
41
|
-
export
|
|
30
|
+
export const Demo = {
|
|
42
31
|
args: {
|
|
43
32
|
// label: "Lorem Ipsum",
|
|
44
33
|
// value: "Lorem Ipsum",
|
|
45
34
|
// fullwidth: true,
|
|
46
35
|
},
|
|
47
|
-
render:
|
|
36
|
+
render: (args) => {
|
|
48
37
|
console.log("args ", args);
|
|
49
|
-
|
|
38
|
+
const props = Object.assign({}, args);
|
|
50
39
|
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Edit Profile" }) }), _jsxs(DialogContent, { className: "sm:max-w-[425px]", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Edit profile" }), _jsx(DialogDescription, { children: "Make changes to your profile here. Click save when you're done." })] }), _jsxs("div", { className: "grid gap-4 py-4", children: [_jsxs("div", { className: "grid grid-cols-4 items-center gap-4", children: [_jsx(Label, { htmlFor: "name", className: "text-right", children: "Name" }), _jsx(Input, { id: "name", defaultValue: "Pedro Duarte", className: "col-span-3" })] }), _jsxs("div", { className: "grid grid-cols-4 items-center gap-4", children: [_jsx(Label, { htmlFor: "username", className: "text-right", children: "Username" }), _jsx(Input, { id: "username", defaultValue: "@peduarte", className: "col-span-3" })] })] }), _jsx(DialogFooter, { children: _jsx(Button, { type: "submit", children: "Save changes" }) })] })] }) }));
|
|
51
40
|
},
|
|
52
41
|
};
|
|
@@ -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,56 +14,56 @@ import { Fragment, forwardRef, useCallback, useEffect, useMemo, useRef, useState
|
|
|
25
14
|
import TextInput from "../TextInput/TextInput";
|
|
26
15
|
import { customInputVariant, dropdownIconVariant, iconWrapperVariant, } from "./Dropdown.styles";
|
|
27
16
|
import { ChevronDownIcon } from "@heroicons/react/16/solid";
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
useEffect(
|
|
17
|
+
const Dropdown = forwardRef((_a, ref) => {
|
|
18
|
+
var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect"]);
|
|
19
|
+
const _id = id || `${label}-select`;
|
|
20
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
21
|
+
const [selectedOption, setSelectedOption] = useState(null);
|
|
22
|
+
const [textValue, setTextValue] = useState("");
|
|
23
|
+
const keyCode = useRef("");
|
|
24
|
+
useEffect(() => {
|
|
36
25
|
if (value && !selectedOption) {
|
|
37
26
|
setSelectedOption(value);
|
|
38
27
|
}
|
|
39
28
|
}, [value, selectedOption]);
|
|
40
|
-
|
|
29
|
+
const handleOnChangeText = useCallback((event) => {
|
|
41
30
|
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(event);
|
|
42
31
|
setTextValue(event.target.value);
|
|
43
32
|
}, [onChangeText]);
|
|
44
|
-
|
|
33
|
+
const handleOptionClick = useCallback((option) => {
|
|
45
34
|
setSelectedOption(option);
|
|
46
35
|
setTextValue(option.label);
|
|
47
36
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
|
|
48
37
|
}, [onSelect]);
|
|
49
|
-
|
|
50
|
-
return options.filter(
|
|
38
|
+
const optionsFiltered = useMemo(() => {
|
|
39
|
+
return options.filter((option) => {
|
|
51
40
|
var _a;
|
|
52
41
|
return !filterMode ||
|
|
53
42
|
((_a = option.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(textValue === null || textValue === void 0 ? void 0 : textValue.toLowerCase()));
|
|
54
43
|
});
|
|
55
44
|
}, [options, filterMode, textValue]);
|
|
56
|
-
|
|
45
|
+
const renderOptions = () => (_jsxs("ul", { className: "absolute mt-1 w-full bg-base-popup border border-base-popup text-base-popup-foreground rounded-md shadow-md z-10 max-h-60 overflow-y-auto", children: [optionsFiltered.map((option) => {
|
|
57
46
|
if (option.renderLabel) {
|
|
58
47
|
return (_jsx(Fragment, { children: option.renderLabel({
|
|
59
48
|
value: option.value,
|
|
60
49
|
label: option.label,
|
|
61
|
-
handleOnClick:
|
|
62
|
-
className:
|
|
50
|
+
handleOnClick: () => handleOptionClick(option),
|
|
51
|
+
className: `px-4 py-2 hover:bg-gray-100 cursor-pointer ${(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value ? " bg-gray-200" : ""}`,
|
|
63
52
|
}) }, option.value));
|
|
64
53
|
}
|
|
65
|
-
return (_jsx("li", { onMouseDown:
|
|
54
|
+
return (_jsx("li", { onMouseDown: () => handleOptionClick(option), className: `px-4 py-2 hover:bg-primary-hover-bg cursor-pointer ${(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value
|
|
66
55
|
? "bg-base-popup-highligh"
|
|
67
|
-
: ""
|
|
68
|
-
}), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] }));
|
|
69
|
-
|
|
56
|
+
: ""}`, children: option.label }, option.value));
|
|
57
|
+
}), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] }));
|
|
58
|
+
const handleOnFocus = useCallback((e) => {
|
|
70
59
|
var _a;
|
|
71
60
|
setIsFocused(true);
|
|
72
61
|
(_a = props === null || props === void 0 ? void 0 : props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
73
62
|
}, [props === null || props === void 0 ? void 0 : props.onFocus]);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
63
|
+
const clearMismatchValue = useCallback((e) => {
|
|
64
|
+
const matchSelectedValue = optionsFiltered.find((opt) => { var _a, _b; return opt.value === ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value) || opt.label === ((_b = e.target) === null || _b === void 0 ? void 0 : _b.value); });
|
|
65
|
+
const isMatchSelectedValue = !!matchSelectedValue;
|
|
66
|
+
let option = matchSelectedValue || {
|
|
78
67
|
value: "",
|
|
79
68
|
label: "",
|
|
80
69
|
};
|
|
@@ -91,17 +80,17 @@ var Dropdown = forwardRef(function (_a, ref) {
|
|
|
91
80
|
setTextValue(option.label);
|
|
92
81
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(option);
|
|
93
82
|
}, [optionsFiltered, textValue]);
|
|
94
|
-
|
|
83
|
+
const handleOnBlur = useCallback((e) => {
|
|
95
84
|
var _a;
|
|
96
85
|
setIsFocused(false);
|
|
97
86
|
clearMismatchValue(e);
|
|
98
87
|
(_a = props === null || props === void 0 ? void 0 : props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
99
88
|
}, [props === null || props === void 0 ? void 0 : props.onBlur]);
|
|
100
|
-
|
|
89
|
+
const handleOnKeyDown = useCallback((e) => {
|
|
101
90
|
var _a;
|
|
102
91
|
keyCode.current = e.code;
|
|
103
92
|
(_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
104
93
|
}, [props === null || props === void 0 ? void 0 : props.onKeyDown]);
|
|
105
|
-
return (_jsxs("div", { className:
|
|
94
|
+
return (_jsxs("div", { className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx("div", { className: iconWrapperVariant({ size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size, isFocus: isFocused }) }) }) }, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown })), isFocused && renderOptions()] }));
|
|
106
95
|
});
|
|
107
96
|
export default Dropdown;
|
|
@@ -1,30 +1,10 @@
|
|
|
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
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
-
if (ar || !(i in from)) {
|
|
15
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
-
ar[i] = from[i];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
-
};
|
|
21
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
2
|
import { useRef, useState } from "react";
|
|
23
3
|
import Dropdown from "./Dropdown";
|
|
24
4
|
import Button from "../Button/Button";
|
|
25
5
|
import { cn } from "@/utils/cn";
|
|
26
6
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
27
|
-
|
|
7
|
+
const meta = {
|
|
28
8
|
title: "Components/Dropdown",
|
|
29
9
|
component: Dropdown,
|
|
30
10
|
tags: ["autodocs"],
|
|
@@ -33,43 +13,44 @@ var meta = {
|
|
|
33
13
|
layout: "fullscreen",
|
|
34
14
|
},
|
|
35
15
|
decorators: [
|
|
36
|
-
|
|
16
|
+
(Story) => (_jsx("div", { className: "p-5 flex w-full", children: _jsx(Story, {}) })),
|
|
37
17
|
],
|
|
38
18
|
};
|
|
39
19
|
export default meta;
|
|
40
|
-
|
|
41
|
-
value:
|
|
42
|
-
label:
|
|
43
|
-
})
|
|
44
|
-
export
|
|
20
|
+
const options = new Array(100).fill("").map((__, index) => ({
|
|
21
|
+
value: `option${index + 1}`,
|
|
22
|
+
label: `Option ${index + 1}`,
|
|
23
|
+
}));
|
|
24
|
+
export const Default = {
|
|
45
25
|
args: {
|
|
46
26
|
label: "Choose an option:",
|
|
47
27
|
fullwidth: true,
|
|
48
|
-
options
|
|
28
|
+
options,
|
|
49
29
|
},
|
|
50
|
-
render:
|
|
30
|
+
render: (args) => {
|
|
51
31
|
console.log("args ", args);
|
|
52
|
-
|
|
53
|
-
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(Dropdown,
|
|
32
|
+
const props = Object.assign({}, args);
|
|
33
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(Dropdown, Object.assign({ id: "1", size: "lg", options: options }, args)), _jsx(Dropdown, Object.assign({ id: "2", size: "md", options: options }, args)), _jsx(Dropdown, Object.assign({ id: "3", size: "sm", options: options }, args))] }));
|
|
54
34
|
},
|
|
55
35
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
const DropdownWithRef = (props) => {
|
|
37
|
+
const inputRef = useRef(null);
|
|
38
|
+
const [options, setOptions] = useState(customOptions);
|
|
39
|
+
const [value, setValue] = useState({
|
|
60
40
|
label: "",
|
|
61
41
|
value: "",
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
return (_jsx(Dropdown,
|
|
42
|
+
});
|
|
43
|
+
const [text, setText] = useState("");
|
|
44
|
+
return (_jsx(Dropdown, Object.assign({ id: "1", size: "lg" }, props, { value: value, options: options, ref: inputRef, labelClassName: "peer-focus:bg-red-500", onSelect: setValue, onChangeText: (e) => setText(e.target.value), onKeyDown: (e) => {
|
|
65
45
|
var _a, _b;
|
|
66
46
|
if (e.code === "Enter") {
|
|
67
|
-
setOptions(
|
|
47
|
+
setOptions((options) => [
|
|
48
|
+
...options,
|
|
68
49
|
{
|
|
69
50
|
label: text,
|
|
70
51
|
value: text,
|
|
71
52
|
},
|
|
72
|
-
]
|
|
53
|
+
]);
|
|
73
54
|
setValue({
|
|
74
55
|
label: text,
|
|
75
56
|
value: text,
|
|
@@ -78,39 +59,39 @@ var DropdownWithRef = function (props) {
|
|
|
78
59
|
}
|
|
79
60
|
} })));
|
|
80
61
|
};
|
|
81
|
-
export
|
|
62
|
+
export const WithRef = {
|
|
82
63
|
args: {
|
|
83
64
|
label: "Choose an option:",
|
|
84
65
|
fullwidth: true,
|
|
85
|
-
options
|
|
66
|
+
options,
|
|
86
67
|
filterMode: true,
|
|
87
68
|
},
|
|
88
|
-
render:
|
|
69
|
+
render: (args) => {
|
|
89
70
|
console.log("args ", args);
|
|
90
|
-
|
|
91
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef,
|
|
71
|
+
const props = Object.assign({}, args);
|
|
72
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef, Object.assign({ id: "1", size: "lg", options: options }, args)) }));
|
|
92
73
|
},
|
|
93
74
|
};
|
|
94
|
-
|
|
95
|
-
value:
|
|
96
|
-
label:
|
|
97
|
-
renderLabel
|
|
98
|
-
return (_jsxs("div", { className: cn(config, "w-full flex justify-between"), onMouseDown: config.handleOnClick, children: [_jsx("span", { children: "Test custom" }), _jsx(Button, { onMouseDown:
|
|
75
|
+
const customOptions = new Array(100).fill("").map((__, index) => ({
|
|
76
|
+
value: `option${index + 1}`,
|
|
77
|
+
label: `Option ${index + 1}`,
|
|
78
|
+
renderLabel(config) {
|
|
79
|
+
return (_jsxs("div", { className: cn(config, "w-full flex justify-between"), onMouseDown: config.handleOnClick, children: [_jsx("span", { children: "Test custom" }), _jsx(Button, { onMouseDown: (e) => {
|
|
99
80
|
// e.stopPropagation();
|
|
100
81
|
alert("SSS");
|
|
101
82
|
}, children: "Add action" })] }));
|
|
102
83
|
},
|
|
103
|
-
})
|
|
104
|
-
export
|
|
84
|
+
}));
|
|
85
|
+
export const CustomOption = {
|
|
105
86
|
args: {
|
|
106
87
|
label: "Choose an option:",
|
|
107
88
|
fullwidth: true,
|
|
108
89
|
options: customOptions,
|
|
109
90
|
filterMode: true,
|
|
110
91
|
},
|
|
111
|
-
render:
|
|
92
|
+
render: (args) => {
|
|
112
93
|
console.log("args ", args);
|
|
113
|
-
|
|
114
|
-
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef,
|
|
94
|
+
const props = Object.assign({}, args);
|
|
95
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef, Object.assign({ id: "1", size: "lg", options: options }, args)) }));
|
|
115
96
|
},
|
|
116
97
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "class-variance-authority";
|
|
2
|
-
export
|
|
2
|
+
export const iconWrapperVariant = cva(["absolute inset-y-0 right-0 flex items-center justify-center"], {
|
|
3
3
|
variants: {
|
|
4
4
|
size: {
|
|
5
5
|
sm: "mr-2",
|
|
@@ -11,7 +11,7 @@ export var iconWrapperVariant = cva(["absolute inset-y-0 right-0 flex items-cent
|
|
|
11
11
|
size: "md",
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
|
-
export
|
|
14
|
+
export const dropdownIconVariant = cva(["transition-all"], {
|
|
15
15
|
variants: {
|
|
16
16
|
size: {
|
|
17
17
|
sm: "size-[14px]",
|
|
@@ -33,7 +33,7 @@ export var dropdownIconVariant = cva(["transition-all"], {
|
|
|
33
33
|
isFocus: false,
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
-
export
|
|
36
|
+
export const customInputVariant = cva([], {
|
|
37
37
|
variants: {
|
|
38
38
|
size: {
|
|
39
39
|
sm: "pe-[30px]",
|