@particle-academy/react-fancy 5.7.0 → 5.9.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/index.cjs +21 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/dist/styles.css +269 -255
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes,
|
|
2
|
+
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
@@ -318,7 +318,7 @@ interface AccordionSectionContextValue {
|
|
|
318
318
|
}
|
|
319
319
|
declare function useAccordionSection(): AccordionSectionContextValue;
|
|
320
320
|
|
|
321
|
-
interface FieldProps {
|
|
321
|
+
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
322
322
|
label?: string;
|
|
323
323
|
description?: string;
|
|
324
324
|
error?: string;
|
|
@@ -329,7 +329,7 @@ interface FieldProps {
|
|
|
329
329
|
className?: string;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
declare function Field({ label, description, error, required, htmlFor, size, children, className, }: FieldProps): react.JSX.Element;
|
|
332
|
+
declare function Field({ label, description, error, required, htmlFor, size, children, className, ...rest }: FieldProps): react.JSX.Element;
|
|
333
333
|
|
|
334
334
|
type InputOption<V = string> = string | {
|
|
335
335
|
value: V;
|
|
@@ -441,7 +441,7 @@ interface SelectProps extends InputBaseProps, InputAffixProps, Omit<SelectHTMLAt
|
|
|
441
441
|
|
|
442
442
|
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
443
443
|
|
|
444
|
-
interface CheckboxProps extends Omit<InputBaseProps, "label"> {
|
|
444
|
+
interface CheckboxProps extends Omit<InputBaseProps, "label">, Omit<HTMLAttributes<HTMLDivElement>, "color" | "defaultChecked" | "onChange" | "id"> {
|
|
445
445
|
checked?: boolean;
|
|
446
446
|
defaultChecked?: boolean;
|
|
447
447
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -459,7 +459,7 @@ interface CheckboxGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
|
|
|
459
459
|
orientation?: "horizontal" | "vertical";
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
declare function CheckboxGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, }: CheckboxGroupProps<V>): react.JSX.Element;
|
|
462
|
+
declare function CheckboxGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, ...rest }: CheckboxGroupProps<V>): react.JSX.Element;
|
|
463
463
|
declare namespace CheckboxGroup {
|
|
464
464
|
var displayName: string;
|
|
465
465
|
}
|
|
@@ -472,12 +472,12 @@ interface RadioGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
|
|
|
472
472
|
orientation?: "horizontal" | "vertical";
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
declare function RadioGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, }: RadioGroupProps<V>): react.JSX.Element;
|
|
475
|
+
declare function RadioGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, ...rest }: RadioGroupProps<V>): react.JSX.Element;
|
|
476
476
|
declare namespace RadioGroup {
|
|
477
477
|
var displayName: string;
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
interface SwitchProps extends Omit<InputBaseProps, "label"> {
|
|
480
|
+
interface SwitchProps extends Omit<InputBaseProps, "label">, Omit<HTMLAttributes<HTMLDivElement>, "color" | "defaultChecked" | "onChange" | "id"> {
|
|
481
481
|
checked?: boolean;
|
|
482
482
|
defaultChecked?: boolean;
|
|
483
483
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -523,7 +523,7 @@ interface MultiSwitchProps<V = string> extends InputBaseProps {
|
|
|
523
523
|
linear?: boolean;
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
declare function MultiSwitch<V = string>({ size, dirty, error, label, description, required, disabled, className, id, name, list, value: controlledValue, defaultValue, onValueChange, linear, mode, }: MultiSwitchProps<V>): react.JSX.Element;
|
|
526
|
+
declare function MultiSwitch<V = string>({ size, dirty, error, label, description, required, disabled, className, id, name, list, value: controlledValue, defaultValue, onValueChange, linear, mode, ...rest }: MultiSwitchProps<V>): react.JSX.Element;
|
|
527
527
|
declare namespace MultiSwitch {
|
|
528
528
|
var displayName: string;
|
|
529
529
|
}
|
|
@@ -761,7 +761,7 @@ interface TableBodyProps {
|
|
|
761
761
|
children: ReactNode;
|
|
762
762
|
className?: string;
|
|
763
763
|
}
|
|
764
|
-
interface TableRowProps {
|
|
764
|
+
interface TableRowProps extends Omit<HTMLAttributes<HTMLTableRowElement>, "onClick"> {
|
|
765
765
|
children: ReactNode;
|
|
766
766
|
className?: string;
|
|
767
767
|
onClick?: () => void;
|
|
@@ -807,7 +807,7 @@ declare function TableHead({ children, className }: TableHeadProps): react.JSX.E
|
|
|
807
807
|
|
|
808
808
|
declare function TableBody({ children, className }: TableBodyProps): react.JSX.Element;
|
|
809
809
|
|
|
810
|
-
declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, }: TableRowProps): react.JSX.Element;
|
|
810
|
+
declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, ...rest }: TableRowProps): react.JSX.Element;
|
|
811
811
|
|
|
812
812
|
declare function TableCell({ children, className, header, ...rest }: TableCellProps): react.JSX.Element;
|
|
813
813
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes,
|
|
2
|
+
import { ElementType, ButtonHTMLAttributes, AnchorHTMLAttributes, ReactNode, HTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, FormHTMLAttributes, TdHTMLAttributes, ComponentType, CSSProperties, ReactElement, RefObject } from 'react';
|
|
3
3
|
import { ClassValue } from 'clsx';
|
|
4
4
|
|
|
5
5
|
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
@@ -318,7 +318,7 @@ interface AccordionSectionContextValue {
|
|
|
318
318
|
}
|
|
319
319
|
declare function useAccordionSection(): AccordionSectionContextValue;
|
|
320
320
|
|
|
321
|
-
interface FieldProps {
|
|
321
|
+
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
322
322
|
label?: string;
|
|
323
323
|
description?: string;
|
|
324
324
|
error?: string;
|
|
@@ -329,7 +329,7 @@ interface FieldProps {
|
|
|
329
329
|
className?: string;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
declare function Field({ label, description, error, required, htmlFor, size, children, className, }: FieldProps): react.JSX.Element;
|
|
332
|
+
declare function Field({ label, description, error, required, htmlFor, size, children, className, ...rest }: FieldProps): react.JSX.Element;
|
|
333
333
|
|
|
334
334
|
type InputOption<V = string> = string | {
|
|
335
335
|
value: V;
|
|
@@ -441,7 +441,7 @@ interface SelectProps extends InputBaseProps, InputAffixProps, Omit<SelectHTMLAt
|
|
|
441
441
|
|
|
442
442
|
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLSelectElement>>;
|
|
443
443
|
|
|
444
|
-
interface CheckboxProps extends Omit<InputBaseProps, "label"> {
|
|
444
|
+
interface CheckboxProps extends Omit<InputBaseProps, "label">, Omit<HTMLAttributes<HTMLDivElement>, "color" | "defaultChecked" | "onChange" | "id"> {
|
|
445
445
|
checked?: boolean;
|
|
446
446
|
defaultChecked?: boolean;
|
|
447
447
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -459,7 +459,7 @@ interface CheckboxGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
|
|
|
459
459
|
orientation?: "horizontal" | "vertical";
|
|
460
460
|
}
|
|
461
461
|
|
|
462
|
-
declare function CheckboxGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, }: CheckboxGroupProps<V>): react.JSX.Element;
|
|
462
|
+
declare function CheckboxGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, ...rest }: CheckboxGroupProps<V>): react.JSX.Element;
|
|
463
463
|
declare namespace CheckboxGroup {
|
|
464
464
|
var displayName: string;
|
|
465
465
|
}
|
|
@@ -472,12 +472,12 @@ interface RadioGroupProps<V = string> extends Omit<InputBaseProps, "id"> {
|
|
|
472
472
|
orientation?: "horizontal" | "vertical";
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
-
declare function RadioGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, }: RadioGroupProps<V>): react.JSX.Element;
|
|
475
|
+
declare function RadioGroup<V = string>({ size, dirty, error, label, description, required, disabled, className, name, list, value: controlledValue, defaultValue, onValueChange, orientation, mode, ...rest }: RadioGroupProps<V>): react.JSX.Element;
|
|
476
476
|
declare namespace RadioGroup {
|
|
477
477
|
var displayName: string;
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
interface SwitchProps extends Omit<InputBaseProps, "label"> {
|
|
480
|
+
interface SwitchProps extends Omit<InputBaseProps, "label">, Omit<HTMLAttributes<HTMLDivElement>, "color" | "defaultChecked" | "onChange" | "id"> {
|
|
481
481
|
checked?: boolean;
|
|
482
482
|
defaultChecked?: boolean;
|
|
483
483
|
onCheckedChange?: (checked: boolean) => void;
|
|
@@ -523,7 +523,7 @@ interface MultiSwitchProps<V = string> extends InputBaseProps {
|
|
|
523
523
|
linear?: boolean;
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
-
declare function MultiSwitch<V = string>({ size, dirty, error, label, description, required, disabled, className, id, name, list, value: controlledValue, defaultValue, onValueChange, linear, mode, }: MultiSwitchProps<V>): react.JSX.Element;
|
|
526
|
+
declare function MultiSwitch<V = string>({ size, dirty, error, label, description, required, disabled, className, id, name, list, value: controlledValue, defaultValue, onValueChange, linear, mode, ...rest }: MultiSwitchProps<V>): react.JSX.Element;
|
|
527
527
|
declare namespace MultiSwitch {
|
|
528
528
|
var displayName: string;
|
|
529
529
|
}
|
|
@@ -761,7 +761,7 @@ interface TableBodyProps {
|
|
|
761
761
|
children: ReactNode;
|
|
762
762
|
className?: string;
|
|
763
763
|
}
|
|
764
|
-
interface TableRowProps {
|
|
764
|
+
interface TableRowProps extends Omit<HTMLAttributes<HTMLTableRowElement>, "onClick"> {
|
|
765
765
|
children: ReactNode;
|
|
766
766
|
className?: string;
|
|
767
767
|
onClick?: () => void;
|
|
@@ -807,7 +807,7 @@ declare function TableHead({ children, className }: TableHeadProps): react.JSX.E
|
|
|
807
807
|
|
|
808
808
|
declare function TableBody({ children, className }: TableBodyProps): react.JSX.Element;
|
|
809
809
|
|
|
810
|
-
declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, }: TableRowProps): react.JSX.Element;
|
|
810
|
+
declare function TableRow({ children, className, onClick, tray, trayTriggerPosition, expanded: controlledExpanded, defaultExpanded, onExpandedChange, ...rest }: TableRowProps): react.JSX.Element;
|
|
811
811
|
|
|
812
812
|
declare function TableCell({ children, className, header, ...rest }: TableCellProps): react.JSX.Element;
|
|
813
813
|
|
package/dist/index.js
CHANGED
|
@@ -2993,9 +2993,10 @@ function Field({
|
|
|
2993
2993
|
htmlFor,
|
|
2994
2994
|
size = "md",
|
|
2995
2995
|
children,
|
|
2996
|
-
className
|
|
2996
|
+
className,
|
|
2997
|
+
...rest
|
|
2997
2998
|
}) {
|
|
2998
|
-
return /* @__PURE__ */ jsxs("div", { "data-react-fancy-field": "", className: cn("flex flex-col gap-2", className), children: [
|
|
2999
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, "data-react-fancy-field": "", className: cn("flex flex-col gap-2", className), children: [
|
|
2999
3000
|
label && /* @__PURE__ */ jsxs(
|
|
3000
3001
|
"label",
|
|
3001
3002
|
{
|
|
@@ -4096,7 +4097,8 @@ var Checkbox = forwardRef(
|
|
|
4096
4097
|
defaultChecked = false,
|
|
4097
4098
|
onCheckedChange,
|
|
4098
4099
|
indeterminate,
|
|
4099
|
-
mode
|
|
4100
|
+
mode,
|
|
4101
|
+
...rest
|
|
4100
4102
|
}, ref) => {
|
|
4101
4103
|
const autoId = useId();
|
|
4102
4104
|
const checkboxId = id ?? autoId;
|
|
@@ -4122,7 +4124,7 @@ var Checkbox = forwardRef(
|
|
|
4122
4124
|
xl: "h-6 w-6"
|
|
4123
4125
|
}[size];
|
|
4124
4126
|
const glyph = indeterminate ? "\u2014" : checked ? "\u2713" : "\u2715";
|
|
4125
|
-
return /* @__PURE__ */ jsxs("div", { "data-react-fancy-checkbox": "", className: cn("flex items-start gap-2", className), children: [
|
|
4127
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, "data-react-fancy-checkbox": "", className: cn("flex items-start gap-2", className), children: [
|
|
4126
4128
|
!showControl ? /* @__PURE__ */ jsx(
|
|
4127
4129
|
"span",
|
|
4128
4130
|
{
|
|
@@ -4213,7 +4215,8 @@ function CheckboxGroup({
|
|
|
4213
4215
|
defaultValue = [],
|
|
4214
4216
|
onValueChange,
|
|
4215
4217
|
orientation = "vertical",
|
|
4216
|
-
mode
|
|
4218
|
+
mode,
|
|
4219
|
+
...rest
|
|
4217
4220
|
}) {
|
|
4218
4221
|
const groupId = useId();
|
|
4219
4222
|
const resolvedMode = useFieldMode(mode);
|
|
@@ -4237,6 +4240,7 @@ function CheckboxGroup({
|
|
|
4237
4240
|
const content = !showControl ? /* @__PURE__ */ jsx(DisplayValue, { size, interactive, onActivate: enterEdit, children: list.map(resolveOption).filter((o) => value.includes(o.value)).map((o) => o.label).join(", ") }) : /* @__PURE__ */ jsx(
|
|
4238
4241
|
"div",
|
|
4239
4242
|
{
|
|
4243
|
+
...rest,
|
|
4240
4244
|
"data-react-fancy-checkbox-group": "",
|
|
4241
4245
|
onBlur: (e) => {
|
|
4242
4246
|
if (interactive && !e.currentTarget.contains(e.relatedTarget)) exitEdit();
|
|
@@ -4319,7 +4323,8 @@ function RadioGroup({
|
|
|
4319
4323
|
defaultValue,
|
|
4320
4324
|
onValueChange,
|
|
4321
4325
|
orientation = "vertical",
|
|
4322
|
-
mode
|
|
4326
|
+
mode,
|
|
4327
|
+
...rest
|
|
4323
4328
|
}) {
|
|
4324
4329
|
const groupId = useId();
|
|
4325
4330
|
const radioName = name ?? groupId;
|
|
@@ -4341,6 +4346,7 @@ function RadioGroup({
|
|
|
4341
4346
|
const content = !showControl ? /* @__PURE__ */ jsx(DisplayValue, { size, interactive, onActivate: enterEdit, children: list.map(resolveOption).find((o) => o.value === value)?.label }) : /* @__PURE__ */ jsx(
|
|
4342
4347
|
"div",
|
|
4343
4348
|
{
|
|
4349
|
+
...rest,
|
|
4344
4350
|
"data-react-fancy-radio-group": "",
|
|
4345
4351
|
role: "radiogroup",
|
|
4346
4352
|
onBlur: (e) => {
|
|
@@ -4452,7 +4458,8 @@ var Switch = forwardRef(
|
|
|
4452
4458
|
defaultChecked = false,
|
|
4453
4459
|
onCheckedChange,
|
|
4454
4460
|
color = "blue",
|
|
4455
|
-
mode
|
|
4461
|
+
mode,
|
|
4462
|
+
...rest
|
|
4456
4463
|
}, ref) => {
|
|
4457
4464
|
const autoId = useId();
|
|
4458
4465
|
const switchId = id ?? autoId;
|
|
@@ -4484,7 +4491,7 @@ var Switch = forwardRef(
|
|
|
4484
4491
|
lg: "translate-x-5",
|
|
4485
4492
|
xl: "translate-x-6"
|
|
4486
4493
|
}[size];
|
|
4487
|
-
return /* @__PURE__ */ jsxs("div", { "data-react-fancy-switch": "", className: cn("flex items-start gap-2", className), children: [
|
|
4494
|
+
return /* @__PURE__ */ jsxs("div", { ...rest, "data-react-fancy-switch": "", className: cn("flex items-start gap-2", className), children: [
|
|
4488
4495
|
!showControl ? /* @__PURE__ */ jsx(
|
|
4489
4496
|
"span",
|
|
4490
4497
|
{
|
|
@@ -4852,7 +4859,8 @@ function MultiSwitch({
|
|
|
4852
4859
|
defaultValue,
|
|
4853
4860
|
onValueChange,
|
|
4854
4861
|
linear,
|
|
4855
|
-
mode
|
|
4862
|
+
mode,
|
|
4863
|
+
...rest
|
|
4856
4864
|
}) {
|
|
4857
4865
|
const resolvedOptions = list.map(resolveOption);
|
|
4858
4866
|
const fallback = defaultValue ?? resolvedOptions[0]?.value;
|
|
@@ -4886,6 +4894,7 @@ function MultiSwitch({
|
|
|
4886
4894
|
"div",
|
|
4887
4895
|
{
|
|
4888
4896
|
ref: containerRef,
|
|
4897
|
+
...rest,
|
|
4889
4898
|
"data-react-fancy-multi-switch": "",
|
|
4890
4899
|
role: "radiogroup",
|
|
4891
4900
|
id,
|
|
@@ -5987,7 +5996,8 @@ function TableRow({
|
|
|
5987
5996
|
trayTriggerPosition = "end",
|
|
5988
5997
|
expanded: controlledExpanded,
|
|
5989
5998
|
defaultExpanded = false,
|
|
5990
|
-
onExpandedChange
|
|
5999
|
+
onExpandedChange,
|
|
6000
|
+
...rest
|
|
5991
6001
|
}) {
|
|
5992
6002
|
const [expanded, setExpanded] = useControllableState(
|
|
5993
6003
|
controlledExpanded,
|
|
@@ -6026,6 +6036,7 @@ function TableRow({
|
|
|
6026
6036
|
/* @__PURE__ */ jsxs(
|
|
6027
6037
|
"tr",
|
|
6028
6038
|
{
|
|
6039
|
+
...rest,
|
|
6029
6040
|
"data-react-fancy-table-row": "",
|
|
6030
6041
|
className: cn(
|
|
6031
6042
|
"transition-colors hover:bg-zinc-50 dark:hover:bg-zinc-800/50",
|