linkedunion-design-kit 1.10.6 → 1.10.7
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/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/src/components/Button/Button/Button.d.ts +1 -1
- package/dist/src/components/Button/Button/Button.module.css +1 -1
- package/dist/src/components/Button/Button/Button.stories.d.ts +2 -2
- package/dist/src/components/Button/IconButton/IconButton.d.ts +1 -1
- package/dist/src/components/Button/IconButton/IconButton.stories.d.ts +2 -2
- package/dist/src/components/Button/index.d.ts +1 -0
- package/dist/src/components/Button/index.js +2 -1
- package/dist/src/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/src/components/DatePicker/DatePicker.js +64 -0
- package/dist/src/components/DatePicker/DatePicker.stories.d.ts +14 -0
- package/dist/src/components/DatePicker/DatePicker.stories.js +171 -0
- package/dist/src/components/DatePicker/index.d.ts +14 -0
- package/dist/src/components/DatePicker/index.js +12 -0
- package/dist/src/components/DatePicker/types.d.ts +19 -0
- package/dist/src/components/Table/Table.d.ts +7 -7
- package/dist/src/components/Table/Table.js +193 -28
- package/dist/src/components/Table/Table.stories.d.ts +5 -5
- package/dist/src/components/Table/Table.stories.js +55 -2
- package/dist/src/components/Table/index.d.ts +8 -0
- package/dist/src/components/Table/index.js +7 -0
- package/dist/src/components/Table/types.d.ts +8 -0
- package/dist/src/components/Table/types.js +1 -0
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -0
- package/dist/src/components/TimePicker/TimePicker.js +109 -0
- package/dist/src/components/TimePicker/TimePicker.stories.d.ts +15 -0
- package/dist/src/components/TimePicker/TimePicker.stories.js +176 -0
- package/dist/src/components/TimePicker/index.d.ts +24 -0
- package/dist/src/components/TimePicker/index.js +22 -0
- package/dist/src/components/TimePicker/types.d.ts +15 -0
- package/dist/src/components/TimePicker/types.js +1 -0
- package/dist/src/components/TimePicker/utils.d.ts +1 -0
- package/dist/src/components/TimePicker/utils.js +1 -0
- package/dist/src/components/Title/Title.module.css +1 -1
- package/dist/src/components/Typography/Heading/heading.module.css +1 -1
- package/dist/src/components/ui/calendar.d.ts +10 -0
- package/dist/src/components/ui/calendar.js +222 -0
- package/dist/src/utils/constants.d.ts +1 -0
- package/dist/src/utils/constants.js +1 -0
- package/dist/styles/global.css +478 -13
- package/package.json +3 -1
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.d.ts +0 -17
- package/dist/src/components/Avatar/Avatar/Avatar1.stories.js +0 -68
- package/dist/src/components/Avatar/Avatar/type.d.ts +0 -12
- package/dist/src/components/ui/avatar.d.ts +0 -13
- package/dist/src/components/ui/avatar.js +0 -53
- package/dist/src/components/ui/dialog.d.ts +0 -15
- package/dist/src/components/ui/dialog.js +0 -68
- /package/dist/src/components/{Avatar/Avatar/type.js → DatePicker/types.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { Tabs, TabsList, TabsTrigger, TabsContent, } from "./src/components/Tabs
|
|
|
24
24
|
export { Select, SelectTrigger, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, SelectValue, } from "./src/components/Dropdown/select";
|
|
25
25
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "./src/components/Alerts/AlertDialog";
|
|
26
26
|
export { Avatar, AvatarImage, AvatarFallback, } from "./src/components/Avatar/Avatar/Avatar";
|
|
27
|
-
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, } from "./src/components/Table/Table";
|
|
27
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, TableButton, TableCellPadded, TableFooter, } from "./src/components/Table/Table";
|
|
28
28
|
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuSubTrigger, DropdownMenuSub, DropdownMenuSubContent, } from "./src/components/Dropdown/DropdownMenu/DropdownMenu";
|
|
29
29
|
export { Badge } from "./src/components/Badge/Badge";
|
|
30
30
|
export { default as Combobox } from "./src/components/Dropdown/Combobox/Combobox";
|
|
@@ -32,3 +32,5 @@ export { Pagination, PaginationContent, PaginationLink, PaginationItem, Paginati
|
|
|
32
32
|
export { Skeleton } from "./src/components/Skeleton/skeleton";
|
|
33
33
|
export { Tabs as VerticalTabs, TabsContent as VerticalTabsContent, TabsList as VerticalTabsList, tabSizes as verticalTabsSize, TabsTrigger as VerticalTabsTrigger, TabsHeading as VerticalTabsHeading, } from "./src/components/VerticalTabs/VerticalTabs";
|
|
34
34
|
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, sizes, } from "./src/components/Modal/Modal";
|
|
35
|
+
export { DatePicker } from "./src/components/DatePicker/DatePicker";
|
|
36
|
+
export { TimePicker } from "./src/components/TimePicker/TimePicker";
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export { Tabs, TabsList, TabsTrigger, TabsContent, } from "./src/components/Tabs
|
|
|
24
24
|
export { Select, SelectTrigger, SelectContent, SelectItem, SelectGroup, SelectLabel, SelectSeparator, SelectValue, } from "./src/components/Dropdown/select";
|
|
25
25
|
export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "./src/components/Alerts/AlertDialog";
|
|
26
26
|
export { Avatar, AvatarImage, AvatarFallback, } from "./src/components/Avatar/Avatar/Avatar";
|
|
27
|
-
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, } from "./src/components/Table/Table";
|
|
27
|
+
export { Table, TableHeader, TableBody, TableRow, TableHead, TableCell, TableCaption, TableButton, TableCellPadded, TableFooter, } from "./src/components/Table/Table";
|
|
28
28
|
export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuCheckboxItem, DropdownMenuLabel, DropdownMenuSubTrigger, DropdownMenuSub, DropdownMenuSubContent, } from "./src/components/Dropdown/DropdownMenu/DropdownMenu";
|
|
29
29
|
export { Badge } from "./src/components/Badge/Badge";
|
|
30
30
|
export { default as Combobox } from "./src/components/Dropdown/Combobox/Combobox";
|
|
@@ -32,3 +32,5 @@ export { Pagination, PaginationContent, PaginationLink, PaginationItem, Paginati
|
|
|
32
32
|
export { Skeleton } from "./src/components/Skeleton/skeleton";
|
|
33
33
|
export { Tabs as VerticalTabs, TabsContent as VerticalTabsContent, TabsList as VerticalTabsList, tabSizes as verticalTabsSize, TabsTrigger as VerticalTabsTrigger, TabsHeading as VerticalTabsHeading, } from "./src/components/VerticalTabs/VerticalTabs";
|
|
34
34
|
export { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, sizes, } from "./src/components/Modal/Modal";
|
|
35
|
+
export { DatePicker } from "./src/components/DatePicker/DatePicker";
|
|
36
|
+
export { TimePicker } from "./src/components/TimePicker/TimePicker";
|
|
@@ -16,7 +16,7 @@ export declare const variant: {
|
|
|
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
18
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
19
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
19
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
20
20
|
variant?: "link" | "fill" | "outline" | "ghost" | null | undefined;
|
|
21
21
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
22
22
|
declare function Button({ className, color, size, shape, variant, asChild, startIcon, endIcon, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -393,7 +393,7 @@ declare const meta: {
|
|
|
393
393
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
394
394
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
395
395
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
396
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
396
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
397
397
|
asChild?: boolean | undefined;
|
|
398
398
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
399
399
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -693,7 +693,7 @@ declare const meta: {
|
|
|
693
693
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
694
694
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
695
695
|
variant?: "fill" | "link" | "outline" | "ghost" | undefined;
|
|
696
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
696
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
697
697
|
asChild?: boolean | undefined;
|
|
698
698
|
startIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
699
699
|
endIcon?: keyof typeof import("../../../utils/iconList").iconList | undefined;
|
|
@@ -9,7 +9,7 @@ export declare const variant: {
|
|
|
9
9
|
declare const buttonVariants: (props?: ({
|
|
10
10
|
color?: "blue" | "light-blue" | "green" | "light-green" | "yellow" | "light-yellow" | "red" | "light-red" | "indigo" | "light-indigo" | "gray" | "light-gray" | "disabled" | null | undefined;
|
|
11
11
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
12
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
12
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
13
13
|
variant?: "fill" | "outline" | "ghost" | null | undefined;
|
|
14
14
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
15
|
declare function IconButton({ className, color, size, shape, variant, asChild, icon, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
@@ -404,7 +404,7 @@ declare const meta: {
|
|
|
404
404
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
405
405
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
406
406
|
variant?: "fill" | "outline" | "ghost" | undefined;
|
|
407
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
407
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
408
408
|
asChild?: boolean | undefined;
|
|
409
409
|
icon?: keyof typeof iconList | undefined;
|
|
410
410
|
}>, context: import("@storybook/core/csf").StoryContext<import("@storybook/react").ReactRenderer, {
|
|
@@ -703,7 +703,7 @@ declare const meta: {
|
|
|
703
703
|
onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
704
704
|
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
705
705
|
variant?: "fill" | "outline" | "ghost" | undefined;
|
|
706
|
-
shape?: "rounded-sm" | "rounded-full" | null | undefined;
|
|
706
|
+
shape?: "rounded-sm" | "rounded-full" | "rounded-none" | null | undefined;
|
|
707
707
|
asChild?: boolean | undefined;
|
|
708
708
|
icon?: keyof typeof iconList | undefined;
|
|
709
709
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -14,7 +14,7 @@ export var buttonStyles = {
|
|
|
14
14
|
"light-indigo": "bg-indigo-100 text-indigo-600 hover:bg-indigo-700 hover:text-indigo-50 active:bg-indigo-800 active:text-indigo-50",
|
|
15
15
|
gray: "bg-gray-900 text-gray-50 hover:bg-gray-100 hover:text-gray-950 active:bg-gray-300 active:text-gray-950",
|
|
16
16
|
"light-gray": "bg-gray-50 text-gray-950 hover:bg-gray-100 active:bg-gray-300",
|
|
17
|
-
disabled: "bg-gray-100 text-gray-300",
|
|
17
|
+
disabled: "bg-gray-100 text-gray-300 cursor-not-allowed",
|
|
18
18
|
},
|
|
19
19
|
size: {
|
|
20
20
|
xl: "h-13 !py-3.5 !px-6 !text-base !font-normal !leading-normal",
|
|
@@ -29,6 +29,7 @@ export var buttonStyles = {
|
|
|
29
29
|
sm: "size-9 !p-2.5",
|
|
30
30
|
},
|
|
31
31
|
shape: {
|
|
32
|
+
"rounded-none": styles["rounded-none"],
|
|
32
33
|
"rounded-sm": styles["rounded-sm"],
|
|
33
34
|
"rounded-full": styles["rounded-full"],
|
|
34
35
|
},
|
|
@@ -0,0 +1,64 @@
|
|
|
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 { format } from "date-fns";
|
|
26
|
+
import { cn } from "../../lib/utils";
|
|
27
|
+
import { Calendar } from "../ui/calendar";
|
|
28
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
|
|
29
|
+
import LUIcon from "../Icons/LUIcon";
|
|
30
|
+
import { getIconSize, getPadding, getIconPosition } from "../Input";
|
|
31
|
+
import { inputVariantConfig, inputVariants } from "../Input/input";
|
|
32
|
+
import { Button } from "../Button/Button/Button";
|
|
33
|
+
import { Default_DatePicker_Variant, Default_DatePicker_Color, Default_DatePicker_Shape, Default_DatePicker_Size, datePickerStyles, Default_DatePicker_Shadow, } from ".";
|
|
34
|
+
import { useState } from "react";
|
|
35
|
+
export function DatePicker(_a) {
|
|
36
|
+
var className = _a.className, _b = _a.variant, variant = _b === void 0 ? Default_DatePicker_Variant : _b, _c = _a.size, size = _c === void 0 ? Default_DatePicker_Size : _c, _d = _a.color, color = _d === void 0 ? Default_DatePicker_Color : _d, _e = _a.shape, shape = _e === void 0 ? Default_DatePicker_Shape : _e, date = _a.date, onChange = _a.onChange, _f = _a.placeholder, placeholder = _f === void 0 ? "MM/DD/YYYY" : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, startIcon = _a.startIcon, endIcon = _a.endIcon, _h = _a.shadow, shadow = _h === void 0 ? Default_DatePicker_Shadow : _h, minDate = _a.minDate, maxDate = _a.maxDate, props = __rest(_a, ["className", "variant", "size", "color", "shape", "date", "onChange", "placeholder", "disabled", "startIcon", "endIcon", "shadow", "minDate", "maxDate"]);
|
|
37
|
+
var _j = useState(false), open = _j[0], setOpen = _j[1];
|
|
38
|
+
var iconSizeClass = getIconSize(size);
|
|
39
|
+
var paddingClass = getPadding(size, !!startIcon, !!endIcon);
|
|
40
|
+
var iconPosition = getIconPosition(size || Default_DatePicker_Size);
|
|
41
|
+
return (_jsxs(Popover, { open: !disabled && open, onOpenChange: disabled ? undefined : setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs("div", { className: "relative", children: [startIcon && (_jsx(LUIcon, { icon: startIcon, size: iconSizeClass, className: cn("absolute top-1/2 -translate-y-1/2 pointer-events-none z-10", iconPosition.left) })), _jsx(Button, { color: "light-gray", "aria-expanded": open, "data-slot": "date-picker-input", className: cn("w-full justify-between !p-0", inputVariants({ variant: variant, size: size, color: color, shape: shape }), "text-left flex items-center", !date && "text-muted-foreground", open &&
|
|
42
|
+
color === "default" &&
|
|
43
|
+
"border-blue-600 ring-2 ring-blue-200", disabled && [
|
|
44
|
+
variant === "filled" && "bg-gray-100",
|
|
45
|
+
"border border-gray-300 cursor-not-allowed pointer-events-none opacity-50",
|
|
46
|
+
]), shape: inputVariantConfig.shape[shape], disabled: disabled, tabIndex: disabled ? -1 : 0, children: _jsx("div", { className: cn("flex-grow flex items-center", paddingClass), children: date ? format(date, "MM/dd/yyyy") : placeholder }) }), endIcon && (_jsx(LUIcon, { icon: endIcon, size: iconSizeClass, className: cn("absolute top-1/2 -translate-y-1/2 pointer-events-none z-10", iconPosition.right) }))] }) }), _jsx(PopoverContent, __assign({ align: "start", className: cn("w-full p-0 bg-white", datePickerStyles.shadow[shadow], className) }, props, { children: _jsx(Calendar, __assign({}, {
|
|
47
|
+
mode: "single",
|
|
48
|
+
selected: date !== null && date !== void 0 ? date : undefined,
|
|
49
|
+
onSelect: function (selectedDate) {
|
|
50
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectedDate !== null && selectedDate !== void 0 ? selectedDate : null);
|
|
51
|
+
setOpen(false);
|
|
52
|
+
},
|
|
53
|
+
calendarSize: size !== null && size !== void 0 ? size : Default_DatePicker_Size,
|
|
54
|
+
autoFocus: true,
|
|
55
|
+
disabled: {
|
|
56
|
+
before: minDate
|
|
57
|
+
? new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())
|
|
58
|
+
: undefined,
|
|
59
|
+
after: maxDate
|
|
60
|
+
? new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate())
|
|
61
|
+
: undefined,
|
|
62
|
+
},
|
|
63
|
+
})) }))] }));
|
|
64
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta } from "@storybook/react";
|
|
2
|
+
import { DatePickerProps } from ".";
|
|
3
|
+
declare const _default: Meta<DatePickerProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, DatePickerProps>;
|
|
6
|
+
export declare const WithLabel: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const WithLabelAndCaption: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const Sizes: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const WithIcons: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ValidationStates: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const Disabled: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const Shapes: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const CalendarSizes: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Shadows: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,171 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { DatePicker } from "./DatePicker";
|
|
14
|
+
import { Body } from "../Typography/Body/body";
|
|
15
|
+
import { Label } from "../Label/Label";
|
|
16
|
+
import { Caption } from "../Typography/Caption/caption";
|
|
17
|
+
import Tooltip from "../ToolTip/Tooltip";
|
|
18
|
+
import LUIcon from "../Icons/LUIcon";
|
|
19
|
+
import { datePickerStyles, Default_DatePicker_Color, Default_DatePicker_Shadow, Default_DatePicker_Shape, Default_DatePicker_Size, Default_DatePicker_Variant, } from ".";
|
|
20
|
+
import { inputVariantConfig } from "../Input/input";
|
|
21
|
+
import { Calendar } from "../ui/calendar";
|
|
22
|
+
import { useEffect, useState } from "react";
|
|
23
|
+
export default {
|
|
24
|
+
title: "Components/DatePicker",
|
|
25
|
+
component: DatePicker,
|
|
26
|
+
tags: ["autodocs"],
|
|
27
|
+
argTypes: {
|
|
28
|
+
variant: {
|
|
29
|
+
control: {
|
|
30
|
+
type: "select",
|
|
31
|
+
},
|
|
32
|
+
options: Object.keys(inputVariantConfig.variant),
|
|
33
|
+
defaultValue: Default_DatePicker_Variant,
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
control: {
|
|
37
|
+
type: "select",
|
|
38
|
+
},
|
|
39
|
+
options: Object.keys(inputVariantConfig.size),
|
|
40
|
+
defaultValue: Default_DatePicker_Size,
|
|
41
|
+
},
|
|
42
|
+
color: {
|
|
43
|
+
control: {
|
|
44
|
+
type: "select",
|
|
45
|
+
},
|
|
46
|
+
options: Object.keys(inputVariantConfig.color),
|
|
47
|
+
defaultValue: Default_DatePicker_Color,
|
|
48
|
+
description: "Color variant of the trigger button",
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: "string" },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
shape: {
|
|
54
|
+
control: {
|
|
55
|
+
type: "select",
|
|
56
|
+
},
|
|
57
|
+
options: Object.keys(inputVariantConfig.shape),
|
|
58
|
+
defaultValue: Default_DatePicker_Shape,
|
|
59
|
+
description: "Shape variant of the trigger button (border radius)",
|
|
60
|
+
table: {
|
|
61
|
+
type: { summary: "string" },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
placeholder: {
|
|
65
|
+
control: "text",
|
|
66
|
+
defaultValue: "MM/DD/YYYY",
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
control: "boolean",
|
|
70
|
+
defaultValue: false,
|
|
71
|
+
},
|
|
72
|
+
shadow: {
|
|
73
|
+
control: {
|
|
74
|
+
type: "select",
|
|
75
|
+
},
|
|
76
|
+
options: Object.keys(datePickerStyles.shadow),
|
|
77
|
+
defaultValue: Default_DatePicker_Shadow,
|
|
78
|
+
description: "Shadow styling for the calendar dropdown when opened",
|
|
79
|
+
table: {
|
|
80
|
+
type: { summary: "string" },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
var Template = function (args) {
|
|
86
|
+
var _a;
|
|
87
|
+
var _b = useState((_a = args.date) !== null && _a !== void 0 ? _a : null), date = _b[0], setDate = _b[1];
|
|
88
|
+
useEffect(function () {
|
|
89
|
+
var _a;
|
|
90
|
+
setDate((_a = args.date) !== null && _a !== void 0 ? _a : null);
|
|
91
|
+
}, [args.date]);
|
|
92
|
+
return (_jsx("div", { className: "w-full max-w-md", children: _jsx(DatePicker, __assign({}, args, { date: date, onChange: setDate })) }));
|
|
93
|
+
};
|
|
94
|
+
export var Default = Template.bind({});
|
|
95
|
+
Default.args = {
|
|
96
|
+
placeholder: "Select a date",
|
|
97
|
+
variant: Default_DatePicker_Variant,
|
|
98
|
+
size: Default_DatePicker_Size,
|
|
99
|
+
};
|
|
100
|
+
export var WithLabel = function () {
|
|
101
|
+
var _a = useState(null), date = _a[0], setDate = _a[1];
|
|
102
|
+
return (_jsx("div", { className: "w-full max-w-md", children: _jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(Tooltip, { title: "?", children: _jsx(LUIcon, { variant: "padded", size: "md", shape: "rounded", icon: "question", color: "light-blue" }) })] }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", date: date, onChange: setDate })] }) }));
|
|
103
|
+
};
|
|
104
|
+
export var WithLabelAndCaption = function () {
|
|
105
|
+
var _a = useState(null), date = _a[0], setDate = _a[1];
|
|
106
|
+
return (_jsx("div", { className: "w-full max-w-md", children: _jsxs("div", { className: "flex flex-col gap-1", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(Tooltip, { title: "?", children: _jsx(LUIcon, { variant: "padded", size: "md", shape: "rounded", icon: "question", color: "light-blue" }) })] }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", date: date, onChange: setDate }), _jsx(Caption, { variant: "sm", children: "Enter your application/validation/helper content here" })] }) }));
|
|
107
|
+
};
|
|
108
|
+
export var Sizes = function () {
|
|
109
|
+
var sizes = Object.keys(inputVariantConfig.size);
|
|
110
|
+
var _a = useState({}), dates = _a[0], setDates = _a[1];
|
|
111
|
+
var handleDateChange = function (size, date) {
|
|
112
|
+
setDates(function (prev) {
|
|
113
|
+
var _a;
|
|
114
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[size] = date, _a)));
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
return (_jsx("div", { className: "space-y-4 w-full max-w-md", children: sizes.map(function (size) { return (_jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: size.charAt(0).toUpperCase() + size.slice(1) }), _jsx(DatePicker, { size: size, placeholder: "MM/DD/YYYY", date: dates[size], onChange: function (date) { return handleDateChange(size, date); } })] }, size)); }) }));
|
|
118
|
+
};
|
|
119
|
+
export var WithIcons = function () {
|
|
120
|
+
var _a = useState(null), dateStart = _a[0], setDateStart = _a[1];
|
|
121
|
+
var _b = useState(null), dateBoth = _b[0], setDateBoth = _b[1];
|
|
122
|
+
return (_jsxs("div", { className: "space-y-4 w-full max-w-md", children: [_jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "With Start Icon" }), _jsx(DatePicker, { startIcon: "plus", placeholder: "MM/DD/YYYY", date: dateStart, onChange: setDateStart })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "With Both Icons" }), _jsx(DatePicker, { startIcon: "plus", endIcon: "calendar-days", placeholder: "MM/DD/YYYY", date: dateBoth, onChange: setDateBoth })] })] }));
|
|
123
|
+
};
|
|
124
|
+
export var ValidationStates = function () {
|
|
125
|
+
var _a = useState(null), dateDefault = _a[0], setDateDefault = _a[1];
|
|
126
|
+
var _b = useState(new Date()), dateSuccess = _b[0], setDateSuccess = _b[1];
|
|
127
|
+
var _c = useState(null), dateWarning = _c[0], setDateWarning = _c[1];
|
|
128
|
+
var _d = useState(null), dateError = _d[0], setDateError = _d[1];
|
|
129
|
+
return (_jsxs("div", { className: "space-y-4 w-full max-w-md", children: [_jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "Default" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", date: dateDefault, onChange: setDateDefault }), _jsx(Caption, { variant: "sm", children: "Enter your application/validation/helper content here" })] })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "Success" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", color: "success", date: dateSuccess, onChange: setDateSuccess }), _jsx(Caption, { variant: "sm", children: "Correct date selected" })] })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "Warning" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", color: "warning", date: dateWarning, onChange: setDateWarning }), _jsx(Caption, { variant: "sm", children: "Please verify the selected date" })] })] }), _jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: "Error" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", color: "danger", date: dateError, onChange: setDateError }), _jsx(Caption, { variant: "sm", children: "Invalid date selection" })] })] })] }));
|
|
130
|
+
};
|
|
131
|
+
export var Disabled = function () {
|
|
132
|
+
return (_jsx("div", { className: "w-full max-w-md", children: _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", disabled: true })] }) }));
|
|
133
|
+
};
|
|
134
|
+
export var Shapes = function () {
|
|
135
|
+
var shapes = Object.keys(inputVariantConfig.shape);
|
|
136
|
+
var _a = useState({}), dates = _a[0], setDates = _a[1];
|
|
137
|
+
var handleDateChange = function (shape, date) {
|
|
138
|
+
setDates(function (prev) {
|
|
139
|
+
var _a;
|
|
140
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[shape] = date, _a)));
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
return (_jsx("div", { className: "space-y-4 w-full max-w-md", children: shapes.map(function (shape) { return (_jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: shape.charAt(0).toUpperCase() + shape.slice(1) }), _jsx(DatePicker, { shape: shape, placeholder: "MM/DD/YYYY", date: dates[shape], onChange: function (date) { return handleDateChange(shape, date); } })] }, shape)); }) }));
|
|
144
|
+
};
|
|
145
|
+
export var CalendarSizes = function () {
|
|
146
|
+
var sizes = Object.keys(inputVariantConfig.size);
|
|
147
|
+
var _a = useState({}), dates = _a[0], setDates = _a[1];
|
|
148
|
+
return (_jsx("div", { className: "flex gap-8 items-start flex-wrap", children: sizes.map(function (size) {
|
|
149
|
+
var _a;
|
|
150
|
+
return (_jsxs("div", { className: "flex flex-col items-center", children: [_jsx(Body, { variant: "body-sm-500", className: "mb-4", children: size.charAt(0).toUpperCase() + size.slice(1) }), _jsx("div", { className: "border border-gray-200 rounded-lg shadow-lg p-0 bg-white", children: _jsx(Calendar, { mode: "single",
|
|
151
|
+
selected: (_a = dates[size]) !== null && _a !== void 0 ? _a : undefined,
|
|
152
|
+
onSelect: function (date) {
|
|
153
|
+
setDates(function (prev) {
|
|
154
|
+
var _a;
|
|
155
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[size] = date !== null && date !== void 0 ? date : null, _a)));
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
calendarSize: size }) })] }, size));
|
|
159
|
+
}) }));
|
|
160
|
+
};
|
|
161
|
+
export var Shadows = function () {
|
|
162
|
+
var shadows = Object.keys(datePickerStyles.shadow);
|
|
163
|
+
var _a = useState({}), dates = _a[0], setDates = _a[1];
|
|
164
|
+
var handleDateChange = function (shadow, date) {
|
|
165
|
+
setDates(function (prev) {
|
|
166
|
+
var _a;
|
|
167
|
+
return (__assign(__assign({}, prev), (_a = {}, _a[shadow] = date, _a)));
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
return (_jsx("div", { className: "space-y-4 w-full max-w-md", children: shadows.map(function (shadow) { return (_jsxs("div", { children: [_jsx(Body, { variant: "body-sm-500", className: "mb-2", children: shadow !== "none" ? "With Shadow" : "Without Shadow" }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx(Label, { variant: "label-lg", children: "Label" }), _jsx(DatePicker, { placeholder: "MM/DD/YYYY", shadow: shadow, date: dates[shadow], onChange: function (date) { return handleDateChange(shadow, date); } })] })] }, shadow)); }) }));
|
|
171
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { inputVariantConfig } from "../Input/input";
|
|
2
|
+
export declare const Default_DatePicker_Variant: keyof typeof inputVariantConfig.variant;
|
|
3
|
+
export declare const Default_DatePicker_Size: keyof typeof inputVariantConfig.size;
|
|
4
|
+
export declare const Default_DatePicker_Color: keyof typeof inputVariantConfig.color;
|
|
5
|
+
export declare const Default_DatePicker_Shape: keyof typeof inputVariantConfig.shape;
|
|
6
|
+
export declare const datePickerStyles: {
|
|
7
|
+
shadow: {
|
|
8
|
+
lg: string;
|
|
9
|
+
none: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const Default_DatePicker_Shadow: keyof typeof datePickerStyles.shadow;
|
|
13
|
+
export { DatePicker } from "./DatePicker";
|
|
14
|
+
export type { DatePickerProps } from "./types";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var Default_DatePicker_Variant = "filled";
|
|
2
|
+
export var Default_DatePicker_Size = "lg";
|
|
3
|
+
export var Default_DatePicker_Color = "default";
|
|
4
|
+
export var Default_DatePicker_Shape = "square";
|
|
5
|
+
export var datePickerStyles = {
|
|
6
|
+
shadow: {
|
|
7
|
+
lg: "rounded-md shadow-lg border border-gray-200",
|
|
8
|
+
none: "",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export var Default_DatePicker_Shadow = "lg";
|
|
12
|
+
export { DatePicker } from "./DatePicker";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VariantProps } from "class-variance-authority";
|
|
2
|
+
import { inputVariantConfig, inputVariants } from "../Input/input";
|
|
3
|
+
import { iconList } from "../../utils/iconList";
|
|
4
|
+
import { datePickerStyles } from ".";
|
|
5
|
+
export interface DatePickerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "size" | "color" | "onChange">, VariantProps<typeof inputVariants> {
|
|
6
|
+
date?: Date | null;
|
|
7
|
+
onChange?: (date: Date | null) => void;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
startIcon?: keyof typeof iconList;
|
|
11
|
+
endIcon?: keyof typeof iconList;
|
|
12
|
+
shape?: keyof typeof inputVariantConfig.shape;
|
|
13
|
+
shadow?: keyof typeof datePickerStyles.shadow;
|
|
14
|
+
minDate?: Date;
|
|
15
|
+
maxDate?: Date;
|
|
16
|
+
size?: keyof typeof inputVariantConfig.size;
|
|
17
|
+
color?: keyof typeof inputVariantConfig.color;
|
|
18
|
+
variant?: keyof typeof inputVariantConfig.variant;
|
|
19
|
+
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
type TableSize = keyof typeof tableSize;
|
|
2
|
+
import { TableColumn, TableSize, TableVariant } from "./types";
|
|
4
3
|
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & {
|
|
5
4
|
size?: TableSize;
|
|
6
5
|
columnMinWidth?: number;
|
|
7
|
-
columns?:
|
|
8
|
-
key: string;
|
|
9
|
-
header: string;
|
|
10
|
-
}>;
|
|
6
|
+
columns?: TableColumn[];
|
|
11
7
|
hasActionColumn?: boolean;
|
|
8
|
+
variant?: TableVariant;
|
|
12
9
|
} & React.RefAttributes<HTMLTableElement>>;
|
|
13
10
|
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
14
11
|
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
@@ -17,10 +14,13 @@ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
|
|
|
17
14
|
collapsibleContent?: React.ReactNode;
|
|
18
15
|
showTrigger?: boolean;
|
|
19
16
|
data?: Record<string, unknown>;
|
|
17
|
+
disableClick?: boolean;
|
|
20
18
|
} & React.RefAttributes<HTMLTableRowElement>>;
|
|
21
19
|
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & {
|
|
22
20
|
size?: TableSize;
|
|
23
21
|
} & React.RefAttributes<HTMLTableCellElement>>;
|
|
24
22
|
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
23
|
+
declare const TableCellPadded: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
25
24
|
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
26
|
-
|
|
25
|
+
declare const TableButton: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCellPadded, TableCaption, TableButton, };
|