@skeletonlabs/skeleton-react 1.5.0-next.0 → 2.0.0-next.1
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.css +2 -0
- package/dist/index.d.ts +85 -17
- package/dist/index.js +162 -17
- package/package.json +30 -32
- package/dist/components/Accordion/Accordion.d.ts +0 -7
- package/dist/components/Accordion/Accordion.js +0 -62
- package/dist/components/Accordion/context.d.ts +0 -4
- package/dist/components/Accordion/context.js +0 -10
- package/dist/components/Accordion/types.d.ts +0 -73
- package/dist/components/Accordion/types.js +0 -2
- package/dist/components/AppBar/AppBar.d.ts +0 -9
- package/dist/components/AppBar/AppBar.js +0 -52
- package/dist/components/AppBar/types.d.ts +0 -63
- package/dist/components/AppBar/types.js +0 -1
- package/dist/components/Avatar/Avatar.d.ts +0 -3
- package/dist/components/Avatar/Avatar.js +0 -28
- package/dist/components/Avatar/types.d.ts +0 -36
- package/dist/components/Avatar/types.js +0 -1
- package/dist/components/FileUpload/FileUpload.d.ts +0 -3
- package/dist/components/FileUpload/FileUpload.js +0 -41
- package/dist/components/FileUpload/types.d.ts +0 -73
- package/dist/components/FileUpload/types.js +0 -1
- package/dist/components/Navigation/Navigation.d.ts +0 -10
- package/dist/components/Navigation/Navigation.js +0 -92
- package/dist/components/Navigation/context.d.ts +0 -2
- package/dist/components/Navigation/context.js +0 -7
- package/dist/components/Navigation/types.d.ts +0 -132
- package/dist/components/Navigation/types.js +0 -2
- package/dist/components/Pagination/Pagination.d.ts +0 -3
- package/dist/components/Pagination/Pagination.js +0 -39
- package/dist/components/Pagination/types.d.ts +0 -56
- package/dist/components/Pagination/types.js +0 -1
- package/dist/components/Progress/Progress.d.ts +0 -3
- package/dist/components/Progress/Progress.js +0 -28
- package/dist/components/Progress/types.d.ts +0 -44
- package/dist/components/Progress/types.js +0 -1
- package/dist/components/ProgressRing/ProgressRing.d.ts +0 -3
- package/dist/components/ProgressRing/ProgressRing.js +0 -34
- package/dist/components/ProgressRing/types.d.ts +0 -53
- package/dist/components/ProgressRing/types.js +0 -1
- package/dist/components/Rating/Rating.d.ts +0 -3
- package/dist/components/Rating/Rating.js +0 -50
- package/dist/components/Rating/types.d.ts +0 -36
- package/dist/components/Rating/types.js +0 -1
- package/dist/components/Segment/Segment.d.ts +0 -5
- package/dist/components/Segment/Segment.js +0 -58
- package/dist/components/Segment/context.d.ts +0 -2
- package/dist/components/Segment/context.js +0 -5
- package/dist/components/Segment/types.d.ts +0 -59
- package/dist/components/Segment/types.js +0 -2
- package/dist/components/Slider/Slider.d.ts +0 -3
- package/dist/components/Slider/Slider.js +0 -39
- package/dist/components/Slider/types.d.ts +0 -66
- package/dist/components/Slider/types.js +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -3
- package/dist/components/Switch/Switch.js +0 -40
- package/dist/components/Switch/types.d.ts +0 -62
- package/dist/components/Switch/types.js +0 -1
- package/dist/components/Tabs/Tabs.d.ts +0 -12
- package/dist/components/Tabs/Tabs.js +0 -80
- package/dist/components/Tabs/context.d.ts +0 -2
- package/dist/components/Tabs/context.js +0 -5
- package/dist/components/Tabs/types.d.ts +0 -64
- package/dist/components/Tabs/types.js +0 -1
- package/dist/components/TagsInput/TagsInput.d.ts +0 -3
- package/dist/components/TagsInput/TagsInput.js +0 -39
- package/dist/components/TagsInput/types.d.ts +0 -40
- package/dist/components/TagsInput/types.js +0 -1
- package/dist/components/Toast/Toast.d.ts +0 -2
- package/dist/components/Toast/Toast.js +0 -49
- package/dist/components/Toast/Toaster.d.ts +0 -2
- package/dist/components/Toast/Toaster.js +0 -28
- package/dist/components/Toast/create-toaster.d.ts +0 -2
- package/dist/components/Toast/create-toaster.js +0 -4
- package/dist/components/Toast/types.d.ts +0 -46
- package/dist/components/Toast/types.js +0 -1
- package/dist/composed/accordion/anatomy/accordion-content.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-content.js +0 -15
- package/dist/composed/accordion/anatomy/accordion-heading.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-heading.js +0 -11
- package/dist/composed/accordion/anatomy/accordion-indicator.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-indicator.js +0 -14
- package/dist/composed/accordion/anatomy/accordion-item.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-item.js +0 -16
- package/dist/composed/accordion/anatomy/accordion-root.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-root.js +0 -20
- package/dist/composed/accordion/anatomy/accordion-trigger.d.ts +0 -2
- package/dist/composed/accordion/anatomy/accordion-trigger.js +0 -15
- package/dist/composed/accordion/index.d.ts +0 -2
- package/dist/composed/accordion/index.js +0 -2
- package/dist/composed/accordion/modules/anatomy.d.ts +0 -14
- package/dist/composed/accordion/modules/anatomy.js +0 -14
- package/dist/composed/accordion/modules/context.d.ts +0 -4
- package/dist/composed/accordion/modules/context.js +0 -5
- package/dist/composed/accordion/modules/types.d.ts +0 -28
- package/dist/composed/accordion/modules/types.js +0 -1
- package/dist/composed/avatar/anatomy/avatar-fallback.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-fallback.js +0 -14
- package/dist/composed/avatar/anatomy/avatar-image.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-image.js +0 -14
- package/dist/composed/avatar/anatomy/avatar-root.d.ts +0 -2
- package/dist/composed/avatar/anatomy/avatar-root.js +0 -20
- package/dist/composed/avatar/index.d.ts +0 -2
- package/dist/composed/avatar/index.js +0 -2
- package/dist/composed/avatar/modules/anatomy.d.ts +0 -8
- package/dist/composed/avatar/modules/anatomy.js +0 -8
- package/dist/composed/avatar/modules/context.d.ts +0 -3
- package/dist/composed/avatar/modules/context.js +0 -3
- package/dist/composed/avatar/modules/types.d.ts +0 -13
- package/dist/composed/avatar/modules/types.js +0 -1
- package/dist/composed/index.d.ts +0 -2
- package/dist/composed/index.js +0 -2
- package/dist/internal/props-with-child.d.ts +0 -7
- package/dist/internal/props-with-child.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as zagSwitch from '@zag-js/switch';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type FC } from 'react';
|
|
2
|
-
import type { TabsRootProps, TabsListProps, TabsControlProps, TabsContentProps, TabsPanelProps } from './types.js';
|
|
3
|
-
export declare const Tabs: FC<TabsRootProps> & {
|
|
4
|
-
/** A group of tab controls. */
|
|
5
|
-
List: FC<TabsListProps>;
|
|
6
|
-
/** An individual tab control. */
|
|
7
|
-
Control: FC<TabsControlProps>;
|
|
8
|
-
/** A group of tab panels. */
|
|
9
|
-
Content: FC<TabsContentProps>;
|
|
10
|
-
/** An individual tab panel. */
|
|
11
|
-
Panel: FC<TabsPanelProps>;
|
|
12
|
-
};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useContext, useId } from 'react';
|
|
4
|
-
import * as tabs from '@zag-js/tabs';
|
|
5
|
-
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
6
|
-
import { TabsContext } from './context.js';
|
|
7
|
-
// Components ---
|
|
8
|
-
const TabsRoot = ({ fluid = false,
|
|
9
|
-
// Root
|
|
10
|
-
base = 'w-full', classes = '',
|
|
11
|
-
// Children
|
|
12
|
-
children,
|
|
13
|
-
// Zag
|
|
14
|
-
...zagProps }) => {
|
|
15
|
-
// Zag
|
|
16
|
-
const service = useMachine(tabs.machine, {
|
|
17
|
-
id: useId(),
|
|
18
|
-
...zagProps
|
|
19
|
-
});
|
|
20
|
-
const api = tabs.connect(service, normalizeProps);
|
|
21
|
-
return (_jsx("div", { ...api.getRootProps(), className: `${base} ${classes}`, "data-testid": "tabs", children: _jsx(TabsContext.Provider, { value: { fluid, api }, children: children }) }));
|
|
22
|
-
};
|
|
23
|
-
const TabsList = ({
|
|
24
|
-
// Root
|
|
25
|
-
base = 'flex', justify = 'justify-start', border = 'border-b-[1px] border-surface-200-800', margin = 'mb-4', gap = 'gap-2', classes = '',
|
|
26
|
-
// Children
|
|
27
|
-
children }) => {
|
|
28
|
-
const ctx = useContext(TabsContext);
|
|
29
|
-
return (_jsx("div", { ...ctx.api.getListProps(), className: `${base} ${justify} ${border} ${margin} ${gap} ${classes}`, "data-testid": "tabs-list", children: children }));
|
|
30
|
-
};
|
|
31
|
-
const TabsControl = ({
|
|
32
|
-
// Root
|
|
33
|
-
base = 'border-b-[1px] border-transparent', padding = 'pb-2', translateX = 'translate-y-[1px]', classes = '',
|
|
34
|
-
// Label
|
|
35
|
-
labelBase = 'btn hover:preset-tonal-primary', labelClasses = '',
|
|
36
|
-
// State
|
|
37
|
-
stateInactive = '[&:not(:hover)]:opacity-50', stateActive = 'border-b-surface-950-50 opacity-100', stateLabelInactive = '', stateLabelActive = '',
|
|
38
|
-
// Nodes
|
|
39
|
-
lead,
|
|
40
|
-
// Children
|
|
41
|
-
children,
|
|
42
|
-
// Zag
|
|
43
|
-
...zagProps }) => {
|
|
44
|
-
const ctx = useContext(TabsContext);
|
|
45
|
-
const state = ctx.api.getTriggerState(zagProps);
|
|
46
|
-
// Reactive
|
|
47
|
-
const rxActive = state.selected ? stateActive : stateInactive;
|
|
48
|
-
const rxLabelActive = state.selected ? stateLabelActive : stateLabelInactive;
|
|
49
|
-
// Styles
|
|
50
|
-
const commonStyles = { width: ctx.fluid ? '100%' : '' };
|
|
51
|
-
return (_jsx("button", { ...ctx.api.getTriggerProps(zagProps), className: `${base} ${padding} ${translateX} ${rxActive} ${classes}`, style: commonStyles, "data-testid": "tabs-control", children: _jsxs("div", { className: `${labelBase} ${rxLabelActive} ${labelClasses}`, style: commonStyles, "data-testid": "tabs-control-label", children: [lead && _jsx("span", { "data-testid": "tabs-control-lead", children: lead }), _jsx("span", { "data-testid": "tabs-control-children", children: children })] }) }));
|
|
52
|
-
};
|
|
53
|
-
const TabsContent = ({
|
|
54
|
-
// Root
|
|
55
|
-
base = '', classes = '',
|
|
56
|
-
// Children
|
|
57
|
-
children }) => {
|
|
58
|
-
return (_jsx("div", { className: `${base} ${classes}`, "data-testid": "tabs-content", children: children }));
|
|
59
|
-
};
|
|
60
|
-
const TabsPanel = ({
|
|
61
|
-
// Root
|
|
62
|
-
base = '', classes = '',
|
|
63
|
-
// Children
|
|
64
|
-
children,
|
|
65
|
-
// Zag
|
|
66
|
-
...zagProps }) => {
|
|
67
|
-
const ctx = useContext(TabsContext);
|
|
68
|
-
return (_jsx("div", { ...ctx.api.getContentProps(zagProps), className: `${base} ${classes}`, "data-testid": "tabs-panel", children: children }));
|
|
69
|
-
};
|
|
70
|
-
// Export ---
|
|
71
|
-
export const Tabs = /* @__PURE__ */ Object.assign(TabsRoot, {
|
|
72
|
-
/** A group of tab controls. */
|
|
73
|
-
List: TabsList,
|
|
74
|
-
/** An individual tab control. */
|
|
75
|
-
Control: TabsControl,
|
|
76
|
-
/** A group of tab panels. */
|
|
77
|
-
Content: TabsContent,
|
|
78
|
-
/** An individual tab panel. */
|
|
79
|
-
Panel: TabsPanel
|
|
80
|
-
});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { ReactNode, PropsWithChildren } from 'react';
|
|
2
|
-
import * as tabs from '@zag-js/tabs';
|
|
3
|
-
export interface TabsContextState {
|
|
4
|
-
fluid: boolean;
|
|
5
|
-
api: ReturnType<typeof tabs.connect>;
|
|
6
|
-
}
|
|
7
|
-
export interface TabsRootProps extends PropsWithChildren, Omit<tabs.Props, 'id' | 'orientation'> {
|
|
8
|
-
/** Set tabs to stretch to fill the available width. */
|
|
9
|
-
fluid?: boolean;
|
|
10
|
-
/** Set base classes for the root element. */
|
|
11
|
-
base?: string;
|
|
12
|
-
/** Provide arbitrary classes for the root element. */
|
|
13
|
-
classes?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface TabsListProps extends PropsWithChildren {
|
|
16
|
-
/** Set base classes for the list element. */
|
|
17
|
-
base?: string;
|
|
18
|
-
/** Set justify classes for the list element. */
|
|
19
|
-
justify?: string;
|
|
20
|
-
/** Set border classes for the list element. */
|
|
21
|
-
border?: string;
|
|
22
|
-
/** Set margin classes for the list element. */
|
|
23
|
-
margin?: string;
|
|
24
|
-
/** Set gap classes for the list element. */
|
|
25
|
-
gap?: string;
|
|
26
|
-
/** Provide arbitrary classes for the list element. */
|
|
27
|
-
classes?: string;
|
|
28
|
-
}
|
|
29
|
-
export interface TabsControlProps extends PropsWithChildren, tabs.TriggerProps {
|
|
30
|
-
/** Set base classes for the control element. */
|
|
31
|
-
base?: string;
|
|
32
|
-
/** Set padding classes for the control element. */
|
|
33
|
-
padding?: string;
|
|
34
|
-
/** Set x-axis translate classes for the control element. */
|
|
35
|
-
translateX?: string;
|
|
36
|
-
/** Provide arbitrary classes for the control element. */
|
|
37
|
-
classes?: string;
|
|
38
|
-
/** Set base classes for the label element. */
|
|
39
|
-
labelBase?: string;
|
|
40
|
-
/** Provide arbitrary classes for the label element. */
|
|
41
|
-
labelClasses?: string;
|
|
42
|
-
/** Set inactive classes for the control element. */
|
|
43
|
-
stateInactive?: string;
|
|
44
|
-
/** Set active classes for the control element. */
|
|
45
|
-
stateActive?: string;
|
|
46
|
-
/** Set inactive classes for the label element. */
|
|
47
|
-
stateLabelInactive?: string;
|
|
48
|
-
/** Set active classes for the label element. */
|
|
49
|
-
stateLabelActive?: string;
|
|
50
|
-
/** The lead node for the control element. */
|
|
51
|
-
lead?: ReactNode;
|
|
52
|
-
}
|
|
53
|
-
export interface TabsContentProps extends PropsWithChildren {
|
|
54
|
-
/** Set base classes for the panel group element. */
|
|
55
|
-
base?: string;
|
|
56
|
-
/** Provide arbitrary classes for the panel group element. */
|
|
57
|
-
classes?: string;
|
|
58
|
-
}
|
|
59
|
-
export interface TabsPanelProps extends PropsWithChildren, tabs.ContentProps {
|
|
60
|
-
/** Set base classes for the panel element. */
|
|
61
|
-
base?: string;
|
|
62
|
-
/** Provide arbitrary classes for the panel element. */
|
|
63
|
-
classes?: string;
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as tabs from '@zag-js/tabs';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
5
|
-
import { useMachine, normalizeProps } from '@zag-js/react';
|
|
6
|
-
export const TagsInput = ({ placeholder = '',
|
|
7
|
-
// Root
|
|
8
|
-
base = 'grid input !h-auto', gap = 'gap-2', padding = 'p-3', classes = '',
|
|
9
|
-
// Input: Add
|
|
10
|
-
inputBase = 'input-ghost', inputClasses = '',
|
|
11
|
-
// Tag List
|
|
12
|
-
tagListBase = 'flex flex-wrap gap-1', tagListClasses = '',
|
|
13
|
-
// Tag
|
|
14
|
-
tagBase = 'chip', tagBackground = 'preset-filled', tagClasses = '',
|
|
15
|
-
// Input: Edit
|
|
16
|
-
tagEditInputBase = 'input', tagEditInputClasses = '',
|
|
17
|
-
// Delete Button
|
|
18
|
-
buttonDeleteBase = '', buttonDeleteClasses = '',
|
|
19
|
-
// Snippets
|
|
20
|
-
buttonDelete,
|
|
21
|
-
// State
|
|
22
|
-
stateDisabled = '',
|
|
23
|
-
// Zag
|
|
24
|
-
...zagProps }) => {
|
|
25
|
-
// Zag
|
|
26
|
-
const service = useMachine(tagsInput.machine, {
|
|
27
|
-
id: useId(),
|
|
28
|
-
...zagProps
|
|
29
|
-
});
|
|
30
|
-
const api = tagsInput.connect(service, normalizeProps);
|
|
31
|
-
// Reactive
|
|
32
|
-
const rxDisabled = service.prop('disabled') ? stateDisabled : '';
|
|
33
|
-
return (_jsxs("div", { ...api.getRootProps(), className: `${base} ${padding} ${gap} ${rxDisabled} ${classes}`, "data-testid": "tags", children: [_jsx("input", { ...api.getInputProps(), placeholder: placeholder, className: `${inputBase} ${inputClasses}`, "data-testid": "tags-input-add" }), _jsx("input", { ...api.getHiddenInputProps(), "data-testid": "tags-input" }), api.value.length > 0 && (_jsx("div", { className: `${tagListBase} ${tagListClasses}`, "data-testid": "tags-list", children: api.value.map((value, index) => {
|
|
34
|
-
const itemState = api.getItemState({ index, value });
|
|
35
|
-
return (
|
|
36
|
-
// Tag
|
|
37
|
-
_jsxs("div", { className: "contents", ...api.getItemProps({ value, index }), "data-testid": "tags-tag", children: [_jsxs("div", { ...api.getItemPreviewProps({ index, value }), className: `${tagBase} ${tagBackground} ${tagClasses}`, style: { display: itemState.editing ? 'none' : '' }, "data-testid": "tag-display", children: [_jsx("span", { children: value }), _jsx("button", { ...api.getItemDeleteTriggerProps({ index, value }), className: `${buttonDeleteBase} ${buttonDeleteClasses}`, "data-testid": "tag-delete", children: buttonDelete ?? _jsx("strong", { children: "\u00D7" }) })] }), _jsx("input", { ...api.getItemInputProps({ index, value }), className: `${tagEditInputBase} ${tagEditInputClasses}`, style: { display: itemState.editing ? '' : 'none' }, "data-testid": "tags-input-edit" })] }, value));
|
|
38
|
-
}) }))] }));
|
|
39
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
3
|
-
export interface TagsInputProps extends Omit<tagsInput.Props, 'id'> {
|
|
4
|
-
/** Set the add tag input placeholder. */
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
/** Set base classes for the root. */
|
|
7
|
-
base?: string;
|
|
8
|
-
/** Set gap classes for the root. */
|
|
9
|
-
gap?: string;
|
|
10
|
-
/** Set padding classes for the root. */
|
|
11
|
-
padding?: string;
|
|
12
|
-
/** Provide arbitrary classes to the root. */
|
|
13
|
-
classes?: string;
|
|
14
|
-
/** Set base classes for the add tag input. */
|
|
15
|
-
inputBase?: string;
|
|
16
|
-
/** Provide arbitrary classes to the add tag input. */
|
|
17
|
-
inputClasses?: string;
|
|
18
|
-
/** Set base classes for the tag list. */
|
|
19
|
-
tagListBase?: string;
|
|
20
|
-
/** Provide arbitrary classes to the tag list. */
|
|
21
|
-
tagListClasses?: string;
|
|
22
|
-
/** Set base classes for each tag. */
|
|
23
|
-
tagBase?: string;
|
|
24
|
-
/** Set background classes for each tag. */
|
|
25
|
-
tagBackground?: string;
|
|
26
|
-
/** Provide arbitrary classes to each tag. */
|
|
27
|
-
tagClasses?: string;
|
|
28
|
-
/** Set base classes for the edit tag input. */
|
|
29
|
-
tagEditInputBase?: string;
|
|
30
|
-
/** Provide arbitrary classes to the edit tag input. */
|
|
31
|
-
tagEditInputClasses?: string;
|
|
32
|
-
/** Set base classes for the delete button. */
|
|
33
|
-
buttonDeleteBase?: string;
|
|
34
|
-
/** Provide arbitrary classes to the delete button. */
|
|
35
|
-
buttonDeleteClasses?: string;
|
|
36
|
-
/** The delete button label snippet. */
|
|
37
|
-
buttonDelete?: ReactNode;
|
|
38
|
-
/** Set the component disabled state. */
|
|
39
|
-
stateDisabled?: string;
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as tagsInput from '@zag-js/tags-input';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import * as toast from '@zag-js/toast';
|
|
4
|
-
import { normalizeProps, useMachine } from '@zag-js/react';
|
|
5
|
-
export function Toast(props) {
|
|
6
|
-
const service = useMachine(toast.machine, {
|
|
7
|
-
...props.toast,
|
|
8
|
-
parent: props.parent
|
|
9
|
-
});
|
|
10
|
-
const api = toast.connect(service, normalizeProps);
|
|
11
|
-
function getStateClasses() {
|
|
12
|
-
switch (api.type) {
|
|
13
|
-
case 'success':
|
|
14
|
-
return props.stateSuccess;
|
|
15
|
-
case 'warning':
|
|
16
|
-
return props.stateWarning;
|
|
17
|
-
case 'error':
|
|
18
|
-
return props.stateError;
|
|
19
|
-
default:
|
|
20
|
-
return props.stateInfo;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: `${props.base} ${props.width} ${props.padding} ${props.rounded} ${getStateClasses()} ${props.classes}`, ...api.getRootProps(), "data-testid": "toast-root", children: [_jsxs("div", { className: `${props.messageBase} ${props.messageClasses}`, "data-testid": "toast-message", children: [_jsx("span", { className: `${props.titleBase} ${props.titleClasses}`, ...api.getTitleProps(), "data-testid": "toast-title", children: api.title }), _jsx("span", { className: `${props.descriptionBase} ${props.descriptionClasses}`, ...api.getDescriptionProps(), "data-testid": "toast-description", children: api.description })] }), api.closable && (
|
|
24
|
-
// Dismiss Button
|
|
25
|
-
_jsx("button", { className: `${props.btnDismissBase} ${props.btnDismissClasses}`, title: props.btnDismissTitle, "aria-label": props.btnDismissAriaLabel, onClick: api.dismiss, "data-testid": "toast-dismiss", children: "\u00D7" }))] }), _jsx("style", { children: `
|
|
26
|
-
[data-part='root'] {
|
|
27
|
-
translate: var(--x) var(--y);
|
|
28
|
-
scale: var(--scale);
|
|
29
|
-
z-index: var(--z-index);
|
|
30
|
-
height: var(--height);
|
|
31
|
-
opacity: var(--opacity);
|
|
32
|
-
will-change: translate, opacity, scale;
|
|
33
|
-
}
|
|
34
|
-
[data-part='root'] {
|
|
35
|
-
transition:
|
|
36
|
-
translate 400ms,
|
|
37
|
-
scale 400ms,
|
|
38
|
-
opacity 400ms;
|
|
39
|
-
transition-timing-function: cubic-bezier(0.21, 1.02, 0.73, 1);
|
|
40
|
-
}
|
|
41
|
-
[data-part='root'][data-state='closed'] {
|
|
42
|
-
transition:
|
|
43
|
-
translate 400ms,
|
|
44
|
-
scale 400ms,
|
|
45
|
-
opacity 200ms;
|
|
46
|
-
transition-timing-function: cubic-bezier(0.06, 0.71, 0.55, 1);
|
|
47
|
-
}
|
|
48
|
-
` })] }));
|
|
49
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { ToasterProps } from './types.js';
|
|
2
|
-
export declare function Toaster({ toaster, base, width, padding, rounded, classes, messageBase, messageClasses, titleBase, titleClasses, descriptionBase, descriptionClasses, btnDismissBase, btnDismissClasses, btnDismissTitle, btnDismissAriaLabel, stateInfo, stateSuccess, stateWarning, stateError }: ToasterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as toast from '@zag-js/toast';
|
|
4
|
-
import { Toast } from './Toast.js';
|
|
5
|
-
import { useId } from 'react';
|
|
6
|
-
import { normalizeProps, useMachine } from '@zag-js/react';
|
|
7
|
-
export function Toaster({
|
|
8
|
-
// Toaster
|
|
9
|
-
toaster,
|
|
10
|
-
// Toast
|
|
11
|
-
base = 'flex justify-between items-center gap-3', width = 'min-w-xs', padding = 'p-3', rounded = 'rounded-container', classes = '',
|
|
12
|
-
// Message
|
|
13
|
-
messageBase = 'grid', messageClasses = '',
|
|
14
|
-
// Title
|
|
15
|
-
titleBase = 'font-semibold', titleClasses = '',
|
|
16
|
-
// Description
|
|
17
|
-
descriptionBase = 'text-sm', descriptionClasses = '',
|
|
18
|
-
// Dismiss Button
|
|
19
|
-
btnDismissBase = 'btn-icon hover:preset-tonal', btnDismissClasses = '', btnDismissTitle = 'Dismiss', btnDismissAriaLabel = 'Dismiss',
|
|
20
|
-
// State
|
|
21
|
-
stateInfo = 'preset-outlined-surface-200-800 preset-filled-surface-50-950', stateSuccess = 'preset-filled-success-500', stateWarning = 'preset-filled-warning-500', stateError = 'preset-filled-error-500' }) {
|
|
22
|
-
const service = useMachine(toast.group.machine, {
|
|
23
|
-
id: useId(),
|
|
24
|
-
store: toaster
|
|
25
|
-
});
|
|
26
|
-
const api = toast.group.connect(service, normalizeProps);
|
|
27
|
-
return (_jsx("div", { ...api.getGroupProps(), "data-testid": "toaster-root", children: api.getToasts().map((toast) => (_jsx(Toast, { base: base, width: width, padding: padding, rounded: rounded, classes: classes, messageBase: messageBase, messageClasses: messageClasses, titleBase: titleBase, titleClasses: titleClasses, descriptionBase: descriptionBase, descriptionClasses: descriptionClasses, btnDismissBase: btnDismissBase, btnDismissClasses: btnDismissClasses, btnDismissTitle: btnDismissTitle, btnDismissAriaLabel: btnDismissAriaLabel, stateInfo: stateInfo, stateError: stateError, stateWarning: stateWarning, stateSuccess: stateSuccess, toast: toast, parent: service }, toast.id))) }));
|
|
28
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as toast from '@zag-js/toast';
|
|
2
|
-
export interface ToasterProps {
|
|
3
|
-
toaster: toast.Store;
|
|
4
|
-
/** Provide base classes for the root element. */
|
|
5
|
-
base?: string;
|
|
6
|
-
/** Provide width classes for the root element. */
|
|
7
|
-
width?: string;
|
|
8
|
-
/** Provide padding classes for the root element. */
|
|
9
|
-
padding?: string;
|
|
10
|
-
/** Provide border radius classes for the root element. */
|
|
11
|
-
rounded?: string;
|
|
12
|
-
/** Provide arbitrary classes for the toast cards. */
|
|
13
|
-
classes?: string;
|
|
14
|
-
/** Provide base classes for the message. */
|
|
15
|
-
messageBase?: string;
|
|
16
|
-
/** Provide classes for the message. */
|
|
17
|
-
messageClasses?: string;
|
|
18
|
-
/** Provide base classes for the title. */
|
|
19
|
-
titleBase?: string;
|
|
20
|
-
/** Provide classes for the title. */
|
|
21
|
-
titleClasses?: string;
|
|
22
|
-
/** Provide base classes for the description. */
|
|
23
|
-
descriptionBase?: string;
|
|
24
|
-
/** Provide classes for the description. */
|
|
25
|
-
descriptionClasses?: string;
|
|
26
|
-
/** Provide base classes for the dismiss button. */
|
|
27
|
-
btnDismissBase?: string;
|
|
28
|
-
/** Provide arbitrary classes for the dismiss button. */
|
|
29
|
-
btnDismissClasses?: string;
|
|
30
|
-
/** Provide the title attribute for the dismiss button. */
|
|
31
|
-
btnDismissTitle?: string;
|
|
32
|
-
/** Provide the aria-label attribute for the dismiss button. */
|
|
33
|
-
btnDismissAriaLabel?: string;
|
|
34
|
-
/** Provide base classes for info toasts. */
|
|
35
|
-
stateInfo?: string;
|
|
36
|
-
/** Provide base classes for success toasts. */
|
|
37
|
-
stateSuccess?: string;
|
|
38
|
-
/** Provide base classes for warning toasts. */
|
|
39
|
-
stateWarning?: string;
|
|
40
|
-
/** Provide base classes for error toasts. */
|
|
41
|
-
stateError?: string;
|
|
42
|
-
}
|
|
43
|
-
export interface ToastProps extends Omit<ToasterProps, 'toaster'> {
|
|
44
|
-
toast: toast.Options;
|
|
45
|
-
parent: toast.GroupService;
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as toast from '@zag-js/toast';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { mergeProps } from '@zag-js/react';
|
|
5
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
6
|
-
import { AccordionRootContext, AccordionItemContext } from '../modules/context.js';
|
|
7
|
-
export default function (props) {
|
|
8
|
-
const rootContext = useContext(AccordionRootContext);
|
|
9
|
-
const itemContext = useContext(AccordionItemContext);
|
|
10
|
-
const { element, children, ...restAttributes } = props;
|
|
11
|
-
const attributes = mergeProps(rootContext.api.getItemContentProps(itemContext.itemProps), {
|
|
12
|
-
className: classesAccordion.content
|
|
13
|
-
}, restAttributes);
|
|
14
|
-
return element ? element({ attributes }) : _jsx("div", { ...attributes, children: children });
|
|
15
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { mergeProps } from '@zag-js/react';
|
|
3
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
4
|
-
export default function (props) {
|
|
5
|
-
const { level = 3, element, children, ...restAttributes } = props;
|
|
6
|
-
const Tag = `h${level}`;
|
|
7
|
-
const attributes = mergeProps({
|
|
8
|
-
className: classesAccordion.heading
|
|
9
|
-
}, restAttributes);
|
|
10
|
-
return element ? element({ attributes }) : _jsx(Tag, { ...attributes, children: children });
|
|
11
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { mergeProps } from '@zag-js/react';
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
5
|
-
import { AccordionRootContext, AccordionItemContext } from '../modules/context.js';
|
|
6
|
-
export default function (props) {
|
|
7
|
-
const rootContext = useContext(AccordionRootContext);
|
|
8
|
-
const itemContext = useContext(AccordionItemContext);
|
|
9
|
-
const { element, children, ...restAttributes } = props;
|
|
10
|
-
const attributes = mergeProps(rootContext.api.getItemIndicatorProps(itemContext.itemProps), {
|
|
11
|
-
class: classesAccordion.indicator
|
|
12
|
-
}, restAttributes);
|
|
13
|
-
return element ? element({ attributes }) : _jsx("div", { ...attributes, children: children });
|
|
14
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import * as accordion from '@zag-js/accordion';
|
|
5
|
-
import { mergeProps } from '@zag-js/react';
|
|
6
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
7
|
-
import { AccordionRootContext, AccordionItemContext } from '../modules/context.js';
|
|
8
|
-
export default function (props) {
|
|
9
|
-
const rootContext = useContext(AccordionRootContext);
|
|
10
|
-
const [itemProps, componentProps] = accordion.splitItemProps(props);
|
|
11
|
-
const { element, children, ...restAttributes } = componentProps;
|
|
12
|
-
const attributes = mergeProps(rootContext.api.getItemProps(itemProps), {
|
|
13
|
-
class: classesAccordion.item
|
|
14
|
-
}, restAttributes);
|
|
15
|
-
return (_jsx(AccordionItemContext.Provider, { value: { itemProps }, children: element ? element({ attributes }) : _jsx("div", { ...attributes, children: children }) }));
|
|
16
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useId } from 'react';
|
|
4
|
-
import * as accordion from '@zag-js/accordion';
|
|
5
|
-
import { useMachine, normalizeProps, mergeProps } from '@zag-js/react';
|
|
6
|
-
import { AccordionRootContext } from '../modules/context.js';
|
|
7
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
8
|
-
export default function (props) {
|
|
9
|
-
const [machineProps, componentProps] = accordion.splitProps(props);
|
|
10
|
-
const { element, children, ...restAttributes } = componentProps;
|
|
11
|
-
const service = useMachine(accordion.machine, {
|
|
12
|
-
id: useId(),
|
|
13
|
-
...machineProps
|
|
14
|
-
});
|
|
15
|
-
const api = accordion.connect(service, normalizeProps);
|
|
16
|
-
const attributes = mergeProps(api.getRootProps(), {
|
|
17
|
-
className: classesAccordion.root
|
|
18
|
-
}, restAttributes);
|
|
19
|
-
return (_jsx(AccordionRootContext.Provider, { value: { api }, children: element ? element({ attributes }) : _jsx("div", { ...attributes, children: children }) }));
|
|
20
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useContext } from 'react';
|
|
4
|
-
import { mergeProps } from '@zag-js/react';
|
|
5
|
-
import { AccordionRootContext, AccordionItemContext } from '../modules/context.js';
|
|
6
|
-
import { classesAccordion } from '@skeletonlabs/skeleton-common';
|
|
7
|
-
export default function (props) {
|
|
8
|
-
const rootContext = useContext(AccordionRootContext);
|
|
9
|
-
const itemContext = useContext(AccordionItemContext);
|
|
10
|
-
const { element, children, ...restAttributes } = props;
|
|
11
|
-
const attributes = mergeProps(rootContext.api.getItemTriggerProps(itemContext.itemProps), {
|
|
12
|
-
className: classesAccordion.trigger
|
|
13
|
-
}, restAttributes);
|
|
14
|
-
return element ? element({ attributes }) : _jsx("button", { ...attributes, children: children });
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import AccordionRoot from '../anatomy/accordion-root.js';
|
|
2
|
-
import AccordionItem from '../anatomy/accordion-item.js';
|
|
3
|
-
import AccordionHeading from '../anatomy/accordion-heading.js';
|
|
4
|
-
import AccordionTrigger from '../anatomy/accordion-trigger.js';
|
|
5
|
-
import AccordionIndicator from '../anatomy/accordion-indicator.js';
|
|
6
|
-
import AccordionContent from '../anatomy/accordion-content.js';
|
|
7
|
-
declare const Accordion: typeof AccordionRoot & {
|
|
8
|
-
Item: typeof AccordionItem;
|
|
9
|
-
Heading: typeof AccordionHeading;
|
|
10
|
-
Trigger: typeof AccordionTrigger;
|
|
11
|
-
Indicator: typeof AccordionIndicator;
|
|
12
|
-
Content: typeof AccordionContent;
|
|
13
|
-
};
|
|
14
|
-
export { Accordion };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import AccordionRoot from '../anatomy/accordion-root.js';
|
|
2
|
-
import AccordionItem from '../anatomy/accordion-item.js';
|
|
3
|
-
import AccordionHeading from '../anatomy/accordion-heading.js';
|
|
4
|
-
import AccordionTrigger from '../anatomy/accordion-trigger.js';
|
|
5
|
-
import AccordionIndicator from '../anatomy/accordion-indicator.js';
|
|
6
|
-
import AccordionContent from '../anatomy/accordion-content.js';
|
|
7
|
-
const Accordion = Object.assign(AccordionRoot, {
|
|
8
|
-
Item: AccordionItem,
|
|
9
|
-
Heading: AccordionHeading,
|
|
10
|
-
Trigger: AccordionTrigger,
|
|
11
|
-
Indicator: AccordionIndicator,
|
|
12
|
-
Content: AccordionContent
|
|
13
|
-
});
|
|
14
|
-
export { Accordion };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { AccordionContext as AccordionRootContextType, AccordionItemContext as AccordionItemContextType } from './types.js';
|
|
2
|
-
declare const AccordionRootContext: import("react").Context<AccordionRootContextType>;
|
|
3
|
-
declare const AccordionItemContext: import("react").Context<AccordionItemContextType>;
|
|
4
|
-
export { AccordionRootContext, AccordionItemContext };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as accordion from '@zag-js/accordion';
|
|
2
|
-
import type { PropsWithChildren, ComponentProps } from 'react';
|
|
3
|
-
import type { PropsWithElement } from '../../../internal/props-with-child.js';
|
|
4
|
-
interface AccordionRootProps extends PropsWithChildren, PropsWithElement, Omit<accordion.Props, 'id'>, Omit<ComponentProps<'div'>, 'id' | 'defaultValue' | 'dir'> {
|
|
5
|
-
}
|
|
6
|
-
interface AccordionItemProps extends PropsWithChildren, PropsWithElement, accordion.ItemProps, ComponentProps<'div'> {
|
|
7
|
-
}
|
|
8
|
-
interface AccordionTriggerProps extends PropsWithChildren, PropsWithElement, ComponentProps<'button'> {
|
|
9
|
-
}
|
|
10
|
-
interface AccordionHeadingProps extends PropsWithChildren, PropsWithElement, ComponentProps<'h3'> {
|
|
11
|
-
/**
|
|
12
|
-
* The level of the heading. This is used to determine the heading level for accessibility purposes.
|
|
13
|
-
*
|
|
14
|
-
* @defaultValue 3
|
|
15
|
-
*/
|
|
16
|
-
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
17
|
-
}
|
|
18
|
-
interface AccordionIndicatorProps extends PropsWithChildren, PropsWithElement, ComponentProps<'div'> {
|
|
19
|
-
}
|
|
20
|
-
interface AccordionContentProps extends PropsWithChildren, PropsWithElement, ComponentProps<'div'> {
|
|
21
|
-
}
|
|
22
|
-
interface AccordionContext {
|
|
23
|
-
api: accordion.Api;
|
|
24
|
-
}
|
|
25
|
-
interface AccordionItemContext {
|
|
26
|
-
itemProps: accordion.ItemProps;
|
|
27
|
-
}
|
|
28
|
-
export type { AccordionRootProps, AccordionItemProps, AccordionTriggerProps, AccordionHeadingProps, AccordionIndicatorProps, AccordionContentProps, AccordionContext, AccordionItemContext };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import * as accordion from '@zag-js/accordion';
|