@eml-payments/ui-kit 1.8.10 → 1.8.12
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/README.md +44 -44
- package/dist/index.css +2 -2
- package/dist/src/assets/index.d.ts +2 -0
- package/dist/src/assets/index.js +3 -0
- package/dist/src/assets/index.ts +3 -0
- package/dist/src/components/Combobox/Combobox.d.ts +9 -9
- package/dist/src/components/Combobox/Combobox.stories.js +19 -17
- package/dist/src/components/CreditCard/CreditCard.d.ts +2 -0
- package/dist/src/components/CreditCard/CreditCard.js +7 -3
- package/dist/src/components/CreditCard/CreditCard.stories.d.ts +1 -0
- package/dist/src/components/CreditCard/CreditCard.stories.js +13 -3
- package/dist/src/components/Dialog/Dialog.d.ts +11 -11
- package/dist/src/components/Dialog/Dialog.js +1 -1
- package/dist/src/components/Dialog/Dialog.stories.d.ts +1 -0
- package/dist/src/components/Dialog/Dialog.stories.js +6 -0
- package/dist/src/components/InputGroup/InputGroup.js +2 -2
- package/dist/src/components/InputGroup/InputGroup.stories.js +5 -4
- package/dist/src/components/index.d.ts +0 -1
- package/dist/src/components/index.js +0 -1
- package/package.json +1 -1
- package/dist/index.d.cts +0 -488
- package/dist/index.d.ts +0 -488
- package/dist/src/components/Table/BaseTable/index.d.ts +0 -1
- package/dist/src/components/Table/BaseTable/index.js +0 -1
- package/dist/src/components/Table/Pagination/PaginationControls.d.ts +0 -3
- package/dist/src/components/Table/Pagination/PaginationControls.js +0 -22
- package/dist/src/components/Table/Pagination/PaginationControls.types.d.ts +0 -24
- package/dist/src/components/Table/Pagination/PaginationControls.types.js +0 -1
- package/dist/src/components/Table/Table.d.ts +0 -4
- package/dist/src/components/Table/Table.js +0 -93
- package/dist/src/components/Table/Table.stories.d.ts +0 -31
- package/dist/src/components/Table/Table.stories.js +0 -479
- package/dist/src/components/Table/hooks/useInfiniteScrolling.d.ts +0 -29
- package/dist/src/components/Table/hooks/useInfiniteScrolling.js +0 -96
- package/dist/src/components/Table/hooks/usePaginationController.d.ts +0 -16
- package/dist/src/components/Table/hooks/usePaginationController.js +0 -30
- package/dist/src/components/Table/hooks/useTableController.d.ts +0 -26
- package/dist/src/components/Table/hooks/useTableController.js +0 -146
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Combobox as ComboboxPrimitive } from '@base-ui/react';
|
|
3
3
|
declare const Combobox: typeof ComboboxPrimitive.Root;
|
|
4
|
-
declare function ComboboxValue({ ...props }: ComboboxPrimitive.Value.Props): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
declare function ComboboxTrigger({ className, children, ...props }: ComboboxPrimitive.Trigger.Props): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function ComboboxValue({ ...props }: Readonly<ComboboxPrimitive.Value.Props>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function ComboboxTrigger({ className, children, ...props }: Readonly<ComboboxPrimitive.Trigger.Props>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare function ComboboxInput({ className, children, disabled, isLoading, showTrigger, showClear, ...props }: ComboboxPrimitive.Input.Props & {
|
|
7
7
|
showTrigger?: boolean;
|
|
8
8
|
showClear?: boolean;
|
|
9
9
|
isLoading?: boolean;
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function ComboboxContent({ className, side, sideOffset, align, alignOffset, anchor, ...props }: ComboboxPrimitive.Popup.Props & Pick<ComboboxPrimitive.Positioner.Props, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'anchor'>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
declare function ComboboxList({ className, ...props }: ComboboxPrimitive.List.Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
declare function ComboboxItem({ className, children, ...props }: ComboboxPrimitive.Item.Props): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
declare function ComboboxGroup({ className, ...props }: ComboboxPrimitive.Group.Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
declare function ComboboxLabel({ className, ...props }: ComboboxPrimitive.GroupLabel.Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
declare function ComboboxCollection({ ...props }: ComboboxPrimitive.Collection.Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function ComboboxList({ className, ...props }: Readonly<ComboboxPrimitive.List.Props>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function ComboboxItem({ className, children, ...props }: Readonly<ComboboxPrimitive.Item.Props>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function ComboboxGroup({ className, ...props }: Readonly<ComboboxPrimitive.Group.Props>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function ComboboxLabel({ className, ...props }: Readonly<ComboboxPrimitive.GroupLabel.Props>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function ComboboxCollection({ ...props }: Readonly<ComboboxPrimitive.Collection.Props>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
declare function ComboboxEmpty({ className, showAddButton, onAddItem, addButtonText, children, ...props }: ComboboxPrimitive.Empty.Props & {
|
|
18
18
|
showAddButton?: boolean;
|
|
19
19
|
onAddItem?: () => void;
|
|
20
20
|
addButtonText?: string;
|
|
21
21
|
}): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
declare function ComboboxSeparator({ className, ...props }: ComboboxPrimitive.Separator.Props): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function ComboboxSeparator({ className, ...props }: Readonly<ComboboxPrimitive.Separator.Props>): import("react/jsx-runtime").JSX.Element;
|
|
23
23
|
declare function ComboboxChips({ className, ...props }: React.ComponentPropsWithRef<typeof ComboboxPrimitive.Chips> & ComboboxPrimitive.Chips.Props): import("react/jsx-runtime").JSX.Element;
|
|
24
24
|
declare function ComboboxChip({ className, children, showRemove, ...props }: ComboboxPrimitive.Chip.Props & {
|
|
25
25
|
showRemove?: boolean;
|
|
26
26
|
}): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
declare function ComboboxChipsInput({ className, ...props }: ComboboxPrimitive.Input.Props): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
declare function ComboboxChipsInput({ className, ...props }: Readonly<ComboboxPrimitive.Input.Props>): import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export { Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, };
|
|
@@ -32,26 +32,28 @@ export const Basic = {
|
|
|
32
32
|
export const WithClearButton = {
|
|
33
33
|
render: () => (_jsxs(Combobox, { items: fruits, defaultValue: fruits[0], children: [_jsx(ComboboxInput, { placeholder: "Select a fruit", showClear: true }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: "No fruits found." }), _jsx(ComboboxList, { children: (item) => (_jsx(ComboboxItem, { value: item, children: item }, item)) })] })] })),
|
|
34
34
|
};
|
|
35
|
+
function WithAddButtonStory() {
|
|
36
|
+
const [value, setValue] = useState(null);
|
|
37
|
+
const [items, setItems] = useState(fruits);
|
|
38
|
+
const handleChangeValue = (newValue) => {
|
|
39
|
+
if (newValue === '') {
|
|
40
|
+
setValue(null);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
setValue(newValue);
|
|
44
|
+
};
|
|
45
|
+
return (_jsxs(Combobox, { items: items, value: value, onInputValueChange: handleChangeValue, children: [_jsx(ComboboxInput, { placeholder: "Select a fruit", showClear: true }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { showAddButton: true, onAddItem: () => setItems((prev) => [...prev, value !== null && value !== void 0 ? value : '']), addButtonText: `Add "${value}" to the list`, children: "No fruits found" }), _jsx(ComboboxList, { children: (item) => (_jsx(ComboboxItem, { value: item, children: item }, item)) })] })] }));
|
|
46
|
+
}
|
|
35
47
|
export const WithAddButton = {
|
|
36
|
-
render: () => {
|
|
37
|
-
const [value, onChangeValue] = useState(null);
|
|
38
|
-
const [items, setItems] = useState(fruits);
|
|
39
|
-
const handleChangeValue = (newValue) => {
|
|
40
|
-
if (newValue === '') {
|
|
41
|
-
onChangeValue(null);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
onChangeValue(newValue);
|
|
45
|
-
};
|
|
46
|
-
return (_jsxs(Combobox, { items: items, value: value, onInputValueChange: handleChangeValue, children: [_jsx(ComboboxInput, { placeholder: "Select a fruit", showClear: true }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { showAddButton: true, onAddItem: () => setItems((prev) => [...prev, value !== null && value !== void 0 ? value : '']), addButtonText: `Add "${value}" to the list`, children: "No fruits found" }), _jsx(ComboboxList, { children: (item) => (_jsx(ComboboxItem, { value: item, children: item }, item)) })] })] }));
|
|
47
|
-
},
|
|
48
|
+
render: () => _jsx(WithAddButtonStory, {}),
|
|
48
49
|
};
|
|
50
|
+
function MultiSelectStory() {
|
|
51
|
+
const [value, setValue] = useState([]);
|
|
52
|
+
const anchor = useComboboxAnchor();
|
|
53
|
+
return (_jsxs(Combobox, { items: fruits, multiple: true, value: value, onValueChange: setValue, children: [_jsxs(ComboboxChips, { ref: anchor, children: [_jsx(ComboboxValue, { children: value.map((item) => (_jsx(ComboboxChip, { children: item }, item))) }), _jsx(ComboboxChipsInput, { placeholder: "Add fruit" })] }), _jsxs(ComboboxContent, { anchor: anchor, children: [_jsx(ComboboxEmpty, { children: "No fruits found" }), _jsx(ComboboxList, { children: (fruit) => (_jsx(ComboboxItem, { value: fruit, children: fruit }, fruit)) })] })] }));
|
|
54
|
+
}
|
|
49
55
|
export const MultiSelect = {
|
|
50
|
-
render: () => {
|
|
51
|
-
const [value, setValue] = useState([]);
|
|
52
|
-
const anchor = useComboboxAnchor();
|
|
53
|
-
return (_jsxs(Combobox, { items: fruits, multiple: true, value: value, onValueChange: setValue, children: [_jsxs(ComboboxChips, { ref: anchor, children: [_jsx(ComboboxValue, { children: value.map((item) => (_jsx(ComboboxChip, { children: item }, item))) }), _jsx(ComboboxChipsInput, { placeholder: "Add fruit" })] }), _jsxs(ComboboxContent, { anchor: anchor, children: [_jsx(ComboboxEmpty, { children: "No fruits found" }), _jsx(ComboboxList, { children: (fruit) => (_jsx(ComboboxItem, { value: fruit, children: fruit }, fruit)) })] })] }));
|
|
54
|
-
},
|
|
56
|
+
render: () => _jsx(MultiSelectStory, {}),
|
|
55
57
|
};
|
|
56
58
|
export const WithGroups = {
|
|
57
59
|
render: () => {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react-hooks/set-state-in-effect */
|
|
3
2
|
import { useEffect, useRef, useState } from 'react';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
4
|
import creditCardFrost from '../../assets/credit-card-frost.png';
|
|
6
5
|
import { BrokenGlassEffect } from './BrokenGlassEffect';
|
|
7
|
-
|
|
6
|
+
const sizeClasses = {
|
|
7
|
+
sm: 'w-full max-w-[118px]',
|
|
8
|
+
md: 'w-full max-w-[236px]',
|
|
9
|
+
lg: 'w-full max-w-[380px]',
|
|
10
|
+
};
|
|
11
|
+
export const CreditCard = ({ imageUrl, isBlocked, size = 'sm' }) => {
|
|
8
12
|
const [isUnfreezing, setIsUnfreezing] = useState(false);
|
|
9
13
|
const prevBlockedRef = useRef(isBlocked);
|
|
10
14
|
useEffect(() => {
|
|
@@ -12,7 +16,7 @@ export const CreditCard = ({ imageUrl, isBlocked }) => {
|
|
|
12
16
|
prevBlockedRef.current = isBlocked;
|
|
13
17
|
setIsUnfreezing(wasBlocked && !isBlocked);
|
|
14
18
|
}, [isBlocked]);
|
|
15
|
-
return (_jsxs("div", { className:
|
|
19
|
+
return (_jsxs("div", { className: clsx('relative overflow-hidden rounded-[10px] shadow-(--shadow-eml)', sizeClasses[size]), children: [_jsx("img", { src: imageUrl, alt: "User credit card", className: clsx('w-full h-full object-cover rounded-[10px] shadow-(--shadow-eml)', 'transition-all duration-700 ease-in-out', { 'filter brightness-70 contrast-110 saturate-75': isBlocked && !isUnfreezing }) }), isBlocked && !isUnfreezing && (_jsx("div", { className: "absolute inset-0 rounded-[10px] transition-all duration-700 ease-out bg-cover bg-center opacity-80", style: {
|
|
16
20
|
backgroundImage: `url(${creditCardFrost})`,
|
|
17
21
|
zIndex: 15,
|
|
18
22
|
mixBlendMode: 'overlay',
|
|
@@ -4,5 +4,6 @@ declare const meta: Meta<typeof CreditCard>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof CreditCard>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
+
export declare const AllSizes: Story;
|
|
7
8
|
export declare const Blocked: Story;
|
|
8
9
|
export declare const ControlledTransition: Story;
|
|
@@ -10,18 +10,28 @@ const meta = {
|
|
|
10
10
|
args: {
|
|
11
11
|
imageUrl: creditCardFront,
|
|
12
12
|
isBlocked: false,
|
|
13
|
+
size: 'sm',
|
|
13
14
|
},
|
|
14
15
|
argTypes: {
|
|
15
16
|
imageUrl: { control: 'text' },
|
|
16
17
|
isBlocked: { control: 'boolean' },
|
|
18
|
+
size: {
|
|
19
|
+
control: 'select',
|
|
20
|
+
options: ['sm', 'md', 'lg'],
|
|
21
|
+
description: 'Card size variant',
|
|
22
|
+
table: {
|
|
23
|
+
defaultValue: { summary: 'sm' },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
17
26
|
},
|
|
18
27
|
};
|
|
19
28
|
export default meta;
|
|
20
|
-
export const Default = {
|
|
21
|
-
|
|
29
|
+
export const Default = {};
|
|
30
|
+
export const AllSizes = {
|
|
31
|
+
render: () => (_jsxs("div", { className: "flex flex-col items-start gap-6 p-4", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Small (max 118px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: false, size: "sm" })] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Medium (max 236px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: false, size: "md" })] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Large (max 380px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: false, size: "lg" })] })] })),
|
|
22
32
|
};
|
|
23
33
|
export const Blocked = {
|
|
24
|
-
render: () => (
|
|
34
|
+
render: () => (_jsxs("div", { className: "flex flex-col items-start gap-6 p-4", children: [_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Small (max 118px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: true, size: "sm" })] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Medium (max 236px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: true, size: "md" })] }), _jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "text-xs text-gray-500 font-medium", children: "Large (max 380px)" }), _jsx(CreditCard, { imageUrl: creditCardFront, isBlocked: true, size: "lg" })] })] })),
|
|
25
35
|
};
|
|
26
36
|
function ControlledTransitionExample() {
|
|
27
37
|
const [isBlocked, setIsBlocked] = useState(true);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
-
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root
|
|
4
|
-
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger
|
|
5
|
-
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal
|
|
6
|
-
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close
|
|
7
|
-
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay
|
|
8
|
-
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
3
|
+
declare function Dialog({ ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Root>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Trigger>>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Portal>>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Close>>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Overlay>>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
declare function DialogHeader({ className, ...props }: React.ComponentProps<'div'
|
|
12
|
-
declare function DialogFooter({ className, ...props }: React.ComponentProps<'div'
|
|
13
|
-
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title
|
|
14
|
-
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description
|
|
10
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: Readonly<React.ComponentProps<'div'>>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: Readonly<React.ComponentProps<'div'>>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Title>>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: Readonly<React.ComponentProps<typeof DialogPrimitive.Description>>): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -19,7 +19,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
19
19
|
return (_jsx(DialogPrimitive.Overlay, { "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 }));
|
|
20
20
|
}
|
|
21
21
|
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
22
|
-
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "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%]
|
|
22
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { "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 inset-0 z-50 grid w-full gap-4 border p-6 shadow-lg duration-200 overflow-y-auto focus:outline-none focus:ring-0 focus:ring-offset-0 sm:inset-auto sm:top-[50%] sm:left-[50%] sm:max-w-lg sm:h-auto sm:max-h-[calc(100vh-2rem)] sm:translate-x-[-50%] sm:translate-y-[-50%] sm:rounded-lg sm:overflow-visible', 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(FiX, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
23
23
|
}
|
|
24
24
|
function DialogHeader({ className, ...props }) {
|
|
25
25
|
return (_jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
@@ -17,3 +17,9 @@ export const WithoutCloseButton = {
|
|
|
17
17
|
export const DialogWithCustomContent = {
|
|
18
18
|
render: () => (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { children: "Custom Content" }) }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Profile Info" }), _jsx(DialogDescription, { children: "This dialog contains structured UI elements." })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Input, { placeholder: "Name", defaultValue: "Jane Doe" }), _jsx(Input, { type: "email", placeholder: "Email", defaultValue: "jane@example.com" })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "ghost", children: "Cancel" }) }), _jsx(Button, { children: "Save" })] })] })] })),
|
|
19
19
|
};
|
|
20
|
+
export const MobileView = {
|
|
21
|
+
globals: {
|
|
22
|
+
viewport: { value: 'mobile' },
|
|
23
|
+
},
|
|
24
|
+
render: () => (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx(Button, { children: "Open dialog" }) }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Mobile Dialog" }), _jsx(DialogDescription, { children: "This dialog is full screen on mobile devices." })] }), _jsx("p", { children: "Resize the viewport to see the responsive behaviour." }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "ghost", children: "Cancel" }) }), _jsx(Button, { children: "Confirm" })] })] })] })),
|
|
25
|
+
};
|
|
@@ -22,12 +22,12 @@ const inputGroupAddonVariants = cva("text-muted-foreground h-auto gap-2 py-1.5 t
|
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
function InputGroupAddon({ className, align = 'inline-start', ...props }) {
|
|
25
|
-
return (_jsx("div", { role: "
|
|
25
|
+
return (_jsx("div", { role: "presentation", "data-slot": "input-group-addon", "data-align": align, className: cn(inputGroupAddonVariants({ align }), className), onClick: (e) => {
|
|
26
26
|
var _a, _b;
|
|
27
27
|
if (e.target.closest('button')) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
(_b = (_a = e.currentTarget.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector('input')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
30
|
+
(_b = (_a = e.currentTarget.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector('[data-slot="input-group-control"]')) === null || _b === void 0 ? void 0 : _b.focus();
|
|
31
31
|
}, ...props }));
|
|
32
32
|
}
|
|
33
33
|
const inputGroupButtonVariants = cva('gap-2 text-sm flex items-center shadow-none', {
|
|
@@ -39,11 +39,12 @@ export const WithInlineStartButton = {
|
|
|
39
39
|
export const WithInlineEndButton = {
|
|
40
40
|
render: () => (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, { placeholder: "Enter text..." }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", children: _jsx(XIcon, {}) }) })] })),
|
|
41
41
|
};
|
|
42
|
+
function WithPasswordStory() {
|
|
43
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
44
|
+
return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, { type: showPassword ? 'text' : 'password', placeholder: "Enter password..." }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", onClick: () => setShowPassword((prev) => !prev), children: showPassword ? _jsx(EyeOffIcon, {}) : _jsx(EyeIcon, {}) }) })] }));
|
|
45
|
+
}
|
|
42
46
|
export const WithPassword = {
|
|
43
|
-
render: () => {
|
|
44
|
-
const [showPassword, setShowPassword] = useState(false);
|
|
45
|
-
return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, { type: showPassword ? 'text' : 'password', placeholder: "Enter password..." }), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", onClick: () => setShowPassword(!showPassword), children: showPassword ? _jsx(EyeOffIcon, {}) : _jsx(EyeIcon, {}) }) })] }));
|
|
46
|
-
},
|
|
47
|
+
render: () => _jsx(WithPasswordStory, {}),
|
|
47
48
|
};
|
|
48
49
|
export const WithMultipleButtons = {
|
|
49
50
|
render: () => (_jsxs(InputGroup, { children: [_jsx(InputGroupAddon, { align: "inline-start", children: _jsx(InputGroupButton, { size: "xs", children: "Copy" }) }), _jsx(InputGroupInput, { placeholder: "Enter value..." }), _jsxs(InputGroupAddon, { align: "inline-end", children: [_jsx(InputGroupButton, { size: "xs", variant: "primary", children: "Save" }), _jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", children: _jsx(XIcon, {}) })] })] })),
|