@spark-ui/components 11.0.1 → 11.1.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/DialogTrigger-woU7vsJi.d.ts +142 -0
- package/dist/Input-N8AWWSmt.d.ts +41 -0
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +20 -0
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +19 -0
- package/dist/accordion/index.d.ts +73 -0
- package/dist/accordion/index.js +325 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/alert-dialog/index.d.ts +119 -0
- package/dist/alert-dialog/index.js +1554 -0
- package/dist/alert-dialog/index.js.map +1 -0
- package/dist/avatar/index.d.ts +66 -0
- package/dist/avatar/index.js +1303 -0
- package/dist/avatar/index.js.map +1 -0
- package/dist/badge/index.d.ts +47 -0
- package/dist/badge/index.js +122 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/breadcrumb/index.d.ts +64 -0
- package/dist/breadcrumb/index.js +327 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/button/index.d.ts +41 -0
- package/dist/button/index.js +935 -0
- package/dist/button/index.js.map +1 -0
- package/dist/card/index.d.ts +61 -0
- package/dist/card/index.js +502 -0
- package/dist/card/index.js.map +1 -0
- package/dist/carousel/index.d.ts +261 -0
- package/dist/carousel/index.js +1801 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/checkbox/index.d.ts +120 -0
- package/dist/checkbox/index.js +511 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/chip/index.d.ts +97 -0
- package/dist/chip/index.js +908 -0
- package/dist/chip/index.js.map +1 -0
- package/dist/collapsible/index.d.ts +43 -0
- package/dist/collapsible/index.js +109 -0
- package/dist/collapsible/index.js.map +1 -0
- package/dist/combobox/index.d.ts +287 -0
- package/dist/combobox/index.js +2588 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/dialog/index.d.ts +33 -0
- package/dist/dialog/index.js +1389 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/divider/index.d.ts +61 -0
- package/dist/divider/index.js +224 -0
- package/dist/divider/index.js.map +1 -0
- package/dist/drawer/index.d.ts +152 -0
- package/dist/drawer/index.js +1400 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/dropdown/index.d.ts +233 -0
- package/dist/dropdown/index.js +2051 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/form-field/index.d.ts +186 -0
- package/dist/form-field/index.js +553 -0
- package/dist/form-field/index.js.map +1 -0
- package/dist/icon/index.d.ts +28 -0
- package/dist/icon/index.js +127 -0
- package/dist/icon/index.js.map +1 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.js +980 -0
- package/dist/icon-button/index.js.map +1 -0
- package/dist/input/index.d.ts +78 -0
- package/dist/input/index.js +724 -0
- package/dist/input/index.js.map +1 -0
- package/dist/kbd/index.d.ts +9 -0
- package/dist/kbd/index.js +47 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/label/index.d.ts +11 -0
- package/dist/label/index.js +78 -0
- package/dist/label/index.js.map +1 -0
- package/dist/link-box/index.d.ts +34 -0
- package/dist/link-box/index.js +92 -0
- package/dist/link-box/index.js.map +1 -0
- package/dist/pagination/index.d.ts +143 -0
- package/dist/pagination/index.js +1353 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/popover/index.d.ts +93 -0
- package/dist/popover/index.js +1339 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/portal/index.d.ts +13 -0
- package/dist/portal/index.js +37 -0
- package/dist/portal/index.js.map +1 -0
- package/dist/progress/index.d.ts +48 -0
- package/dist/progress/index.js +223 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress-tracker/index.d.ts +80 -0
- package/dist/progress-tracker/index.js +571 -0
- package/dist/progress-tracker/index.js.map +1 -0
- package/dist/radio-group/index.d.ts +100 -0
- package/dist/radio-group/index.js +318 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/rating/index.d.ts +78 -0
- package/dist/rating/index.js +363 -0
- package/dist/rating/index.js.map +1 -0
- package/dist/scrolling-list/index.d.ts +118 -0
- package/dist/scrolling-list/index.js +1426 -0
- package/dist/scrolling-list/index.js.map +1 -0
- package/dist/segmented-gauge/index.d.ts +100 -0
- package/dist/segmented-gauge/index.js +277 -0
- package/dist/segmented-gauge/index.js.map +1 -0
- package/dist/select/index.d.ts +167 -0
- package/dist/select/index.js +581 -0
- package/dist/select/index.js.map +1 -0
- package/dist/skeleton/index.d.ts +67 -0
- package/dist/skeleton/index.js +206 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/slider/index.d.ts +97 -0
- package/dist/slider/index.js +220 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slot/index.d.ts +16 -0
- package/dist/slot/index.js +51 -0
- package/dist/slot/index.js.map +1 -0
- package/dist/snackbar/index.d.ts +158 -0
- package/dist/snackbar/index.js +1756 -0
- package/dist/snackbar/index.js.map +1 -0
- package/dist/spinner/index.d.ts +21 -0
- package/dist/spinner/index.js +139 -0
- package/dist/spinner/index.js.map +1 -0
- package/dist/stepper/index.d.ts +81 -0
- package/dist/stepper/index.js +1847 -0
- package/dist/stepper/index.js.map +1 -0
- package/dist/switch/index.d.ts +64 -0
- package/dist/switch/index.js +327 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/tabs/index.d.ts +103 -0
- package/dist/tabs/index.js +1376 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tag/index.d.ts +29 -0
- package/dist/tag/index.js +283 -0
- package/dist/tag/index.js.map +1 -0
- package/dist/text-link/index.d.ts +20 -0
- package/dist/text-link/index.js +100 -0
- package/dist/text-link/index.js.map +1 -0
- package/dist/textarea/index.d.ts +57 -0
- package/dist/textarea/index.js +797 -0
- package/dist/textarea/index.js.map +1 -0
- package/dist/toast/index.d.ts +56 -0
- package/dist/toast/index.js +1412 -0
- package/dist/toast/index.js.map +1 -0
- package/dist/visually-hidden/index.d.ts +16 -0
- package/dist/visually-hidden/index.js +67 -0
- package/dist/visually-hidden/index.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/icon/index.ts
|
|
21
|
+
var icon_exports = {};
|
|
22
|
+
__export(icon_exports, {
|
|
23
|
+
Icon: () => Icon
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(icon_exports);
|
|
26
|
+
|
|
27
|
+
// src/icon/Icon.tsx
|
|
28
|
+
var import_react2 = require("react");
|
|
29
|
+
|
|
30
|
+
// src/slot/Slot.tsx
|
|
31
|
+
var import_radix_ui = require("radix-ui");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var Slottable = import_radix_ui.Slot.Slottable;
|
|
35
|
+
var Slot = ({ ref, ...props }) => {
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_radix_ui.Slot.Root, { ref, ...props });
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/visually-hidden/VisuallyHidden.tsx
|
|
40
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
41
|
+
var VisuallyHidden = ({ asChild = false, ref, ...props }) => {
|
|
42
|
+
const Component = asChild ? Slot : "span";
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
44
|
+
Component,
|
|
45
|
+
{
|
|
46
|
+
...props,
|
|
47
|
+
ref,
|
|
48
|
+
style: {
|
|
49
|
+
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
50
|
+
position: "absolute",
|
|
51
|
+
border: 0,
|
|
52
|
+
width: 1,
|
|
53
|
+
height: 1,
|
|
54
|
+
padding: 0,
|
|
55
|
+
margin: -1,
|
|
56
|
+
overflow: "hidden",
|
|
57
|
+
clip: "rect(0, 0, 0, 0)",
|
|
58
|
+
whiteSpace: "nowrap",
|
|
59
|
+
wordWrap: "normal",
|
|
60
|
+
...props.style
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
VisuallyHidden.displayName = "VisuallyHidden";
|
|
66
|
+
|
|
67
|
+
// src/icon/Icon.styles.tsx
|
|
68
|
+
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
69
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
70
|
+
var iconStyles = (0, import_class_variance_authority.cva)(["fill-current shrink-0"], {
|
|
71
|
+
variants: {
|
|
72
|
+
/**
|
|
73
|
+
* Color scheme of the icon.
|
|
74
|
+
*/
|
|
75
|
+
intent: (0, import_internal_utils.makeVariants)({
|
|
76
|
+
current: ["text-current"],
|
|
77
|
+
main: ["text-main"],
|
|
78
|
+
support: ["text-support"],
|
|
79
|
+
accent: ["text-accent"],
|
|
80
|
+
basic: ["text-basic"],
|
|
81
|
+
success: ["text-success"],
|
|
82
|
+
alert: ["text-alert"],
|
|
83
|
+
error: ["text-error"],
|
|
84
|
+
info: ["text-info"],
|
|
85
|
+
neutral: ["text-neutral"]
|
|
86
|
+
}),
|
|
87
|
+
/**
|
|
88
|
+
* Sets the size of the icon.
|
|
89
|
+
*/
|
|
90
|
+
size: (0, import_internal_utils.makeVariants)({
|
|
91
|
+
current: ["u-current-font-size"],
|
|
92
|
+
sm: ["w-sz-16", "h-sz-16"],
|
|
93
|
+
md: ["w-sz-24", "h-sz-24"],
|
|
94
|
+
lg: ["w-sz-32", "h-sz-32"],
|
|
95
|
+
xl: ["w-sz-40", "h-sz-40"]
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// src/icon/Icon.tsx
|
|
101
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
102
|
+
var Icon = ({
|
|
103
|
+
label,
|
|
104
|
+
className,
|
|
105
|
+
size = "current",
|
|
106
|
+
intent = "current",
|
|
107
|
+
children,
|
|
108
|
+
...others
|
|
109
|
+
}) => {
|
|
110
|
+
const child = import_react2.Children.only(children);
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
112
|
+
(0, import_react2.cloneElement)(child, {
|
|
113
|
+
className: iconStyles({ className, size, intent }),
|
|
114
|
+
"data-spark-component": "icon",
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
focusable: "false",
|
|
117
|
+
...others
|
|
118
|
+
}),
|
|
119
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(VisuallyHidden, { children: label })
|
|
120
|
+
] });
|
|
121
|
+
};
|
|
122
|
+
Icon.displayName = "Icon";
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
Icon
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/icon/index.ts","../../src/icon/Icon.tsx","../../src/slot/Slot.tsx","../../src/visually-hidden/VisuallyHidden.tsx","../../src/icon/Icon.styles.tsx"],"sourcesContent":["export * from './Icon'\n","import { Children, cloneElement, ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react'\n\nimport { VisuallyHidden } from '../visually-hidden'\nimport { iconStyles, IconVariantsProps } from './Icon.styles'\n\nexport interface IconProps extends IconVariantsProps, ComponentPropsWithoutRef<'svg'> {\n /**\n * The svg icon that will be wrapped\n */\n children: ReactNode\n /**\n * The accessible label for the icon. This label will be visually hidden but announced to screen\n * reader users, similar to `alt` text for `img` tags.\n */\n label?: string\n}\n\nexport const Icon = ({\n label,\n className,\n size = 'current',\n intent = 'current',\n children,\n ...others\n}: IconProps) => {\n const child = Children.only(children)\n\n return (\n <>\n {cloneElement(child as ReactElement<Record<string, any>>, {\n className: iconStyles({ className, size, intent }),\n 'data-spark-component': 'icon',\n 'aria-hidden': 'true',\n focusable: 'false',\n ...others,\n })}\n\n {label && <VisuallyHidden>{label}</VisuallyHidden>}\n </>\n )\n}\n\nIcon.displayName = 'Icon'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { HTMLAttributes, PropsWithChildren, Ref } from 'react'\n\nimport { Slot } from '../slot'\n\nexport type VisuallyHiddenProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n ref?: Ref<HTMLElement>\n}\n\nexport const VisuallyHidden = ({ asChild = false, ref, ...props }: VisuallyHiddenProps) => {\n const Component = asChild ? Slot : 'span'\n\n return (\n <Component\n {...props}\n ref={ref}\n style={{\n // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss\n position: 'absolute',\n border: 0,\n width: 1,\n height: 1,\n padding: 0,\n margin: -1,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n wordWrap: 'normal',\n ...props.style,\n }}\n />\n )\n}\n\nVisuallyHidden.displayName = 'VisuallyHidden'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const iconStyles = cva(['fill-current shrink-0'], {\n variants: {\n /**\n * Color scheme of the icon.\n */\n intent: makeVariants<\n 'intent',\n [\n 'current',\n 'main',\n 'support',\n 'accent',\n 'basic',\n 'success',\n 'alert',\n 'error',\n 'info',\n 'neutral',\n ]\n >({\n current: ['text-current'],\n main: ['text-main'],\n support: ['text-support'],\n accent: ['text-accent'],\n basic: ['text-basic'],\n success: ['text-success'],\n alert: ['text-alert'],\n error: ['text-error'],\n info: ['text-info'],\n neutral: ['text-neutral'],\n }),\n /**\n * Sets the size of the icon.\n */\n size: makeVariants<'size', ['current', 'sm', 'md', 'lg', 'xl']>({\n current: ['u-current-font-size'],\n sm: ['w-sz-16', 'h-sz-16'],\n md: ['w-sz-24', 'h-sz-24'],\n lg: ['w-sz-32', 'h-sz-32'],\n xl: ['w-sz-40', 'h-sz-40'],\n }),\n },\n})\n\nexport type IconVariantsProps = VariantProps<typeof iconStyles>\n"],"mappings":";;;;;;;;;;;;;;;;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,SAAS,CAAC,qBAAqB;AAAA,MAC/B,IAAI,CAAC,WAAW,SAAS;AAAA,MACzB,IAAI,CAAC,WAAW,SAAS;AAAA,MACzB,IAAI,CAAC,WAAW,SAAS;AAAA,MACzB,IAAI,CAAC,WAAW,SAAS;AAAA,IAC3B,CAAC;AAAA,EACH;AACF,CAAC;;;AHjBG,IAAAC,sBAAA;AAXG,IAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT;AAAA,EACA,GAAG;AACL,MAAiB;AACf,QAAM,QAAQ,uBAAS,KAAK,QAAQ;AAEpC,SACE,8EACG;AAAA,oCAAa,OAA4C;AAAA,MACxD,WAAW,WAAW,EAAE,WAAW,MAAM,OAAO,CAAC;AAAA,MACjD,wBAAwB;AAAA,MACxB,eAAe;AAAA,MACf,WAAW;AAAA,MACX,GAAG;AAAA,IACL,CAAC;AAAA,IAEA,SAAS,6CAAC,kBAAgB,iBAAM;AAAA,KACnC;AAEJ;AAEA,KAAK,cAAc;","names":["import_react","RadixSlot","import_jsx_runtime","import_jsx_runtime"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { ButtonProps } from '../button/index.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
|
|
7
|
+
interface IconButtonProps extends Omit<ButtonProps, 'loadingText'> {
|
|
8
|
+
'aria-label': string;
|
|
9
|
+
ref?: Ref<HTMLButtonElement>;
|
|
10
|
+
}
|
|
11
|
+
declare const IconButton: {
|
|
12
|
+
({ design, disabled, intent, shape, size, className, ref, ...others }: IconButtonProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { IconButton, type IconButtonProps };
|