@central-ui/react 0.2.0 → 0.4.0
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/components/accordion/index.d.ts +14 -14
- package/dist/components/accordion/index.js +19 -19
- package/dist/components/autocomplete/index.d.ts +57 -49
- package/dist/components/autocomplete/index.js +69 -60
- package/dist/components/avatar/index.d.ts +7 -6
- package/dist/components/avatar/index.js +9 -9
- package/dist/components/banner/index.js +1 -1
- package/dist/components/carousel/index.d.ts +189 -0
- package/dist/components/carousel/index.js +303 -0
- package/dist/components/checkbox/index.d.ts +12 -11
- package/dist/components/checkbox/index.js +21 -21
- package/dist/components/combobox/index.d.ts +67 -71
- package/dist/components/combobox/index.js +80 -72
- package/dist/components/datepicker/index.d.ts +8 -9
- package/dist/components/datepicker/index.js +13 -13
- package/dist/components/dialog/index.d.ts +18 -18
- package/dist/components/dialog/index.js +22 -21
- package/dist/components/drawer/index.d.ts +24 -24
- package/dist/components/drawer/index.js +28 -27
- package/dist/components/empty/index.d.ts +2 -1
- package/dist/components/empty/index.js +2 -1
- package/dist/components/exception/index.d.ts +98 -0
- package/dist/components/exception/index.js +116 -0
- package/dist/components/fileupload/index.d.ts +8 -8
- package/dist/components/input/index.d.ts +14 -14
- package/dist/components/input/index.js +27 -27
- package/dist/components/menu/index.d.ts +37 -37
- package/dist/components/menu/index.js +47 -47
- package/dist/components/numberinput/index.d.ts +22 -22
- package/dist/components/numberinput/index.js +35 -35
- package/dist/components/otpinput/index.d.ts +12 -12
- package/dist/components/otpinput/index.js +21 -21
- package/dist/components/passwordinput/index.d.ts +15 -15
- package/dist/components/passwordinput/index.js +27 -27
- package/dist/components/popover/index.d.ts +16 -16
- package/dist/components/popover/index.js +20 -19
- package/dist/components/radio/index.d.ts +12 -12
- package/dist/components/radio/index.js +25 -25
- package/dist/components/ratinginput/index.d.ts +1 -1
- package/dist/components/ratinginput/index.js +3 -3
- package/dist/components/select/index.d.ts +32 -29
- package/dist/components/select/index.js +45 -35
- package/dist/components/slider/index.d.ts +20 -20
- package/dist/components/slider/index.js +27 -27
- package/dist/components/stepper/index.d.ts +8 -7
- package/dist/components/stepper/index.js +4 -2
- package/dist/components/switch/index.d.ts +9 -9
- package/dist/components/switch/index.js +17 -17
- package/dist/components/table/index.d.ts +2 -2
- package/dist/components/table/index.js +16 -16
- package/dist/components/tabs/index.d.ts +10 -10
- package/dist/components/tabs/index.js +11 -11
- package/dist/components/textarea/index.d.ts +13 -13
- package/dist/components/textarea/index.js +25 -25
- package/dist/components/toast/index.d.ts +11 -11
- package/dist/components/toast/index.js +11 -11
- package/dist/components/toggle/index.d.ts +7 -7
- package/dist/components/toggle/index.js +9 -9
- package/dist/components/tooltip/index.d.ts +6 -6
- package/dist/components/tooltip/index.js +6 -7
- package/dist/components/tour/index.d.ts +2 -2
- package/dist/components/tour/index.js +5 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/utils/icons.d.ts +92 -23
- package/dist/utils/icons.js +3 -3
- package/package.json +69 -67
- package/src/presets/shopify-polaris/shopify-polaris-accordion.css +28 -28
- package/src/presets/shopify-polaris/shopify-polaris-carousel.css +62 -0
- package/src/presets/shopify-polaris/shopify-polaris-exception.css +40 -0
- package/src/presets/shopify-polaris/shopify-polaris.css +2 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-accordion.css +28 -28
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-carousel.css +55 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy-exception.css +40 -0
- package/src/presets/shopify-polaris-legacy/shopify-polaris-legacy.css +2 -0
- package/dist/types/Tone.d.ts +0 -3
- package/dist/types/Tone.js +0 -1
- package/dist/utils/Tone.d.ts +0 -2
- package/dist/utils/Tone.js +0 -6
|
@@ -3,7 +3,7 @@ import { Input as BaseInput } from '@base-ui/react/input';
|
|
|
3
3
|
import { LoaderCircle } from "../../utils/icons.js";
|
|
4
4
|
import { useRef } from 'react';
|
|
5
5
|
import { useForwardClickToInput } from "../../utils/useForwardClickToInput.js";
|
|
6
|
-
import { cloneElement, createContext,
|
|
6
|
+
import { cloneElement, createContext, useContext, useEffect, useId, useState, } from 'react';
|
|
7
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
8
|
import { readValidation, validationAttributes, validationMessageContent } from "../../utils/Validation.js";
|
|
9
9
|
/**
|
|
@@ -60,7 +60,7 @@ export function Root({ children, id, validation, value, defaultValue, onValueCha
|
|
|
60
60
|
validation: readValidation(validation),
|
|
61
61
|
}, children: children }));
|
|
62
62
|
}
|
|
63
|
-
export
|
|
63
|
+
export function Textarea({ disableStyle, className, 'aria-describedby': describedBy, ref, ...props }) {
|
|
64
64
|
const context = useInputContext();
|
|
65
65
|
const inputRef = useRef(null);
|
|
66
66
|
// Resetting the internal value when the surrounding html form resets, since the control is always controlled by Root's value
|
|
@@ -90,58 +90,58 @@ export const Textarea = /* @__PURE__ */ forwardRef(function Textarea({ disableSt
|
|
|
90
90
|
if (!details.isCanceled && !context.controlled)
|
|
91
91
|
context.setValueInternalState(nextValue);
|
|
92
92
|
}, "data-component": "textarea-textarea", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
93
|
-
}
|
|
94
|
-
export
|
|
93
|
+
}
|
|
94
|
+
export function TextareaGroup({ disableStyle, className, onClick, ref, ...props }) {
|
|
95
95
|
const attributes = usePartAttributes();
|
|
96
96
|
const forwardClick = useForwardClickToInput('textarea', onClick);
|
|
97
97
|
return (_jsx("div", { ...attributes, ...props, ref: ref, onClick: forwardClick, "data-component": "textarea-textareagroup", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
98
|
-
}
|
|
99
|
-
export
|
|
98
|
+
}
|
|
99
|
+
export function Container({ disableStyle, className, ref, ...props }) {
|
|
100
100
|
const attributes = usePartAttributes();
|
|
101
101
|
return (_jsx("div", { ...attributes, ...props, ref: ref, "data-component": "textarea-container", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
/** Labels the associated control automatically. Supply the visible text; do not wire a second label association. */
|
|
104
|
-
export
|
|
104
|
+
export function Label({ disableStyle, className, id, ref, ...props }) {
|
|
105
105
|
const context = useInputContext();
|
|
106
106
|
const labelId = id ?? context.inputId + '-label';
|
|
107
107
|
const attributes = usePartAttributes();
|
|
108
108
|
return (_jsx("label", { ...attributes, ...props, id: labelId, ref: ref, htmlFor: context.inputId, "data-component": "textarea-label", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
109
|
-
}
|
|
110
|
-
export
|
|
109
|
+
}
|
|
110
|
+
export function Description({ disableStyle, className, id, ref, ...props }) {
|
|
111
111
|
const messageId = useMessageId(id);
|
|
112
112
|
const attributes = usePartAttributes();
|
|
113
113
|
return (_jsx("div", { ...attributes, ...props, id: messageId, ref: ref, "data-component": "textarea-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
114
|
-
}
|
|
114
|
+
}
|
|
115
115
|
/** Shows itself only while Root's validation is `'error'`: with no children it shows the message from `['error', message]`, a function children formats that message, and other children replace it. */
|
|
116
|
-
export
|
|
116
|
+
export function Error({ children, ref, ...props }) {
|
|
117
117
|
const context = useInputContext();
|
|
118
118
|
const content = validationMessageContent(context.validation, 'error', children);
|
|
119
119
|
if (content === undefined)
|
|
120
120
|
return null;
|
|
121
121
|
return _jsx(Message, { ...props, ref: ref, role: "alert", component: "textarea-error", children: content });
|
|
122
|
-
}
|
|
122
|
+
}
|
|
123
123
|
/** Shows itself only while Root's validation is `'success'`: with no children it shows the message from `['success', message]`, a function children formats that message, and other children replace it. */
|
|
124
|
-
export
|
|
124
|
+
export function Success({ children, ref, ...props }) {
|
|
125
125
|
const context = useInputContext();
|
|
126
126
|
const content = validationMessageContent(context.validation, 'success', children);
|
|
127
127
|
if (content === undefined)
|
|
128
128
|
return null;
|
|
129
129
|
return _jsx(Message, { ...props, ref: ref, role: "status", component: "textarea-success", children: content });
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
131
|
// The shared body of Error and Success, mounted only while they show, so only visible messages describe the textarea
|
|
132
|
-
|
|
132
|
+
function Message({ disableStyle, className, id, component, ref, ...props }) {
|
|
133
133
|
const messageId = useMessageId(id);
|
|
134
134
|
const attributes = usePartAttributes();
|
|
135
135
|
return _jsx("div", { "aria-atomic": "true", ...attributes, ...props, id: messageId, ref: ref, "data-component": component, "data-style-disabled": disableStyle ? '' : undefined, className: className });
|
|
136
|
-
}
|
|
137
|
-
export
|
|
136
|
+
}
|
|
137
|
+
export function Addon({ disableStyle, className, variant = 'normal', ref, ...props }) {
|
|
138
138
|
const attributes = usePartAttributes();
|
|
139
139
|
return (_jsx("div", { ...attributes, ...props, ref: ref, "data-variant": variant, "data-component": "textarea-addon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
140
|
-
}
|
|
141
|
-
export
|
|
140
|
+
}
|
|
141
|
+
export function AddonText({ disableStyle, className, ref, ...props }) {
|
|
142
142
|
const attributes = usePartAttributes();
|
|
143
143
|
return (_jsx("span", { ...attributes, ...props, ref: ref, "data-component": "textarea-addontext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
144
|
-
}
|
|
144
|
+
}
|
|
145
145
|
/** Supply the decorative icon as a child. Its classes are preserved; interaction belongs to the surrounding control. */
|
|
146
146
|
export function AddonIcon({ disableStyle, children, className, ...props }) {
|
|
147
147
|
const attributes = usePartAttributes();
|
|
@@ -157,16 +157,16 @@ export function AddonIcon({ disableStyle, children, className, ...props }) {
|
|
|
157
157
|
className: twMerge(children.props.className, className),
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
export
|
|
160
|
+
export function AddonButton({ disableStyle, className, disabled, type = 'button', ref, ...props }) {
|
|
161
161
|
const context = useInputContext();
|
|
162
162
|
const attributes = usePartAttributes();
|
|
163
163
|
return (_jsx("button", { ...attributes, ...props, ref: ref, type: type, disabled: disabled || context.disabled || context.readOnly, "data-component": "textarea-addonbutton", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
164
|
-
}
|
|
164
|
+
}
|
|
165
165
|
/** Built-in icon; no children needed. Use it inside its matching control. */
|
|
166
|
-
export
|
|
166
|
+
export function AddonLoadingIcon({ disableStyle, className, strokeWidth = 1.5, ref, ...props }) {
|
|
167
167
|
const attributes = usePartAttributes();
|
|
168
168
|
return (_jsx(LoaderCircle, { ...attributes, "aria-hidden": true, ...props, ref: ref, strokeWidth: strokeWidth, "data-component": "textarea-addonloadingicon", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
169
|
-
}
|
|
169
|
+
}
|
|
170
170
|
const InputContext = /* @__PURE__ */ createContext(null);
|
|
171
171
|
function useInputContext() {
|
|
172
172
|
const context = useContext(InputContext);
|
|
@@ -2,7 +2,7 @@ import type { StyleProps } from '../../types/Style.ts';
|
|
|
2
2
|
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
3
3
|
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
4
4
|
import type { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
5
|
-
export type ProviderProps = Omit<BaseToast.Provider.Props, 'toastManager'> & Pick<BaseToast.Viewport.Props, 'style'> & {
|
|
5
|
+
export type ProviderProps = Omit<BaseToast.Provider.Props, 'toastManager' | 'render'> & Pick<BaseToast.Viewport.Props, 'style'> & {
|
|
6
6
|
className?: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
@@ -64,10 +64,10 @@ export declare function Root({ tone, children, }: {
|
|
|
64
64
|
tone?: 'neutral' | 'success' | 'error';
|
|
65
65
|
children: ReactNode;
|
|
66
66
|
}): import("react").JSX.Element;
|
|
67
|
-
export type ToastProps = Omit<BaseToast.Root.Props, 'toast' | 'className'> & {
|
|
67
|
+
export type ToastProps = Omit<BaseToast.Root.Props, 'toast' | 'className' | 'render'> & {
|
|
68
68
|
className?: string;
|
|
69
69
|
} & StyleProps;
|
|
70
|
-
export declare
|
|
70
|
+
export declare function Toast({ disableStyle, className, style, children, ref, ...props }: ToastProps): import("react").JSX.Element;
|
|
71
71
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
72
72
|
export declare function Icon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
73
73
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
@@ -75,20 +75,20 @@ export declare function Icon({ disableStyle, children, className, ...props }: (O
|
|
|
75
75
|
'data-tone'?: string;
|
|
76
76
|
}>;
|
|
77
77
|
}) & StyleProps): import("react").FunctionComponentElement<any>;
|
|
78
|
-
export declare
|
|
78
|
+
export declare function Title({ disableStyle, className, ref, ...props }: (Omit<BaseToast.Title.Props, 'className' | 'render'> & {
|
|
79
79
|
className?: string;
|
|
80
|
-
} & StyleProps
|
|
81
|
-
export declare
|
|
80
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
81
|
+
export declare function Description({ disableStyle, className, ref, ...props }: (Omit<BaseToast.Description.Props, 'className' | 'render'> & {
|
|
82
82
|
className?: string;
|
|
83
|
-
} & StyleProps
|
|
83
|
+
}) & StyleProps): import("react").JSX.Element;
|
|
84
84
|
/** Icon-only: put just a CloseButtonIcon inside, never text like "Close". It is already named "Dismiss notification" for screen readers. Pass asChild to give dismissing behavior to your own button instead, like a "Dismiss" Button, which then names itself. */
|
|
85
|
-
export declare
|
|
85
|
+
export declare function CloseButton({ asChild, disableStyle, children, ref, ...props }: Omit<BaseToast.Close.Props, 'className' | 'render'> & {
|
|
86
86
|
className?: string;
|
|
87
|
-
} & AsChildProps & StyleProps
|
|
87
|
+
} & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
88
88
|
/** Runs the toast's action. Pass asChild to give this behavior to your own button instead; it keeps the state data attributes but none of this part's styling. */
|
|
89
|
-
export declare
|
|
89
|
+
export declare function ActionButton({ asChild, disableStyle, children, ref, ...props }: Omit<BaseToast.Action.Props, 'className' | 'render'> & {
|
|
90
90
|
className?: string;
|
|
91
|
-
} & AsChildProps & StyleProps
|
|
91
|
+
} & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
92
92
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
93
93
|
export declare function CloseButtonIcon({ disableStyle, children, className, ...props }: (Omit<ComponentProps<'svg'>, 'children'> & {
|
|
94
94
|
/** Omit for the supplied default icon; pass a child only to replace it. */
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { asChildRendering } from "../../utils/asChild.js";
|
|
3
3
|
import { Toast as BaseToast } from '@base-ui/react/toast';
|
|
4
4
|
import { CircleCheck, Info, TriangleAlert, X } from "../../utils/icons.js";
|
|
5
|
-
import { cloneElement, createContext,
|
|
5
|
+
import { cloneElement, createContext, useContext, useEffect, useState, } from 'react';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
/**
|
|
8
8
|
* Mount Provider once before calling Show. Show receives the notification composition; do not render Toast directly outside it. Icon follows Root tone automatically. For urgent priority, supply title/description in Show options so the live region can announce them.
|
|
@@ -74,7 +74,7 @@ export function Show(render, options) {
|
|
|
74
74
|
export function Root({ tone = 'neutral', children, }) {
|
|
75
75
|
return _jsx(ToneContext.Provider, { value: tone, children: children });
|
|
76
76
|
}
|
|
77
|
-
export
|
|
77
|
+
export function Toast({ disableStyle, className, style, children, ref, ...props }) {
|
|
78
78
|
const notification = useNotificationContext();
|
|
79
79
|
const tone = useContext(ToneContext);
|
|
80
80
|
return (_jsx(BaseToast.Root, { ...props, ref: ref, toast: notification, "data-tone": tone, "data-component": "toast-toast", "data-style-disabled": disableStyle ? '' : undefined, className: className, style: (state) => {
|
|
@@ -115,7 +115,7 @@ export const Toast = /* @__PURE__ */ forwardRef(function Toast({ disableStyle, c
|
|
|
115
115
|
...(typeof style === 'function' ? style(state) : style),
|
|
116
116
|
};
|
|
117
117
|
}, children: _jsx(BaseToast.Content, { "data-component": "toast-toast-1", children: children }) }));
|
|
118
|
-
}
|
|
118
|
+
}
|
|
119
119
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
120
120
|
export function Icon({ disableStyle, children, className, ...props }) {
|
|
121
121
|
const tone = useContext(ToneContext);
|
|
@@ -141,24 +141,24 @@ export function Icon({ disableStyle, children, className, ...props }) {
|
|
|
141
141
|
strokeWidth: props.strokeWidth ?? icon.props.strokeWidth ?? 1.8,
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
export
|
|
144
|
+
export function Title({ disableStyle, className, ref, ...props }) {
|
|
145
145
|
return (_jsx(BaseToast.Title, { ...props, ref: ref, "data-component": "toast-title", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
146
|
-
}
|
|
147
|
-
export
|
|
146
|
+
}
|
|
147
|
+
export function Description({ disableStyle, className, ref, ...props }) {
|
|
148
148
|
return (_jsx(BaseToast.Description, { ...props, ref: ref, "data-component": "toast-description", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
149
|
-
}
|
|
149
|
+
}
|
|
150
150
|
/** Icon-only: put just a CloseButtonIcon inside, never text like "Close". It is already named "Dismiss notification" for screen readers. Pass asChild to give dismissing behavior to your own button instead, like a "Dismiss" Button, which then names itself. */
|
|
151
|
-
export
|
|
151
|
+
export function CloseButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
152
152
|
// Naming the icon-only button for screen readers, while the consumer's own button names itself
|
|
153
153
|
const ariaLabel = asChild ? undefined : 'Dismiss notification';
|
|
154
154
|
const rendering = asChildRendering({ asChild, children, component: 'toast-closebutton', disableStyle });
|
|
155
155
|
return _jsx(BaseToast.Close, { "aria-label": ariaLabel, ...props, ref: ref, ...rendering });
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
/** Runs the toast's action. Pass asChild to give this behavior to your own button instead; it keeps the state data attributes but none of this part's styling. */
|
|
158
|
-
export
|
|
158
|
+
export function ActionButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
159
159
|
const rendering = asChildRendering({ asChild, children, component: 'toast-actionbutton', disableStyle });
|
|
160
160
|
return _jsx(BaseToast.Action, { ...props, ref: ref, ...rendering });
|
|
161
|
-
}
|
|
161
|
+
}
|
|
162
162
|
/** A default icon is supplied. Omit children for the usual case; pass an icon only to replace that visual. */
|
|
163
163
|
export function CloseButtonIcon({ disableStyle, children = _jsx(X, {}), className, ...props }) {
|
|
164
164
|
const tone = useContext(ToneContext);
|
|
@@ -23,18 +23,18 @@ import type { SVGIconProps } from '../../types/Icon.ts';
|
|
|
23
23
|
* )
|
|
24
24
|
* }
|
|
25
25
|
*/
|
|
26
|
-
export declare
|
|
26
|
+
export declare function Root({ children, className, disableStyle, size, pressed, defaultPressed, onPressedChange, disabled, ref, ...props }: Omit<BaseToggle.Props, 'className'> & {
|
|
27
27
|
className?: string;
|
|
28
28
|
/** Choose the shared size for the visible parts in this composition. */
|
|
29
|
-
size?: ButtonProps[
|
|
30
|
-
} & StyleProps
|
|
29
|
+
size?: ButtonProps['size'];
|
|
30
|
+
} & StyleProps): import("react").JSX.Element;
|
|
31
31
|
/** Render beside InactiveIcon inside Root. It automatically appears only while pressed; supply the decorative icon without another visibility condition. */
|
|
32
|
-
export declare
|
|
32
|
+
export declare function ActiveIcon({ ref, ...props }: SVGIconProps & {
|
|
33
33
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
34
34
|
children: ReactElement<SVGIconProps>;
|
|
35
|
-
} & StyleProps
|
|
35
|
+
} & StyleProps): import("react").JSX.Element | null;
|
|
36
36
|
/** Render beside ActiveIcon inside Root. It automatically appears only while unpressed; supply the decorative icon without another visibility condition. */
|
|
37
|
-
export declare
|
|
37
|
+
export declare function InactiveIcon({ ref, ...props }: SVGIconProps & {
|
|
38
38
|
/** Supply the decorative icon; the wrapper forwards the relevant state and preserves its classes. */
|
|
39
39
|
children: ReactElement<SVGIconProps>;
|
|
40
|
-
} & StyleProps
|
|
40
|
+
} & StyleProps): import("react").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Toggle as BaseToggle } from '@base-ui/react/toggle';
|
|
3
|
-
import { cloneElement, createContext,
|
|
3
|
+
import { cloneElement, createContext, useContext, useState, } from 'react';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
/**
|
|
6
6
|
* Root is the interactive toggle button. ActiveIcon and InactiveIcon switch automatically with pressed state; do not conditionally render them yourself.
|
|
@@ -22,30 +22,30 @@ import { twMerge } from 'tailwind-merge';
|
|
|
22
22
|
* )
|
|
23
23
|
* }
|
|
24
24
|
*/
|
|
25
|
-
export
|
|
25
|
+
export function Root({ children, className, disableStyle, size = 'medium', pressed, defaultPressed = false, onPressedChange, disabled = false, ref, ...props }) {
|
|
26
26
|
const [pressedInternalState, setPressedInternalState] = useState(defaultPressed);
|
|
27
27
|
return (_jsx(BaseToggle, { ...props, ref: ref, pressed: pressed, defaultPressed: defaultPressed, disabled: disabled, "data-size": size, "data-component": "toggle-root", "data-style-disabled": disableStyle ? '' : undefined, onPressedChange: (next, details) => {
|
|
28
28
|
onPressedChange?.(next, details);
|
|
29
29
|
if (!details.isCanceled)
|
|
30
30
|
setPressedInternalState(next);
|
|
31
31
|
}, className: className, children: _jsx(ToggleContext.Provider, { value: { pressed: pressed ?? pressedInternalState, disabled, size }, children: children }) }));
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
/** Render beside InactiveIcon inside Root. It automatically appears only while pressed; supply the decorative icon without another visibility condition. */
|
|
34
|
-
export
|
|
34
|
+
export function ActiveIcon({ ref, ...props }) {
|
|
35
35
|
const context = useToggleContext();
|
|
36
36
|
if (!context.pressed)
|
|
37
37
|
return null;
|
|
38
38
|
return _jsx(StateIcon, { ...props, ref: ref, component: "toggle-activeicon" });
|
|
39
|
-
}
|
|
39
|
+
}
|
|
40
40
|
/** Render beside ActiveIcon inside Root. It automatically appears only while unpressed; supply the decorative icon without another visibility condition. */
|
|
41
|
-
export
|
|
41
|
+
export function InactiveIcon({ ref, ...props }) {
|
|
42
42
|
const context = useToggleContext();
|
|
43
43
|
if (context.pressed)
|
|
44
44
|
return null;
|
|
45
45
|
return _jsx(StateIcon, { ...props, ref: ref, component: "toggle-inactiveicon" });
|
|
46
|
-
}
|
|
46
|
+
}
|
|
47
47
|
// The shared body of ActiveIcon and InactiveIcon: decorates the supplied icon with the toggle's state
|
|
48
|
-
|
|
48
|
+
function StateIcon({ disableStyle, children, className, component, ref, ...props }) {
|
|
49
49
|
const context = useToggleContext();
|
|
50
50
|
return cloneElement(children, {
|
|
51
51
|
...props,
|
|
@@ -61,7 +61,7 @@ const StateIcon = /* @__PURE__ */ forwardRef(function StateIcon({ disableStyle,
|
|
|
61
61
|
},
|
|
62
62
|
className: twMerge(children.props.className, className),
|
|
63
63
|
});
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
65
|
const ToggleContext = /* @__PURE__ */ createContext(null);
|
|
66
66
|
function useToggleContext() {
|
|
67
67
|
const context = useContext(ToggleContext);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StyleProps } from '../../types/Style.ts';
|
|
2
2
|
import type { AsChildProps } from '../../utils/asChild.ts';
|
|
3
3
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
4
|
-
import type { ComponentPropsWithRef } from 'react';
|
|
4
|
+
import type { ComponentProps, ComponentPropsWithRef } from 'react';
|
|
5
5
|
/**
|
|
6
6
|
* OpenButton renders its own trigger button; pass asChild to make your own target element the trigger instead. Keep Popup in the same Root. Popup already includes its portal and positioner. PopupText supplies the help text; Arrow is optional.
|
|
7
7
|
*
|
|
@@ -30,13 +30,13 @@ import type { ComponentPropsWithRef } from 'react';
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function Root<Payload = unknown>(props: BaseTooltip.Root.Props<Payload>): import("react").JSX.Element;
|
|
32
32
|
/** Opens the tooltip on hover or focus. Pass asChild to give this behavior to your own element, like your app's Button. */
|
|
33
|
-
export declare
|
|
33
|
+
export declare function OpenButton({ asChild, disableStyle, children, ref, ...props }: Omit<BaseTooltip.Trigger.Props, 'className' | 'render'> & {
|
|
34
34
|
className?: string;
|
|
35
|
-
} & AsChildProps & StyleProps
|
|
36
|
-
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseTooltip.Popup>, 'className'> & {
|
|
35
|
+
} & AsChildProps & StyleProps): import("react").JSX.Element;
|
|
36
|
+
export type PopupProps = Omit<ComponentPropsWithRef<typeof BaseTooltip.Popup>, 'className' | 'render'> & {
|
|
37
37
|
className?: string;
|
|
38
38
|
} & Pick<BaseTooltip.Portal.Props, 'container' | 'keepMounted'> & Pick<BaseTooltip.Positioner.Props, 'anchor' | 'positionMethod' | 'side' | 'sideOffset' | 'align' | 'alignOffset' | 'collisionBoundary' | 'collisionPadding' | 'sticky' | 'arrowPadding' | 'disableAnchorTracking' | 'collisionAvoidance'> & StyleProps;
|
|
39
39
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
40
40
|
export declare function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }: PopupProps): import("react").JSX.Element;
|
|
41
|
-
export declare
|
|
42
|
-
export declare
|
|
41
|
+
export declare function PopupText({ disableStyle, className, ref, ...props }: ComponentProps<'span'> & StyleProps): import("react").JSX.Element;
|
|
42
|
+
export declare function Arrow({ disableStyle, className, style, ref, ...props }: Omit<ComponentProps<'svg'>, 'children' | 'dangerouslySetInnerHTML'> & StyleProps): import("react").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { asChildRendering } from "../../utils/asChild.js";
|
|
3
3
|
import { Tooltip as BaseTooltip } from '@base-ui/react/tooltip';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
5
4
|
/**
|
|
6
5
|
* OpenButton renders its own trigger button; pass asChild to make your own target element the trigger instead. Keep Popup in the same Root. Popup already includes its portal and positioner. PopupText supplies the help text; Arrow is optional.
|
|
7
6
|
*
|
|
@@ -32,10 +31,10 @@ export function Root(props) {
|
|
|
32
31
|
return _jsx(BaseTooltip.Root, { ...props });
|
|
33
32
|
}
|
|
34
33
|
/** Opens the tooltip on hover or focus. Pass asChild to give this behavior to your own element, like your app's Button. */
|
|
35
|
-
export
|
|
34
|
+
export function OpenButton({ asChild, disableStyle, children, ref, ...props }) {
|
|
36
35
|
const rendering = asChildRendering({ asChild, children, component: 'tooltip-openbutton', disableStyle });
|
|
37
36
|
return _jsx(BaseTooltip.Trigger, { ...props, ref: ref, ...rendering });
|
|
38
|
-
}
|
|
37
|
+
}
|
|
39
38
|
/** Already includes the portal and positioner. Keep it in the matching Root and let the native open state control visibility. */
|
|
40
39
|
export function Popup({ disableStyle, container, keepMounted, anchor, positionMethod, side = 'top', sideOffset = 8, align = 'start', alignOffset, collisionBoundary, collisionPadding, sticky, arrowPadding, disableAnchorTracking, collisionAvoidance, className, style, ...props }) {
|
|
41
40
|
const baseStyle = {
|
|
@@ -46,9 +45,9 @@ export function Popup({ disableStyle, container, keepMounted, anchor, positionMe
|
|
|
46
45
|
? (state) => ({ ...baseStyle, ...style(state) })
|
|
47
46
|
: { ...baseStyle, ...style } }) }) }));
|
|
48
47
|
}
|
|
49
|
-
export
|
|
48
|
+
export function PopupText({ disableStyle, className, ref, ...props }) {
|
|
50
49
|
return (_jsx("span", { ...props, ref: ref, "data-component": "tooltip-popuptext", "data-style-disabled": disableStyle ? '' : undefined, className: className }));
|
|
51
|
-
}
|
|
52
|
-
export
|
|
50
|
+
}
|
|
51
|
+
export function Arrow({ disableStyle, className, style, ref, ...props }) {
|
|
53
52
|
return (_jsxs(BaseTooltip.Arrow, { style: style, render: _jsx("svg", { ...props, ref: ref, "aria-hidden": true, width: "20", height: "10", viewBox: "0 0 20 10" }), "data-component": "tooltip-arrow", "data-style-disabled": disableStyle ? '' : undefined, className: className, children: [_jsx("path", { d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z", "data-component": "tooltip-arrow-1" }), _jsx("path", { d: "M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z", "data-component": "tooltip-arrow-2" }), _jsx("path", { d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z", "data-component": "tooltip-arrow-3" })] }));
|
|
54
|
-
}
|
|
53
|
+
}
|
|
@@ -38,7 +38,7 @@ import type { ComponentProps, ReactElement, ReactNode, SVGProps } from 'react';
|
|
|
38
38
|
* <Tour.Description>Narrow the results.</Tour.Description>
|
|
39
39
|
* </Tour.Content>
|
|
40
40
|
* <Tour.Progress />
|
|
41
|
-
* <Tour.
|
|
41
|
+
* <Tour.PreviousButton>Back</Tour.PreviousButton>
|
|
42
42
|
* <Tour.NextButton>Next</Tour.NextButton>
|
|
43
43
|
* <Tour.DoneButton>Done</Tour.DoneButton>
|
|
44
44
|
* </Tour.Popup>
|
|
@@ -133,7 +133,7 @@ export declare function Progress({ disableStyle, className, children, ...props }
|
|
|
133
133
|
}): import("react").JSX.Element;
|
|
134
134
|
type ButtonProps = ComponentProps<'button'> & AsChildProps & StyleProps;
|
|
135
135
|
/** Goes back one step, styled like a secondary Button. Not rendered on the first step, where there's nothing to go back to. Pass asChild to give this behavior to your own button instead. */
|
|
136
|
-
export declare function
|
|
136
|
+
export declare function PreviousButton(props: ButtonProps): import("react").JSX.Element | null;
|
|
137
137
|
/** Goes to the next step, styled like a primary Button. Not rendered on the last step; DoneButton takes its place there. Pass asChild to give this behavior to your own button instead. */
|
|
138
138
|
export declare function NextButton(props: ButtonProps): import("react").JSX.Element | null;
|
|
139
139
|
/** Finishes the tour, styled like a primary Button. Rendered only on the last step, in NextButton's place. Pass asChild to give this behavior to your own button instead. */
|
|
@@ -40,7 +40,7 @@ import { twMerge } from 'tailwind-merge';
|
|
|
40
40
|
* <Tour.Description>Narrow the results.</Tour.Description>
|
|
41
41
|
* </Tour.Content>
|
|
42
42
|
* <Tour.Progress />
|
|
43
|
-
* <Tour.
|
|
43
|
+
* <Tour.PreviousButton>Back</Tour.PreviousButton>
|
|
44
44
|
* <Tour.NextButton>Next</Tour.NextButton>
|
|
45
45
|
* <Tour.DoneButton>Done</Tour.DoneButton>
|
|
46
46
|
* </Tour.Popup>
|
|
@@ -230,11 +230,11 @@ function TourButton({ asChild, joyrideProps, part, defaultClassName, disableStyl
|
|
|
230
230
|
return (_jsx("button", { type: "button", ...behaviorProps, ...asChildStyleAttributes({ asChild, component: `tour-${part}`, disableStyle }), className: twMerge(!disableStyle && defaultClassName, className), children: children }));
|
|
231
231
|
}
|
|
232
232
|
/** Goes back one step, styled like a secondary Button. Not rendered on the first step, where there's nothing to go back to. Pass asChild to give this behavior to your own button instead. */
|
|
233
|
-
export function
|
|
234
|
-
const step = useStep('
|
|
233
|
+
export function PreviousButton(props) {
|
|
234
|
+
const step = useStep('PreviousButton');
|
|
235
235
|
if (step.joyride.index === 0)
|
|
236
236
|
return null;
|
|
237
|
-
return (_jsx(TourButton, { ...props, joyrideProps: step.joyride.backProps, part: "
|
|
237
|
+
return (_jsx(TourButton, { ...props, joyrideProps: step.joyride.backProps, part: "previousbutton", defaultClassName: `${buttonBase} ${secondaryButton}` }));
|
|
238
238
|
}
|
|
239
239
|
/** Goes to the next step, styled like a primary Button. Not rendered on the last step; DoneButton takes its place there. Pass asChild to give this behavior to your own button instead. */
|
|
240
240
|
export function NextButton(props) {
|
|
@@ -276,5 +276,6 @@ export function CloseButtonIcon({ disableStyle, children, className, ...props })
|
|
|
276
276
|
'data-style-disabled': disableStyle ? '' : undefined,
|
|
277
277
|
},
|
|
278
278
|
className: twMerge(!disableStyle && 'h-4 w-fit shrink-0 text-inherit', children?.props.className, className),
|
|
279
|
+
strokeWidth: props.strokeWidth ?? children?.props.strokeWidth ?? 2,
|
|
279
280
|
});
|
|
280
281
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -30,8 +30,10 @@ export * as Badge from './components/badge/index.tsx';
|
|
|
30
30
|
export * as Breadcrumb from './components/breadcrumb/index.tsx';
|
|
31
31
|
export * as Button from './components/button/index.tsx';
|
|
32
32
|
export * as Card from './components/card/index.tsx';
|
|
33
|
+
export * as Carousel from './components/carousel/index.tsx';
|
|
33
34
|
export * as Divider from './components/divider/index.tsx';
|
|
34
35
|
export * as Empty from './components/empty/index.tsx';
|
|
36
|
+
export * as Exception from './components/exception/index.tsx';
|
|
35
37
|
export * as Form from './components/form/index.tsx';
|
|
36
38
|
export * as Metric from './components/metric/index.tsx';
|
|
37
39
|
export * as Page from './components/page/index.tsx';
|
package/dist/index.js
CHANGED
|
@@ -30,8 +30,10 @@ export * as Badge from "./components/badge/index.js";
|
|
|
30
30
|
export * as Breadcrumb from "./components/breadcrumb/index.js";
|
|
31
31
|
export * as Button from "./components/button/index.js";
|
|
32
32
|
export * as Card from "./components/card/index.js";
|
|
33
|
+
export * as Carousel from "./components/carousel/index.js";
|
|
33
34
|
export * as Divider from "./components/divider/index.js";
|
|
34
35
|
export * as Empty from "./components/empty/index.js";
|
|
36
|
+
export * as Exception from "./components/exception/index.js";
|
|
35
37
|
export * as Form from "./components/form/index.js";
|
|
36
38
|
export * as Metric from "./components/metric/index.js";
|
|
37
39
|
export * as Page from "./components/page/index.js";
|
package/dist/utils/icons.d.ts
CHANGED
|
@@ -1,24 +1,93 @@
|
|
|
1
1
|
import type { SVGIconProps } from '../types/Icon.ts';
|
|
2
|
-
export declare const ArrowLeft:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare const
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
export declare const ArrowLeft: {
|
|
3
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const CalendarDays: {
|
|
7
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const Check: {
|
|
11
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const ChevronDown: {
|
|
15
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const ChevronLeft: {
|
|
19
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
20
|
+
displayName: string;
|
|
21
|
+
};
|
|
22
|
+
export declare const ChevronRight: {
|
|
23
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
24
|
+
displayName: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const ChevronUp: {
|
|
27
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
28
|
+
displayName: string;
|
|
29
|
+
};
|
|
30
|
+
export declare const ChevronsUpDown: {
|
|
31
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
32
|
+
displayName: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const CircleAlert: {
|
|
35
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
38
|
+
export declare const CircleCheck: {
|
|
39
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
export declare const Eye: {
|
|
43
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
export declare const EyeOff: {
|
|
47
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const File: {
|
|
51
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const FolderOpen: {
|
|
55
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
56
|
+
displayName: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const GripVertical: {
|
|
59
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
60
|
+
displayName: string;
|
|
61
|
+
};
|
|
62
|
+
export declare const Info: {
|
|
63
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
64
|
+
displayName: string;
|
|
65
|
+
};
|
|
66
|
+
export declare const LoaderCircle: {
|
|
67
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
68
|
+
displayName: string;
|
|
69
|
+
};
|
|
70
|
+
export declare const Minus: {
|
|
71
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
72
|
+
displayName: string;
|
|
73
|
+
};
|
|
74
|
+
export declare const Star: {
|
|
75
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
76
|
+
displayName: string;
|
|
77
|
+
};
|
|
78
|
+
export declare const Text: {
|
|
79
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
80
|
+
displayName: string;
|
|
81
|
+
};
|
|
82
|
+
export declare const TriangleAlert: {
|
|
83
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
84
|
+
displayName: string;
|
|
85
|
+
};
|
|
86
|
+
export declare const Upload: {
|
|
87
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
88
|
+
displayName: string;
|
|
89
|
+
};
|
|
90
|
+
export declare const X: {
|
|
91
|
+
({ size, width, height, color, strokeWidth, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }: SVGIconProps): import("react").JSX.Element;
|
|
92
|
+
displayName: string;
|
|
93
|
+
};
|
package/dist/utils/icons.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createElement
|
|
2
|
+
import { createElement } from 'react';
|
|
3
3
|
/** Builds a Lucide-compatible icon from its SVG elements, so the package ships only the icons it uses instead of the whole lucide-react catalog. Icon shapes are copied from lucide-react v1.57.0 (ISC license, https://lucide.dev). */
|
|
4
4
|
function createIcon(name, iconNode) {
|
|
5
|
-
|
|
5
|
+
function Icon({ size = 24, width, height, color = 'currentColor', strokeWidth = 2, absoluteStrokeWidth, nonScalingStroke, className, children, ref, ...props }) {
|
|
6
6
|
// Keeping the stroke the same visual thickness at any size, when asked
|
|
7
7
|
const iconStrokeWidth = absoluteStrokeWidth
|
|
8
8
|
? (Number(strokeWidth) * 24) / Number(width ?? size)
|
|
@@ -17,7 +17,7 @@ function createIcon(name, iconNode) {
|
|
|
17
17
|
vectorEffect: nonScalingStroke ? 'non-scaling-stroke' : undefined,
|
|
18
18
|
...attributes,
|
|
19
19
|
})), children] }));
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
Icon.displayName = name.replace(/(^|-)(\w)/g, (_match, _dash, letter) => letter.toUpperCase());
|
|
22
22
|
return Icon;
|
|
23
23
|
}
|