linkedunion-design-kit 1.11.6 → 1.11.8
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/app/layout.d.ts +1 -1
- package/dist/app/{layout.js → layout.jsx} +3 -2
- package/dist/app/page.d.ts +1 -1
- package/dist/app/page.jsx +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/src/components/Accordion/Accordion.stories.jsx +33 -0
- package/dist/src/components/Accordion/accordion.d.ts +4 -4
- package/dist/src/components/Accordion/{accordion.js → accordion.jsx} +11 -16
- package/dist/src/components/Alerts/Alert/alert.d.ts +7 -7
- package/dist/src/components/Alerts/Alert/{alert.js → alert.jsx} +21 -25
- package/dist/src/components/Alerts/Alert/alert.stories.d.ts +8 -8
- package/dist/src/components/Alerts/Alert/alert.stories.jsx +344 -0
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.d.ts +11 -11
- package/dist/src/components/Alerts/AlertDialog/{alert-dialog.js → alert-dialog.jsx} +26 -24
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.d.ts +10 -10
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.jsx +552 -0
- package/dist/src/components/AppIcons/AndroidIcon.jsx +24 -0
- package/dist/src/components/AppIcons/{AppIcon.js → AppIcon.jsx} +4 -15
- package/dist/src/components/AppIcons/AppleIcon.jsx +31 -0
- package/dist/src/components/AppIcons/PlayStoreIcon.jsx +29 -0
- package/dist/src/components/Avatar/Avatar/{Avatar.js → Avatar.jsx} +13 -18
- package/dist/src/components/Avatar/Avatar/Avatar.stories.d.ts +7 -7
- package/dist/src/components/Avatar/Avatar/Avatar.stories.jsx +95 -0
- package/dist/src/components/Avatar/Avatar/{Avatar.test.js → Avatar.test.jsx} +1 -2
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.jsx +17 -0
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.jsx +32 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.jsx +20 -0
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.stories.d.ts +2 -2
- package/dist/src/components/Avatar/StatusIndicator/{StatusIndicator.stories.js → StatusIndicator.stories.jsx} +12 -3
- package/dist/src/components/Badge/Badge.d.ts +1 -1
- package/dist/src/components/Badge/{Badge.js → Badge.jsx} +8 -13
- package/dist/src/components/Badge/Badge.stories.d.ts +10 -10
- package/dist/src/components/Badge/Badge.stories.jsx +201 -0
- package/dist/src/components/Button/Button/Button.d.ts +3 -2
- package/dist/src/components/Button/Button/{Button.js → Button.jsx} +24 -8
- package/dist/src/components/Button/Button/Button.stories.d.ts +5 -3
- package/dist/src/components/Button/Button/{Button.stories.js → Button.stories.jsx} +1 -13
- package/dist/src/components/Button/Button/Button.test.jsx +73 -0
- package/dist/src/components/Button/IconButton/IconButton.d.ts +1 -1
- package/dist/src/components/Button/IconButton/{IconButton.js → IconButton.jsx} +4 -13
- package/dist/src/components/Button/IconButton/IconButton.stories.d.ts +1 -1
- package/dist/src/components/Button/IconButton/{IconButton.stories.js → IconButton.stories.jsx} +1 -13
- package/dist/src/components/Button/IconButton/{IconButton.test.js → IconButton.test.jsx} +5 -6
- package/dist/src/components/Button/index.d.ts +1 -0
- package/dist/src/components/Button/index.js +3 -2
- package/dist/src/components/Card/MultipleNews/MultiNews.d.ts +1 -1
- package/dist/src/components/Card/MultipleNews/MultiNews.jsx +71 -0
- package/dist/src/components/Card/MultipleNews/{MultiNews.stories.js → MultiNews.stories.jsx} +1 -2
- package/dist/src/components/Card/PostByCategory/PostByCategory.d.ts +1 -1
- package/dist/src/components/Card/PostByCategory/PostByCategory.jsx +57 -0
- package/dist/src/components/Card/PostByCategory/{PostByCategory.stories.js → PostByCategory.stories.jsx} +1 -2
- package/dist/src/components/Card/SinglePost/SinglePost.d.ts +1 -1
- package/dist/src/components/Card/SinglePost/SinglePost.jsx +26 -0
- package/dist/src/components/Card/card.d.ts +2 -1
- package/dist/src/components/Card/{card.js → card.jsx} +2 -13
- package/dist/src/components/Card/contactProfile/ContactProfile.d.ts +1 -1
- package/dist/src/components/Card/contactProfile/ContactProfile.jsx +76 -0
- package/dist/src/components/Card/contactProfile/{ContactProfile.stories.js → ContactProfile.stories.jsx} +1 -2
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.d.ts +1 -1
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.jsx +41 -0
- package/dist/src/components/Card/photoAlbum/{PhotoAlbum.stories.js → PhotoAlbum.stories.jsx} +1 -13
- package/dist/src/components/Card/photoGallery/PhotoGallery.d.ts +1 -1
- package/dist/src/components/Card/photoGallery/PhotoGallery.jsx +17 -0
- package/dist/src/components/Card/photoGallery/{PhotoGallery.stories.js → PhotoGallery.stories.jsx} +1 -13
- package/dist/src/components/Checkbox/checkbox.d.ts +1 -1
- package/dist/src/components/Checkbox/{checkbox.js → checkbox.jsx} +6 -13
- package/dist/src/components/Checkbox/checkbox.stories.jsx +113 -0
- package/dist/src/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/src/components/ColorPicker/{ColorPicker.js → ColorPicker.jsx} +6 -13
- package/dist/src/components/ColorPicker/ColorPicker.stories.d.ts +5 -5
- package/dist/src/components/ColorPicker/ColorPicker.stories.jsx +138 -0
- package/dist/src/components/Colors/color.d.ts +1 -1
- package/dist/src/components/Colors/{color.js → color.jsx} +1 -2
- package/dist/src/components/Colors/color.stories.jsx +20 -0
- package/dist/src/components/Colors/{color.test.js → color.test.jsx} +3 -4
- package/dist/src/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/src/components/DatePicker/DatePicker.jsx +67 -0
- package/dist/src/components/DatePicker/DatePicker.stories.d.ts +9 -9
- package/dist/src/components/DatePicker/DatePicker.stories.jsx +291 -0
- package/dist/src/components/DateRangePicker/DateRangePicker.d.ts +1 -1
- package/dist/src/components/DateRangePicker/{DateRangePicker.js → DateRangePicker.jsx} +92 -44
- package/dist/src/components/DateRangePicker/DateRangePicker.stories.d.ts +19 -19
- package/dist/src/components/DateRangePicker/DateRangePicker.stories.jsx +582 -0
- package/dist/src/components/Dropdown/Combobox/Combobox.d.ts +1 -1
- package/dist/src/components/Dropdown/Combobox/{Combobox.js → Combobox.jsx} +67 -29
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.d.ts +8 -8
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.jsx +289 -0
- package/dist/src/components/Dropdown/Combobox/dialog.d.ts +10 -10
- package/dist/src/components/Dropdown/Combobox/dialog.jsx +66 -0
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.jsx +7 -0
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.d.ts +7 -3
- package/dist/src/components/Dropdown/DropdownMenu/{DropdownMenu.js → DropdownMenu.jsx} +29 -22
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.d.ts +19 -12
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.jsx +552 -0
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.jsx +19 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.d.ts +5 -0
- package/dist/src/components/Dropdown/DropdownMenu/index.js +5 -0
- package/dist/src/components/Dropdown/Select.stories.d.ts +7 -6
- package/dist/src/components/Dropdown/{Select.stories.js → Select.stories.jsx} +71 -8
- package/dist/src/components/Dropdown/select.d.ts +10 -10
- package/dist/src/components/Dropdown/select.jsx +94 -0
- package/dist/src/components/Icons/LUIcon.d.ts +1 -1
- package/dist/src/components/Icons/{LUIcon.js → LUIcon.jsx} +10 -13
- package/dist/src/components/Icons/stories/IconDropdown.jsx +67 -0
- package/dist/src/components/Icons/stories/IconGallery.jsx +77 -0
- package/dist/src/components/Icons/stories/InteractiveIconSelector.jsx +86 -0
- package/dist/src/components/Icons/stories/LUIcon.stories.d.ts +5 -5
- package/dist/src/components/Icons/stories/{LUIcon.stories.js → LUIcon.stories.jsx} +23 -8
- package/dist/src/components/ImageUploader/imageUploader.d.ts +1 -1
- package/dist/src/components/ImageUploader/{imageUploader.js → imageUploader.jsx} +28 -13
- package/dist/src/components/Images/LuImage.d.ts +1 -1
- package/dist/src/components/Images/{LuImage.js → LuImage.jsx} +1 -13
- package/dist/src/components/Images/{LuImage.stories.js → LuImage.stories.jsx} +1 -13
- package/dist/src/components/Images/{LuImage.test.js → LuImage.test.jsx} +6 -18
- package/dist/src/components/Input/Input.stories.d.ts +9 -8
- package/dist/src/components/Input/Input.stories.jsx +250 -0
- package/dist/src/components/Input/input.d.ts +1 -1
- package/dist/src/components/Input/{input.js → input.jsx} +10 -13
- package/dist/src/components/Label/Label.d.ts +1 -1
- package/dist/src/components/Label/{Label.js → Label.jsx} +2 -13
- package/dist/src/components/Label/{Label.stories.js → Label.stories.jsx} +1 -13
- package/dist/src/components/Modal/Modal.d.ts +3 -3
- package/dist/src/components/Modal/{Modal.js → Modal.jsx} +20 -19
- package/dist/src/components/Modal/Modal.stories.d.ts +15 -15
- package/dist/src/components/Modal/Modal.stories.jsx +487 -0
- package/dist/src/components/Pagination/pagination.d.ts +5 -5
- package/dist/src/components/Pagination/{pagination.js → pagination.jsx} +18 -21
- package/dist/src/components/Pagination/pagination.stories.d.ts +6 -6
- package/dist/src/components/Pagination/pagination.stories.jsx +301 -0
- package/dist/src/components/RadioGroup/{RadioGroup.stories.js → RadioGroup.stories.jsx} +52 -22
- package/dist/src/components/RadioGroup/radio-group.d.ts +1 -1
- package/dist/src/components/RadioGroup/{radio-group.js → radio-group.jsx} +6 -14
- package/dist/src/components/Separator/Separator.stories.d.ts +15 -0
- package/dist/src/components/Separator/Separator.stories.jsx +94 -0
- package/dist/src/components/Separator/index.d.ts +1 -0
- package/dist/src/components/Separator/index.js +1 -0
- package/dist/src/components/Separator/separator.d.ts +4 -0
- package/dist/src/components/Separator/separator.jsx +20 -0
- package/dist/src/components/Sheet/index.d.ts +1 -0
- package/dist/src/components/Sheet/index.js +1 -0
- package/dist/src/components/Sheet/sheet.d.ts +25 -0
- package/dist/src/components/Sheet/sheet.jsx +73 -0
- package/dist/src/components/Sheet/sheet.stories.d.ts +4 -0
- package/dist/src/components/Sheet/sheet.stories.jsx +34 -0
- package/dist/src/components/Skeleton/skeleton.d.ts +14 -14
- package/dist/src/components/Skeleton/{skeleton.js → skeleton.jsx} +23 -27
- package/dist/src/components/Skeleton/skeleton.stories.d.ts +14 -14
- package/dist/src/components/Skeleton/skeleton.stories.jsx +734 -0
- package/dist/src/components/Slider/slider.d.ts +1 -1
- package/dist/src/components/Slider/slider.jsx +31 -0
- package/dist/src/components/SweetAlert/SweetAlert.d.ts +9 -9
- package/dist/src/components/SweetAlert/{SweetAlert.js → SweetAlert.jsx} +18 -21
- package/dist/src/components/SweetAlert/SweetAlert.stories.d.ts +7 -7
- package/dist/src/components/SweetAlert/{SweetAlert.stories.js → SweetAlert.stories.jsx} +215 -15
- package/dist/src/components/Switch/{Switch.stories.js → Switch.stories.jsx} +1 -13
- package/dist/src/components/Switch/switch.d.ts +1 -1
- package/dist/src/components/Switch/{switch.js → switch.jsx} +4 -13
- package/dist/src/components/Table/{Table.js → Table.jsx} +111 -58
- package/dist/src/components/Table/Table.stories.d.ts +13 -13
- package/dist/src/components/Table/{Table.stories.js → Table.stories.jsx} +299 -45
- package/dist/src/components/Table/{Table.test.js → Table.test.jsx} +39 -7
- package/dist/src/components/Tabs/{Tabs.stories.js → Tabs.stories.jsx} +10 -3
- package/dist/src/components/Tabs/tabs.d.ts +4 -4
- package/dist/src/components/Tabs/tabs.jsx +32 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/src/components/TimePicker/{TimePicker.js → TimePicker.jsx} +54 -30
- package/dist/src/components/TimePicker/TimePicker.stories.d.ts +10 -10
- package/dist/src/components/TimePicker/TimePicker.stories.jsx +298 -0
- package/dist/src/components/Title/Title.d.ts +1 -1
- package/dist/src/components/Title/{Title.js → Title.jsx} +2 -2
- package/dist/src/components/Title/{Title.stories.js → Title.stories.jsx} +1 -13
- package/dist/src/components/Title/{Title.test.js → Title.test.jsx} +4 -5
- package/dist/src/components/ToolTip/Tooltip.d.ts +1 -1
- package/dist/src/components/ToolTip/Tooltip.jsx +18 -0
- package/dist/src/components/ToolTip/{Tooltip.stories.js → Tooltip.stories.jsx} +2 -14
- package/dist/src/components/Typography/Body/{Body.stories.js → Body.stories.jsx} +1 -13
- package/dist/src/components/Typography/Body/body.d.ts +1 -1
- package/dist/src/components/Typography/Body/{body.js → body.jsx} +4 -13
- package/dist/src/components/Typography/Caption/{Caption.stories.js → Caption.stories.jsx} +1 -13
- package/dist/src/components/Typography/Caption/caption.d.ts +1 -1
- package/dist/src/components/Typography/Caption/{caption.js → caption.jsx} +4 -13
- package/dist/src/components/Typography/Display/{Display.stories.js → Display.stories.jsx} +1 -13
- package/dist/src/components/Typography/Display/display.d.ts +1 -1
- package/dist/src/components/Typography/Display/{display.js → display.jsx} +4 -13
- package/dist/src/components/Typography/Heading/Heading.stories.d.ts +6 -6
- package/dist/src/components/Typography/Heading/Heading.stories.jsx +85 -0
- package/dist/src/components/Typography/Heading/{heading.js → heading.jsx} +5 -14
- package/dist/src/components/VerticalTabs/{VerticalTabs.js → VerticalTabs.jsx} +9 -17
- package/dist/src/components/VerticalTabs/VerticalTabs.stories.jsx +154 -0
- package/dist/src/components/VerticalTabs/VerticalTabs.test.jsx +97 -0
- package/dist/src/components/ui/calendar.d.ts +2 -2
- package/dist/src/components/ui/{calendar.js → calendar.jsx} +36 -22
- package/dist/src/components/ui/command.d.ts +9 -9
- package/dist/src/components/ui/command.jsx +67 -0
- package/dist/src/components/ui/popover.d.ts +4 -4
- package/dist/src/components/ui/popover.jsx +33 -0
- package/dist/src/components/ui/tooltip.d.ts +4 -4
- package/dist/src/components/ui/tooltip.jsx +38 -0
- package/dist/src/components/ui/typography.d.ts +1 -1
- package/dist/src/components/ui/{typography.js → typography.jsx} +4 -13
- package/dist/styles/global.css +107 -5
- package/package.json +4 -3
- package/dist/app/page.js +0 -4
- package/dist/src/components/Accordion/Accordion.stories.js +0 -32
- package/dist/src/components/Alerts/Alert/alert.stories.js +0 -166
- package/dist/src/components/Alerts/AlertDialog/alert-dialog.stories.js +0 -213
- package/dist/src/components/AppIcons/AndroidIcon.js +0 -28
- package/dist/src/components/AppIcons/AppleIcon.js +0 -28
- package/dist/src/components/AppIcons/PlayStoreIcon.js +0 -28
- package/dist/src/components/Avatar/Avatar/Avatar.stories.js +0 -69
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.js +0 -8
- package/dist/src/components/Avatar/AvatarGroup/AvatarGroup.stories.js +0 -14
- package/dist/src/components/Avatar/StatusIndicator/StatusIndicator.js +0 -18
- package/dist/src/components/Badge/Badge.stories.js +0 -145
- package/dist/src/components/Button/Button/Button.test.js +0 -10
- package/dist/src/components/Card/MultipleNews/MultiNews.js +0 -46
- package/dist/src/components/Card/PostByCategory/PostByCategory.js +0 -37
- package/dist/src/components/Card/SinglePost/SinglePost.js +0 -10
- package/dist/src/components/Card/contactProfile/ContactProfile.js +0 -39
- package/dist/src/components/Card/photoAlbum/PhotoAlbum.js +0 -16
- package/dist/src/components/Card/photoGallery/PhotoGallery.js +0 -8
- package/dist/src/components/Checkbox/checkbox.stories.js +0 -78
- package/dist/src/components/ColorPicker/ColorPicker.stories.js +0 -77
- package/dist/src/components/Colors/color.stories.js +0 -32
- package/dist/src/components/DatePicker/DatePicker.js +0 -64
- package/dist/src/components/DatePicker/DatePicker.stories.js +0 -171
- package/dist/src/components/DateRangePicker/DateRangePicker.stories.js +0 -318
- package/dist/src/components/Dropdown/Combobox/Combobox.stories.js +0 -225
- package/dist/src/components/Dropdown/Combobox/dialog.js +0 -68
- package/dist/src/components/Dropdown/Combobox/utils/renderBadge.js +0 -5
- package/dist/src/components/Dropdown/DropdownMenu/DropdownMenu.stories.js +0 -253
- package/dist/src/components/Dropdown/DropdownMenu/SelectAllSection.js +0 -9
- package/dist/src/components/Dropdown/select.js +0 -87
- package/dist/src/components/Icons/stories/IconDropdown.js +0 -38
- package/dist/src/components/Icons/stories/IconGallery.js +0 -31
- package/dist/src/components/Icons/stories/InteractiveIconSelector.js +0 -26
- package/dist/src/components/Input/Input.stories.js +0 -133
- package/dist/src/components/Modal/Modal.stories.js +0 -115
- package/dist/src/components/Pagination/pagination.stories.js +0 -168
- package/dist/src/components/Skeleton/skeleton.stories.js +0 -414
- package/dist/src/components/Slider/slider.js +0 -38
- package/dist/src/components/Tabs/tabs.js +0 -43
- package/dist/src/components/TimePicker/TimePicker.stories.js +0 -176
- package/dist/src/components/ToolTip/Tooltip.js +0 -8
- package/dist/src/components/Typography/Heading/Heading.stories.js +0 -67
- package/dist/src/components/VerticalTabs/VerticalTabs.stories.js +0 -100
- package/dist/src/components/VerticalTabs/VerticalTabs.test.js +0 -48
- package/dist/src/components/ui/command.js +0 -65
- package/dist/src/components/ui/popover.js +0 -42
- package/dist/src/components/ui/tooltip.js +0 -42
- /package/dist/src/components/AppIcons/{AppIcon.stories.js → AppIcon.stories.jsx} +0 -0
- /package/dist/src/components/Card/SinglePost/{SinglePost.stories.js → SinglePost.stories.jsx} +0 -0
- /package/dist/src/components/Icons/{LUIcon.test.js → LUIcon.test.jsx} +0 -0
- /package/dist/src/components/ImageUploader/{ImageUploader.stories.js → ImageUploader.stories.jsx} +0 -0
- /package/dist/src/components/Slider/{Slider.stories.js → Slider.stories.jsx} +0 -0
- /package/dist/src/components/ui/{collapsible.js → collapsible.jsx} +0 -0
|
@@ -1,318 +0,0 @@
|
|
|
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
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
import { DateRangePicker } from "./DateRangePicker";
|
|
23
|
-
import { Body } from "../Typography/Body/body";
|
|
24
|
-
import { Label } from "../Label/Label";
|
|
25
|
-
import { Caption } from "../Typography/Caption/caption";
|
|
26
|
-
import Tooltip from "../ToolTip/Tooltip";
|
|
27
|
-
import LUIcon from "../Icons/LUIcon";
|
|
28
|
-
import { Default_DateRangePicker_Color, Default_DateRangePicker_Shadow, Default_DateRangePicker_Shape, Default_DateRangePicker_Size, Default_DateRangePicker_Variant, } from ".";
|
|
29
|
-
import { inputVariantConfig } from "../Input/input";
|
|
30
|
-
import { useState } from "react";
|
|
31
|
-
import { addDays, subDays, startOfMonth, endOfMonth, subMonths, startOfYear, endOfYear, startOfDay, } from "date-fns";
|
|
32
|
-
import { DateRangePickerDefaults } from "../../utils/constants";
|
|
33
|
-
import { Button } from "../Button/Button/Button";
|
|
34
|
-
// Destructure default values from enum
|
|
35
|
-
var defaultNumberOfMonths = DateRangePickerDefaults.numberOfMonths, defaultDateFormat = DateRangePickerDefaults.dateFormat, defaultSeparator = DateRangePickerDefaults.separator, defaultStartLabel = DateRangePickerDefaults.startLabel, defaultEndLabel = DateRangePickerDefaults.endLabel;
|
|
36
|
-
// Helper to get today's date
|
|
37
|
-
var getToday = function () { return startOfDay(new Date()); };
|
|
38
|
-
// Common preset configurations
|
|
39
|
-
var getCommonPresets = function (today) { return [
|
|
40
|
-
{ label: "Today", range: { from: today, to: today } },
|
|
41
|
-
{ label: "Last 7 Days", range: { from: subDays(today, 6), to: today } },
|
|
42
|
-
{ label: "Last 30 Days", range: { from: subDays(today, 29), to: today } },
|
|
43
|
-
{
|
|
44
|
-
label: "This Month",
|
|
45
|
-
range: { from: startOfMonth(today), to: endOfMonth(today) },
|
|
46
|
-
},
|
|
47
|
-
]; };
|
|
48
|
-
var getExtendedPresets = function (today) { return __spreadArray(__spreadArray([], getCommonPresets(today), true), [
|
|
49
|
-
{ label: "Last 14 Days", range: { from: subDays(today, 13), to: today } },
|
|
50
|
-
{
|
|
51
|
-
label: "Last Month",
|
|
52
|
-
range: {
|
|
53
|
-
from: startOfMonth(subMonths(today, 1)),
|
|
54
|
-
to: endOfMonth(subMonths(today, 1)),
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "This Year",
|
|
59
|
-
range: { from: startOfYear(today), to: endOfYear(today) },
|
|
60
|
-
},
|
|
61
|
-
], false); };
|
|
62
|
-
var getBookingPresets = function (today) { return [
|
|
63
|
-
{
|
|
64
|
-
label: "Weekend",
|
|
65
|
-
range: { from: addDays(today, 5), to: addDays(today, 7) },
|
|
66
|
-
},
|
|
67
|
-
{ label: "1 Week", range: { from: today, to: addDays(today, 7) } },
|
|
68
|
-
{ label: "2 Weeks", range: { from: today, to: addDays(today, 14) } },
|
|
69
|
-
]; };
|
|
70
|
-
var getAnalyticsPresets = function (today) { return [
|
|
71
|
-
{ label: "Last 7 Days", range: { from: subDays(today, 6), to: today } },
|
|
72
|
-
{ label: "Last 30 Days", range: { from: subDays(today, 29), to: today } },
|
|
73
|
-
{ label: "Last 90 Days", range: { from: subDays(today, 89), to: today } },
|
|
74
|
-
{
|
|
75
|
-
label: "This Month",
|
|
76
|
-
range: { from: startOfMonth(today), to: endOfMonth(today) },
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
label: "Last Month",
|
|
80
|
-
range: {
|
|
81
|
-
from: startOfMonth(subMonths(today, 1)),
|
|
82
|
-
to: endOfMonth(subMonths(today, 1)),
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
]; };
|
|
86
|
-
// Reusable hook for date range state
|
|
87
|
-
var useDateRangeState = function (initialValue) {
|
|
88
|
-
if (initialValue === void 0) { initialValue = null; }
|
|
89
|
-
return useState(initialValue);
|
|
90
|
-
};
|
|
91
|
-
// Helper component for displaying selected dates
|
|
92
|
-
var SelectedDateDisplay = function (_a) {
|
|
93
|
-
var dateRange = _a.dateRange;
|
|
94
|
-
if (!(dateRange === null || dateRange === void 0 ? void 0 : dateRange.from))
|
|
95
|
-
return null;
|
|
96
|
-
return (_jsxs(Caption, { variant: "sm", color: "gray", children: ["Selected: ", dateRange.from.toLocaleDateString(), dateRange.to && " - ".concat(dateRange.to.toLocaleDateString())] }));
|
|
97
|
-
};
|
|
98
|
-
export default {
|
|
99
|
-
title: "Components/DateRangePicker",
|
|
100
|
-
component: DateRangePicker,
|
|
101
|
-
tags: ["autodocs"],
|
|
102
|
-
argTypes: {
|
|
103
|
-
variant: {
|
|
104
|
-
control: {
|
|
105
|
-
type: "select",
|
|
106
|
-
},
|
|
107
|
-
options: Object.keys(inputVariantConfig.variant),
|
|
108
|
-
defaultValue: Default_DateRangePicker_Variant,
|
|
109
|
-
},
|
|
110
|
-
size: {
|
|
111
|
-
control: {
|
|
112
|
-
type: "select",
|
|
113
|
-
},
|
|
114
|
-
options: Object.keys(inputVariantConfig.size),
|
|
115
|
-
defaultValue: Default_DateRangePicker_Size,
|
|
116
|
-
description: "Size of the input and calendar",
|
|
117
|
-
},
|
|
118
|
-
color: {
|
|
119
|
-
control: {
|
|
120
|
-
type: "select",
|
|
121
|
-
},
|
|
122
|
-
options: Object.keys(inputVariantConfig.color),
|
|
123
|
-
defaultValue: Default_DateRangePicker_Color,
|
|
124
|
-
description: "Color scheme of the input",
|
|
125
|
-
},
|
|
126
|
-
shape: {
|
|
127
|
-
control: {
|
|
128
|
-
type: "select",
|
|
129
|
-
},
|
|
130
|
-
options: Object.keys(inputVariantConfig.shape),
|
|
131
|
-
defaultValue: Default_DateRangePicker_Shape,
|
|
132
|
-
description: "Shape of the input",
|
|
133
|
-
},
|
|
134
|
-
shadow: {
|
|
135
|
-
control: "boolean",
|
|
136
|
-
defaultValue: Default_DateRangePicker_Shadow,
|
|
137
|
-
description: "Show shadow on the calendar popover",
|
|
138
|
-
},
|
|
139
|
-
disabled: {
|
|
140
|
-
control: "boolean",
|
|
141
|
-
defaultValue: false,
|
|
142
|
-
description: "Whether the date range picker is disabled",
|
|
143
|
-
},
|
|
144
|
-
numberOfMonths: {
|
|
145
|
-
control: {
|
|
146
|
-
type: "number",
|
|
147
|
-
min: 1,
|
|
148
|
-
max: 2,
|
|
149
|
-
},
|
|
150
|
-
defaultValue: Number(defaultNumberOfMonths),
|
|
151
|
-
description: "Number of calendar months to display",
|
|
152
|
-
},
|
|
153
|
-
dateFormat: {
|
|
154
|
-
control: "text",
|
|
155
|
-
defaultValue: defaultDateFormat,
|
|
156
|
-
description: "Format for displaying dates",
|
|
157
|
-
},
|
|
158
|
-
separator: {
|
|
159
|
-
control: "text",
|
|
160
|
-
defaultValue: defaultSeparator,
|
|
161
|
-
description: "Separator between start and end dates",
|
|
162
|
-
},
|
|
163
|
-
showClearButton: {
|
|
164
|
-
control: "boolean",
|
|
165
|
-
defaultValue: true,
|
|
166
|
-
description: "Show clear button when date is selected",
|
|
167
|
-
},
|
|
168
|
-
showApplyButton: {
|
|
169
|
-
control: "boolean",
|
|
170
|
-
defaultValue: false,
|
|
171
|
-
description: "Show Apply and Cancel buttons in calendar footer",
|
|
172
|
-
},
|
|
173
|
-
startLabel: {
|
|
174
|
-
control: "text",
|
|
175
|
-
defaultValue: defaultStartLabel,
|
|
176
|
-
description: "Label for start date placeholder",
|
|
177
|
-
},
|
|
178
|
-
endLabel: {
|
|
179
|
-
control: "text",
|
|
180
|
-
defaultValue: defaultEndLabel,
|
|
181
|
-
description: "Label for end date placeholder",
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
parameters: {
|
|
185
|
-
docs: {
|
|
186
|
-
description: {
|
|
187
|
-
component: "A date range picker component for selecting a start and end date. Built on top of react-day-picker with support for presets, custom date ranges, multiple months display, clear functionality, optional Apply/Cancel buttons, and customizable start/end labels for better UX. Automatically adapts to mobile screens (< 768px) with a step-by-step date selection process: first select start date, then end date, then confirm with Apply/Cancel buttons.",
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
var Template = function (args) {
|
|
193
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
194
|
-
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsx("div", { className: "w-80", children: _jsx(DateRangePicker, __assign({}, args, { dateRange: dateRange, onChange: setDateRange })) }), _jsx(SelectedDateDisplay, { dateRange: dateRange })] }));
|
|
195
|
-
};
|
|
196
|
-
export var Default = Template.bind({});
|
|
197
|
-
Default.args = {
|
|
198
|
-
size: Default_DateRangePicker_Size,
|
|
199
|
-
variant: Default_DateRangePicker_Variant,
|
|
200
|
-
color: Default_DateRangePicker_Color,
|
|
201
|
-
shape: Default_DateRangePicker_Shape,
|
|
202
|
-
shadow: Default_DateRangePicker_Shadow,
|
|
203
|
-
numberOfMonths: 2,
|
|
204
|
-
};
|
|
205
|
-
export var WithStartEndLabels = function () {
|
|
206
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
207
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Default Labels" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Shows \"Start date\" and \"End date\" by default" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, endIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Custom Labels" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Customize labels for your use case" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startLabel: "Check-in", endLabel: "Check-out", endIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Business Context" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Labels adapt to your domain" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startLabel: "From", endLabel: "To", endIcon: "calendar-days" })] })] }));
|
|
208
|
-
};
|
|
209
|
-
export var WithIcons = function () {
|
|
210
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
211
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "With Calendar Icon" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "With Both Icons" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", endIcon: "angle-down" })] })] }));
|
|
212
|
-
};
|
|
213
|
-
export var Sizes = function () {
|
|
214
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
215
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Small (sm)" }), _jsx(DateRangePicker, { size: "sm", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Medium (md)" }), _jsx(DateRangePicker, { size: "md", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Large (lg)" }), _jsx(DateRangePicker, { size: "lg", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] })] }));
|
|
216
|
-
};
|
|
217
|
-
export var Variants = function () {
|
|
218
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
219
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Filled (default)" }), _jsx(DateRangePicker, { variant: "filled", color: "default", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Outline" }), _jsx(DateRangePicker, { variant: "outlined", color: "default", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] })] }));
|
|
220
|
-
};
|
|
221
|
-
export var Shapes = function () {
|
|
222
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
223
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Square" }), _jsx(DateRangePicker, { shape: "square", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Rounded" }), _jsx(DateRangePicker, { shape: "rounded", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] })] }));
|
|
224
|
-
};
|
|
225
|
-
export var WithPresets = function () {
|
|
226
|
-
var today = getToday();
|
|
227
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
228
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsx(Label, { children: "With Quick Select Presets" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", presets: getExtendedPresets(today) }), _jsx(SelectedDateDisplay, { dateRange: dateRange })] }));
|
|
229
|
-
};
|
|
230
|
-
export var SingleMonth = function () {
|
|
231
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
232
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsx(Label, { children: "Single Month Display" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", numberOfMonths: 1 })] }));
|
|
233
|
-
};
|
|
234
|
-
export var WithDateRestrictions = function () {
|
|
235
|
-
var today = getToday();
|
|
236
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
237
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Only Future Dates" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Cannot select dates before today" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", minDate: today })] }), _jsxs("div", { children: [_jsx(Label, { children: "Only Past Dates" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Cannot select dates after today" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", maxDate: today })] }), _jsxs("div", { children: [_jsx(Label, { children: "Restricted Range" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Only dates within 30 days from today" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", minDate: subDays(today, 30), maxDate: addDays(today, 30) })] })] }));
|
|
238
|
-
};
|
|
239
|
-
export var DisabledState = function () {
|
|
240
|
-
var dateRange = useState({
|
|
241
|
-
from: startOfDay(new Date()),
|
|
242
|
-
to: addDays(startOfDay(new Date()), 7),
|
|
243
|
-
})[0];
|
|
244
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Disabled Empty" }), _jsx(DateRangePicker, { disabled: true, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Disabled with Value" }), _jsx(DateRangePicker, { disabled: true, dateRange: dateRange, startIcon: "calendar-days" })] })] }));
|
|
245
|
-
};
|
|
246
|
-
export var CustomFormatting = function () {
|
|
247
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
248
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Custom Date Format" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Format: dd/MM/yyyy" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", dateFormat: "dd/MM/yyyy" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Custom Separator" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Separator: \" to \"" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", separator: " to " })] }), _jsxs("div", { children: [_jsx(Label, { children: "Long Date Format" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Format: MMM dd, yyyy" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", dateFormat: "MMM dd, yyyy" })] })] }));
|
|
249
|
-
};
|
|
250
|
-
export var Colors = function () {
|
|
251
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
252
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Default" }), _jsx(DateRangePicker, { color: "default", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsxs("div", { children: [_jsx(Label, { children: "Error" }), _jsx(DateRangePicker, { color: "danger", dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" }), _jsx(Caption, { variant: "sm", color: "danger", className: "mt-1", children: "Please select a valid date range" })] })] }));
|
|
253
|
-
};
|
|
254
|
-
export var FormIntegration = function () {
|
|
255
|
-
var today = getToday();
|
|
256
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
257
|
-
var _b = useState(false), submitted = _b[0], setSubmitted = _b[1];
|
|
258
|
-
var handleSubmit = function (e) {
|
|
259
|
-
e.preventDefault();
|
|
260
|
-
setSubmitted(true);
|
|
261
|
-
setTimeout(function () { return setSubmitted(false); }, 3000);
|
|
262
|
-
};
|
|
263
|
-
return (_jsxs("form", { onSubmit: handleSubmit, className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "Booking Period" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Select your check-in and check-out dates" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", minDate: today, presets: getBookingPresets(today) })] }), _jsx(Button, { type: "submit", disabled: !(dateRange === null || dateRange === void 0 ? void 0 : dateRange.from) || !(dateRange === null || dateRange === void 0 ? void 0 : dateRange.to), className: "w-full", children: "Book Now" }), submitted && (_jsx("div", { className: "p-3 bg-green-50 border border-green-200 rounded-md", children: _jsxs(Body, { variant: "body-sm", color: "success", children: ["\u2713 Booking submitted for", " ", (dateRange === null || dateRange === void 0 ? void 0 : dateRange.from) && dateRange.from.toLocaleDateString(), (dateRange === null || dateRange === void 0 ? void 0 : dateRange.to) && " - ".concat(dateRange.to.toLocaleDateString())] }) }))] }));
|
|
264
|
-
};
|
|
265
|
-
export var WithTooltip = function () {
|
|
266
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
267
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Label, { children: "Reporting Period" }), _jsx(Tooltip, { title: "Select the start and end dates for your report", children: _jsx(LUIcon, { icon: "info", size: "xs", color: "gray" }) })] }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }));
|
|
268
|
-
};
|
|
269
|
-
export var RealWorldExamples = function () {
|
|
270
|
-
var today = getToday();
|
|
271
|
-
var _a = useDateRangeState(), bookingRange = _a[0], setBookingRange = _a[1];
|
|
272
|
-
var _b = useDateRangeState({
|
|
273
|
-
from: subDays(today, 30),
|
|
274
|
-
to: today,
|
|
275
|
-
}), analyticsRange = _b[0], setAnalyticsRange = _b[1];
|
|
276
|
-
var _c = useDateRangeState(), projectRange = _c[0], setProjectRange = _c[1];
|
|
277
|
-
return (_jsxs("div", { className: "flex flex-col gap-6 max-w-2xl", children: [_jsxs("div", { children: [_jsx(Body, { variant: "body-lg-500", className: "mb-4", children: "Hotel Booking" }), _jsx("div", { className: "p-4 border border-gray-200 rounded-lg space-y-4", children: _jsxs("div", { children: [_jsx(Label, { children: "Select your stay dates" }), _jsx(DateRangePicker, { dateRange: bookingRange, onChange: setBookingRange, startIcon: "calendar-days", minDate: today, separator: " \u2192 ", numberOfMonths: 2, presets: getBookingPresets(today) })] }) })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-lg-500", className: "mb-4", children: "Analytics Dashboard" }), _jsxs("div", { className: "p-4 border border-gray-200 rounded-lg space-y-4", children: [_jsxs("div", { children: [_jsx(Label, { children: "Date Range" }), _jsx(DateRangePicker, { dateRange: analyticsRange, onChange: setAnalyticsRange, startIcon: "calendar-days", numberOfMonths: 2, presets: getAnalyticsPresets(today) })] }), (analyticsRange === null || analyticsRange === void 0 ? void 0 : analyticsRange.from) && (analyticsRange === null || analyticsRange === void 0 ? void 0 : analyticsRange.to) && (_jsx("div", { className: "p-3 bg-blue-50 rounded-md", children: _jsxs(Caption, { variant: "sm", color: "info", children: ["Showing data for", " ", Math.ceil((analyticsRange.to.getTime() -
|
|
278
|
-
analyticsRange.from.getTime()) /
|
|
279
|
-
(1000 * 60 * 60 * 24)) + 1, " ", "days"] }) }))] })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-lg-500", className: "mb-4", children: "Project Timeline" }), _jsx("div", { className: "p-4 border border-gray-200 rounded-lg space-y-4", children: _jsxs("div", { children: [_jsx(Label, { children: "Project Duration" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Set the start and end dates for your project" }), _jsx(DateRangePicker, { dateRange: projectRange, onChange: setProjectRange, startIcon: "calendar-days", minDate: today, variant: "outlined", numberOfMonths: 2 })] }) })] })] }));
|
|
280
|
-
};
|
|
281
|
-
export var WithClearButton = function () {
|
|
282
|
-
var _a = useState({
|
|
283
|
-
from: startOfDay(new Date()),
|
|
284
|
-
to: addDays(startOfDay(new Date()), 7),
|
|
285
|
-
}), dateRange = _a[0], setDateRange = _a[1];
|
|
286
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsxs("div", { children: [_jsx(Label, { children: "With Clear Button (default)" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Clear button appears automatically when dates are selected" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", showClearButton: true })] }), _jsxs("div", { children: [_jsx(Label, { children: "Without Clear Button" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", showClearButton: false, endIcon: "angle-down" })] })] }));
|
|
287
|
-
};
|
|
288
|
-
export var WithApplyButton = function () {
|
|
289
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
290
|
-
var _b = useDateRangeState(), appliedRange = _b[0], setAppliedRange = _b[1];
|
|
291
|
-
return (_jsx("div", { className: "flex flex-col gap-4 max-w-sm", children: _jsxs("div", { children: [_jsx(Label, { children: "With Apply/Cancel Buttons" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Changes are only applied when you click Apply" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", showApplyButton: true, onApply: function (range) {
|
|
292
|
-
setAppliedRange(range);
|
|
293
|
-
}, onCancel: function () {
|
|
294
|
-
setDateRange(appliedRange);
|
|
295
|
-
}, onClear: function () {
|
|
296
|
-
setAppliedRange(null);
|
|
297
|
-
} })] }) }));
|
|
298
|
-
};
|
|
299
|
-
export var WithApplyButtonAndPresets = function () {
|
|
300
|
-
var today = getToday();
|
|
301
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
302
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsx(Label, { children: "Apply Button with Presets" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Preview your selection before applying" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", showApplyButton: true, presets: getCommonPresets(today) })] }));
|
|
303
|
-
};
|
|
304
|
-
export var ClearButtonCallbacks = function () {
|
|
305
|
-
var _a = useState({
|
|
306
|
-
from: startOfDay(new Date()),
|
|
307
|
-
to: addDays(startOfDay(new Date()), 7),
|
|
308
|
-
}), dateRange = _a[0], setDateRange = _a[1];
|
|
309
|
-
var _b = useState(0), clearCount = _b[0], setClearCount = _b[1];
|
|
310
|
-
return (_jsxs("div", { className: "flex flex-col gap-4 max-w-sm", children: [_jsx(Label, { children: "Clear Button with Callback" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days", onClear: function () {
|
|
311
|
-
setClearCount(function (prev) { return prev + 1; });
|
|
312
|
-
console.log("Cleared");
|
|
313
|
-
} }), clearCount > 0 && (_jsxs(Caption, { variant: "sm", color: "gray", children: ["Cleared ", clearCount, " time", clearCount > 1 ? "s" : ""] }))] }));
|
|
314
|
-
};
|
|
315
|
-
export var MobileResponsive = function () {
|
|
316
|
-
var _a = useDateRangeState(), dateRange = _a[0], setDateRange = _a[1];
|
|
317
|
-
return (_jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { children: [_jsx(Label, { children: "Mobile-Optimized Date Range Picker" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "Resize your browser to < 768px width to see the mobile experience" }), _jsx(Body, { as: "p", variant: "body-xs", color: "light-gray", className: "mb-2", children: "On mobile: Step 1 - Select start date \u2192 Step 2 - Select end date \u2192 Step 3 - Apply/Cancel" }), _jsx(DateRangePicker, { dateRange: dateRange, onChange: setDateRange, startIcon: "calendar-days" })] }), _jsx(SelectedDateDisplay, { dateRange: dateRange }), _jsx("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-md", children: _jsxs(Caption, { variant: "sm", color: "info", children: ["\uD83D\uDCA1 The component automatically detects screen size and provides:", _jsx("br", {}), "\u2022 Desktop (\u2265768px): Full calendar with 1-2 months", _jsx("br", {}), "\u2022 Mobile (<768px): Single month with step-by-step guidance", _jsx("br", {}), "\u2022 Apply/Cancel buttons automatically appear on mobile after both dates are selected"] }) })] }));
|
|
318
|
-
};
|
|
@@ -1,225 +0,0 @@
|
|
|
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
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import { useState } from "react";
|
|
23
|
-
import Combobox from "./Combobox";
|
|
24
|
-
import { comboboxColor, comboboxSelectType, comboboxShapes, comboboxSizes, } from ".";
|
|
25
|
-
import LUIcon from "../../../components/Icons/LUIcon";
|
|
26
|
-
import { Label } from "../../../components/Label/Label";
|
|
27
|
-
import Tooltip from "../../../components/ToolTip/Tooltip";
|
|
28
|
-
import { Caption } from "../../../components/Typography/Caption/caption";
|
|
29
|
-
import { Button } from "../../../components/Button/Button/Button";
|
|
30
|
-
import { Checkbox } from "../../../components/Checkbox/checkbox";
|
|
31
|
-
import { Badge } from "../../../components/Badge/Badge";
|
|
32
|
-
export default {
|
|
33
|
-
title: "Components/Dropdown/Combobox",
|
|
34
|
-
component: Combobox,
|
|
35
|
-
tags: ["autodocs"],
|
|
36
|
-
argTypes: {
|
|
37
|
-
options: {
|
|
38
|
-
control: { type: "object" },
|
|
39
|
-
description: "Options for the combobox dropdown",
|
|
40
|
-
table: {
|
|
41
|
-
type: { summary: "Array<{ value: string; label: string }>" },
|
|
42
|
-
defaultValue: { summary: "See default" },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
size: {
|
|
46
|
-
control: { type: "select" },
|
|
47
|
-
options: Object.keys(comboboxSizes),
|
|
48
|
-
description: "Size of the combobox button",
|
|
49
|
-
table: {
|
|
50
|
-
type: { summary: "comboboxSizes" },
|
|
51
|
-
defaultValue: { summary: "md" },
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
placeholder: {
|
|
55
|
-
control: { type: "text" },
|
|
56
|
-
description: "Placeholder text for the combobox",
|
|
57
|
-
table: {
|
|
58
|
-
type: { summary: "string" },
|
|
59
|
-
defaultValue: { summary: "Select Options" },
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
shape: {
|
|
63
|
-
control: { type: "select" },
|
|
64
|
-
options: Object.keys(comboboxShapes),
|
|
65
|
-
description: "Shape of the combobox button",
|
|
66
|
-
table: {
|
|
67
|
-
type: { summary: "comboboxShapes" },
|
|
68
|
-
defaultValue: { summary: "rectangular" },
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
variant: {
|
|
72
|
-
control: { type: "select" },
|
|
73
|
-
options: Object.keys(comboboxSelectType),
|
|
74
|
-
description: "Type of the combobox",
|
|
75
|
-
table: {
|
|
76
|
-
type: { summary: "comboboxSelectType" },
|
|
77
|
-
defaultValue: { summary: "fill" },
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
color: {
|
|
81
|
-
control: { type: "select" },
|
|
82
|
-
options: Object.keys(comboboxColor.fill),
|
|
83
|
-
description: "Color of the combobox",
|
|
84
|
-
table: {
|
|
85
|
-
type: { summary: "comboboxColor" },
|
|
86
|
-
defaultValue: { summary: "default" },
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
isSearch: {
|
|
90
|
-
control: { type: "boolean" },
|
|
91
|
-
description: "Enable search functionality",
|
|
92
|
-
table: {
|
|
93
|
-
type: { summary: "boolean" },
|
|
94
|
-
defaultValue: { summary: "false" },
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
isMulti: {
|
|
98
|
-
control: { type: "boolean" },
|
|
99
|
-
description: "Enable multi-select functionality",
|
|
100
|
-
table: {
|
|
101
|
-
type: { summary: "boolean" },
|
|
102
|
-
defaultValue: { summary: "false" },
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
onSelect: {
|
|
106
|
-
control: false,
|
|
107
|
-
description: "Callback fired when an option is selected",
|
|
108
|
-
table: {
|
|
109
|
-
type: { summary: "(selected: any) => void" },
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
disabled: {
|
|
113
|
-
control: { type: "boolean" },
|
|
114
|
-
description: "Disable the combobox",
|
|
115
|
-
table: {
|
|
116
|
-
type: { summary: "boolean" },
|
|
117
|
-
defaultValue: { summary: "false" },
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
renderOption: {
|
|
121
|
-
control: false,
|
|
122
|
-
description: "Custom render function for options",
|
|
123
|
-
table: {
|
|
124
|
-
type: { summary: "(option: any) => ReactNode" },
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
defaultValue: {
|
|
128
|
-
control: { type: "text" },
|
|
129
|
-
description: "Default value for the combobox",
|
|
130
|
-
table: {
|
|
131
|
-
type: { summary: "string | string[]" },
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
var Template = function (args) { return _jsx(Combobox, __assign({}, args)); };
|
|
137
|
-
export var Default = Template.bind({});
|
|
138
|
-
Default.args = {
|
|
139
|
-
size: "md",
|
|
140
|
-
placeholder: "Select Options",
|
|
141
|
-
shape: "rectangular",
|
|
142
|
-
options: [
|
|
143
|
-
{ key: "next.js", value: "Next.js" },
|
|
144
|
-
{ key: "sveltekit", value: "SvelteKit" },
|
|
145
|
-
{ key: "nest.js", value: "Nest.js" },
|
|
146
|
-
{ key: "remix", value: "Remix" },
|
|
147
|
-
{ key: "astro", value: "Astro" },
|
|
148
|
-
{ key: "react", value: "React" },
|
|
149
|
-
{ key: "nest", value: "Nest" },
|
|
150
|
-
{ key: "python", value: "Python" },
|
|
151
|
-
{ key: "ai", value: "AI" },
|
|
152
|
-
],
|
|
153
|
-
isSearch: true,
|
|
154
|
-
isMulti: true,
|
|
155
|
-
renderOption: function (option) { return (_jsxs(_Fragment, { children: [option.icon && _jsx(LUIcon, { icon: option.icon, size: "md" }), _jsx("span", { children: option.key })] })); },
|
|
156
|
-
onSelect: function (value) { return console.log(value); },
|
|
157
|
-
};
|
|
158
|
-
export var Basic = function () { return (_jsx(Combobox, { options: [
|
|
159
|
-
{ key: "React", value: "react" },
|
|
160
|
-
{ key: "Vue", value: "vue" },
|
|
161
|
-
], onSelect: function (value) { return console.log(value); } })); };
|
|
162
|
-
export var ComboboxSize = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsx(Combobox, { size: "sm", options: [
|
|
163
|
-
{ key: "React", value: "react" },
|
|
164
|
-
{ key: "Vue", value: "vue" },
|
|
165
|
-
], onSelect: function (value) { return console.log(value); } }), _jsx(Combobox, { size: "md", options: [
|
|
166
|
-
{ key: "React", value: "react" },
|
|
167
|
-
{ key: "Vue", value: "vue" },
|
|
168
|
-
], onSelect: function (value) { return console.log(value); } }), _jsx(Combobox, { size: "lg", options: [
|
|
169
|
-
{ key: "React", value: "react" },
|
|
170
|
-
{ key: "Vue", value: "vue" },
|
|
171
|
-
], onSelect: function (value) { return console.log(value); } })] })); };
|
|
172
|
-
export var ComboboxType = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsx(Label, { variant: "label-sm", children: "Text" }), _jsx(Combobox, { isMulti: true, options: ["React", "Vue", "Angular"], renderOption: function (option) { return _jsx("span", { children: option.value }); } }), _jsx(Label, { variant: "label-sm", children: "Text With Right Icon" }), _jsx(Combobox, { isMulti: true, options: ["React", "Vue", "Angular"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center justify-between w-full", children: [_jsx("span", { children: option.value }), _jsx(LUIcon, { icon: "plus" })] })); } }), _jsx(Label, { variant: "label-sm", children: "Text With Left Icon" }), _jsx(Combobox, { isMulti: true, options: [
|
|
173
|
-
{ key: "next.js", value: "Next.js", icon: "plus" },
|
|
174
|
-
{ key: "sveltekit", value: "SvelteKit", icon: "star" },
|
|
175
|
-
{ key: "nest.js", value: "Nest.js", icon: "check" },
|
|
176
|
-
{ key: "remix", value: "Remix", icon: "minus" },
|
|
177
|
-
{ key: "astro", value: "Astro", icon: "plus" },
|
|
178
|
-
], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: option.icon }), _jsx("span", { children: option.value })] })); } }), _jsx(Label, { variant: "label-sm", children: "Badge" }), _jsx(Combobox, { isMulti: true, options: ["React", "Vue", "Angular"], renderOption: function (option) { return (_jsx(Badge, { startIcon: "star", color: "light-blue", children: option.value })); } }), _jsx(Label, { variant: "label-sm", children: "Text+Counter" }), _jsx(Combobox, { isMulti: true, options: ["React", "Vue", "Angular"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center justify-between w-full", children: [_jsx("span", { children: option.value }), _jsx(Badge, { color: "light-blue", children: +3 })] })); } })] })); };
|
|
179
|
-
export var ComboboxWithCheckbox = function () {
|
|
180
|
-
var _a = useState([]), selected = _a[0], setSelected = _a[1];
|
|
181
|
-
var options = ["React", "Vue", "Angular"];
|
|
182
|
-
var onCheckChange = function (value) {
|
|
183
|
-
setSelected(function (prev) {
|
|
184
|
-
return prev.includes(value) ? prev.filter(function (v) { return v !== value; }) : __spreadArray(__spreadArray([], prev, true), [value], false);
|
|
185
|
-
});
|
|
186
|
-
};
|
|
187
|
-
return (_jsx(Combobox, { isMulti: true, options: options, onSelect: function (value) {
|
|
188
|
-
if (Array.isArray(value)) {
|
|
189
|
-
setSelected(value);
|
|
190
|
-
}
|
|
191
|
-
}, renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(Checkbox, { id: "checkbox-".concat(option.value), checked: selected.includes(option.value), onCheckedChange: function () {
|
|
192
|
-
onCheckChange(option.value);
|
|
193
|
-
} }), _jsx("span", { children: option.value })] })); } }));
|
|
194
|
-
};
|
|
195
|
-
export var ComboboxWithUserIcon = function () { return (_jsx(Combobox, { isMulti: true, options: ["React", "Vue", "Angular", "Nest", "Next"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: "user", variant: "padded" }), _jsx("span", { children: option.value })] })); } })); };
|
|
196
|
-
export var ComboboxWithDefaultValue = function () { return (_jsxs("div", { className: "space-y-4", children: [_jsx(Label, { variant: "label-sm", children: "Multiple Default Values in Multiple Select" }), _jsx(Combobox, { isMulti: true, isSearch: true, options: ["React", "Vue", "Angular", "Nest", "Next"], defaultValue: ["React", "Vue"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: "plus" }), _jsx("span", { children: option.value })] })); } }), _jsx(Label, { variant: "label-sm", children: "Single Default Value in Multiple Select" }), _jsx(Combobox, { isMulti: true, isSearch: true, options: ["React", "Vue", "Angular", "Nest", "Next"], defaultValue: ["React"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: "plus" }), _jsx("span", { children: option.value })] })); } }), _jsx(Label, { variant: "label-sm", children: "Single Default Value in Single Select" }), _jsx(Combobox, { isSearch: true, options: ["React", "Vue", "Angular", "Nest", "Next"], defaultValue: "React", renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: "plus" }), _jsx("span", { children: option.value })] })); } })] })); };
|
|
197
|
-
export var ListOfArray = function () { return (_jsx(Combobox, { isMulti: true, isSearch: true, options: ["React", "Vue", "Angular", "Nest", "Next"], renderOption: function (option) { return (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx(LUIcon, { icon: "plus" }), _jsx("span", { children: option.value })] })); } })); };
|
|
198
|
-
export var ComboboxValidation = function () {
|
|
199
|
-
var _a = useState(""), selected = _a[0], setSelected = _a[1];
|
|
200
|
-
var _b = useState(false), error = _b[0], setError = _b[1];
|
|
201
|
-
var handleSelect = function (value) {
|
|
202
|
-
// Since isMulti is false, value will be string
|
|
203
|
-
if (typeof value === "string") {
|
|
204
|
-
setSelected(value);
|
|
205
|
-
if (value && error)
|
|
206
|
-
setError(false);
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
var handleSubmit = function (e) {
|
|
210
|
-
e.preventDefault();
|
|
211
|
-
if (!selected) {
|
|
212
|
-
setError(true);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
setError(false);
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
return (_jsxs("form", { className: "space-y-4", onSubmit: handleSubmit, children: [_jsxs("div", { className: "flex items-center gap-2 mb-2", children: [_jsx(Label, { variant: "label-sm", children: "Select Category" }), _jsx("span", { className: "text-red-600", children: "*" }), _jsx(Tooltip, { title: "Select Option", children: _jsx(LUIcon, { variant: "padded", size: "xs", shape: "rounded", icon: "question", color: "light-blue" }) })] }), _jsxs("div", { children: [_jsx(Combobox, { placeholder: "Select framework...", size: "md", options: [
|
|
219
|
-
{ key: "next.js", value: "Next.js" },
|
|
220
|
-
{ key: "sveltekit", value: "SvelteKit" },
|
|
221
|
-
{ key: "nest.js", value: "Nest.js" },
|
|
222
|
-
{ key: "remix", value: "Remix" },
|
|
223
|
-
{ key: "astro", value: "Astro" },
|
|
224
|
-
], isSearch: true, onSelect: handleSelect, color: error ? "red" : "default", renderOption: function (option) { return _jsx("span", { children: option.value }); } }), error && (_jsx(Caption, { variant: "md", className: "mt-1 text-red-600", children: "field is required" }))] }), _jsx(Button, { type: "submit", children: "Submit" })] }));
|
|
225
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
26
|
-
import { XIcon } from "lucide-react";
|
|
27
|
-
import { cn } from "../../../lib/utils";
|
|
28
|
-
function Dialog(_a) {
|
|
29
|
-
var props = __rest(_a, []);
|
|
30
|
-
return _jsx(DialogPrimitive.Root, __assign({ "data-slot": "dialog" }, props));
|
|
31
|
-
}
|
|
32
|
-
function DialogTrigger(_a) {
|
|
33
|
-
var props = __rest(_a, []);
|
|
34
|
-
return _jsx(DialogPrimitive.Trigger, __assign({ "data-slot": "dialog-trigger" }, props));
|
|
35
|
-
}
|
|
36
|
-
function DialogPortal(_a) {
|
|
37
|
-
var props = __rest(_a, []);
|
|
38
|
-
return _jsx(DialogPrimitive.Portal, __assign({ "data-slot": "dialog-portal" }, props));
|
|
39
|
-
}
|
|
40
|
-
function DialogClose(_a) {
|
|
41
|
-
var props = __rest(_a, []);
|
|
42
|
-
return _jsx(DialogPrimitive.Close, __assign({ "data-slot": "dialog-close" }, props));
|
|
43
|
-
}
|
|
44
|
-
function DialogOverlay(_a) {
|
|
45
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
46
|
-
return (_jsx(DialogPrimitive.Overlay, __assign({ "data-slot": "dialog-overlay", className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className) }, props)));
|
|
47
|
-
}
|
|
48
|
-
function DialogContent(_a) {
|
|
49
|
-
var className = _a.className, children = _a.children, _b = _a.showCloseButton, showCloseButton = _b === void 0 ? true : _b, props = __rest(_a, ["className", "children", "showCloseButton"]);
|
|
50
|
-
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, __assign({ "data-slot": "dialog-content", className: cn("bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200", className) }, props, { children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] }))] }));
|
|
51
|
-
}
|
|
52
|
-
function DialogHeader(_a) {
|
|
53
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
54
|
-
return (_jsx("div", __assign({ "data-slot": "dialog-header", className: cn("flex flex-col gap-2 text-center sm:text-left", className) }, props)));
|
|
55
|
-
}
|
|
56
|
-
function DialogFooter(_a) {
|
|
57
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
58
|
-
return (_jsx("div", __assign({ "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className) }, props)));
|
|
59
|
-
}
|
|
60
|
-
function DialogTitle(_a) {
|
|
61
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
62
|
-
return (_jsx(DialogPrimitive.Title, __assign({ "data-slot": "dialog-title", className: cn("text-lg leading-none font-semibold", className) }, props)));
|
|
63
|
-
}
|
|
64
|
-
function DialogDescription(_a) {
|
|
65
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
66
|
-
return (_jsx(DialogPrimitive.Description, __assign({ "data-slot": "dialog-description", className: cn("text-muted-foreground text-sm", className) }, props)));
|
|
67
|
-
}
|
|
68
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Badge } from "../../../../components/Badge/Badge";
|
|
3
|
-
export var renderBadge = function (option, handleRemove) {
|
|
4
|
-
return (_jsx(Badge, { color: "light-blue", startIcon: option.icon, onRemove: function () { return handleRemove(option.value); }, children: option.key }, option.value));
|
|
5
|
-
};
|