@spark-ui/components 10.22.1 → 11.0.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/package.json +5 -5
- package/dist/DialogTrigger-woU7vsJi.d.ts +0 -142
- package/dist/Input-N8AWWSmt.d.ts +0 -41
- package/dist/InputTrailingIcon-ZZx8PoJy.d.ts +0 -20
- package/dist/LabelRequiredIndicator-DRnCzHMU.d.ts +0 -19
- package/dist/accordion/index.d.ts +0 -73
- package/dist/accordion/index.js +0 -325
- package/dist/accordion/index.js.map +0 -1
- package/dist/alert-dialog/index.d.ts +0 -119
- package/dist/alert-dialog/index.js +0 -1554
- package/dist/alert-dialog/index.js.map +0 -1
- package/dist/avatar/index.d.ts +0 -66
- package/dist/avatar/index.js +0 -1303
- package/dist/avatar/index.js.map +0 -1
- package/dist/badge/index.d.ts +0 -47
- package/dist/badge/index.js +0 -122
- package/dist/badge/index.js.map +0 -1
- package/dist/breadcrumb/index.d.ts +0 -64
- package/dist/breadcrumb/index.js +0 -327
- package/dist/breadcrumb/index.js.map +0 -1
- package/dist/button/index.d.ts +0 -41
- package/dist/button/index.js +0 -935
- package/dist/button/index.js.map +0 -1
- package/dist/card/index.d.ts +0 -61
- package/dist/card/index.js +0 -502
- package/dist/card/index.js.map +0 -1
- package/dist/carousel/index.d.ts +0 -261
- package/dist/carousel/index.js +0 -1801
- package/dist/carousel/index.js.map +0 -1
- package/dist/checkbox/index.d.ts +0 -120
- package/dist/checkbox/index.js +0 -511
- package/dist/checkbox/index.js.map +0 -1
- package/dist/chip/index.d.ts +0 -97
- package/dist/chip/index.js +0 -908
- package/dist/chip/index.js.map +0 -1
- package/dist/collapsible/index.d.ts +0 -43
- package/dist/collapsible/index.js +0 -109
- package/dist/collapsible/index.js.map +0 -1
- package/dist/combobox/index.d.ts +0 -287
- package/dist/combobox/index.js +0 -2588
- package/dist/combobox/index.js.map +0 -1
- package/dist/dialog/index.d.ts +0 -33
- package/dist/dialog/index.js +0 -1389
- package/dist/dialog/index.js.map +0 -1
- package/dist/divider/index.d.ts +0 -61
- package/dist/divider/index.js +0 -224
- package/dist/divider/index.js.map +0 -1
- package/dist/drawer/index.d.ts +0 -152
- package/dist/drawer/index.js +0 -1400
- package/dist/drawer/index.js.map +0 -1
- package/dist/dropdown/index.d.ts +0 -233
- package/dist/dropdown/index.js +0 -2051
- package/dist/dropdown/index.js.map +0 -1
- package/dist/form-field/index.d.ts +0 -186
- package/dist/form-field/index.js +0 -553
- package/dist/form-field/index.js.map +0 -1
- package/dist/icon/index.d.ts +0 -28
- package/dist/icon/index.js +0 -127
- package/dist/icon/index.js.map +0 -1
- package/dist/icon-button/index.d.ts +0 -16
- package/dist/icon-button/index.js +0 -980
- package/dist/icon-button/index.js.map +0 -1
- package/dist/input/index.d.ts +0 -78
- package/dist/input/index.js +0 -724
- package/dist/input/index.js.map +0 -1
- package/dist/kbd/index.d.ts +0 -9
- package/dist/kbd/index.js +0 -47
- package/dist/kbd/index.js.map +0 -1
- package/dist/label/index.d.ts +0 -11
- package/dist/label/index.js +0 -78
- package/dist/label/index.js.map +0 -1
- package/dist/link-box/index.d.ts +0 -34
- package/dist/link-box/index.js +0 -92
- package/dist/link-box/index.js.map +0 -1
- package/dist/pagination/index.d.ts +0 -143
- package/dist/pagination/index.js +0 -1353
- package/dist/pagination/index.js.map +0 -1
- package/dist/popover/index.d.ts +0 -93
- package/dist/popover/index.js +0 -1339
- package/dist/popover/index.js.map +0 -1
- package/dist/portal/index.d.ts +0 -13
- package/dist/portal/index.js +0 -37
- package/dist/portal/index.js.map +0 -1
- package/dist/progress/index.d.ts +0 -48
- package/dist/progress/index.js +0 -223
- package/dist/progress/index.js.map +0 -1
- package/dist/progress-tracker/index.d.ts +0 -80
- package/dist/progress-tracker/index.js +0 -571
- package/dist/progress-tracker/index.js.map +0 -1
- package/dist/radio-group/index.d.ts +0 -100
- package/dist/radio-group/index.js +0 -318
- package/dist/radio-group/index.js.map +0 -1
- package/dist/rating/index.d.ts +0 -78
- package/dist/rating/index.js +0 -363
- package/dist/rating/index.js.map +0 -1
- package/dist/scrolling-list/index.d.ts +0 -118
- package/dist/scrolling-list/index.js +0 -1426
- package/dist/scrolling-list/index.js.map +0 -1
- package/dist/segmented-gauge/index.d.ts +0 -100
- package/dist/segmented-gauge/index.js +0 -277
- package/dist/segmented-gauge/index.js.map +0 -1
- package/dist/select/index.d.ts +0 -167
- package/dist/select/index.js +0 -581
- package/dist/select/index.js.map +0 -1
- package/dist/skeleton/index.d.ts +0 -67
- package/dist/skeleton/index.js +0 -206
- package/dist/skeleton/index.js.map +0 -1
- package/dist/slider/index.d.ts +0 -97
- package/dist/slider/index.js +0 -220
- package/dist/slider/index.js.map +0 -1
- package/dist/slot/index.d.ts +0 -16
- package/dist/slot/index.js +0 -51
- package/dist/slot/index.js.map +0 -1
- package/dist/snackbar/index.d.ts +0 -158
- package/dist/snackbar/index.js +0 -1756
- package/dist/snackbar/index.js.map +0 -1
- package/dist/spinner/index.d.ts +0 -21
- package/dist/spinner/index.js +0 -139
- package/dist/spinner/index.js.map +0 -1
- package/dist/stepper/index.d.ts +0 -81
- package/dist/stepper/index.js +0 -1847
- package/dist/stepper/index.js.map +0 -1
- package/dist/switch/index.d.ts +0 -64
- package/dist/switch/index.js +0 -327
- package/dist/switch/index.js.map +0 -1
- package/dist/tabs/index.d.ts +0 -103
- package/dist/tabs/index.js +0 -1376
- package/dist/tabs/index.js.map +0 -1
- package/dist/tag/index.d.ts +0 -29
- package/dist/tag/index.js +0 -283
- package/dist/tag/index.js.map +0 -1
- package/dist/text-link/index.d.ts +0 -20
- package/dist/text-link/index.js +0 -100
- package/dist/text-link/index.js.map +0 -1
- package/dist/textarea/index.d.ts +0 -57
- package/dist/textarea/index.js +0 -797
- package/dist/textarea/index.js.map +0 -1
- package/dist/toast/index.d.ts +0 -56
- package/dist/toast/index.js +0 -1412
- package/dist/toast/index.js.map +0 -1
- package/dist/visually-hidden/index.d.ts +0 -16
- package/dist/visually-hidden/index.js +0 -67
- package/dist/visually-hidden/index.js.map +0 -1
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ButtonHTMLAttributes, Ref, HTMLAttributes } from 'react';
|
|
3
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
-
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
|
|
6
|
-
declare const radioInputVariants: (props?: ({
|
|
7
|
-
intent?: "main" | "support" | "accent" | "basic" | "success" | "alert" | "error" | "info" | "neutral" | null | undefined;
|
|
8
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
-
type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>;
|
|
10
|
-
|
|
11
|
-
interface RadioInputProps extends RadioInputVariantsProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {
|
|
12
|
-
/**
|
|
13
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
14
|
-
*/
|
|
15
|
-
asChild?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The value given as data when submitted with a name.
|
|
18
|
-
*/
|
|
19
|
-
value: string;
|
|
20
|
-
/**
|
|
21
|
-
* When true, prevents the user from interacting with the radio item.
|
|
22
|
-
*/
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* When true, indicates that the user must check the radio item before the owning form can be submitted.
|
|
26
|
-
*/
|
|
27
|
-
required?: boolean;
|
|
28
|
-
ref?: Ref<HTMLButtonElement>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type RadioProps = RadioInputProps & {
|
|
32
|
-
ref?: Ref<HTMLButtonElement>;
|
|
33
|
-
};
|
|
34
|
-
declare const Radio: {
|
|
35
|
-
({ className, children, id, disabled: disabledProp, ref, ...others }: RadioProps): react_jsx_runtime.JSX.Element;
|
|
36
|
-
displayName: string;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
declare const radioGroupStyles: (props?: ({
|
|
40
|
-
orientation?: "vertical" | "horizontal" | null | undefined;
|
|
41
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
42
|
-
type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>;
|
|
43
|
-
|
|
44
|
-
interface RadioGroupProps extends RadioGroupVariantsProps, Pick<RadioInputVariantsProps, 'intent'>, Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {
|
|
45
|
-
/**
|
|
46
|
-
* Change the component to the HTML tag or custom component of the only child.
|
|
47
|
-
*/
|
|
48
|
-
asChild?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.
|
|
51
|
-
*/
|
|
52
|
-
defaultValue?: string;
|
|
53
|
-
/**
|
|
54
|
-
* The controlled value of the radio item to check. Should be used in conjunction with onValueChange.
|
|
55
|
-
*/
|
|
56
|
-
value?: string;
|
|
57
|
-
/**
|
|
58
|
-
* Event handler called when the value changes.
|
|
59
|
-
*/
|
|
60
|
-
onValueChange?: (value: string) => void;
|
|
61
|
-
/**
|
|
62
|
-
* When true, prevents the user from interacting with radio items.
|
|
63
|
-
*/
|
|
64
|
-
disabled?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* The name of the group. Submitted with its owning form as part of a name/value pair.
|
|
67
|
-
*/
|
|
68
|
-
name?: string;
|
|
69
|
-
/**
|
|
70
|
-
* When true, indicates that the user must check a radio item before the owning form can be submitted.
|
|
71
|
-
*/
|
|
72
|
-
required?: boolean;
|
|
73
|
-
/**
|
|
74
|
-
* The orientation of the component.
|
|
75
|
-
*/
|
|
76
|
-
orientation?: 'horizontal' | 'vertical';
|
|
77
|
-
/**
|
|
78
|
-
* The reading direction of the radio group.
|
|
79
|
-
*/
|
|
80
|
-
dir?: 'ltr' | 'rtl';
|
|
81
|
-
/**
|
|
82
|
-
* When true, keyboard navigation will loop from last item to first, and vice versa.
|
|
83
|
-
*/
|
|
84
|
-
loop?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* When true, the label will be placed on the left side of the Radio
|
|
87
|
-
*/
|
|
88
|
-
reverse?: boolean;
|
|
89
|
-
ref?: Ref<HTMLDivElement>;
|
|
90
|
-
}
|
|
91
|
-
declare const RadioGroup$1: {
|
|
92
|
-
({ orientation, loop, intent, disabled, className, required: requiredProp, reverse, ref, ...others }: RadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
93
|
-
displayName: string;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
declare const RadioGroup: typeof RadioGroup$1 & {
|
|
97
|
-
Radio: typeof Radio;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export { RadioGroup, type RadioGroupProps, type RadioProps };
|
|
@@ -1,318 +0,0 @@
|
|
|
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/radio-group/index.ts
|
|
21
|
-
var radio_group_exports = {};
|
|
22
|
-
__export(radio_group_exports, {
|
|
23
|
-
RadioGroup: () => RadioGroup2
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(radio_group_exports);
|
|
26
|
-
|
|
27
|
-
// src/radio-group/Radio.tsx
|
|
28
|
-
var import_class_variance_authority4 = require("class-variance-authority");
|
|
29
|
-
var import_react2 = require("react");
|
|
30
|
-
|
|
31
|
-
// src/radio-group/RadioGroupContext.tsx
|
|
32
|
-
var import_react = require("react");
|
|
33
|
-
var RadioGroupContext = (0, import_react.createContext)(null);
|
|
34
|
-
var useRadioGroup = () => {
|
|
35
|
-
const context = (0, import_react.useContext)(RadioGroupContext);
|
|
36
|
-
if (!context) {
|
|
37
|
-
throw Error("useRadioGroup must be used within a RadioGroup provider");
|
|
38
|
-
}
|
|
39
|
-
return context;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// src/radio-group/RadioInput.tsx
|
|
43
|
-
var import_form_field = require("@spark-ui/components/form-field");
|
|
44
|
-
var import_radix_ui2 = require("radix-ui");
|
|
45
|
-
|
|
46
|
-
// src/radio-group/RadioIndicator.tsx
|
|
47
|
-
var import_radix_ui = require("radix-ui");
|
|
48
|
-
|
|
49
|
-
// src/radio-group/RadioIndicator.styles.ts
|
|
50
|
-
var import_internal_utils = require("@spark-ui/internal-utils");
|
|
51
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
52
|
-
var radioIndicatorStyles = (0, import_class_variance_authority.cva)(
|
|
53
|
-
[
|
|
54
|
-
"relative block",
|
|
55
|
-
"size-3/5",
|
|
56
|
-
"after:absolute",
|
|
57
|
-
"after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2",
|
|
58
|
-
"after:h-0",
|
|
59
|
-
"after:w-0",
|
|
60
|
-
"after:block",
|
|
61
|
-
"after:rounded-[50%]",
|
|
62
|
-
"after:content-['']",
|
|
63
|
-
"after:transition-all",
|
|
64
|
-
"data-[state=checked]:after:size-full"
|
|
65
|
-
],
|
|
66
|
-
{
|
|
67
|
-
variants: {
|
|
68
|
-
intent: (0, import_internal_utils.makeVariants)({
|
|
69
|
-
main: ["after:bg-main"],
|
|
70
|
-
support: ["after:bg-support"],
|
|
71
|
-
accent: ["after:bg-accent"],
|
|
72
|
-
basic: ["after:bg-basic"],
|
|
73
|
-
neutral: ["after:bg-neutral"],
|
|
74
|
-
success: ["after:bg-success"],
|
|
75
|
-
alert: ["after:bg-alert"],
|
|
76
|
-
error: ["after:bg-error"],
|
|
77
|
-
info: ["after:bg-info"]
|
|
78
|
-
})
|
|
79
|
-
},
|
|
80
|
-
defaultVariants: {
|
|
81
|
-
intent: "basic"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
// src/radio-group/RadioIndicator.tsx
|
|
87
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
88
|
-
var RadioIndicator = ({ intent, className, ref, ...others }) => {
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
-
import_radix_ui.RadioGroup.Indicator,
|
|
91
|
-
{
|
|
92
|
-
ref,
|
|
93
|
-
className: radioIndicatorStyles({ intent, className }),
|
|
94
|
-
...others
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
RadioIndicator.displayName = "RadioGroup.RadioIndicator";
|
|
99
|
-
|
|
100
|
-
// src/radio-group/RadioInput.styles.ts
|
|
101
|
-
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
102
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
103
|
-
var radioInputVariants = (0, import_class_variance_authority2.cva)(
|
|
104
|
-
[
|
|
105
|
-
"flex shrink-0 items-center justify-center",
|
|
106
|
-
"rounded-full",
|
|
107
|
-
"border-md",
|
|
108
|
-
"outline-hidden",
|
|
109
|
-
"hover:ring-4",
|
|
110
|
-
"focus-visible:u-outline",
|
|
111
|
-
"disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent",
|
|
112
|
-
"u-shadow-border-transition",
|
|
113
|
-
"size-sz-24"
|
|
114
|
-
],
|
|
115
|
-
{
|
|
116
|
-
variants: {
|
|
117
|
-
/**
|
|
118
|
-
* Color scheme of the radio input.
|
|
119
|
-
*/
|
|
120
|
-
intent: (0, import_internal_utils2.makeVariants)({
|
|
121
|
-
main: ["border-outline", "data-[state=checked]:border-main", "hover:ring-main-container"],
|
|
122
|
-
support: [
|
|
123
|
-
"border-outline",
|
|
124
|
-
"data-[state=checked]:border-support",
|
|
125
|
-
"hover:ring-support-container"
|
|
126
|
-
],
|
|
127
|
-
accent: [
|
|
128
|
-
"border-outline",
|
|
129
|
-
"data-[state=checked]:border-accent",
|
|
130
|
-
"hover:ring-accent-container"
|
|
131
|
-
],
|
|
132
|
-
basic: [
|
|
133
|
-
"border-outline",
|
|
134
|
-
"data-[state=checked]:border-basic",
|
|
135
|
-
"hover:ring-basic-container"
|
|
136
|
-
],
|
|
137
|
-
neutral: [
|
|
138
|
-
"border-outline",
|
|
139
|
-
"data-[state=checked]:border-neutral",
|
|
140
|
-
"hover:ring-neutral-container"
|
|
141
|
-
],
|
|
142
|
-
info: ["border-info", "data-[state=checked]:border-info", "hover:ring-info-container"],
|
|
143
|
-
success: [
|
|
144
|
-
"border-success",
|
|
145
|
-
"data-[state=checked]:border-success",
|
|
146
|
-
"hover:ring-success-container"
|
|
147
|
-
],
|
|
148
|
-
alert: ["border-alert", "data-[state=checked]:border-alert", "hover:ring-alert-container"],
|
|
149
|
-
error: ["border-error", "data-[state=checked]:border-error", "hover:ring-error-container"]
|
|
150
|
-
})
|
|
151
|
-
},
|
|
152
|
-
defaultVariants: {
|
|
153
|
-
intent: "basic"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
// src/radio-group/RadioInput.tsx
|
|
159
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
160
|
-
var RadioInput = ({ intent: intentProp, className, ref, ...others }) => {
|
|
161
|
-
const { state } = (0, import_form_field.useFormFieldControl)();
|
|
162
|
-
const intent = state ?? intentProp;
|
|
163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
164
|
-
import_radix_ui2.RadioGroup.RadioGroupItem,
|
|
165
|
-
{
|
|
166
|
-
"data-spark-component": "radio-input",
|
|
167
|
-
ref,
|
|
168
|
-
className: radioInputVariants({ intent, className }),
|
|
169
|
-
...others,
|
|
170
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RadioIndicator, { intent, forceMount: true })
|
|
171
|
-
}
|
|
172
|
-
);
|
|
173
|
-
};
|
|
174
|
-
RadioInput.displayName = "RadioGroup.RadioInput";
|
|
175
|
-
|
|
176
|
-
// src/radio-group/RadioLabel.tsx
|
|
177
|
-
var import_radix_ui3 = require("radix-ui");
|
|
178
|
-
|
|
179
|
-
// src/radio-group/RadioLabel.styles.tsx
|
|
180
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
181
|
-
var radioLabelStyles = (0, import_class_variance_authority3.cva)("grow", {
|
|
182
|
-
variants: {
|
|
183
|
-
disabled: {
|
|
184
|
-
true: ["text-neutral/dim-2", "cursor-not-allowed"],
|
|
185
|
-
false: ["cursor-pointer"]
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
defaultVariants: {
|
|
189
|
-
disabled: false
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
// src/radio-group/RadioLabel.tsx
|
|
194
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
195
|
-
var RadioLabel = ({ disabled, ...others }) => {
|
|
196
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
197
|
-
import_radix_ui3.Label.Root,
|
|
198
|
-
{
|
|
199
|
-
"data-spark-component": "radio-label",
|
|
200
|
-
className: radioLabelStyles({ disabled }),
|
|
201
|
-
...others
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
RadioLabel.displayName = "RadioGroup.RadioLabel";
|
|
206
|
-
|
|
207
|
-
// src/radio-group/Radio.tsx
|
|
208
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
209
|
-
var ID_PREFIX = ":radio";
|
|
210
|
-
var Radio = ({
|
|
211
|
-
className,
|
|
212
|
-
children,
|
|
213
|
-
id,
|
|
214
|
-
disabled: disabledProp,
|
|
215
|
-
ref,
|
|
216
|
-
...others
|
|
217
|
-
}) => {
|
|
218
|
-
const innerId = `${ID_PREFIX}-input-${(0, import_react2.useId)()}`;
|
|
219
|
-
const innerLabelId = `${ID_PREFIX}-label-${(0, import_react2.useId)()}`;
|
|
220
|
-
const { intent, disabled, reverse } = useRadioGroup();
|
|
221
|
-
const radioLabel = children && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RadioLabel, { disabled: disabledProp || disabled, htmlFor: id || innerId, id: innerLabelId, children });
|
|
222
|
-
const radioInput = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
223
|
-
RadioInput,
|
|
224
|
-
{
|
|
225
|
-
ref,
|
|
226
|
-
id: id || innerId,
|
|
227
|
-
intent,
|
|
228
|
-
"aria-labelledby": children ? innerLabelId : void 0,
|
|
229
|
-
...others,
|
|
230
|
-
disabled: disabledProp
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
const content = reverse ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
234
|
-
radioLabel,
|
|
235
|
-
radioInput
|
|
236
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
237
|
-
radioInput,
|
|
238
|
-
radioLabel
|
|
239
|
-
] });
|
|
240
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: (0, import_class_variance_authority4.cx)("gap-md text-body-1 flex items-start", className), children: content });
|
|
241
|
-
};
|
|
242
|
-
Radio.displayName = "RadioGroup.Radio";
|
|
243
|
-
|
|
244
|
-
// src/radio-group/RadioGroup.tsx
|
|
245
|
-
var import_form_field2 = require("@spark-ui/components/form-field");
|
|
246
|
-
var import_radix_ui4 = require("radix-ui");
|
|
247
|
-
|
|
248
|
-
// src/radio-group/RadioGroup.styles.ts
|
|
249
|
-
var import_class_variance_authority5 = require("class-variance-authority");
|
|
250
|
-
var radioGroupStyles = (0, import_class_variance_authority5.cva)(["flex"], {
|
|
251
|
-
variants: {
|
|
252
|
-
orientation: {
|
|
253
|
-
vertical: ["flex-col", "gap-lg"],
|
|
254
|
-
horizontal: ["flex-row", "gap-xl"]
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
// src/radio-group/RadioGroupProvider.tsx
|
|
260
|
-
var import_react3 = require("react");
|
|
261
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
262
|
-
var RadioGroupProvider = ({
|
|
263
|
-
intent,
|
|
264
|
-
disabled,
|
|
265
|
-
reverse,
|
|
266
|
-
children
|
|
267
|
-
}) => {
|
|
268
|
-
const value = (0, import_react3.useMemo)(() => ({ intent, disabled, reverse }), [intent, disabled, reverse]);
|
|
269
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(RadioGroupContext.Provider, { value, children });
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
// src/radio-group/RadioGroup.tsx
|
|
273
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
274
|
-
var RadioGroup = ({
|
|
275
|
-
orientation = "vertical",
|
|
276
|
-
loop = true,
|
|
277
|
-
intent = "basic",
|
|
278
|
-
disabled,
|
|
279
|
-
className,
|
|
280
|
-
required: requiredProp,
|
|
281
|
-
reverse = false,
|
|
282
|
-
ref,
|
|
283
|
-
...others
|
|
284
|
-
}) => {
|
|
285
|
-
const { labelId, isInvalid, isRequired, description, name } = (0, import_form_field2.useFormFieldControl)();
|
|
286
|
-
const required = requiredProp !== void 0 ? requiredProp : isRequired;
|
|
287
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RadioGroupProvider, { reverse, intent, disabled, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
288
|
-
import_radix_ui4.RadioGroup.RadioGroup,
|
|
289
|
-
{
|
|
290
|
-
"data-spark-component": "radio-group",
|
|
291
|
-
className: radioGroupStyles({ orientation, className }),
|
|
292
|
-
name,
|
|
293
|
-
ref,
|
|
294
|
-
disabled,
|
|
295
|
-
orientation,
|
|
296
|
-
loop,
|
|
297
|
-
required,
|
|
298
|
-
"aria-labelledby": labelId,
|
|
299
|
-
"aria-invalid": isInvalid,
|
|
300
|
-
"aria-required": required,
|
|
301
|
-
"aria-describedby": description,
|
|
302
|
-
...others
|
|
303
|
-
}
|
|
304
|
-
) });
|
|
305
|
-
};
|
|
306
|
-
RadioGroup.displayName = "RadioGroup";
|
|
307
|
-
|
|
308
|
-
// src/radio-group/index.ts
|
|
309
|
-
var RadioGroup2 = Object.assign(RadioGroup, {
|
|
310
|
-
Radio
|
|
311
|
-
});
|
|
312
|
-
RadioGroup2.displayName = "RadioGroup";
|
|
313
|
-
Radio.displayName = "RadioGroup.Radio";
|
|
314
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
315
|
-
0 && (module.exports = {
|
|
316
|
-
RadioGroup
|
|
317
|
-
});
|
|
318
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/radio-group/index.ts","../../src/radio-group/Radio.tsx","../../src/radio-group/RadioGroupContext.tsx","../../src/radio-group/RadioInput.tsx","../../src/radio-group/RadioIndicator.tsx","../../src/radio-group/RadioIndicator.styles.ts","../../src/radio-group/RadioInput.styles.ts","../../src/radio-group/RadioLabel.tsx","../../src/radio-group/RadioLabel.styles.tsx","../../src/radio-group/RadioGroup.tsx","../../src/radio-group/RadioGroup.styles.ts","../../src/radio-group/RadioGroupProvider.tsx"],"sourcesContent":["import { Radio } from './Radio'\nimport { RadioGroup as Root } from './RadioGroup'\n\nexport const RadioGroup: typeof Root & {\n Radio: typeof Radio\n} = Object.assign(Root, {\n Radio,\n})\n\nRadioGroup.displayName = 'RadioGroup'\nRadio.displayName = 'RadioGroup.Radio'\n\nexport { type RadioGroupProps } from './RadioGroup'\nexport { type RadioProps } from './Radio'\n","import { cx } from 'class-variance-authority'\nimport { Ref, useId } from 'react'\n\nimport { useRadioGroup } from './RadioGroupContext'\nimport { RadioInput, RadioInputProps } from './RadioInput'\nimport { RadioLabel } from './RadioLabel'\n\nexport type RadioProps = RadioInputProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nconst ID_PREFIX = ':radio'\n\nexport const Radio = ({\n className,\n children,\n id,\n disabled: disabledProp,\n ref,\n ...others\n}: RadioProps) => {\n const innerId = `${ID_PREFIX}-input-${useId()}`\n const innerLabelId = `${ID_PREFIX}-label-${useId()}`\n\n const { intent, disabled, reverse } = useRadioGroup()\n\n const radioLabel = children && (\n <RadioLabel disabled={disabledProp || disabled} htmlFor={id || innerId} id={innerLabelId}>\n {children}\n </RadioLabel>\n )\n\n const radioInput = (\n <RadioInput\n ref={ref}\n id={id || innerId}\n intent={intent}\n aria-labelledby={children ? innerLabelId : undefined}\n {...others}\n disabled={disabledProp}\n />\n )\n\n const content = reverse ? (\n <>\n {radioLabel}\n {radioInput}\n </>\n ) : (\n <>\n {radioInput}\n {radioLabel}\n </>\n )\n\n return <div className={cx('gap-md text-body-1 flex items-start', className)}>{content}</div>\n}\n\nRadio.displayName = 'RadioGroup.Radio'\n","import { createContext, useContext } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport type { RadioInputProps } from './RadioInput'\n\nexport type RadioGroupContextState = Pick<RadioInputProps, 'intent' | 'disabled'> &\n Pick<RadioGroupProps, 'reverse'>\n\nexport const RadioGroupContext = createContext<RadioGroupContextState | null>(null)\n\nexport const useRadioGroup = () => {\n const context = useContext(RadioGroupContext)\n\n if (!context) {\n throw Error('useRadioGroup must be used within a RadioGroup provider')\n }\n\n return context\n}\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { ButtonHTMLAttributes, Ref } from 'react'\n\nimport { RadioIndicator } from './RadioIndicator'\nimport { radioInputVariants, RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioInputProps\n extends RadioInputVariantsProps,\n Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value given as data when submitted with a name.\n */\n value: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n /**\n * When true, indicates that the user must check the radio item before the owning form can be submitted.\n */\n required?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const RadioInput = ({ intent: intentProp, className, ref, ...others }: RadioInputProps) => {\n const { state } = useFormFieldControl()\n\n const intent = state ?? intentProp\n\n return (\n <RadixRadioGroup.RadioGroupItem\n data-spark-component=\"radio-input\"\n ref={ref}\n className={radioInputVariants({ intent, className })}\n {...others}\n >\n <RadioIndicator intent={intent} forceMount />\n </RadixRadioGroup.RadioGroupItem>\n )\n}\n\nRadioInput.displayName = 'RadioGroup.RadioInput'\n","import { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { radioIndicatorStyles, RadioIndicatorStylesProps } from './RadioIndicator.styles'\n\nexport interface RadioIndicatorProps extends RadioIndicatorStylesProps {\n className?: string\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true | undefined\n ref?: Ref<HTMLSpanElement>\n}\n\nexport const RadioIndicator = ({ intent, className, ref, ...others }: RadioIndicatorProps) => {\n return (\n <RadixRadioGroup.Indicator\n ref={ref}\n className={radioIndicatorStyles({ intent, className })}\n {...others}\n />\n )\n}\n\nRadioIndicator.displayName = 'RadioGroup.RadioIndicator'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioIndicatorStyles = cva(\n [\n 'relative block',\n 'size-3/5',\n 'after:absolute',\n 'after:left-1/2 after:top-1/2 after:-translate-x-1/2 after:-translate-y-1/2',\n 'after:h-0',\n 'after:w-0',\n 'after:block',\n 'after:rounded-[50%]',\n \"after:content-['']\",\n 'after:transition-all',\n 'data-[state=checked]:after:size-full',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['after:bg-main'],\n support: ['after:bg-support'],\n accent: ['after:bg-accent'],\n basic: ['after:bg-basic'],\n neutral: ['after:bg-neutral'],\n success: ['after:bg-success'],\n alert: ['after:bg-alert'],\n error: ['after:bg-error'],\n info: ['after:bg-info'],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type RadioIndicatorStylesProps = VariantProps<typeof radioIndicatorStyles>\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioInputVariants = cva(\n [\n 'flex shrink-0 items-center justify-center',\n 'rounded-full',\n 'border-md',\n 'outline-hidden',\n 'hover:ring-4',\n 'focus-visible:u-outline',\n 'disabled:cursor-not-allowed disabled:border-outline/dim-2 disabled:hover:ring-transparent',\n 'u-shadow-border-transition',\n 'size-sz-24',\n ],\n {\n variants: {\n /**\n * Color scheme of the radio input.\n */\n intent: makeVariants<\n 'intent',\n ['main', 'support', 'accent', 'basic', 'success', 'alert', 'error', 'info', 'neutral']\n >({\n main: ['border-outline', 'data-[state=checked]:border-main', 'hover:ring-main-container'],\n support: [\n 'border-outline',\n 'data-[state=checked]:border-support',\n 'hover:ring-support-container',\n ],\n accent: [\n 'border-outline',\n 'data-[state=checked]:border-accent',\n 'hover:ring-accent-container',\n ],\n basic: [\n 'border-outline',\n 'data-[state=checked]:border-basic',\n 'hover:ring-basic-container',\n ],\n neutral: [\n 'border-outline',\n 'data-[state=checked]:border-neutral',\n 'hover:ring-neutral-container',\n ],\n info: ['border-info', 'data-[state=checked]:border-info', 'hover:ring-info-container'],\n success: [\n 'border-success',\n 'data-[state=checked]:border-success',\n 'hover:ring-success-container',\n ],\n alert: ['border-alert', 'data-[state=checked]:border-alert', 'hover:ring-alert-container'],\n error: ['border-error', 'data-[state=checked]:border-error', 'hover:ring-error-container'],\n }),\n },\n defaultVariants: {\n intent: 'basic',\n },\n }\n)\n\nexport type RadioInputVariantsProps = VariantProps<typeof radioInputVariants>\n","import { Label } from 'radix-ui'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nimport { radioLabelStyles, RadioLabelStylesProps } from './RadioLabel.styles'\n\nexport interface RadioLabelProps\n extends RadioLabelStylesProps,\n PropsWithChildren<HTMLAttributes<HTMLLabelElement>> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The id of the element the label is associated with.\n */\n htmlFor?: string\n /**\n * When true, prevents the user from interacting with the radio item.\n */\n disabled?: boolean\n}\n\nexport const RadioLabel = ({ disabled, ...others }: RadioLabelProps) => {\n return (\n <Label.Root\n data-spark-component=\"radio-label\"\n className={radioLabelStyles({ disabled })}\n {...others}\n />\n )\n}\n\nRadioLabel.displayName = 'RadioGroup.RadioLabel'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioLabelStyles = cva('grow', {\n variants: {\n disabled: {\n true: ['text-neutral/dim-2', 'cursor-not-allowed'],\n false: ['cursor-pointer'],\n },\n },\n defaultVariants: {\n disabled: false,\n },\n})\n\nexport type RadioLabelStylesProps = VariantProps<typeof radioLabelStyles>\n","import { useFormFieldControl } from '@spark-ui/components/form-field'\nimport { RadioGroup as RadixRadioGroup } from 'radix-ui'\nimport { HTMLAttributes, Ref } from 'react'\n\nimport { radioGroupStyles, RadioGroupVariantsProps } from './RadioGroup.styles'\nimport { RadioGroupProvider } from './RadioGroupProvider'\nimport { RadioInputVariantsProps } from './RadioInput.styles'\n\nexport interface RadioGroupProps\n extends RadioGroupVariantsProps,\n Pick<RadioInputVariantsProps, 'intent'>,\n Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'dir' | 'onChange'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: boolean\n /**\n * The value of the radio item that should be checked when initially rendered. Use when you do not need to control the state of the radio items.\n */\n defaultValue?: string\n /**\n * The controlled value of the radio item to check. Should be used in conjunction with onValueChange.\n */\n value?: string\n /**\n * Event handler called when the value changes.\n */\n onValueChange?: (value: string) => void\n /**\n * When true, prevents the user from interacting with radio items.\n */\n disabled?: boolean\n /**\n * The name of the group. Submitted with its owning form as part of a name/value pair.\n */\n name?: string\n /**\n * When true, indicates that the user must check a radio item before the owning form can be submitted.\n */\n required?: boolean\n /**\n * The orientation of the component.\n */\n orientation?: 'horizontal' | 'vertical'\n /**\n * The reading direction of the radio group.\n */\n dir?: 'ltr' | 'rtl'\n /**\n * When true, keyboard navigation will loop from last item to first, and vice versa.\n */\n loop?: boolean\n /**\n * When true, the label will be placed on the left side of the Radio\n */\n reverse?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const RadioGroup = ({\n orientation = 'vertical',\n loop = true,\n intent = 'basic',\n disabled,\n className,\n required: requiredProp,\n reverse = false,\n ref,\n ...others\n}: RadioGroupProps) => {\n const { labelId, isInvalid, isRequired, description, name } = useFormFieldControl()\n const required = requiredProp !== undefined ? requiredProp : isRequired\n\n return (\n <RadioGroupProvider reverse={reverse} intent={intent} disabled={disabled}>\n <RadixRadioGroup.RadioGroup\n data-spark-component=\"radio-group\"\n className={radioGroupStyles({ orientation, className })}\n name={name}\n ref={ref}\n disabled={disabled}\n orientation={orientation}\n loop={loop}\n required={required}\n aria-labelledby={labelId}\n aria-invalid={isInvalid}\n aria-required={required}\n aria-describedby={description}\n {...others}\n />\n </RadioGroupProvider>\n )\n}\n\nRadioGroup.displayName = 'RadioGroup'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const radioGroupStyles = cva(['flex'], {\n variants: {\n orientation: {\n vertical: ['flex-col', 'gap-lg'],\n horizontal: ['flex-row', 'gap-xl'],\n },\n },\n})\n\nexport type RadioGroupVariantsProps = VariantProps<typeof radioGroupStyles>\n","import { ReactNode, useMemo } from 'react'\n\nimport type { RadioGroupProps } from './RadioGroup'\nimport { RadioGroupContext } from './RadioGroupContext'\nimport type { RadioInputProps } from './RadioInput'\n\nexport interface RadioGroupProviderProps\n extends Pick<RadioInputProps, 'intent' | 'disabled'>,\n Pick<RadioGroupProps, 'reverse'> {\n children: ReactNode\n}\n\nexport const RadioGroupProvider = ({\n intent,\n disabled,\n reverse,\n children,\n}: RadioGroupProviderProps) => {\n const value = useMemo(() => ({ intent, disabled, reverse }), [intent, disabled, reverse])\n\n return <RadioGroupContext.Provider value={value}>{children}</RadioGroupContext.Provider>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,oBAAAA;AAAA;AAAA;;;ACAA,IAAAC,mCAAmB;AACnB,IAAAC,gBAA2B;;;ACD3B,mBAA0C;AAQnC,IAAM,wBAAoB,4BAA6C,IAAI;AAE3E,IAAM,gBAAgB,MAAM;AACjC,QAAM,cAAU,yBAAW,iBAAiB;AAE5C,MAAI,CAAC,SAAS;AACZ,UAAM,MAAM,yDAAyD;AAAA,EACvE;AAEA,SAAO;AACT;;;AClBA,wBAAoC;AACpC,IAAAC,mBAA8C;;;ACD9C,sBAA8C;;;ACA9C,4BAA6B;AAC7B,sCAAkC;AAE3B,IAAM,2BAAuB;AAAA,EAClC;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,YAAQ,oCAGN;AAAA,QACA,MAAM,CAAC,eAAe;AAAA,Q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7D;;;AFsDM,IAAAC,sBAAA;AAhBC,IAAM,aAAa,CAAC;AAAA,EACzB,cAAc;AAAA,EACd,OAAO;AAAA,EACP,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,UAAU;AAAA,EACV;AAAA,EACA,GAAG;AACL,MAAuB;AACrB,QAAM,EAAE,SAAS,WAAW,YAAY,aAAa,KAAK,QAAI,wCAAoB;AAClF,QAAM,WAAW,iBAAiB,SAAY,eAAe;AAE7D,SACE,6CAAC,sBAAmB,SAAkB,QAAgB,UACpD;AAAA,IAAC,iBAAAC,WAAgB;AAAA,IAAhB;AAAA,MACC,wBAAqB;AAAA,MACrB,WAAW,iBAAiB,EAAE,aAAa,UAAU,CAAC;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,mBAAiB;AAAA,MACjB,gBAAc;AAAA,MACd,iBAAe;AAAA,MACf,oBAAkB;AAAA,MACjB,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAEA,WAAW,cAAc;;;AT3FlB,IAAMC,cAET,OAAO,OAAO,YAAM;AAAA,EACtB;AACF,CAAC;AAEDA,YAAW,cAAc;AACzB,MAAM,cAAc;","names":["RadioGroup","import_class_variance_authority","import_react","import_radix_ui","RadixRadioGroup","import_internal_utils","import_class_variance_authority","import_jsx_runtime","RadixRadioGroup","import_radix_ui","import_class_variance_authority","import_jsx_runtime","import_jsx_runtime","import_form_field","import_radix_ui","import_class_variance_authority","import_react","import_jsx_runtime","import_jsx_runtime","RadixRadioGroup","RadioGroup"]}
|
package/dist/rating/index.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { MouseEvent, Ref, PropsWithChildren, ComponentPropsWithRef } from 'react';
|
|
3
|
-
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
|
-
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
|
|
6
|
-
declare const ratingStarStyles: (props?: ({
|
|
7
|
-
disabled?: boolean | null | undefined;
|
|
8
|
-
readOnly?: boolean | null | undefined;
|
|
9
|
-
gap?: "sm" | "md" | null | undefined;
|
|
10
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
|
-
declare const ratingStarIconStyles: (props?: ({
|
|
12
|
-
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
-
design?: "filled" | "outlined" | null | undefined;
|
|
14
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
|
-
type RatingStarstylesProps = Omit<VariantProps<typeof ratingStarStyles>, 'gap'>;
|
|
16
|
-
type RatingStarIconStylesProps = Omit<VariantProps<typeof ratingStarIconStyles>, 'design'>;
|
|
17
|
-
|
|
18
|
-
type StarValue = 0 | 0.5 | 1;
|
|
19
|
-
|
|
20
|
-
interface RatingStarProps extends RatingStarstylesProps, RatingStarIconStylesProps {
|
|
21
|
-
value: StarValue;
|
|
22
|
-
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
23
|
-
onMouseEnter?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
24
|
-
ref?: Ref<HTMLDivElement>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface RatingProps extends PropsWithChildren<ComponentPropsWithRef<'div'>> {
|
|
28
|
-
/**
|
|
29
|
-
* Use the `defaultValue` prop to set the default value of the input, on a from 0 to 5.
|
|
30
|
-
*
|
|
31
|
-
* Use this when you want to use it in an uncontrolled manner
|
|
32
|
-
*/
|
|
33
|
-
defaultValue?: number;
|
|
34
|
-
/**
|
|
35
|
-
* The value is the number of the rating selected, on a scale from 0 to 5.
|
|
36
|
-
*
|
|
37
|
-
* Use this when you want to use it in a controlled manner,
|
|
38
|
-
* in conjunction with the `onValueChange` prop
|
|
39
|
-
*/
|
|
40
|
-
value?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Event handler called when the value changes.
|
|
43
|
-
*/
|
|
44
|
-
onValueChange?: (value: number) => void;
|
|
45
|
-
/**
|
|
46
|
-
* Sets the component as interactive or not.
|
|
47
|
-
* @default undefined
|
|
48
|
-
*/
|
|
49
|
-
readOnly?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* When `true`, prevents the user from interacting.
|
|
52
|
-
* @default false
|
|
53
|
-
*/
|
|
54
|
-
disabled?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Sets the size of the stars.
|
|
57
|
-
* @default 'md'
|
|
58
|
-
*/
|
|
59
|
-
size?: RatingStarProps['size'];
|
|
60
|
-
/**
|
|
61
|
-
* Name of the underlying input.
|
|
62
|
-
* @default undefined
|
|
63
|
-
*/
|
|
64
|
-
name?: string;
|
|
65
|
-
/**
|
|
66
|
-
* id of the underlying input.
|
|
67
|
-
* @default undefined
|
|
68
|
-
*/
|
|
69
|
-
id?: string;
|
|
70
|
-
/**
|
|
71
|
-
* aria-label of the underlying input.
|
|
72
|
-
* @default undefined
|
|
73
|
-
*/
|
|
74
|
-
'aria-label': string;
|
|
75
|
-
}
|
|
76
|
-
declare const Rating: ({ defaultValue, value: propValue, onValueChange, size, disabled, readOnly, name, id, "aria-label": ariaLabel, ref, ...rest }: RatingProps) => react_jsx_runtime.JSX.Element;
|
|
77
|
-
|
|
78
|
-
export { Rating, type RatingProps };
|