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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Badge } from "./Badge";
|
|
3
|
+
import { badgeStyles } from ".";
|
|
4
|
+
import { iconList } from "../../utils/iconList";
|
|
5
|
+
var meta = {
|
|
6
|
+
title: "Components/Badge",
|
|
7
|
+
component: Badge,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
type: {
|
|
11
|
+
control: {
|
|
12
|
+
type: "select",
|
|
13
|
+
options: Object.keys(badgeStyles.type),
|
|
14
|
+
},
|
|
15
|
+
description: "The type of the badge.",
|
|
16
|
+
table: {
|
|
17
|
+
type: { summary: "string" },
|
|
18
|
+
defaultValue: { summary: "fill" },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
color: {
|
|
22
|
+
control: {
|
|
23
|
+
type: "select",
|
|
24
|
+
},
|
|
25
|
+
options: Object.keys(badgeStyles.fillColor),
|
|
26
|
+
description: "The color of the badge.",
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: "string" },
|
|
29
|
+
defaultValue: { summary: "blue" },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
control: {
|
|
34
|
+
type: "select",
|
|
35
|
+
options: Object.keys(badgeStyles.size),
|
|
36
|
+
},
|
|
37
|
+
description: "The size of the badge.",
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: "string" },
|
|
40
|
+
defaultValue: { summary: "md" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
shape: {
|
|
44
|
+
control: {
|
|
45
|
+
type: "select",
|
|
46
|
+
},
|
|
47
|
+
options: Object.keys(badgeStyles.shape),
|
|
48
|
+
description: "The shape of the badge.",
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: "string" },
|
|
51
|
+
defaultValue: { summary: "rounded" },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
startIcon: {
|
|
55
|
+
control: {
|
|
56
|
+
type: "select",
|
|
57
|
+
options: Object.keys(iconList),
|
|
58
|
+
},
|
|
59
|
+
description: "The icon to display at the start of the badge.",
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string" },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
endIcon: {
|
|
65
|
+
control: {
|
|
66
|
+
type: "select",
|
|
67
|
+
options: Object.keys(iconList),
|
|
68
|
+
},
|
|
69
|
+
description: "The icon to display at the end of the badge.",
|
|
70
|
+
table: {
|
|
71
|
+
type: { summary: "string" },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
control: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
},
|
|
78
|
+
description: "Whether the badge is disabled.",
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: "boolean" },
|
|
81
|
+
defaultValue: { summary: "false" },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
onRemove: {
|
|
85
|
+
description: "When provided, displays a close icon that calls this function when clicked. The close icon is only shown when this prop is present.",
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: "() => void" },
|
|
88
|
+
defaultValue: { summary: "undefined" },
|
|
89
|
+
},
|
|
90
|
+
control: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
decorators: [
|
|
94
|
+
function (Story, context) {
|
|
95
|
+
// Use type, not color, to determine color options
|
|
96
|
+
var currentType = context.args.type;
|
|
97
|
+
if (context.argTypes && context.argTypes.color) {
|
|
98
|
+
context.argTypes.color.options =
|
|
99
|
+
currentType === "fill"
|
|
100
|
+
? Object.keys(badgeStyles.fillColor)
|
|
101
|
+
: Object.keys(badgeStyles.outlineColor);
|
|
102
|
+
}
|
|
103
|
+
return <Story {...context}/>;
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
export default meta;
|
|
108
|
+
export var Default = {
|
|
109
|
+
args: {
|
|
110
|
+
children: "Default Badge",
|
|
111
|
+
onRemove: undefined,
|
|
112
|
+
},
|
|
113
|
+
parameters: {
|
|
114
|
+
docs: {
|
|
115
|
+
description: {
|
|
116
|
+
story: "Default badge without a close icon. The close icon is only shown when the onRemove prop is provided.",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
export var BadgeSize = function () { return (<div className="flex flex-col space-y-2">
|
|
122
|
+
<Badge size="sm">Small Badge</Badge>
|
|
123
|
+
<Badge size="md">Medium Badge</Badge>
|
|
124
|
+
<Badge size="lg">Large Badge</Badge>
|
|
125
|
+
</div>); };
|
|
126
|
+
export var WithIcons = function () { return (<div className="flex flex-col space-y-2">
|
|
127
|
+
<Badge startIcon="check">Left Icon Only</Badge>
|
|
128
|
+
<Badge endIcon="check">Right Icon Only</Badge>
|
|
129
|
+
<Badge startIcon="check" endIcon="star">
|
|
130
|
+
Both Icons
|
|
131
|
+
</Badge>
|
|
132
|
+
<p className="text-sm mt-2 text-gray-500">
|
|
133
|
+
Note: None of these have an onRemove handler, so no close icon is shown
|
|
134
|
+
</p>
|
|
135
|
+
</div>); };
|
|
136
|
+
export var BadgeType = function () { return (<div className="flex flex-col space-y-2">
|
|
137
|
+
<Badge type="fill">Fill Badge</Badge>
|
|
138
|
+
<Badge type="outline">Outline Badge</Badge>
|
|
139
|
+
</div>); };
|
|
140
|
+
export var BadgeShape = function () { return (<div className="flex flex-col space-y-2">
|
|
141
|
+
<Badge shape="rounded">Rounded Badge</Badge>
|
|
142
|
+
<Badge shape="square">Square Badge</Badge>
|
|
143
|
+
</div>); };
|
|
144
|
+
export var BadgeFillColors = function () { return (<div className="flex flex-row space-x-2">
|
|
145
|
+
<Badge color="blue">Blue</Badge>
|
|
146
|
+
<Badge color="light-blue">Light Blue</Badge>
|
|
147
|
+
<Badge color="red">Red</Badge>
|
|
148
|
+
<Badge color="light-red">Light Red</Badge>
|
|
149
|
+
<Badge color="indigo">Indigo</Badge>
|
|
150
|
+
<Badge color="light-indigo">Light Indigo</Badge>
|
|
151
|
+
<Badge color="green">Green</Badge>
|
|
152
|
+
<Badge color="light-green">Light Green</Badge>
|
|
153
|
+
<Badge color="yellow">Yellow</Badge>
|
|
154
|
+
<Badge color="light-yellow">Light Yellow</Badge>
|
|
155
|
+
<Badge color="gray">Gray</Badge>
|
|
156
|
+
<Badge color="light-gray">Light Gray</Badge>
|
|
157
|
+
</div>); };
|
|
158
|
+
export var BadgeOutlineColors = function () { return (<div className="flex flex-row space-x-2">
|
|
159
|
+
<Badge color="blue" type="outline">
|
|
160
|
+
Blue
|
|
161
|
+
</Badge>
|
|
162
|
+
<Badge color="red" type="outline">
|
|
163
|
+
Red
|
|
164
|
+
</Badge>
|
|
165
|
+
<Badge color="indigo" type="outline">
|
|
166
|
+
Indigo
|
|
167
|
+
</Badge>
|
|
168
|
+
<Badge color="green" type="outline">
|
|
169
|
+
Green
|
|
170
|
+
</Badge>
|
|
171
|
+
<Badge color="yellow" type="outline">
|
|
172
|
+
Yellow
|
|
173
|
+
</Badge>
|
|
174
|
+
<Badge color="gray" type="outline">
|
|
175
|
+
Gray
|
|
176
|
+
</Badge>
|
|
177
|
+
</div>); };
|
|
178
|
+
export var DisabledBadge = function () { return (<div className="flex flex-col space-y-2">
|
|
179
|
+
<Badge disabled>Disabled Badge</Badge>
|
|
180
|
+
</div>); };
|
|
181
|
+
export var BadgeWithCounter = function () { return (<div className="flex flex-col space-y-2">
|
|
182
|
+
<Badge>3</Badge>
|
|
183
|
+
<Badge color="red">+3</Badge>
|
|
184
|
+
</div>); };
|
|
185
|
+
export var BadgeWithRemoveHandler = function () {
|
|
186
|
+
var handleRemove = function () {
|
|
187
|
+
alert("Badge removed!");
|
|
188
|
+
};
|
|
189
|
+
return (<div className="flex flex-col space-y-2">
|
|
190
|
+
<Badge startIcon="plus" onRemove={handleRemove} color="green">
|
|
191
|
+
Badge with Close Icon
|
|
192
|
+
</Badge>
|
|
193
|
+
<Badge onRemove={handleRemove}>Removable Badge</Badge>
|
|
194
|
+
<Badge startIcon="check" onRemove={handleRemove}>
|
|
195
|
+
Check with Remove
|
|
196
|
+
</Badge>
|
|
197
|
+
<Badge type="outline" onRemove={handleRemove}>
|
|
198
|
+
Outline Removable
|
|
199
|
+
</Badge>
|
|
200
|
+
</div>);
|
|
201
|
+
};
|
|
@@ -15,9 +15,10 @@ export declare const variant: {
|
|
|
15
15
|
};
|
|
16
16
|
declare const buttonVariants: (props?: ({
|
|
17
17
|
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | null | undefined;
|
|
18
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
18
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
19
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
19
20
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
20
21
|
variant?: "link" | "fill" | "outline" | "ghost" | null | undefined;
|
|
21
22
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
|
-
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }: ButtonProps):
|
|
23
|
+
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }: ButtonProps): React.JSX.Element;
|
|
23
24
|
export { Button, buttonVariants };
|
|
@@ -29,7 +29,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
29
29
|
}
|
|
30
30
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
31
|
};
|
|
32
|
-
import
|
|
32
|
+
import * as React from "react";
|
|
33
33
|
import { Slot } from "@radix-ui/react-slot";
|
|
34
34
|
import { cva } from "class-variance-authority";
|
|
35
35
|
import { cn } from "../../../lib/utils";
|
|
@@ -37,30 +37,39 @@ import LUIcon from "../../Icons/LUIcon";
|
|
|
37
37
|
import { buttonStyles } from "..";
|
|
38
38
|
export var variant = {
|
|
39
39
|
fill: "",
|
|
40
|
-
link: "lu-bg-transparent hover:lu-bg-transparent focus:lu-bg-transparent active:lu-bg-transparent !p-0 underline-offset-4 hover:underline border-none",
|
|
41
|
-
outline: "border lu-bg-transparent",
|
|
40
|
+
link: "lu-bg-transparent hover:lu-bg-transparent focus:lu-bg-transparent active:lu-bg-transparent !p-0 underline-offset-4 hover:underline border-none font-normal leading-normal",
|
|
41
|
+
outline: "lu-border lu-bg-transparent",
|
|
42
42
|
ghost: "lu-bg-transparent border-none",
|
|
43
43
|
};
|
|
44
|
-
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap
|
|
44
|
+
var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer", {
|
|
45
45
|
variants: {
|
|
46
46
|
color: buttonStyles.fillColor,
|
|
47
|
-
size: buttonStyles.size,
|
|
47
|
+
size: __assign(__assign({}, buttonStyles.size), { none: "" }),
|
|
48
|
+
linkSize: __assign(__assign({}, buttonStyles.linkSize), { none: "" }),
|
|
48
49
|
shape: buttonStyles.shape,
|
|
49
50
|
variant: variant,
|
|
50
51
|
},
|
|
51
52
|
defaultVariants: {
|
|
52
53
|
color: "blue",
|
|
53
54
|
size: "md",
|
|
55
|
+
linkSize: "none",
|
|
54
56
|
shape: "rounded-sm",
|
|
55
57
|
variant: "fill",
|
|
56
58
|
},
|
|
57
|
-
compoundVariants: __spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
59
|
+
compoundVariants: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], Object.entries(buttonStyles.linkColor).map(function (_a) {
|
|
58
60
|
var color = _a[0], className = _a[1];
|
|
59
61
|
return ({
|
|
60
62
|
color: color,
|
|
61
63
|
variant: "link",
|
|
62
64
|
class: className,
|
|
63
65
|
});
|
|
66
|
+
}), true), Object.entries(buttonStyles.linkSize).map(function (_a) {
|
|
67
|
+
var sizeKey = _a[0], className = _a[1];
|
|
68
|
+
return ({
|
|
69
|
+
linkSize: sizeKey,
|
|
70
|
+
variant: "link",
|
|
71
|
+
class: className,
|
|
72
|
+
});
|
|
64
73
|
}), true), Object.entries(buttonStyles.outlineColor).map(function (_a) {
|
|
65
74
|
var color = _a[0], className = _a[1];
|
|
66
75
|
return ({
|
|
@@ -78,7 +87,7 @@ var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespa
|
|
|
78
87
|
}), true),
|
|
79
88
|
});
|
|
80
89
|
function Button(_a) {
|
|
81
|
-
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b,
|
|
90
|
+
var className = _a.className, _b = _a.color, color = _b === void 0 ? "blue" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, shape = _a.shape, _d = _a.variant, variant = _d === void 0 ? "fill" : _d, _e = _a.asChild, asChild = _e === void 0 ? false : _e, startIcon = _a.startIcon, endIcon = _a.endIcon, props = __rest(_a, ["className", "color", "size", "shape", "variant", "asChild", "startIcon", "endIcon"]);
|
|
82
91
|
var Comp = asChild ? Slot : "button";
|
|
83
92
|
// Map button size to appropriate icon sizes for start and end icons
|
|
84
93
|
var getIconSizes = function () {
|
|
@@ -98,6 +107,13 @@ function Button(_a) {
|
|
|
98
107
|
// Use the calculated sizes based on button size
|
|
99
108
|
var startIconSizeValue = iconSizes.startIcon;
|
|
100
109
|
var endIconSizeValue = iconSizes.endIcon;
|
|
101
|
-
|
|
110
|
+
var sizeProps = variant === "link"
|
|
111
|
+
? { linkSize: size === "xl" ? "lg" : size, size: "none" }
|
|
112
|
+
: { size: size !== null && size !== void 0 ? size : "md", linkSize: "none" };
|
|
113
|
+
return (<Comp data-slot="button" data-size={size} data-variant={variant} data-color={color} className={cn(buttonVariants(__assign(__assign({ variant: variant, color: color }, sizeProps), { shape: shape })), className)} {...props}>
|
|
114
|
+
{startIcon && (<LUIcon size={startIconSizeValue} data-testid="start-icon" icon={startIcon}/>)}
|
|
115
|
+
{props.children}
|
|
116
|
+
{endIcon && (<LUIcon size={endIconSizeValue} data-testid="end-icon" icon={endIcon}/>)}
|
|
117
|
+
</Comp>);
|
|
102
118
|
}
|
|
103
119
|
export { Button, buttonVariants };
|
|
@@ -391,9 +391,10 @@ declare const meta: {
|
|
|
391
391
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
392
392
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
393
393
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
394
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
394
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
395
395
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
396
396
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
397
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
397
398
|
asChild?: boolean | undefined;
|
|
398
399
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
399
400
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -691,13 +692,14 @@ declare const meta: {
|
|
|
691
692
|
onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
692
693
|
onTransitionStart?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
693
694
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
694
|
-
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
695
|
+
size?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
695
696
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
696
697
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
698
|
+
linkSize?: "sm" | "md" | "lg" | "none" | null | undefined;
|
|
697
699
|
asChild?: boolean | undefined;
|
|
698
700
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
699
701
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
700
|
-
}>) => import("react
|
|
702
|
+
}>) => import("react").JSX.Element)[];
|
|
701
703
|
};
|
|
702
704
|
export default meta;
|
|
703
705
|
type Story = StoryObj<typeof Button>;
|
|
@@ -1,15 +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
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
1
|
import { Button, variant } from "./Button";
|
|
14
2
|
import { buttonStyles } from "..";
|
|
15
3
|
var meta = {
|
|
@@ -133,7 +121,7 @@ var meta = {
|
|
|
133
121
|
context.argTypes.shape.table.disable = isLink;
|
|
134
122
|
}
|
|
135
123
|
}
|
|
136
|
-
return
|
|
124
|
+
return <Story {...context}/>;
|
|
137
125
|
},
|
|
138
126
|
],
|
|
139
127
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { Dummy_label } from "../../../utils/constants";
|
|
3
|
+
import { Button } from "./Button";
|
|
4
|
+
describe("Button Component", function () {
|
|
5
|
+
it("renders default button component", function () {
|
|
6
|
+
render(<Button>{Dummy_label}</Button>);
|
|
7
|
+
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
// it("renders button with a custom label", () => {
|
|
11
|
+
// render(<Button>{Dummy_label}</Button>);
|
|
12
|
+
// expect(
|
|
13
|
+
// screen.getByRole("button", { name: Dummy_label }),
|
|
14
|
+
// ).toBeInTheDocument();
|
|
15
|
+
// });
|
|
16
|
+
// it("calls onClick handler when clicked", () => {
|
|
17
|
+
// const handleClick = jest.fn();
|
|
18
|
+
// render(<Button onClick={handleClick}>Click</Button>);
|
|
19
|
+
// fireEvent.click(screen.getByRole("button"));
|
|
20
|
+
// expect(handleClick).toHaveBeenCalledTimes(1);
|
|
21
|
+
// });
|
|
22
|
+
// it("renders startIcon when provided", () => {
|
|
23
|
+
// render(<Button startIcon={<span>*</span>}>{Dummy_label}</Button>);
|
|
24
|
+
// expect(screen.getByTestId("start-icon")).toBeInTheDocument();
|
|
25
|
+
// });
|
|
26
|
+
// it("renders endIcon when provided", () => {
|
|
27
|
+
// render(<Button endIcon={<span>*</span>}>{Dummy_label}</Button>);
|
|
28
|
+
// expect(screen.getByTestId("end-icon")).toBeInTheDocument();
|
|
29
|
+
// });
|
|
30
|
+
// it("applies correct color, shape, and size classes", () => {
|
|
31
|
+
// render(
|
|
32
|
+
// <Button color="primary" shape="rounded-full" size="lg">
|
|
33
|
+
// {Dummy_label}
|
|
34
|
+
// </Button>,
|
|
35
|
+
// );
|
|
36
|
+
// const buttonElement = screen.getByRole("button");
|
|
37
|
+
// expect(buttonElement).toHaveClass(
|
|
38
|
+
// buttonColors["primary"],
|
|
39
|
+
// buttonShapes["rounded-full"],
|
|
40
|
+
// buttonSizes["lg"],
|
|
41
|
+
// );
|
|
42
|
+
// });
|
|
43
|
+
// it("applies additional className when provided", () => {
|
|
44
|
+
// render(<Button className="custom-class">{Dummy_label}</Button>);
|
|
45
|
+
// expect(screen.getByRole("button")).toHaveClass("custom-class");
|
|
46
|
+
// });
|
|
47
|
+
// it("renders without crashing when no props are provided", () => {
|
|
48
|
+
// render(<Button>{Dummy_label}</Button>);
|
|
49
|
+
// expect(screen.getByRole("button")).toBeInTheDocument();
|
|
50
|
+
// });
|
|
51
|
+
// it("renders button with both startIcon and endIcon", () => {
|
|
52
|
+
// render(
|
|
53
|
+
// <Button startIcon={<span>*</span>} endIcon={<span>*</span>}>
|
|
54
|
+
// {Dummy_label}
|
|
55
|
+
// </Button>,
|
|
56
|
+
// );
|
|
57
|
+
// expect(screen.getByTestId("start-icon")).toBeInTheDocument();
|
|
58
|
+
// expect(screen.getByTestId("end-icon")).toBeInTheDocument();
|
|
59
|
+
// });
|
|
60
|
+
// it("does not render startIcon when not provided", () => {
|
|
61
|
+
// render(<Button>{Dummy_label}</Button>);
|
|
62
|
+
// expect(screen.queryByTestId("start-icon")).not.toBeInTheDocument();
|
|
63
|
+
// });
|
|
64
|
+
// it("does not render endIcon when not provided", () => {
|
|
65
|
+
// render(<Button>{Dummy_label}</Button>);
|
|
66
|
+
// expect(screen.queryByTestId("end-icon")).not.toBeInTheDocument();
|
|
67
|
+
// });
|
|
68
|
+
// it("renders correctly without a className prop", () => {
|
|
69
|
+
// render(<Button>{Dummy_label}</Button>);
|
|
70
|
+
// const buttonElement = screen.getByRole("button");
|
|
71
|
+
// expect(buttonElement).not.toHaveClass("custom-class");
|
|
72
|
+
// });
|
|
73
|
+
// });
|
|
@@ -16,5 +16,5 @@ declare function IconButton({ className, color, size, shape, variant, asChild, i
|
|
|
16
16
|
asChild?: boolean;
|
|
17
17
|
icon?: keyof typeof iconList;
|
|
18
18
|
variant?: "fill" | "outline" | "ghost";
|
|
19
|
-
}):
|
|
19
|
+
}): React.JSX.Element;
|
|
20
20
|
export { IconButton, buttonVariants };
|
|
@@ -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)
|
|
@@ -20,7 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
9
|
}
|
|
21
10
|
return t;
|
|
22
11
|
};
|
|
23
|
-
import
|
|
12
|
+
import * as React from "react";
|
|
24
13
|
import { Slot } from "@radix-ui/react-slot";
|
|
25
14
|
import { cva } from "class-variance-authority";
|
|
26
15
|
import { cn } from "../../../lib/utils";
|
|
@@ -67,6 +56,8 @@ function IconButton(_a) {
|
|
|
67
56
|
? buttonStyles.ghostColor[color]
|
|
68
57
|
: buttonStyles.fillColor[color];
|
|
69
58
|
var iconSize = getIconSize();
|
|
70
|
-
return (
|
|
59
|
+
return (<Comp data-slot="button" className={cn(buttonVariants({ color: color, size: size, shape: shape, variant: variant, className: className }), extraClasses)} {...props}>
|
|
60
|
+
<LUIcon size={iconSize} data-testid="icon" icon={icon !== null && icon !== void 0 ? icon : "info"}/>
|
|
61
|
+
</Comp>);
|
|
71
62
|
}
|
|
72
63
|
export { IconButton, buttonVariants };
|
|
@@ -706,7 +706,7 @@ declare const meta: {
|
|
|
706
706
|
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
707
707
|
asChild?: boolean | undefined;
|
|
708
708
|
icon?: keyof typeof iconList | undefined;
|
|
709
|
-
}>) => import("react
|
|
709
|
+
}>) => import("react").JSX.Element)[];
|
|
710
710
|
};
|
|
711
711
|
export default meta;
|
|
712
712
|
type Story = StoryObj<typeof IconButton>;
|
package/dist/src/components/Button/IconButton/{IconButton.stories.js → IconButton.stories.jsx}
RENAMED
|
@@ -1,15 +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
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
1
|
import { iconList } from "../../../utils/iconList";
|
|
14
2
|
import { IconButton, variant } from "./IconButton";
|
|
15
3
|
import { buttonStyles } from "..";
|
|
@@ -121,7 +109,7 @@ var meta = {
|
|
|
121
109
|
: Object.keys(buttonStyles.fillColor);
|
|
122
110
|
}
|
|
123
111
|
}
|
|
124
|
-
return
|
|
112
|
+
return <Story {...context}/>;
|
|
125
113
|
},
|
|
126
114
|
],
|
|
127
115
|
};
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
3
2
|
import { IconButton } from "./IconButton";
|
|
4
3
|
import { buttonStyles } from "..";
|
|
5
4
|
describe("Icon Button Component", function () {
|
|
6
5
|
it("renders icon button with required icon prop", function () {
|
|
7
|
-
render(
|
|
6
|
+
render(<IconButton icon="chart-simple"/>);
|
|
8
7
|
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
9
8
|
});
|
|
10
9
|
it("calls onClick handler when clicked", function () {
|
|
11
10
|
var handleClick = jest.fn();
|
|
12
|
-
render(
|
|
11
|
+
render(<IconButton onClick={handleClick} icon="chart-simple"/>);
|
|
13
12
|
fireEvent.click(screen.getByRole("button"));
|
|
14
13
|
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
15
14
|
});
|
|
16
15
|
it("applies correct color, shape, and size classes", function () {
|
|
17
|
-
render(
|
|
16
|
+
render(<IconButton color="blue" shape="rounded-full" size="lg" icon="chart-simple"/>);
|
|
18
17
|
var buttonElement = screen.getByRole("button");
|
|
19
18
|
expect(buttonElement).toHaveClass(buttonStyles.fillColor["blue"], buttonStyles.shape["rounded-full"], buttonStyles.iconButtonSize["lg"]);
|
|
20
19
|
});
|
|
21
20
|
it("applies additional className when provided", function () {
|
|
22
|
-
render(
|
|
21
|
+
render(<IconButton className="custom-class" icon="chart-simple"/>);
|
|
23
22
|
expect(screen.getByRole("button")).toHaveClass("custom-class");
|
|
24
23
|
});
|
|
25
24
|
it("renders without crashing when all required props are provided", function () {
|
|
26
|
-
render(
|
|
25
|
+
render(<IconButton icon="chart-simple"/>);
|
|
27
26
|
expect(screen.getByRole("button")).toBeInTheDocument();
|
|
28
27
|
});
|
|
29
28
|
});
|
|
@@ -43,8 +43,9 @@ export var buttonStyles = {
|
|
|
43
43
|
disabled: "text-gray-300 hover:no-underline",
|
|
44
44
|
},
|
|
45
45
|
linkSize: {
|
|
46
|
-
lg: "!text-
|
|
47
|
-
md: "!text-
|
|
46
|
+
lg: "!text-lg",
|
|
47
|
+
md: "!text-base",
|
|
48
|
+
sm: "!text-sm",
|
|
48
49
|
},
|
|
49
50
|
outlineColor: {
|
|
50
51
|
blue: "text-blue-600 hover:bg-blue-700 hover:text-blue-50 active:bg-blue-800 active:text-blue-50",
|
|
@@ -2,4 +2,4 @@ import { CardInterface } from "../type";
|
|
|
2
2
|
export interface MultiNewsProps extends Omit<CardInterface, "href" | "type"> {
|
|
3
3
|
onButtonClick?: () => void;
|
|
4
4
|
}
|
|
5
|
-
export declare const MultipleNewsCard: (props: MultiNewsProps) => import("react
|
|
5
|
+
export declare const MultipleNewsCard: (props: MultiNewsProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import LuImage from "../../Images/LuImage";
|
|
2
|
+
import { Button } from "../../Button/Button/Button";
|
|
3
|
+
import { Body } from "../../Typography/Body/body";
|
|
4
|
+
import { Heading } from "../../Typography/Heading/heading";
|
|
5
|
+
export var MultipleNewsCard = function (props) {
|
|
6
|
+
var item = props.item, image = props.image, btnLabel = props.btnLabel, editor = props.editor, _a = props.mediaPosition, mediaPosition = _a === void 0 ? "right" : _a, orientation = props.orientation, onButtonClick = props.onButtonClick;
|
|
7
|
+
// Common card media component
|
|
8
|
+
var CardMedia = function (_a) {
|
|
9
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
10
|
+
return (<LuImage src={image} width={240} height={240} className={"object-cover w-full ".concat(className, " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardImage)} alt="Image"/>);
|
|
11
|
+
};
|
|
12
|
+
// Common content section
|
|
13
|
+
var CardContent = function (_a) {
|
|
14
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
15
|
+
return (<div className={"flex flex-col !gap-2 ".concat(className)}>
|
|
16
|
+
<Heading variant="h4-600" className={"line-clamp-1 capitalize ".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
|
|
17
|
+
{item === null || item === void 0 ? void 0 : item.title}
|
|
18
|
+
</Heading>
|
|
19
|
+
|
|
20
|
+
{(item === null || item === void 0 ? void 0 : item.short_description) && (<Body variant="body-xl" className={"".concat(item.description ? "line-clamp-1 text-gray-900" : "line-clamp-2 text-gray-600", " ").concat(editor === null || editor === void 0 ? void 0 : editor.shortDescription)}>
|
|
21
|
+
{item === null || item === void 0 ? void 0 : item.short_description}
|
|
22
|
+
</Body>)}
|
|
23
|
+
<Body variant="body-lg" className={"text-gray-600 line-clamp-2 ".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)} dangerouslySetInnerHTML={{
|
|
24
|
+
__html: item.description || "",
|
|
25
|
+
}}/>
|
|
26
|
+
</div>);
|
|
27
|
+
};
|
|
28
|
+
// Common button component with conditional shape
|
|
29
|
+
var ActionButton = function (_a) {
|
|
30
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b;
|
|
31
|
+
return (<div>
|
|
32
|
+
{btnLabel && (<Button endIcon={"angle-right"} size={"sm"} {...(mediaPosition === "middle" && { shape: "rounded-full" })} className={"".concat(mediaPosition === "middle" && "shadow-md !font-semibold", " ").concat(editor === null || editor === void 0 ? void 0 : editor.cardBtn, " ").concat(className)} onClick={onButtonClick}>
|
|
33
|
+
{btnLabel}
|
|
34
|
+
</Button>)}
|
|
35
|
+
</div>);
|
|
36
|
+
};
|
|
37
|
+
// Horizontal layout
|
|
38
|
+
if (orientation === "horizontal") {
|
|
39
|
+
return (<div className={"!p-5 bg-white rounded-2xl flex max-sm:flex-col ".concat(mediaPosition === "right" ? "flex-row-reverse" : "", " !gap-5 items-center shadow-lg ").concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
40
|
+
<CardMedia className="w-full sm:max-w-48 aspect-square rounded-lg"/>
|
|
41
|
+
<div className="flex flex-col !gap-5 w-full">
|
|
42
|
+
<CardContent />
|
|
43
|
+
|
|
44
|
+
<ActionButton />
|
|
45
|
+
</div>
|
|
46
|
+
</div>);
|
|
47
|
+
}
|
|
48
|
+
// Vertical layout
|
|
49
|
+
return (<div className={"!p-4 bg-white rounded-2xl flex flex-col !gap-5 max-w-md shadow-lg ".concat(editor === null || editor === void 0 ? void 0 : editor.card)}>
|
|
50
|
+
<div className={"flex ".concat(mediaPosition === "top" ? "flex-col" : "flex-col-reverse", " !gap-4")}>
|
|
51
|
+
{mediaPosition === "middle" && (<Body variant="body-lg" className={"text-gray-600 line-clamp-2 h-14 ".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)} dangerouslySetInnerHTML={{
|
|
52
|
+
__html: item.description || "",
|
|
53
|
+
}}/>)}
|
|
54
|
+
<CardMedia className="aspect-16/10"/>
|
|
55
|
+
<div className={"flex flex-col !gap-1"}>
|
|
56
|
+
<Heading variant="h4-700" className={"line-clamp-1 capitalize ".concat(editor === null || editor === void 0 ? void 0 : editor.cardTitle)}>
|
|
57
|
+
{item === null || item === void 0 ? void 0 : item.title}
|
|
58
|
+
</Heading>
|
|
59
|
+
|
|
60
|
+
<Body aria-description="short-Description" variant={mediaPosition === "middle" ? "body-lg-500" : "body-xl"} className={"".concat(item.description || mediaPosition === "middle" ? "line-clamp-1 text-gray-600" : "line-clamp-2 h-14 text-gray-600", " ").concat(editor === null || editor === void 0 ? void 0 : editor.shortDescription)}>
|
|
61
|
+
{item === null || item === void 0 ? void 0 : item.short_description}
|
|
62
|
+
</Body>
|
|
63
|
+
|
|
64
|
+
{mediaPosition !== "middle" && (<Body variant="body-lg" className={"text-gray-600 line-clamp-2 ".concat(editor === null || editor === void 0 ? void 0 : editor.cardText)} dangerouslySetInnerHTML={{
|
|
65
|
+
__html: item.description || "",
|
|
66
|
+
}}/>)}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<ActionButton />
|
|
70
|
+
</div>);
|
|
71
|
+
};
|