@jbpark/ui-kit 2.2.2 → 2.3.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/Menu.d.mts +1 -1
- package/dist/Menu.mjs +1 -1
- package/dist/Reveals.d.mts +1 -1
- package/dist/Typography.d.mts +1 -1
- package/dist/{index-BQHdyc27.d.mts → index-CKq4NOxI.d.mts} +10 -10
- package/dist/{index-BbwB0IAD.d.mts → index-CXT7Z-4F.d.mts} +4 -4
- package/dist/{index-D2igfkiF.d.mts → index-DrfCF4Ya.d.mts} +2 -2
- package/dist/index.d.mts +120 -70
- package/dist/index.mjs +1 -1
- package/dist/output.css +256 -0
- package/dist/{src-DZ7IYc6G.mjs → src-MBsIpDyP.mjs} +276 -41
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as renderConditional, t as cn } from "./utils-CssUrKWE.mjs";
|
|
2
2
|
import { t as Typography_default } from "./Typography-GMk9208W.mjs";
|
|
3
|
-
import { ArrowUp, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronUpIcon, CircleIcon, CircleQuestionMark, CircleX, Info, Loader2, LoaderCircle, OctagonAlert, OctagonX, Search, Square, SquareCheck, X, XIcon } from "lucide-react";
|
|
3
|
+
import { ArrowUp, Check, CheckIcon, ChevronDown, ChevronDownIcon, ChevronUpIcon, Circle, CircleCheck, CircleIcon, CircleQuestionMark, CircleX, Info, Loader2, LoaderCircle, OctagonAlert, OctagonX, Search, Square, SquareCheck, X, XIcon } from "lucide-react";
|
|
4
4
|
import React, { Children, createElement, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
5
5
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -9,10 +9,9 @@ import { cva } from "class-variance-authority";
|
|
|
9
9
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
10
10
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
11
11
|
import { Drawer } from "vaul";
|
|
12
|
-
import
|
|
12
|
+
import { Label, RadioGroup, Select, Separator } from "radix-ui";
|
|
13
13
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
14
14
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
15
|
-
import { RadioGroup, Select } from "radix-ui";
|
|
16
15
|
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
17
16
|
import { HexColorPicker } from "react-colorful";
|
|
18
17
|
import { useIntersectionObserver, useThrottle, useWindowScroll } from "@uidotdev/usehooks";
|
|
@@ -380,6 +379,141 @@ function DrawerDescription$1({ className, ...props }) {
|
|
|
380
379
|
});
|
|
381
380
|
}
|
|
382
381
|
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/core/field.tsx
|
|
384
|
+
var field_exports = /* @__PURE__ */ __exportAll({
|
|
385
|
+
Field: () => Field$1,
|
|
386
|
+
FieldContent: () => FieldContent,
|
|
387
|
+
FieldDescription: () => FieldDescription,
|
|
388
|
+
FieldError: () => FieldError,
|
|
389
|
+
FieldGroup: () => FieldGroup,
|
|
390
|
+
FieldLabel: () => FieldLabel$1,
|
|
391
|
+
FieldLegend: () => FieldLegend,
|
|
392
|
+
FieldSeparator: () => FieldSeparator,
|
|
393
|
+
FieldSet: () => FieldSet,
|
|
394
|
+
FieldTitle: () => FieldTitle
|
|
395
|
+
});
|
|
396
|
+
const { Label: Label$3 } = label_exports;
|
|
397
|
+
const { Separator: Separator$2 } = separator_exports;
|
|
398
|
+
function FieldSet({ className, ...props }) {
|
|
399
|
+
return /* @__PURE__ */ jsx("fieldset", {
|
|
400
|
+
"data-slot": "field-set",
|
|
401
|
+
className: cn("flex flex-col gap-6", `has-[>[data-slot=checkbox-group]]:gap-3
|
|
402
|
+
has-[>[data-slot=radio-group]]:gap-3`, className),
|
|
403
|
+
...props
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
407
|
+
return /* @__PURE__ */ jsx("legend", {
|
|
408
|
+
"data-slot": "field-legend",
|
|
409
|
+
"data-variant": variant,
|
|
410
|
+
className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
|
|
411
|
+
...props
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function FieldGroup({ className, ...props }) {
|
|
415
|
+
return /* @__PURE__ */ jsx("div", {
|
|
416
|
+
"data-slot": "field-group",
|
|
417
|
+
className: cn(`group/field-group @container/field-group flex w-full flex-col gap-7
|
|
418
|
+
data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4`, className),
|
|
419
|
+
...props
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
423
|
+
variants: { orientation: {
|
|
424
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
425
|
+
horizontal: [
|
|
426
|
+
"flex-row items-center",
|
|
427
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
428
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
429
|
+
],
|
|
430
|
+
responsive: [
|
|
431
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
432
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
433
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
434
|
+
]
|
|
435
|
+
} },
|
|
436
|
+
defaultVariants: { orientation: "vertical" }
|
|
437
|
+
});
|
|
438
|
+
function Field$1({ className, orientation = "vertical", ...props }) {
|
|
439
|
+
return /* @__PURE__ */ jsx("div", {
|
|
440
|
+
role: "group",
|
|
441
|
+
"data-slot": "field",
|
|
442
|
+
"data-orientation": orientation,
|
|
443
|
+
className: cn(fieldVariants({ orientation }), className),
|
|
444
|
+
...props
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
function FieldContent({ className, ...props }) {
|
|
448
|
+
return /* @__PURE__ */ jsx("div", {
|
|
449
|
+
"data-slot": "field-content",
|
|
450
|
+
className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
|
|
451
|
+
...props
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
function FieldLabel$1({ className, ...props }) {
|
|
455
|
+
return /* @__PURE__ */ jsx(Label$3, {
|
|
456
|
+
"data-slot": "field-label",
|
|
457
|
+
className: cn(`group/field-label peer/field-label flex w-fit gap-2 leading-snug
|
|
458
|
+
group-data-[disabled=true]/field:opacity-50`, `has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col
|
|
459
|
+
has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border
|
|
460
|
+
[&>*]:data-[slot=field]:p-4`, `has-data-[state=checked]:bg-primary/5
|
|
461
|
+
has-data-[state=checked]:border-primary
|
|
462
|
+
dark:has-data-[state=checked]:bg-primary/10`, className),
|
|
463
|
+
...props
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
function FieldTitle({ className, ...props }) {
|
|
467
|
+
return /* @__PURE__ */ jsx("div", {
|
|
468
|
+
"data-slot": "field-label",
|
|
469
|
+
className: cn(`flex w-fit items-center gap-2 text-sm leading-snug font-medium
|
|
470
|
+
group-data-[disabled=true]/field:opacity-50`, className),
|
|
471
|
+
...props
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function FieldDescription({ className, ...props }) {
|
|
475
|
+
return /* @__PURE__ */ jsx("p", {
|
|
476
|
+
"data-slot": "field-description",
|
|
477
|
+
className: cn(`text-muted-foreground text-sm leading-normal font-normal
|
|
478
|
+
group-has-[[data-orientation=horizontal]]/field:text-balance`, "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
|
|
479
|
+
...props
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
483
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
484
|
+
"data-slot": "field-separator",
|
|
485
|
+
"data-content": !!children,
|
|
486
|
+
className: cn(`relative -my-2 h-5 text-sm
|
|
487
|
+
group-data-[variant=outline]/field-group:-mb-2`, className),
|
|
488
|
+
...props,
|
|
489
|
+
children: [/* @__PURE__ */ jsx(Separator$2, { className: "absolute inset-0 top-1/2" }), children && /* @__PURE__ */ jsx("span", {
|
|
490
|
+
className: "bg-background text-muted-foreground relative mx-auto block\n w-fit px-2",
|
|
491
|
+
"data-slot": "field-separator-content",
|
|
492
|
+
children
|
|
493
|
+
})]
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
497
|
+
const content = useMemo(() => {
|
|
498
|
+
if (children) return children;
|
|
499
|
+
if (!errors?.length) return null;
|
|
500
|
+
const uniqueErrors = [...new Map(errors.map((error) => [error?.message, error])).values()];
|
|
501
|
+
if (uniqueErrors?.length == 1) return uniqueErrors[0]?.message;
|
|
502
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
503
|
+
className: "ml-4 flex list-disc flex-col gap-1",
|
|
504
|
+
children: uniqueErrors.map((error, index) => error?.message && /* @__PURE__ */ jsx("li", { children: error.message }, index))
|
|
505
|
+
});
|
|
506
|
+
}, [children, errors]);
|
|
507
|
+
if (!content) return null;
|
|
508
|
+
return /* @__PURE__ */ jsx("div", {
|
|
509
|
+
role: "alert",
|
|
510
|
+
"data-slot": "field-error",
|
|
511
|
+
className: cn("text-destructive text-sm font-normal", className),
|
|
512
|
+
...props,
|
|
513
|
+
children: content
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
383
517
|
//#endregion
|
|
384
518
|
//#region src/core/input.tsx
|
|
385
519
|
var input_exports = /* @__PURE__ */ __exportAll({ Input: () => Input$1 });
|
|
@@ -404,7 +538,7 @@ function Input$1({ className, type, ...props }) {
|
|
|
404
538
|
//#region src/core/label.tsx
|
|
405
539
|
var label_exports = /* @__PURE__ */ __exportAll({ Label: () => Label$2 });
|
|
406
540
|
function Label$2({ className, ...props }) {
|
|
407
|
-
return /* @__PURE__ */ jsx(
|
|
541
|
+
return /* @__PURE__ */ jsx(Label.Root, {
|
|
408
542
|
"data-slot": "label",
|
|
409
543
|
className: cn(`flex items-center gap-2 text-sm leading-none font-medium select-none
|
|
410
544
|
group-data-[disabled=true]:pointer-events-none
|
|
@@ -504,10 +638,10 @@ function Progress$1({ className, value, barClassName, barStyle, ...props }) {
|
|
|
504
638
|
//#endregion
|
|
505
639
|
//#region src/core/radio-group.tsx
|
|
506
640
|
var radio_group_exports = /* @__PURE__ */ __exportAll({
|
|
507
|
-
RadioGroup: () => RadioGroup$
|
|
641
|
+
RadioGroup: () => RadioGroup$2,
|
|
508
642
|
RadioGroupItem: () => RadioGroupItem
|
|
509
643
|
});
|
|
510
|
-
function RadioGroup$
|
|
644
|
+
function RadioGroup$2({ className, ...props }) {
|
|
511
645
|
return /* @__PURE__ */ jsx(RadioGroup.Root, {
|
|
512
646
|
"data-slot": "radio-group",
|
|
513
647
|
className: cn("grid gap-3", className),
|
|
@@ -666,6 +800,21 @@ function SelectScrollDownButton({ className, ...props }) {
|
|
|
666
800
|
});
|
|
667
801
|
}
|
|
668
802
|
|
|
803
|
+
//#endregion
|
|
804
|
+
//#region src/core/separator.tsx
|
|
805
|
+
var separator_exports = /* @__PURE__ */ __exportAll({ Separator: () => Separator$1 });
|
|
806
|
+
function Separator$1({ className, orientation = "horizontal", decorative = true, ...props }) {
|
|
807
|
+
return /* @__PURE__ */ jsx(Separator.Root, {
|
|
808
|
+
"data-slot": "separator",
|
|
809
|
+
decorative,
|
|
810
|
+
orientation,
|
|
811
|
+
className: cn(`bg-border shrink-0 data-[orientation=horizontal]:h-px
|
|
812
|
+
data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full
|
|
813
|
+
data-[orientation=vertical]:w-px`, className),
|
|
814
|
+
...props
|
|
815
|
+
});
|
|
816
|
+
}
|
|
817
|
+
|
|
669
818
|
//#endregion
|
|
670
819
|
//#region src/core/skeleton.tsx
|
|
671
820
|
var skeleton_exports = /* @__PURE__ */ __exportAll({ Skeleton: () => Skeleton$1 });
|
|
@@ -737,15 +886,15 @@ const variantClasses = {
|
|
|
737
886
|
};
|
|
738
887
|
const sizesClasses = {
|
|
739
888
|
small: "h-6 px-3 text-sm",
|
|
740
|
-
|
|
889
|
+
middle: "h-8 px-4 text-base",
|
|
741
890
|
large: "h-10 px-5 text-lg"
|
|
742
891
|
};
|
|
743
892
|
const iconSizes = {
|
|
744
893
|
small: "size-6",
|
|
745
|
-
|
|
894
|
+
middle: "size-8",
|
|
746
895
|
large: "size-10"
|
|
747
896
|
};
|
|
748
|
-
const Button$1 = ({ icon, className, variant = "solid", size = "
|
|
897
|
+
const Button$1 = ({ icon, className, variant = "solid", size = "middle", color = "default", block = false, disabled, loading, danger, children, onMouseDown, ...props }) => {
|
|
749
898
|
const iconOnly = icon && !children;
|
|
750
899
|
const computedColor = danger ? "danger" : color;
|
|
751
900
|
const colored = computedColor && computedColor !== "default";
|
|
@@ -754,7 +903,7 @@ const Button$1 = ({ icon, className, variant = "solid", size = "medium", color =
|
|
|
754
903
|
disabled,
|
|
755
904
|
variant: "default",
|
|
756
905
|
"data-color": computedColor,
|
|
757
|
-
className: cn("inline-flex items-center justify-center gap-x-2", "rounded-lg", "cursor-pointer", "h-auto py-0", "transition-all", variantClasses[variant || "solid"], sizesClasses[size || "
|
|
906
|
+
className: cn("inline-flex items-center justify-center gap-x-2", "rounded-lg", "cursor-pointer", "h-auto py-0", "transition-all", variantClasses[variant || "solid"], sizesClasses[size || "middle"], iconOnly && iconSizes[size || "middle"], block && "w-full", colored && (variant === "solid" ? [
|
|
758
907
|
"bg-(--btn-bg)",
|
|
759
908
|
"hover:bg-(--btn-bg-hover)",
|
|
760
909
|
"active:bg-(--btn-bg-active)",
|
|
@@ -773,7 +922,7 @@ var Button_default$1 = Button$1;
|
|
|
773
922
|
|
|
774
923
|
//#endregion
|
|
775
924
|
//#region src/components/atoms/Checkbox/Group/index.tsx
|
|
776
|
-
const Group = ({
|
|
925
|
+
const Group = ({ orientation = "vertical", placement = "left", className, classNames = {}, options: _options = [], defaultValue, value: _value, onChange: _onChange = () => {} }) => {
|
|
777
926
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue || []);
|
|
778
927
|
const controlled = _value !== void 0;
|
|
779
928
|
const value = controlled ? _value : uncontrolledValue;
|
|
@@ -787,8 +936,8 @@ const Group = ({ direction = "vertical", placement = "left", className, classNam
|
|
|
787
936
|
_onChange(nextValue);
|
|
788
937
|
};
|
|
789
938
|
return /* @__PURE__ */ jsx("ul", {
|
|
790
|
-
className: cn(
|
|
791
|
-
children: options.map((item
|
|
939
|
+
className: cn(orientation === "vertical" ? "space-y-2" : "flex gap-2", className),
|
|
940
|
+
children: options.map((item) => {
|
|
792
941
|
const checked = value.includes(item.value);
|
|
793
942
|
return /* @__PURE__ */ jsx("li", {
|
|
794
943
|
className: cn("flex", classNames?.wrapper),
|
|
@@ -800,23 +949,25 @@ const Group = ({ direction = "vertical", placement = "left", className, classNam
|
|
|
800
949
|
onChange: (checked$1) => onChange(checked$1, item.value),
|
|
801
950
|
children: item.label
|
|
802
951
|
})
|
|
803
|
-
},
|
|
952
|
+
}, String(item.value));
|
|
804
953
|
})
|
|
805
954
|
});
|
|
806
955
|
};
|
|
807
|
-
var Group_default = Group;
|
|
956
|
+
var Group_default$1 = Group;
|
|
808
957
|
|
|
809
958
|
//#endregion
|
|
810
959
|
//#region src/components/atoms/Checkbox/index.tsx
|
|
811
960
|
const { Checkbox: CoreCheckbox } = checkbox_exports;
|
|
812
961
|
const { Label: CoreLabel } = label_exports;
|
|
813
|
-
const Checkbox = ({ placement = "left", value = "", children, className, icons, defaultChecked, checked: _checked, onChange: _onChange = () => {}, ...props }) => {
|
|
962
|
+
const Checkbox = ({ placement = "left", value = "", children, className, icons, disabled, defaultChecked, checked: _checked, onChange: _onChange = () => {}, ...props }) => {
|
|
814
963
|
const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked || false);
|
|
815
964
|
const reactId = useId();
|
|
816
965
|
const id = typeof value === "boolean" || !value ? reactId : String(value);
|
|
817
966
|
const controlled = _checked !== void 0;
|
|
818
967
|
const checked = controlled ? _checked : uncontrolledChecked;
|
|
968
|
+
const cursorClassName = disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
819
969
|
const onChange = (next) => {
|
|
970
|
+
if (disabled) return;
|
|
820
971
|
if (!controlled) setUncontrolledChecked(next);
|
|
821
972
|
_onChange(next);
|
|
822
973
|
};
|
|
@@ -831,34 +982,35 @@ const Checkbox = ({ placement = "left", value = "", children, className, icons,
|
|
|
831
982
|
}
|
|
832
983
|
}),
|
|
833
984
|
/* @__PURE__ */ jsx("span", {
|
|
834
|
-
className: "
|
|
985
|
+
className: cn(cursorClassName, disabled && "opacity-50"),
|
|
835
986
|
onClick: () => {
|
|
836
987
|
document.getElementById(id)?.click();
|
|
837
988
|
},
|
|
838
989
|
children: checked ? icons.checked ?? /* @__PURE__ */ jsx(SquareCheck, {}) : icons.unchecked ?? /* @__PURE__ */ jsx(Square, {})
|
|
839
990
|
}),
|
|
840
991
|
children && /* @__PURE__ */ jsx("label", {
|
|
841
|
-
className: "
|
|
992
|
+
className: cn(cursorClassName, disabled && "opacity-50"),
|
|
842
993
|
htmlFor: id,
|
|
843
994
|
children
|
|
844
995
|
})
|
|
845
996
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CoreCheckbox, {
|
|
846
997
|
id,
|
|
847
998
|
checked,
|
|
848
|
-
|
|
999
|
+
disabled,
|
|
1000
|
+
className: cn(cursorClassName),
|
|
849
1001
|
onCheckedChange: onChange
|
|
850
1002
|
}), children && /* @__PURE__ */ jsx(CoreLabel, {
|
|
851
1003
|
htmlFor: id,
|
|
852
|
-
className: "
|
|
1004
|
+
className: cn(cursorClassName, "text-left"),
|
|
853
1005
|
children
|
|
854
1006
|
})] });
|
|
855
1007
|
return /* @__PURE__ */ jsx("div", {
|
|
856
|
-
className: cn("flex items-center gap-x-2", placement === "right" && "flex-row-reverse", className),
|
|
1008
|
+
className: cn("flex items-center gap-x-2", placement === "right" && "flex-row-reverse", cursorClassName, className),
|
|
857
1009
|
...props,
|
|
858
1010
|
children: renderContent
|
|
859
1011
|
});
|
|
860
1012
|
};
|
|
861
|
-
Checkbox.Group = Group_default;
|
|
1013
|
+
Checkbox.Group = Group_default$1;
|
|
862
1014
|
var Checkbox_default = Checkbox;
|
|
863
1015
|
|
|
864
1016
|
//#endregion
|
|
@@ -1233,23 +1385,104 @@ const Progress = ({ value, className, direction = "horizontal", classNames }) =>
|
|
|
1233
1385
|
};
|
|
1234
1386
|
var Progress_default = Progress;
|
|
1235
1387
|
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/components/atoms/Radio/Group/index.tsx
|
|
1390
|
+
const RadioGroup$1 = ({ orientation = "vertical", placement = "left", className, classNames = {}, options: _options = [], defaultValue, value: _value, onChange: _onChange = () => {} }) => {
|
|
1391
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
1392
|
+
const controlled = _value !== void 0;
|
|
1393
|
+
const value = controlled ? _value : uncontrolledValue;
|
|
1394
|
+
const options = _options.map((item) => typeof item === "object" ? item : {
|
|
1395
|
+
label: `${item}`,
|
|
1396
|
+
value: item
|
|
1397
|
+
});
|
|
1398
|
+
const onChange = (checked, optionValue) => {
|
|
1399
|
+
if (!checked) return;
|
|
1400
|
+
if (!controlled) setUncontrolledValue(optionValue);
|
|
1401
|
+
_onChange(optionValue);
|
|
1402
|
+
};
|
|
1403
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1404
|
+
className: cn(orientation === "vertical" ? "space-y-2" : "flex gap-2", className),
|
|
1405
|
+
children: options.map((item) => {
|
|
1406
|
+
const checked = value === item.value;
|
|
1407
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1408
|
+
className: cn("flex", classNames?.wrapper),
|
|
1409
|
+
children: /* @__PURE__ */ jsx(Radio_default, {
|
|
1410
|
+
placement,
|
|
1411
|
+
className: cn(classNames?.item),
|
|
1412
|
+
value: item.value,
|
|
1413
|
+
checked,
|
|
1414
|
+
onChange: (checked$1) => onChange(checked$1, item.value),
|
|
1415
|
+
children: item.label
|
|
1416
|
+
})
|
|
1417
|
+
}, String(item.value));
|
|
1418
|
+
})
|
|
1419
|
+
});
|
|
1420
|
+
};
|
|
1421
|
+
var Group_default = RadioGroup$1;
|
|
1422
|
+
|
|
1236
1423
|
//#endregion
|
|
1237
1424
|
//#region src/components/atoms/Radio/index.tsx
|
|
1238
1425
|
const { RadioGroup: Core$3, RadioGroupItem: Item$3 } = radio_group_exports;
|
|
1239
|
-
const {
|
|
1240
|
-
const Radio = ({ children }) => {
|
|
1241
|
-
const
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1426
|
+
const { Field, FieldLabel } = field_exports;
|
|
1427
|
+
const Radio = ({ placement = "left", value = "", children, className, icons, disabled, defaultChecked, checked: _checked, onChange: _onChange = () => {}, ...props }) => {
|
|
1428
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked || false);
|
|
1429
|
+
const reactId = useId();
|
|
1430
|
+
const id = typeof value === "boolean" || !value ? reactId : String(value);
|
|
1431
|
+
const controlled = _checked !== void 0;
|
|
1432
|
+
const checked = controlled ? _checked : uncontrolledChecked;
|
|
1433
|
+
const cursorClassName = disabled ? "cursor-not-allowed" : "cursor-pointer";
|
|
1434
|
+
const onChange = (next) => {
|
|
1435
|
+
if (disabled) return;
|
|
1436
|
+
if (!controlled) setUncontrolledChecked(next);
|
|
1437
|
+
_onChange(next);
|
|
1438
|
+
};
|
|
1439
|
+
const renderContent = icons ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1440
|
+
/* @__PURE__ */ jsx("input", {
|
|
1441
|
+
id,
|
|
1442
|
+
hidden: true,
|
|
1443
|
+
type: "radio",
|
|
1444
|
+
checked,
|
|
1445
|
+
onChange: (e) => {
|
|
1446
|
+
onChange(e.target.checked);
|
|
1447
|
+
}
|
|
1448
|
+
}),
|
|
1449
|
+
/* @__PURE__ */ jsx("span", {
|
|
1450
|
+
className: cn(cursorClassName, disabled && "opacity-50"),
|
|
1451
|
+
onClick: () => {
|
|
1452
|
+
document.getElementById(id)?.click();
|
|
1453
|
+
},
|
|
1454
|
+
children: checked ? icons.checked ?? /* @__PURE__ */ jsx(CircleCheck, {}) : icons.unchecked ?? /* @__PURE__ */ jsx(Circle, {})
|
|
1455
|
+
}),
|
|
1456
|
+
children && /* @__PURE__ */ jsx("label", {
|
|
1457
|
+
className: cn(cursorClassName, disabled && "opacity-50"),
|
|
1248
1458
|
htmlFor: id,
|
|
1249
|
-
children
|
|
1250
|
-
})
|
|
1251
|
-
})
|
|
1459
|
+
children
|
|
1460
|
+
})
|
|
1461
|
+
] }) : /* @__PURE__ */ jsx(Core$3, {
|
|
1462
|
+
value: checked ? id : "",
|
|
1463
|
+
onValueChange: () => onChange(true),
|
|
1464
|
+
children: /* @__PURE__ */ jsxs(Field, {
|
|
1465
|
+
orientation: "horizontal",
|
|
1466
|
+
className: cn("flex", placement === "right" && "flex-row-reverse"),
|
|
1467
|
+
"data-disabled": disabled,
|
|
1468
|
+
children: [/* @__PURE__ */ jsx(Item$3, {
|
|
1469
|
+
value: id,
|
|
1470
|
+
id,
|
|
1471
|
+
checked,
|
|
1472
|
+
disabled
|
|
1473
|
+
}), /* @__PURE__ */ jsx(FieldLabel, {
|
|
1474
|
+
htmlFor: id,
|
|
1475
|
+
children
|
|
1476
|
+
})]
|
|
1477
|
+
})
|
|
1478
|
+
});
|
|
1479
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1480
|
+
className: cn("flex items-center gap-x-2", icons && placement === "right" && "flex-row-reverse", cursorClassName, className),
|
|
1481
|
+
...props,
|
|
1482
|
+
children: renderContent
|
|
1483
|
+
});
|
|
1252
1484
|
};
|
|
1485
|
+
Radio.Group = Group_default;
|
|
1253
1486
|
var Radio_default = Radio;
|
|
1254
1487
|
|
|
1255
1488
|
//#endregion
|
|
@@ -1433,7 +1666,7 @@ var Collapse_default = Collapse;
|
|
|
1433
1666
|
|
|
1434
1667
|
//#endregion
|
|
1435
1668
|
//#region src/components/molecules/Menu/Item/Label/index.tsx
|
|
1436
|
-
const Label = ({ children, className, ...props }) => {
|
|
1669
|
+
const Label$1 = ({ children, className, ...props }) => {
|
|
1437
1670
|
if (typeof children === "string") return /* @__PURE__ */ jsx(Typography_default.Text, {
|
|
1438
1671
|
className: cn(className),
|
|
1439
1672
|
...props,
|
|
@@ -1441,7 +1674,7 @@ const Label = ({ children, className, ...props }) => {
|
|
|
1441
1674
|
});
|
|
1442
1675
|
return children;
|
|
1443
1676
|
};
|
|
1444
|
-
var Label_default = Label;
|
|
1677
|
+
var Label_default = Label$1;
|
|
1445
1678
|
|
|
1446
1679
|
//#endregion
|
|
1447
1680
|
//#region src/components/molecules/Menu/Item/index.tsx
|
|
@@ -5416,10 +5649,11 @@ var Item_default$1 = Item$1;
|
|
|
5416
5649
|
//#region src/components/molecules/Marquees/index.tsx
|
|
5417
5650
|
const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = true, ...props }) => {
|
|
5418
5651
|
const [width, setWidth] = useState("100vw");
|
|
5652
|
+
const [padding, setPadding] = useState(0);
|
|
5419
5653
|
const [pause, setPause] = useState(false);
|
|
5420
5654
|
const throttledWidth = useThrottle(width, 200);
|
|
5421
5655
|
const { size } = useResponsiveSize();
|
|
5422
|
-
const
|
|
5656
|
+
const containerRef = useRef(null);
|
|
5423
5657
|
const hoverEvents = pauseOnHover ? {
|
|
5424
5658
|
onMouseEnter: () => {
|
|
5425
5659
|
setPause(true);
|
|
@@ -5428,9 +5662,10 @@ const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = tru
|
|
|
5428
5662
|
setPause(false);
|
|
5429
5663
|
}
|
|
5430
5664
|
} : {};
|
|
5431
|
-
const maxWidth = typeof throttledWidth === "string" ? "100%" : Math.min(throttledWidth, innerSize.width);
|
|
5432
5665
|
useEffect(() => {
|
|
5433
|
-
if (!size.width) return;
|
|
5666
|
+
if (!size.width || !containerRef.current) return;
|
|
5667
|
+
const computedStyle = getComputedStyle(containerRef.current);
|
|
5668
|
+
setPadding((parseFloat(computedStyle.paddingLeft) || 0) + (parseFloat(computedStyle.paddingRight) || 0));
|
|
5434
5669
|
setWidth(size.width);
|
|
5435
5670
|
}, [size]);
|
|
5436
5671
|
useEffect(() => {
|
|
@@ -5443,13 +5678,13 @@ const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = tru
|
|
|
5443
5678
|
};
|
|
5444
5679
|
}, []);
|
|
5445
5680
|
return /* @__PURE__ */ jsx("div", {
|
|
5446
|
-
ref:
|
|
5681
|
+
ref: containerRef,
|
|
5447
5682
|
className: cn(className),
|
|
5448
5683
|
...hoverEvents,
|
|
5449
5684
|
...props,
|
|
5450
5685
|
children: /* @__PURE__ */ jsx("div", {
|
|
5451
5686
|
className: cn("flex flex-col gap-y-5", "overflow-hidden", "whitespace-nowrap", "bg-inherit"),
|
|
5452
|
-
style: { width:
|
|
5687
|
+
style: { width: typeof throttledWidth === "number" ? throttledWidth - padding : throttledWidth },
|
|
5453
5688
|
children: items?.map(({ children, key: itemKey, ...item }, key) => /* @__PURE__ */ jsx(Item_default$1, {
|
|
5454
5689
|
width: throttledWidth,
|
|
5455
5690
|
pause,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbpark/ui-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Modern React UI component library built with TypeScript, Tailwind CSS, and Radix UI. Featuring atoms, molecules, organisms and layout templates for building beautiful interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|