@jbpark/ui-kit 9.1.1 → 10.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/README.ko.md +18 -17
- package/README.md +18 -17
- package/dist/Button.d.mts +1 -1
- package/dist/Button.d.mts.map +1 -1
- package/dist/Button.mjs +4 -5
- package/dist/Button.mjs.map +1 -1
- package/dist/Tag.d.mts.map +1 -1
- package/dist/Tag.mjs.map +1 -1
- package/dist/components/atoms/checkbox/checkbox.mjs.map +1 -1
- package/dist/components/atoms/option-group.mjs.map +1 -1
- package/dist/components/atoms/popover.d.mts +3 -1
- package/dist/components/atoms/popover.d.mts.map +1 -1
- package/dist/components/atoms/popover.mjs +10 -111
- package/dist/components/atoms/popover.mjs.map +1 -1
- package/dist/components/atoms/progress.mjs +3 -4
- package/dist/components/atoms/progress.mjs.map +1 -1
- package/dist/components/atoms/radio/context.mjs +2 -2
- package/dist/components/atoms/radio/context.mjs.map +1 -1
- package/dist/components/atoms/radio/group.mjs +6 -6
- package/dist/components/atoms/radio/group.mjs.map +1 -1
- package/dist/components/atoms/radio/radio.d.mts +2 -5
- package/dist/components/atoms/radio/radio.d.mts.map +1 -1
- package/dist/components/atoms/radio/radio.mjs +0 -1
- package/dist/components/atoms/radio/radio.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/content-classes.mjs +1 -1
- package/dist/components/atoms/rich-text-editor/content-classes.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/rich-text-editor.mjs +1 -1
- package/dist/components/atoms/rich-text-editor/rich-text-editor.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/toolbar-button.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/toolbar-presets.mjs.map +1 -1
- package/dist/components/atoms/rich-text-editor/toolbar.mjs +1 -1
- package/dist/components/atoms/rich-text-editor/toolbar.mjs.map +1 -1
- package/dist/components/atoms/select.mjs +5 -1
- package/dist/components/atoms/select.mjs.map +1 -1
- package/dist/components/atoms/skeleton/node.mjs +1 -1
- package/dist/components/atoms/skeleton/node.mjs.map +1 -1
- package/dist/components/atoms/skeleton/skeleton.mjs +2 -2
- package/dist/components/atoms/skeleton/skeleton.mjs.map +1 -1
- package/dist/components/atoms/slider/slider.mjs.map +1 -1
- package/dist/components/atoms/switch.d.mts +1 -1
- package/dist/components/atoms/switch.d.mts.map +1 -1
- package/dist/components/atoms/switch.mjs +3 -3
- package/dist/components/atoms/switch.mjs.map +1 -1
- package/dist/components/molecules/collapse.mjs +3 -10
- package/dist/components/molecules/collapse.mjs.map +1 -1
- package/dist/components/molecules/reveals/reveals.mjs +1 -1
- package/dist/components/molecules/reveals/reveals.mjs.map +1 -1
- package/dist/components/organisms/drawer.d.mts +1 -2
- package/dist/components/organisms/drawer.d.mts.map +1 -1
- package/dist/components/organisms/drawer.mjs +5 -7
- package/dist/components/organisms/drawer.mjs.map +1 -1
- package/dist/components/organisms/modal.d.mts.map +1 -1
- package/dist/components/organisms/modal.mjs +1 -3
- package/dist/components/organisms/modal.mjs.map +1 -1
- package/dist/components/templates/container.d.mts +4 -3
- package/dist/components/templates/container.d.mts.map +1 -1
- package/dist/components/templates/container.mjs +10 -6
- package/dist/components/templates/container.mjs.map +1 -1
- package/dist/components/templates/index.d.mts +13 -0
- package/dist/components/templates/layout/content.d.mts +4 -3
- package/dist/components/templates/layout/content.d.mts.map +1 -1
- package/dist/components/templates/layout/content.mjs +14 -9
- package/dist/components/templates/layout/content.mjs.map +1 -1
- package/dist/core/accordion.d.mts +1 -1
- package/dist/core/accordion.mjs +12 -12
- package/dist/core/accordion.mjs.map +1 -1
- package/dist/core/badge.d.mts +5 -17
- package/dist/core/badge.d.mts.map +1 -1
- package/dist/core/badge.mjs +12 -21
- package/dist/core/badge.mjs.map +1 -1
- package/dist/core/button.d.mts +7 -6
- package/dist/core/button.d.mts.map +1 -1
- package/dist/core/button.mjs +4 -4
- package/dist/core/button.mjs.map +1 -1
- package/dist/core/calendar.mjs +2 -1
- package/dist/core/calendar.mjs.map +1 -1
- package/dist/core/checkbox.d.mts +1 -1
- package/dist/core/checkbox.mjs +14 -14
- package/dist/core/checkbox.mjs.map +1 -1
- package/dist/core/dialog.d.mts +1 -1
- package/dist/core/dialog.mjs +25 -33
- package/dist/core/dialog.mjs.map +1 -1
- package/dist/core/drawer.d.mts +1 -1
- package/dist/core/drawer.mjs +45 -46
- package/dist/core/drawer.mjs.map +1 -1
- package/dist/core/label.d.mts +1 -2
- package/dist/core/label.mjs +1 -3
- package/dist/core/label.mjs.map +1 -1
- package/dist/core/popover.d.mts +1 -1
- package/dist/core/popover.mjs +42 -37
- package/dist/core/popover.mjs.map +1 -1
- package/dist/core/progress.d.mts +1 -1
- package/dist/core/progress.mjs +7 -10
- package/dist/core/progress.mjs.map +1 -1
- package/dist/core/radio-group.d.mts +3 -7
- package/dist/core/radio-group.mjs +14 -13
- package/dist/core/radio-group.mjs.map +1 -1
- package/dist/core/select.d.mts +7 -3
- package/dist/core/select.d.mts.map +1 -1
- package/dist/core/select.mjs +60 -56
- package/dist/core/select.mjs.map +1 -1
- package/dist/core/separator.d.mts +1 -1
- package/dist/core/separator.mjs +6 -5
- package/dist/core/separator.mjs.map +1 -1
- package/dist/core/slider.d.mts +1 -1
- package/dist/core/slider.mjs +38 -27
- package/dist/core/slider.mjs.map +1 -1
- package/dist/core/switch.d.mts +1 -1
- package/dist/core/switch.mjs +15 -15
- package/dist/core/switch.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/lib/z-layers.mjs +4 -6
- package/dist/lib/z-layers.mjs.map +1 -1
- package/dist/providers/config/config.mjs +2 -2
- package/dist/providers/config/config.mjs.map +1 -1
- package/dist/style.css +327 -462
- package/package.json +7 -20
- package/dist/core/radio-group.d.mts.map +0 -1
|
@@ -6,19 +6,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
//#region src/components/molecules/collapse.tsx
|
|
7
7
|
const { Accordion, AccordionItem, AccordionTrigger, AccordionContent } = accordion_exports;
|
|
8
8
|
const Collapse = ({ expandIcon, accordion = false, items = [], className, classNames, defaultActiveKey, activeKey: _activeKey, onChange: _onChange, ...props }) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
type: "single",
|
|
12
|
-
onValueChange: (value) => {
|
|
13
|
-
_onChange?.(value ? [value] : []);
|
|
14
|
-
},
|
|
15
|
-
...controlled ? { value: `${_activeKey?.[0] ?? ""}` } : { defaultValue: `${defaultActiveKey?.[0] ?? ""}` }
|
|
16
|
-
} : {
|
|
17
|
-
type: "multiple",
|
|
9
|
+
const accordionProps = {
|
|
10
|
+
multiple: !accordion,
|
|
18
11
|
onValueChange: (values) => {
|
|
19
12
|
_onChange?.(values);
|
|
20
13
|
},
|
|
21
|
-
...
|
|
14
|
+
..._activeKey !== void 0 ? { value: (_activeKey ?? []).map((key) => `${key}`) } : { defaultValue: (defaultActiveKey ?? []).map((key) => `${key}`) }
|
|
22
15
|
};
|
|
23
16
|
return /* @__PURE__ */ jsx(Accordion, {
|
|
24
17
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapse.mjs","names":["accordion"],"sources":["../../../src/components/molecules/collapse.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { accordion } from '../../core';\n\nconst { Accordion, AccordionItem, AccordionTrigger, AccordionContent } =\n accordion;\n\ninterface Item {\n key: React.Key;\n label: React.ReactNode;\n disabled?: boolean;\n children: React.ReactNode;\n}\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'defaultValue' | 'value' | 'dir'\n> {\n items?: Item[];\n accordion?: boolean;\n expandIcon?: React.ReactNode;\n classNames?: {\n item?: string;\n header?: string;\n body?: string;\n };\n defaultActiveKey?: string[] | number[];\n activeKey?: string[] | number[];\n onChange?: (keys: string[]) => void;\n}\n\nconst Collapse = ({\n expandIcon,\n accordion = false,\n items = [],\n className,\n classNames,\n defaultActiveKey,\n activeKey: _activeKey,\n onChange: _onChange,\n ...props\n}: Props) => {\n const controlled = _activeKey !== undefined;\n\n
|
|
1
|
+
{"version":3,"file":"collapse.mjs","names":["accordion"],"sources":["../../../src/components/molecules/collapse.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { accordion } from '../../core';\n\nconst { Accordion, AccordionItem, AccordionTrigger, AccordionContent } =\n accordion;\n\ninterface Item {\n key: React.Key;\n label: React.ReactNode;\n disabled?: boolean;\n children: React.ReactNode;\n}\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'onChange' | 'defaultValue' | 'value' | 'dir'\n> {\n items?: Item[];\n accordion?: boolean;\n expandIcon?: React.ReactNode;\n classNames?: {\n item?: string;\n header?: string;\n body?: string;\n };\n defaultActiveKey?: string[] | number[];\n activeKey?: string[] | number[];\n onChange?: (keys: string[]) => void;\n}\n\nconst Collapse = ({\n expandIcon,\n accordion = false,\n items = [],\n className,\n classNames,\n defaultActiveKey,\n activeKey: _activeKey,\n onChange: _onChange,\n ...props\n}: Props) => {\n const controlled = _activeKey !== undefined;\n\n // Base UI's accordion has no `type` and always models the open set as an\n // array; `multiple` (default false) is the only single-vs-multiple switch.\n // `accordion` here means \"one panel open at a time\", so `multiple = !accordion`.\n const accordionProps = {\n multiple: !accordion,\n onValueChange: (values: string[]) => {\n _onChange?.(values);\n },\n ...(controlled\n ? { value: (_activeKey ?? []).map(key => `${key}`) }\n : { defaultValue: (defaultActiveKey ?? []).map(key => `${key}`) }),\n };\n\n return (\n <Accordion {...props} className={className} {...accordionProps}>\n {items.map(({ key, label, children, disabled }) => (\n <AccordionItem\n key={key}\n value={String(key)}\n className={cn(\n 'border-none',\n classNames?.item,\n //\n )}\n disabled={disabled}\n >\n <AccordionTrigger\n className={cn(\n 'hover:no-underline',\n classNames?.header,\n disabled && 'cursor-no-drop opacity-50',\n //\n )}\n expandIcon={expandIcon}\n disabled={disabled}\n >\n {label}\n </AccordionTrigger>\n <AccordionContent\n className={cn(\n classNames?.body,\n //\n )}\n >\n {children}\n </AccordionContent>\n </AccordionItem>\n ))}\n </Accordion>\n );\n};\n\nexport default Collapse;\n"],"mappings":";;;;;;AAQA,MAAM,EAAE,WAAW,eAAe,kBAAkB,qBAClDA;AA0BF,MAAM,YAAY,EAChB,YACA,YAAY,OACZ,QAAQ,CAAC,GACT,WACA,YACA,kBACA,WAAW,YACX,UAAU,WACV,GAAG,YACQ;CAMX,MAAM,iBAAiB;EACrB,UAAU,CAAC;EACX,gBAAgB,WAAqB;GACnC,YAAY,MAAM;EACpB;EACA,GAViB,eAAe,KAAA,IAW5B,EAAE,QAAQ,cAAc,CAAC,EAAA,CAAG,KAAI,QAAO,GAAG,KAAK,EAAE,IACjD,EAAE,eAAe,oBAAoB,CAAC,EAAA,CAAG,KAAI,QAAO,GAAG,KAAK,EAAE;CACpE;CAEA,OACE,oBAAC,WAAD;EAAW,GAAI;EAAkB;EAAW,GAAI;EAC7C,UAAA,MAAM,KAAK,EAAE,KAAK,OAAO,UAAU,eAClC,qBAAC,eAAD;GAEE,OAAO,OAAO,GAAG;GACjB,WAAW,GACT,eACA,YAAY,IAEd;GACU;GARZ,UAAA,CAUE,oBAAC,kBAAD;IACE,WAAW,GACT,sBACA,YAAY,QACZ,YAAY,2BAEd;IACY;IACF;IAET,UAAA;GACe,CAAA,GAClB,oBAAC,kBAAD;IACE,WAAW,GACT,YAAY,IAEd;IAEC;GACe,CAAA,CACL;EA7BR,GAAA,GA6BQ,CAChB;CACQ,CAAA;AAEf"}
|
|
@@ -20,7 +20,7 @@ const Reveals = ({ children, className, classNames, items = [], cascade = CASCAD
|
|
|
20
20
|
children: item.children
|
|
21
21
|
}, index));
|
|
22
22
|
return /* @__PURE__ */ jsx("div", {
|
|
23
|
-
className: cn("flex gap-5", className, classNames?.root),
|
|
23
|
+
className: cn("flex flex-wrap gap-5", className, classNames?.root),
|
|
24
24
|
...props,
|
|
25
25
|
children: renderItems(children ? Children.toArray(children).map((child) => ({ children: child })) : items)
|
|
26
26
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reveals.mjs","names":[],"sources":["../../../../src/components/molecules/reveals/reveals.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Item, { type ItemProps } from './item';\n\nexport interface Props\n extends React.ComponentPropsWithoutRef<'div'>, ItemProps {\n cascade?: number;\n classNames?: {\n root?: string;\n item?: string;\n };\n once?: boolean;\n items?: ItemProps[];\n}\n\nexport const DURATION = 0.6;\nexport const DELAY = 0;\nexport const CASCADE = 0.1;\n\nconst Reveals = ({\n children,\n className,\n classNames,\n items = [],\n cascade = CASCADE,\n duration = DURATION,\n delay = DELAY,\n effect,\n once,\n viewport,\n variants,\n transition,\n ...props\n}: Props) => {\n const renderItems = (items: ItemProps[]) =>\n items.map((item, index) => (\n <Item\n key={index}\n effect={effect}\n duration={duration}\n delay={delay + cascade * index}\n once={once}\n viewport={viewport}\n variants={variants}\n transition={transition}\n {...item}\n className={cn(\n item.className,\n classNames?.item,\n //\n )}\n >\n {item.children}\n </Item>\n ));\n\n return (\n <div\n className={cn(\n 'flex gap-5',\n className,\n classNames?.root,\n //\n )}\n {...props}\n >\n {renderItems(\n children\n ? Children.toArray(children).map(child => ({\n children: child,\n }))\n : items,\n )}\n </div>\n );\n};\n\nexport default Reveals;\n"],"mappings":";;;;;AAiBA,MAAa,WAAW;AACxB,MAAa,QAAQ;AACrB,MAAa,UAAU;AAEvB,MAAM,WAAW,EACf,UACA,WACA,YACA,QAAQ,CAAC,GACT,UAAU,SACV,WAAW,UACX,QAAA,GACA,QACA,MACA,UACA,UACA,YACA,GAAG,YACQ;CACX,MAAM,eAAe,UACnB,MAAM,KAAK,MAAM,UACf,oBAAC,MAAD;EAEU;EACE;EACV,OAAO,QAAQ,UAAU;EACnB;EACI;EACA;EACE;EACZ,GAAI;EACJ,WAAW,GACT,KAAK,WACL,YAAY,IAEd;EAEC,UAAA,KAAK;CACF,GAhBC,KAgBD,CACP;CAEH,OACE,oBAAC,OAAD;EACE,WAAW,GACT,
|
|
1
|
+
{"version":3,"file":"reveals.mjs","names":[],"sources":["../../../../src/components/molecules/reveals/reveals.tsx"],"sourcesContent":["import { Children } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Item, { type ItemProps } from './item';\n\nexport interface Props\n extends React.ComponentPropsWithoutRef<'div'>, ItemProps {\n cascade?: number;\n classNames?: {\n root?: string;\n item?: string;\n };\n once?: boolean;\n items?: ItemProps[];\n}\n\nexport const DURATION = 0.6;\nexport const DELAY = 0;\nexport const CASCADE = 0.1;\n\nconst Reveals = ({\n children,\n className,\n classNames,\n items = [],\n cascade = CASCADE,\n duration = DURATION,\n delay = DELAY,\n effect,\n once,\n viewport,\n variants,\n transition,\n ...props\n}: Props) => {\n const renderItems = (items: ItemProps[]) =>\n items.map((item, index) => (\n <Item\n key={index}\n effect={effect}\n duration={duration}\n delay={delay + cascade * index}\n once={once}\n viewport={viewport}\n variants={variants}\n transition={transition}\n {...item}\n className={cn(\n item.className,\n classNames?.item,\n //\n )}\n >\n {item.children}\n </Item>\n ));\n\n return (\n <div\n className={cn(\n 'flex flex-wrap gap-5',\n className,\n classNames?.root,\n //\n )}\n {...props}\n >\n {renderItems(\n children\n ? Children.toArray(children).map(child => ({\n children: child,\n }))\n : items,\n )}\n </div>\n );\n};\n\nexport default Reveals;\n"],"mappings":";;;;;AAiBA,MAAa,WAAW;AACxB,MAAa,QAAQ;AACrB,MAAa,UAAU;AAEvB,MAAM,WAAW,EACf,UACA,WACA,YACA,QAAQ,CAAC,GACT,UAAU,SACV,WAAW,UACX,QAAA,GACA,QACA,MACA,UACA,UACA,YACA,GAAG,YACQ;CACX,MAAM,eAAe,UACnB,MAAM,KAAK,MAAM,UACf,oBAAC,MAAD;EAEU;EACE;EACV,OAAO,QAAQ,UAAU;EACnB;EACI;EACA;EACE;EACZ,GAAI;EACJ,WAAW,GACT,KAAK,WACL,YAAY,IAEd;EAEC,UAAA,KAAK;CACF,GAhBC,KAgBD,CACP;CAEH,OACE,oBAAC,OAAD;EACE,WAAW,GACT,wBACA,WACA,YAAY,IAEd;EACA,GAAI;EAEH,UAAA,YACC,WACI,SAAS,QAAQ,QAAQ,CAAC,CAAC,KAAI,WAAU,EACvC,UAAU,MACZ,EAAE,IACF,KACN;CACG,CAAA;AAET"}
|
|
@@ -11,7 +11,6 @@ interface Props {
|
|
|
11
11
|
size?: 'small' | 'medium' | 'large' | 'full' | string;
|
|
12
12
|
maskClosable?: boolean;
|
|
13
13
|
handlebar?: boolean;
|
|
14
|
-
draggable?: boolean;
|
|
15
14
|
rounded?: boolean;
|
|
16
15
|
mask?: boolean;
|
|
17
16
|
className?: string;
|
|
@@ -30,7 +29,7 @@ interface Props {
|
|
|
30
29
|
container?: HTMLElement;
|
|
31
30
|
onClose: () => void;
|
|
32
31
|
}
|
|
33
|
-
declare const Drawer: ({ open, title, extra, footer, closable, closeIcon, direction, size, maskClosable, handlebar,
|
|
32
|
+
declare const Drawer: ({ open, title, extra, footer, closable, closeIcon, direction, size, maskClosable, handlebar, rounded, mask, className, classNames, style, children, container, onClose, ...props }: Props) => import("react").JSX.Element;
|
|
34
33
|
//#endregion
|
|
35
34
|
export { Props, Drawer as default };
|
|
36
35
|
//# sourceMappingURL=drawer.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.mts","names":[],"sources":["../../../src/components/organisms/drawer.tsx"],"mappings":";UA2CiB;EACf;EACA,WAAW,MAAM;EACjB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,SAAS,MAAM;EACf;EACA,YAAY,MAAM;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA
|
|
1
|
+
{"version":3,"file":"drawer.d.mts","names":[],"sources":["../../../src/components/organisms/drawer.tsx"],"mappings":";UA2CiB;EACf;EACA,WAAW,MAAM;EACjB,QAAQ,MAAM;EACd,QAAQ,MAAM;EACd,SAAS,MAAM;EACf;EACA,YAAY,MAAM;EAClB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ,MAAM;EACd;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF,YAAY;EACZ;;cA8BI,WAAU,MAAA,OAAA,OAAA,QAAA,UAAA,WAAA,WAAA,MAAA,cAAA,WAAA,SAAA,MAAA,WAAA,YAAA,OAAA,UAAA,WAAA,YAAA,SAoBb,0BAAK,IAAA"}
|
|
@@ -36,7 +36,7 @@ const getSizeStyles = (direction, size) => {
|
|
|
36
36
|
const value = SIZES[size] || size;
|
|
37
37
|
return direction === "top" || direction === "bottom" ? { height: value } : { width: value };
|
|
38
38
|
};
|
|
39
|
-
const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direction = "bottom", size = "medium", maskClosable = true, handlebar = true,
|
|
39
|
+
const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direction = "bottom", size = "medium", maskClosable = true, handlebar = true, rounded = false, mask = true, className, classNames, style, children, container, onClose, ...props }) => {
|
|
40
40
|
const { locale } = useConfig();
|
|
41
41
|
useEffect(() => {
|
|
42
42
|
if (!open || mask) return;
|
|
@@ -64,20 +64,18 @@ const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direct
|
|
|
64
64
|
]);
|
|
65
65
|
return /* @__PURE__ */ jsx(DrawerCore, {
|
|
66
66
|
open,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
container,
|
|
67
|
+
modal: mask,
|
|
68
|
+
disablePointerDismissal: !maskClosable,
|
|
70
69
|
onOpenChange: (open) => {
|
|
71
70
|
if (!open) onClose();
|
|
72
71
|
},
|
|
73
72
|
...props,
|
|
74
73
|
children: /* @__PURE__ */ jsxs(DrawerContent, {
|
|
74
|
+
direction,
|
|
75
|
+
container,
|
|
75
76
|
className: cn("border-none outline-none", rounded ? ROUNDED_CLASSES[direction] : "rounded-none!", classNames?.content, className),
|
|
76
77
|
handlebar,
|
|
77
78
|
mask,
|
|
78
|
-
onPointerDownOutside: (event) => {
|
|
79
|
-
if (!maskClosable) event.preventDefault();
|
|
80
|
-
},
|
|
81
79
|
classNames: {
|
|
82
80
|
mask: classNames?.mask || "",
|
|
83
81
|
handlebar: classNames?.handlebar || ""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.mjs","names":["drawer"],"sources":["../../../src/components/organisms/drawer.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { drawer } from '../../core';\nimport Button from '../atoms/button';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\n// `body.style.pointerEvents` is global state (per document), so several\n// mask-less overlays opening at once would otherwise race: each instance\n// would capture whatever the previous one had already written and the\n// last cleanup would restore a stale value. Reference counting makes only\n// the first instance capture the original value and only the last one\n// restore it. Keyed by document (not a single module-level counter) so\n// drawers portaled into different documents — e.g. live-editor's iframe\n// Renderer — don't share state with the host document.\ntype MaskLessState = { count: number; originalPointerEvents: string | null };\nconst maskLessStates = new WeakMap<Document, MaskLessState>();\n\nconst getMaskLessState = (doc: Document): MaskLessState => {\n let state = maskLessStates.get(doc);\n\n if (!state) {\n state = { count: 0, originalPointerEvents: null };\n maskLessStates.set(doc, state);\n }\n\n return state;\n};\n\nexport interface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n extra?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n size?: 'small' | 'medium' | 'large' | 'full' | string;\n maskClosable?: boolean;\n handlebar?: boolean;\n
|
|
1
|
+
{"version":3,"file":"drawer.mjs","names":["drawer"],"sources":["../../../src/components/organisms/drawer.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { drawer } from '../../core';\nimport Button from '../atoms/button';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\n// `body.style.pointerEvents` is global state (per document), so several\n// mask-less overlays opening at once would otherwise race: each instance\n// would capture whatever the previous one had already written and the\n// last cleanup would restore a stale value. Reference counting makes only\n// the first instance capture the original value and only the last one\n// restore it. Keyed by document (not a single module-level counter) so\n// drawers portaled into different documents — e.g. live-editor's iframe\n// Renderer — don't share state with the host document.\ntype MaskLessState = { count: number; originalPointerEvents: string | null };\nconst maskLessStates = new WeakMap<Document, MaskLessState>();\n\nconst getMaskLessState = (doc: Document): MaskLessState => {\n let state = maskLessStates.get(doc);\n\n if (!state) {\n state = { count: 0, originalPointerEvents: null };\n maskLessStates.set(doc, state);\n }\n\n return state;\n};\n\nexport interface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n extra?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n size?: 'small' | 'medium' | 'large' | 'full' | string;\n maskClosable?: boolean;\n handlebar?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n extra?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst SIZES: Record<string, string> = {\n small: '30%',\n medium: '50%',\n large: '75%',\n full: '90%',\n};\n\n// Rounds the edge facing into the viewport — the opposite edge from\n// whichever side the drawer is anchored to.\nconst ROUNDED_CLASSES: Record<'top' | 'bottom' | 'left' | 'right', string> = {\n top: 'rounded-b-[30px]!',\n bottom: 'rounded-t-[30px]!',\n left: 'rounded-r-[30px]!',\n right: 'rounded-l-[30px]!',\n};\n\nconst getSizeStyles = (\n direction: 'top' | 'bottom' | 'left' | 'right',\n size: string,\n): React.CSSProperties => {\n const value = SIZES[size] || size;\n\n return direction === 'top' || direction === 'bottom'\n ? { height: value }\n : { width: value };\n};\n\nconst Drawer = ({\n open,\n title,\n extra,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n size = 'medium',\n maskClosable = true,\n handlebar = true,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n const { locale } = useConfig();\n\n useEffect(() => {\n if (!open || mask) {\n return;\n }\n\n const targetDocument = container?.ownerDocument ?? document;\n const targetWindow = targetDocument.defaultView ?? window;\n const body = targetDocument.body;\n const state = getMaskLessState(targetDocument);\n\n if (state.count === 0) {\n state.originalPointerEvents = body.style.pointerEvents;\n }\n state.count += 1;\n\n const raf = targetWindow.requestAnimationFrame(() => {\n body.style.pointerEvents = 'auto';\n });\n\n return () => {\n targetWindow.cancelAnimationFrame(raf);\n state.count -= 1;\n\n if (state.count === 0) {\n body.style.pointerEvents = state.originalPointerEvents ?? '';\n state.originalPointerEvents = null;\n }\n };\n }, [open, mask, container]);\n\n return (\n <DrawerCore\n open={open}\n // antd's mask ⇒ Base UI's modal (focus trap + scroll lock); maskClosable\n // gates outside-press dismissal at the root, replacing vaul's\n // Content-level onPointerDownOutside handler.\n modal={mask}\n disablePointerDismissal={!maskClosable}\n onOpenChange={open => {\n if (!open) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n direction={direction}\n container={container}\n className={cn(\n 'border-none outline-none',\n rounded ? ROUNDED_CLASSES[direction] : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n classNames={{\n mask: classNames?.mask || '',\n handlebar: classNames?.handlebar || '',\n }}\n style={{\n ...getSizeStyles(direction, size),\n ...style,\n }}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <div className=\"flex items-start gap-2\">\n {closable && (\n <Button\n variant=\"text\"\n shape=\"circle\"\n size=\"small\"\n aria-label={locale.close ?? DEFAULT_LOCALE.close}\n icon={closeIcon || <X />}\n onClick={onClose}\n className={cn(classNames?.close)}\n />\n )}\n <div className=\"flex flex-1 items-start justify-between gap-2\">\n <DrawerTitle className={cn(classNames?.title)}>\n {title}\n </DrawerTitle>\n {extra != null && (\n <div className={cn('shrink-0', classNames?.extra)}>{extra}</div>\n )}\n </div>\n </div>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {footer != null && (\n <DrawerFooter className={cn(classNames?.footer)}>\n {footer}\n </DrawerFooter>\n )}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;AAYA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AAWJ,MAAM,iCAAiB,IAAI,QAAiC;AAE5D,MAAM,oBAAoB,QAAiC;CACzD,IAAI,QAAQ,eAAe,IAAI,GAAG;CAElC,IAAI,CAAC,OAAO;EACV,QAAQ;GAAE,OAAO;GAAG,uBAAuB;EAAK;EAChD,eAAe,IAAI,KAAK,KAAK;CAC/B;CAEA,OAAO;AACT;AAiCA,MAAM,QAAgC;CACpC,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;AACR;AAIA,MAAM,kBAAuE;CAC3E,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAEA,MAAM,iBACJ,WACA,SACwB;CACxB,MAAM,QAAQ,MAAM,SAAS;CAE7B,OAAO,cAAc,SAAS,cAAc,WACxC,EAAE,QAAQ,MAAM,IAChB,EAAE,OAAO,MAAM;AACrB;AAEA,MAAM,UAAU,EACd,MACA,OACA,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AAK;OACL,cAAY,OAAO,SAAS,eAAe;OAC3C,MAAM,aAAa,oBAAC,GAAD,CAAI,CAAA;OACvB,SAAS;OACT,WAAW,GAAG,YAAY,KAAK;MAChC,CAAA,GAEH,qBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,oBAAC,aAAD;QAAa,WAAW,GAAG,YAAY,KAAK;QACzC,UAAA;OACU,CAAA,GACZ,SAAS,QACR,oBAAC,OAAD;QAAK,WAAW,GAAG,YAAY,YAAY,KAAK;QAAI,UAAA;OAAW,CAAA,CAE9D;MACF,CAAA,CAAA;KACL,CAAA,GAAA,oBAAC,mBAAD,EAAmB,WAAU,SAAU,CAAA,CAC3B;;IACd,oBAAC,OAAD;KACE,WAAW,GACT,qBACA,YAAY,IAEd;KAEC;IACE,CAAA;IACJ,UAAU,QACT,oBAAC,cAAD;KAAc,WAAW,GAAG,YAAY,MAAM;KAC3C,UAAA;IACW,CAAA;GAEH;;CACL,CAAA;AAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.mts","names":[],"sources":["../../../src/components/organisms/modal.tsx"],"mappings":";;UAiCiB;EACf;EACA;EACA;IAGM,YAAY,MAAM;IAClB;;EAEN,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,SAAS,MAAM;EACf;EACA;IACE;IACA;IACA;IACA;;EAEF,QAAQ,MAAM;EACd;EACA;EACA,YAAY;EACZ,WAAW,MAAM;EACjB;EACA;;KAGG;UAEK,oBAAoB;EAC5B,SAAS;;;;;;EAMT;EACA;EACA,OAAO,MAAM;EACb,YAAY;;cAGR;KAkBH,MAAA,cAAA,UAAA,WAAA,WAAA,YAAA,OAAA,OAAA,SAAA,QAAA,WAAA,UAAA,QAAA,YAAA,MAAA,aAAA,SAAA,QAAK,MAAA,IAAA;;;
|
|
1
|
+
{"version":3,"file":"modal.d.mts","names":[],"sources":["../../../src/components/organisms/modal.tsx"],"mappings":";;UAiCiB;EACf;EACA;EACA;IAGM,YAAY,MAAM;IAClB;;EAEN,YAAY,MAAM;EAClB,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,SAAS,MAAM;EACf;EACA;IACE;IACA;IACA;IACA;;EAEF,QAAQ,MAAM;EACd;EACA;EACA,YAAY;EACZ,WAAW,MAAM;EACjB;EACA;;KAGG;UAEK,oBAAoB;EAC5B,SAAS;;;;;;EAMT;EACA;EACA,OAAO,MAAM;EACb,YAAY;;cAGR;KAkBH,MAAA,cAAA,UAAA,WAAA,WAAA,YAAA,OAAA,OAAA,SAAA,QAAA,WAAA,UAAA,QAAA,YAAA,MAAA,aAAA,SAAA,QAAK,MAAA,IAAA;;;EAwNa,KAAA,OAAA;EAEG,QAAA,OAAA;EAEF,MAAA,OAAA;EAEE,QAAA,OAAA;EAIA,QAAA,OAAA"}
|
|
@@ -20,6 +20,7 @@ const Modal = ({ open = false, maskClosable, closable = false, closeIcon, classN
|
|
|
20
20
|
onOpenChange: (open) => {
|
|
21
21
|
if (!open) onCancel?.();
|
|
22
22
|
},
|
|
23
|
+
disablePointerDismissal: !resolvedMaskClosable,
|
|
23
24
|
...props,
|
|
24
25
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
25
26
|
className: cn("rounded-lg p-4 max-sm:max-w-[80%]", "border-none outline-none", className),
|
|
@@ -31,9 +32,6 @@ const Modal = ({ open = false, maskClosable, closable = false, closeIcon, classN
|
|
|
31
32
|
closable,
|
|
32
33
|
closeIcon,
|
|
33
34
|
container,
|
|
34
|
-
onPointerDownOutside: (event) => {
|
|
35
|
-
if (!resolvedMaskClosable) event.preventDefault();
|
|
36
|
-
},
|
|
37
35
|
children: [
|
|
38
36
|
/* @__PURE__ */ jsxs(DialogHeader, {
|
|
39
37
|
className: cn(classNames?.header, !title && "hidden"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.mjs","names":["dialog"],"sources":["../../../src/components/organisms/modal.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Check,\n CircleQuestionMark,\n Info,\n OctagonAlert,\n OctagonX,\n} from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { dialog } from '../../core';\nimport Button from '../atoms/button';\nimport {\n type ImperativeStack,\n createImperativeStack,\n isBrowser,\n} from './imperative-stack';\n\nconst {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} = dialog;\n\nexport interface Props {\n open?: boolean;\n maskClosable?: boolean;\n closable?:\n | boolean\n | {\n closeIcon?: React.ReactNode;\n disabled?: boolean;\n };\n closeIcon?: React.ReactNode;\n title?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n classNames?: {\n mask?: string;\n header?: string;\n body?: string;\n footer?: string;\n };\n style?: React.CSSProperties;\n okText?: string;\n cancelText?: string;\n container?: HTMLElement;\n children?: React.ReactNode;\n onOk?: () => void;\n onCancel?: () => void;\n}\n\ntype ModalStatus = 'info' | 'success' | 'error' | 'warning';\n\ninterface StaticProps extends Props {\n status?: ModalStatus;\n /**\n * Interaction mode set by `Modal.confirm()` to request the two-button\n * footer. `confirm` is a mode, not a status, so it rides its own axis rather\n * than `status` — call `Modal.confirm()` rather than setting this directly.\n */\n mode?: 'confirm';\n id?: string;\n icon?: React.ReactNode;\n container?: HTMLElement;\n}\n\nconst Modal = ({\n open = false,\n maskClosable,\n closable = false,\n closeIcon,\n className,\n classNames,\n style,\n title,\n content,\n footer,\n container,\n children,\n okText,\n cancelText,\n onOk,\n onCancel,\n ...props\n}: Props) => {\n const { locale, defaultProps } = useConfig();\n const modalDefaults = defaultProps?.modal as\n Partial<Pick<Props, 'maskClosable'>> | undefined;\n // Explicit prop > `Config` default > built-in, matching Button/Tag.\n const resolvedMaskClosable =\n maskClosable ?? modalDefaults?.maskClosable ?? false;\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open: boolean) => {\n if (!open) {\n onCancel?.();\n }\n }}\n {...props}\n >\n <DialogContent\n className={cn(\n 'rounded-lg p-4 max-sm:max-w-[80%]',\n 'border-none outline-none',\n className,\n )}\n classNames={{\n ...classNames,\n mask: cn('bg-black/60', classNames?.mask),\n }}\n style={style}\n closable={closable}\n closeIcon={closeIcon}\n container={container}\n onPointerDownOutside={event => {\n if (!resolvedMaskClosable) {\n event.preventDefault();\n }\n }}\n >\n {/**\n * @todo [Dialog & AlertDialog] fix: can't get id correctly in shadow dom\n * @see https://github.com/radix-ui/primitives/pull/3384\n **/}\n <DialogHeader\n className={cn(\n classNames?.header,\n !title && 'hidden',\n //\n )}\n >\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription className=\"hidden\" />\n </DialogHeader>\n <div className={cn('break-all', classNames?.body)}>\n {children ?? content}\n </div>\n {footer !== null && (\n <DialogFooter\n className={cn('flex-row justify-end gap-x-2', classNames?.footer)}\n >\n {footer || (\n <>\n <Button onClick={onOk}>\n {okText ?? locale.ok ?? DEFAULT_LOCALE.ok}\n </Button>\n <Button variant=\"outlined\" onClick={onCancel}>\n {cancelText ?? locale.cancel ?? DEFAULT_LOCALE.cancel}\n </Button>\n </>\n )}\n </DialogFooter>\n )}\n </DialogContent>\n </Dialog>\n );\n};\n\nconst STATIC_ICONS = {\n info: <Info className=\"text-blue-400\" />,\n success: <Check className=\"text-green-400\" />,\n error: <OctagonX className=\"text-red-400\" />,\n warning: <OctagonAlert className=\"text-yellow-400\" />,\n confirm: <CircleQuestionMark />,\n};\n\nconst StaticModal = ({\n id,\n status,\n mode,\n title,\n content,\n okText,\n cancelText,\n container,\n icon,\n onOk,\n onCancel,\n ...props\n}: StaticProps & { id: string }): React.ReactPortal | null => {\n const { locale } = useConfig();\n const [open, setOpen] = useState(true);\n const resolvedOkText = okText ?? locale.ok ?? DEFAULT_LOCALE.ok;\n const resolvedCancelText =\n cancelText ?? locale.cancel ?? DEFAULT_LOCALE.cancel;\n // `confirm` is an interaction mode (two-button footer), not a status; the\n // semantic state comes from `status`.\n const isConfirm = mode === 'confirm';\n\n const closeModal = (callback?: () => void) => {\n callback?.();\n setOpen(false);\n setTimeout(() => {\n modalStack.destroy(id);\n }, 200);\n };\n\n const footer = isConfirm ? (\n <div className=\"grid w-full grid-cols-5 gap-x-2\">\n <Button\n variant=\"outlined\"\n className=\"col-span-2\"\n onClick={() => closeModal(onCancel)}\n >\n {resolvedCancelText}\n </Button>\n <Button className=\"col-span-3\" onClick={() => closeModal(onOk)}>\n {resolvedOkText}\n </Button>\n </div>\n ) : (\n <Button\n className={cn(\n 'grow',\n //\n )}\n onClick={() => closeModal(onOk)}\n >\n {resolvedOkText}\n </Button>\n );\n\n if (!isBrowser) {\n return null;\n }\n\n return createPortal(\n <Modal\n open={open}\n footer={footer}\n className={cn(\n 'z-10000',\n 'box-content w-100',\n 'rounded-3xl p-4',\n 'gap-y-0',\n )}\n classNames={{\n mask: 'z-10000 bg-black/[.6]',\n body: cn(\n 'text-black-70 whitespace-pre-wrap text-center',\n content && 'mt-3',\n ),\n footer: 'mt-9',\n }}\n title={\n <p\n className={cn(\n 'text-center text-lg leading-normal whitespace-pre-wrap',\n 'flex items-center justify-center gap-x-2',\n //\n )}\n >\n {icon ||\n (isConfirm ? STATIC_ICONS.confirm : status && STATIC_ICONS[status])}\n {title}\n </p>\n }\n container={container}\n onCancel={() => closeModal(onCancel)}\n {...props}\n >\n {content}\n </Modal>,\n modalStack.getRootElement(container)!,\n );\n};\n\n// No `role`/`aria-modal` here — this element is only a mount point for the\n// imperative stack, not the dialog itself. Radix already renders its own\n// `role=\"dialog\"`/`aria-modal=\"true\"` on the actual `DialogContent` via\n// portal once a modal is open. Setting it here as well would (a) leave\n// `aria-modal=\"true\"` on the page permanently, even with zero modals open,\n// hiding the rest of the document from screen readers, and (b) duplicate\n// Radix's own dialog role once one is open.\nconst modalStack: ImperativeStack<StaticProps> =\n createImperativeStack<StaticProps>({\n createRootElement: () => {\n const el = document.createElement('div');\n el.style.zIndex = '10000';\n el.style.position = 'absolute';\n return el;\n },\n StackItem: StaticModal,\n });\n\nModal.destroy = modalStack.destroy;\n\nModal.destroyAll = () => {\n modalStack.destroy();\n};\n\nModal.info = (props: StaticProps) =>\n modalStack.render({ status: 'info', ...props });\nModal.success = (props: StaticProps) =>\n modalStack.render({ status: 'success', ...props });\nModal.error = (props: StaticProps) =>\n modalStack.render({ status: 'error', ...props });\nModal.warning = (props: StaticProps) =>\n modalStack.render({ status: 'warning', ...props });\n// `confirm` is a mode, not a status, so it rides its own `mode` axis rather\n// than `status`.\nModal.confirm = (props: StaticProps) =>\n modalStack.render({ mode: 'confirm', ...props });\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,EACJ,QACA,eACA,mBACA,cACA,cACA,gBACEA;AA8CJ,MAAM,SAAS,EACb,OAAO,OACP,cACA,WAAW,OACX,WACA,WACA,YACA,OACA,OACA,SACA,QACA,WACA,UACA,QACA,YACA,MACA,UACA,GAAG,YACQ;CACX,MAAM,EAAE,QAAQ,iBAAiB,UAAU;CAC3C,MAAM,gBAAgB,cAAc;CAGpC,MAAM,uBACJ,gBAAgB,eAAe,gBAAgB;CAEjD,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OACE,oBAAC,QAAD;EACQ;EACN,eAAe,SAAkB;GAC/B,IAAI,CAAC,MACH,WAAW;EAEf;EACA,GAAI;EAEJ,UAAA,qBAAC,eAAD;GACE,WAAW,GACT,qCACA,4BACA,SACF;GACA,YAAY;IACV,GAAG;IACH,MAAM,GAAG,eAAe,YAAY,IAAI;GAC1C;GACO;GACG;GACC;GACA;GACX,uBAAsB,UAAS;IAC7B,IAAI,CAAC,sBACH,MAAM,eAAe;GAEzB;GAlBF,UAAA;IAwBE,qBAAC,cAAD;KACE,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,QAEZ;KALF,UAAA,CAOE,oBAAC,aAAD,EAAA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AM;CAAW,GAAG;AAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"modal.mjs","names":["dialog"],"sources":["../../../src/components/organisms/modal.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport {\n Check,\n CircleQuestionMark,\n Info,\n OctagonAlert,\n OctagonX,\n} from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { dialog } from '../../core';\nimport Button from '../atoms/button';\nimport {\n type ImperativeStack,\n createImperativeStack,\n isBrowser,\n} from './imperative-stack';\n\nconst {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} = dialog;\n\nexport interface Props {\n open?: boolean;\n maskClosable?: boolean;\n closable?:\n | boolean\n | {\n closeIcon?: React.ReactNode;\n disabled?: boolean;\n };\n closeIcon?: React.ReactNode;\n title?: React.ReactNode;\n content?: React.ReactNode;\n footer?: React.ReactNode;\n className?: string;\n classNames?: {\n mask?: string;\n header?: string;\n body?: string;\n footer?: string;\n };\n style?: React.CSSProperties;\n okText?: string;\n cancelText?: string;\n container?: HTMLElement;\n children?: React.ReactNode;\n onOk?: () => void;\n onCancel?: () => void;\n}\n\ntype ModalStatus = 'info' | 'success' | 'error' | 'warning';\n\ninterface StaticProps extends Props {\n status?: ModalStatus;\n /**\n * Interaction mode set by `Modal.confirm()` to request the two-button\n * footer. `confirm` is a mode, not a status, so it rides its own axis rather\n * than `status` — call `Modal.confirm()` rather than setting this directly.\n */\n mode?: 'confirm';\n id?: string;\n icon?: React.ReactNode;\n container?: HTMLElement;\n}\n\nconst Modal = ({\n open = false,\n maskClosable,\n closable = false,\n closeIcon,\n className,\n classNames,\n style,\n title,\n content,\n footer,\n container,\n children,\n okText,\n cancelText,\n onOk,\n onCancel,\n ...props\n}: Props) => {\n const { locale, defaultProps } = useConfig();\n const modalDefaults = defaultProps?.modal as\n Partial<Pick<Props, 'maskClosable'>> | undefined;\n // Explicit prop > `Config` default > built-in, matching Button/Tag.\n const resolvedMaskClosable =\n maskClosable ?? modalDefaults?.maskClosable ?? false;\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open: boolean) => {\n if (!open) {\n onCancel?.();\n }\n }}\n // antd's `maskClosable` is a root-level dismissal concern in Base UI:\n // blocking the outside (mask) press keeps the dialog open on backdrop\n // click while Escape still closes it, matching the previous behaviour.\n disablePointerDismissal={!resolvedMaskClosable}\n {...props}\n >\n <DialogContent\n className={cn(\n 'rounded-lg p-4 max-sm:max-w-[80%]',\n 'border-none outline-none',\n className,\n )}\n classNames={{\n ...classNames,\n mask: cn('bg-black/60', classNames?.mask),\n }}\n style={style}\n closable={closable}\n closeIcon={closeIcon}\n container={container}\n >\n {/**\n * @todo [Dialog & AlertDialog] fix: can't get id correctly in shadow dom\n *\n * Filed while `core/dialog` was still Radix-based; the linked fix is\n * Radix's, and the repo no longer depends on it. Revalidate against\n * Base UI's Dialog before acting on this — the bug may already be gone.\n * @see https://github.com/radix-ui/primitives/pull/3384\n **/}\n <DialogHeader\n className={cn(\n classNames?.header,\n !title && 'hidden',\n //\n )}\n >\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription className=\"hidden\" />\n </DialogHeader>\n <div className={cn('break-all', classNames?.body)}>\n {children ?? content}\n </div>\n {footer !== null && (\n <DialogFooter\n className={cn('flex-row justify-end gap-x-2', classNames?.footer)}\n >\n {footer || (\n <>\n <Button onClick={onOk}>\n {okText ?? locale.ok ?? DEFAULT_LOCALE.ok}\n </Button>\n <Button variant=\"outlined\" onClick={onCancel}>\n {cancelText ?? locale.cancel ?? DEFAULT_LOCALE.cancel}\n </Button>\n </>\n )}\n </DialogFooter>\n )}\n </DialogContent>\n </Dialog>\n );\n};\n\nconst STATIC_ICONS = {\n info: <Info className=\"text-blue-400\" />,\n success: <Check className=\"text-green-400\" />,\n error: <OctagonX className=\"text-red-400\" />,\n warning: <OctagonAlert className=\"text-yellow-400\" />,\n confirm: <CircleQuestionMark />,\n};\n\nconst StaticModal = ({\n id,\n status,\n mode,\n title,\n content,\n okText,\n cancelText,\n container,\n icon,\n onOk,\n onCancel,\n ...props\n}: StaticProps & { id: string }): React.ReactPortal | null => {\n const { locale } = useConfig();\n const [open, setOpen] = useState(true);\n const resolvedOkText = okText ?? locale.ok ?? DEFAULT_LOCALE.ok;\n const resolvedCancelText =\n cancelText ?? locale.cancel ?? DEFAULT_LOCALE.cancel;\n // `confirm` is an interaction mode (two-button footer), not a status; the\n // semantic state comes from `status`.\n const isConfirm = mode === 'confirm';\n\n const closeModal = (callback?: () => void) => {\n callback?.();\n setOpen(false);\n setTimeout(() => {\n modalStack.destroy(id);\n }, 200);\n };\n\n const footer = isConfirm ? (\n <div className=\"grid w-full grid-cols-5 gap-x-2\">\n <Button\n variant=\"outlined\"\n className=\"col-span-2\"\n onClick={() => closeModal(onCancel)}\n >\n {resolvedCancelText}\n </Button>\n <Button className=\"col-span-3\" onClick={() => closeModal(onOk)}>\n {resolvedOkText}\n </Button>\n </div>\n ) : (\n <Button\n className={cn(\n 'grow',\n //\n )}\n onClick={() => closeModal(onOk)}\n >\n {resolvedOkText}\n </Button>\n );\n\n if (!isBrowser) {\n return null;\n }\n\n return createPortal(\n <Modal\n open={open}\n footer={footer}\n className={cn(\n 'z-10000',\n 'box-content w-100',\n 'rounded-3xl p-4',\n 'gap-y-0',\n )}\n classNames={{\n mask: 'z-10000 bg-black/[.6]',\n body: cn(\n 'text-black-70 whitespace-pre-wrap text-center',\n content && 'mt-3',\n ),\n footer: 'mt-9',\n }}\n title={\n <p\n className={cn(\n 'text-center text-lg leading-normal whitespace-pre-wrap',\n 'flex items-center justify-center gap-x-2',\n //\n )}\n >\n {icon ||\n (isConfirm ? STATIC_ICONS.confirm : status && STATIC_ICONS[status])}\n {title}\n </p>\n }\n container={container}\n onCancel={() => closeModal(onCancel)}\n {...props}\n >\n {content}\n </Modal>,\n modalStack.getRootElement(container)!,\n );\n};\n\n// No `role`/`aria-modal` here — this element is only a mount point for the\n// imperative stack, not the dialog itself. Base UI already renders its own\n// `role=\"dialog\"`/`aria-modal=\"true\"` on the actual `DialogContent` via\n// portal once a modal is open. Setting it here as well would (a) leave\n// `aria-modal=\"true\"` on the page permanently, even with zero modals open,\n// hiding the rest of the document from screen readers, and (b) duplicate\n// Base UI's own dialog role once one is open.\nconst modalStack: ImperativeStack<StaticProps> =\n createImperativeStack<StaticProps>({\n createRootElement: () => {\n const el = document.createElement('div');\n el.style.zIndex = '10000';\n el.style.position = 'absolute';\n return el;\n },\n StackItem: StaticModal,\n });\n\nModal.destroy = modalStack.destroy;\n\nModal.destroyAll = () => {\n modalStack.destroy();\n};\n\nModal.info = (props: StaticProps) =>\n modalStack.render({ status: 'info', ...props });\nModal.success = (props: StaticProps) =>\n modalStack.render({ status: 'success', ...props });\nModal.error = (props: StaticProps) =>\n modalStack.render({ status: 'error', ...props });\nModal.warning = (props: StaticProps) =>\n modalStack.render({ status: 'warning', ...props });\n// `confirm` is a mode, not a status, so it rides its own `mode` axis rather\n// than `status`.\nModal.confirm = (props: StaticProps) =>\n modalStack.render({ mode: 'confirm', ...props });\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,EACJ,QACA,eACA,mBACA,cACA,cACA,gBACEA;AA8CJ,MAAM,SAAS,EACb,OAAO,OACP,cACA,WAAW,OACX,WACA,WACA,YACA,OACA,OACA,SACA,QACA,WACA,UACA,QACA,YACA,MACA,UACA,GAAG,YACQ;CACX,MAAM,EAAE,QAAQ,iBAAiB,UAAU;CAC3C,MAAM,gBAAgB,cAAc;CAGpC,MAAM,uBACJ,gBAAgB,eAAe,gBAAgB;CAEjD,IAAI,OAAO,WAAW,aACpB,OAAO;CAGT,OACE,oBAAC,QAAD;EACQ;EACN,eAAe,SAAkB;GAC/B,IAAI,CAAC,MACH,WAAW;EAEf;EAIA,yBAAyB,CAAC;EAC1B,GAA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ChD,MAAM,WAAW,UACf,WAAW,OAAO;CAAE,QAAQ;CAAW,GAAG;AAAM,CAAC;AACnD,MAAM,SAAS,UACb,WAAW,OAAO;CAAE,QAAQ;CAAS,GAAG;AAAM,CAAC;AACjD,MAAM,WAAW,UACf,WAAW,OAAO;CAAE,QAAQ;CAAW,GAAG;AAAM,CAAC;AAGnD,MAAM,WAAW,UACf,WAAW,OAAO;CAAE,MAAM;CAAW,GAAG;AAAM,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
1
2
|
//#region src/components/templates/container.d.ts
|
|
2
3
|
type MaxWidth = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | 'full' | 'none';
|
|
3
|
-
interface Props extends
|
|
4
|
+
interface Props extends Omit<useRender.ComponentProps<'div'>, 'className'> {
|
|
4
5
|
maxWidth?: MaxWidth;
|
|
5
6
|
padded?: boolean;
|
|
6
|
-
|
|
7
|
+
className?: string;
|
|
7
8
|
}
|
|
8
|
-
declare const Container: ({ className, maxWidth, padded,
|
|
9
|
+
declare const Container: ({ className, maxWidth, padded, render, ...props }: Props) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
9
10
|
//#endregion
|
|
10
11
|
export { Props, Container as default };
|
|
11
12
|
//# sourceMappingURL=container.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.mts","names":[],"sources":["../../../src/components/templates/container.tsx"],"mappings":";
|
|
1
|
+
{"version":3,"file":"container.d.mts","names":[],"sources":["../../../src/components/templates/container.tsx"],"mappings":";;KAMK;UAmCY,cAAc,KAC7B,UAAU;EAGV,WAAW;EACX;EACA;;cAMI,cAAa,WAAA,UAAA,QAAA,WAAA,SAMhB,0BAAK,+CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../../utils.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
4
|
//#region src/components/templates/container.tsx
|
|
5
5
|
const MAX_WIDTH_CLASSES = {
|
|
6
6
|
"3xs": "max-w-3xs",
|
|
@@ -19,10 +19,14 @@ const MAX_WIDTH_CLASSES = {
|
|
|
19
19
|
full: "max-w-full",
|
|
20
20
|
none: "max-w-none"
|
|
21
21
|
};
|
|
22
|
-
const Container = ({ className, maxWidth = "7xl", padded = true,
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const Container = ({ className, maxWidth = "7xl", padded = true, render, ...props }) => {
|
|
23
|
+
return useRender({
|
|
24
|
+
defaultTagName: "div",
|
|
25
|
+
render,
|
|
26
|
+
props: {
|
|
27
|
+
...props,
|
|
28
|
+
className: cn("mx-auto w-full", MAX_WIDTH_CLASSES[maxWidth], padded && "px-4 sm:px-6 lg:px-8", className)
|
|
29
|
+
}
|
|
26
30
|
});
|
|
27
31
|
};
|
|
28
32
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.mjs","names":[],"sources":["../../../src/components/templates/container.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"container.mjs","names":[],"sources":["../../../src/components/templates/container.tsx"],"sourcesContent":["'use client';\n\nimport { useRender } from '@base-ui/react/use-render';\n\nimport { cn } from '@repo/ui/utils';\n\ntype MaxWidth =\n | '3xs'\n | '2xs'\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | '2xl'\n | '3xl'\n | '4xl'\n | '5xl'\n | '6xl'\n | '7xl'\n | 'full'\n | 'none';\n\nconst MAX_WIDTH_CLASSES: Record<MaxWidth, string> = {\n '3xs': 'max-w-3xs',\n '2xs': 'max-w-2xs',\n xs: 'max-w-xs',\n sm: 'max-w-sm',\n md: 'max-w-md',\n lg: 'max-w-lg',\n xl: 'max-w-xl',\n '2xl': 'max-w-2xl',\n '3xl': 'max-w-3xl',\n '4xl': 'max-w-4xl',\n '5xl': 'max-w-5xl',\n '6xl': 'max-w-6xl',\n '7xl': 'max-w-7xl',\n full: 'max-w-full',\n none: 'max-w-none',\n};\n\nexport interface Props extends Omit<\n useRender.ComponentProps<'div'>,\n 'className'\n> {\n maxWidth?: MaxWidth;\n padded?: boolean;\n className?: string;\n}\n\n// Standardizes the `mx-auto max-w-7xl px-4` wrapper every app in this\n// monorepo was rewriting by hand inside Content — one place to change the\n// page's content width/gutters instead of N call sites.\nconst Container = ({\n className,\n maxWidth = '7xl',\n padded = true,\n render,\n ...props\n}: Props) => {\n return useRender({\n defaultTagName: 'div',\n render,\n props: {\n ...props,\n className: cn(\n 'mx-auto w-full',\n MAX_WIDTH_CLASSES[maxWidth],\n padded && 'px-4 sm:px-6 lg:px-8',\n className,\n //\n ),\n },\n });\n};\n\nexport default Container;\n"],"mappings":";;;;AAuBA,MAAM,oBAA8C;CAClD,OAAO;CACP,OAAO;CACP,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;AACR;AAcA,MAAM,aAAa,EACjB,WACA,WAAW,OACX,SAAS,MACT,QACA,GAAG,YACQ;CACX,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,GAAG;GACH,WAAW,GACT,kBACA,kBAAkB,WAClB,UAAU,wBACV,SAEF;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Props } from "./layout/content.mjs";
|
|
2
|
+
import { Props as Props$1 } from "./layout/footer.mjs";
|
|
3
|
+
import { Props as Props$2 } from "./layout/header.mjs";
|
|
4
|
+
import { Props as Props$3 } from "./layout/layout.mjs";
|
|
5
|
+
import { Props as Props$4 } from "./layout/sider.mjs";
|
|
6
|
+
import Layout from "../../Layout.mjs";
|
|
7
|
+
import Container, { Props as Props$5 } from "./container.mjs";
|
|
8
|
+
import Empty, { Props as Props$6 } from "./empty.mjs";
|
|
9
|
+
import Result, { Props as Props$7 } from "./result.mjs";
|
|
10
|
+
import PageHeader, { Props as Props$8 } from "./page-header.mjs";
|
|
11
|
+
import Row, { Props as Props$9 } from "./grid/row.mjs";
|
|
12
|
+
import Col, { Props as Props$10 } from "./grid/col.mjs";
|
|
13
|
+
export { Col, type Props$10 as ColProps, Container, type Props$5 as ContainerProps, type Props as ContentProps, Empty, type Props$6 as EmptyProps, type Props$1 as FooterProps, type Props$2 as HeaderProps, Layout, type Props$3 as LayoutProps, PageHeader, type Props$8 as PageHeaderProps, Result, type Props$7 as ResultProps, Row, type Props$9 as RowProps, type Props$4 as SiderProps };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
1
2
|
//#region src/components/templates/layout/content.d.ts
|
|
2
|
-
interface Props extends
|
|
3
|
-
|
|
3
|
+
interface Props extends Omit<useRender.ComponentProps<'main'>, 'className'> {
|
|
4
|
+
className?: string;
|
|
4
5
|
}
|
|
5
|
-
declare const Content: ({ children, className,
|
|
6
|
+
declare const Content: ({ children, className, render, ...props }: Props) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
6
7
|
//#endregion
|
|
7
8
|
export { Props, Content as default };
|
|
8
9
|
//# sourceMappingURL=content.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.mts","names":[],"sources":["../../../../src/components/templates/layout/content.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.d.mts","names":[],"sources":["../../../../src/components/templates/layout/content.tsx"],"mappings":";;UAQiB,cAAc,KAC7B,UAAU;EAGV;;cAGI,YAAW,UAAA,WAAA,WAAA,SAA2C,0BAAK,+CAAA"}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { cn } from "../../../utils.mjs";
|
|
2
3
|
import { SiderRegistryContext } from "./sider-context.mjs";
|
|
3
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
5
6
|
//#region src/components/templates/layout/content.tsx
|
|
6
|
-
const Content = ({ children, className,
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const Content = ({ children, className, render, ...props }) => {
|
|
8
|
+
return useRender({
|
|
9
|
+
defaultTagName: "main",
|
|
10
|
+
render,
|
|
11
|
+
props: {
|
|
12
|
+
...props,
|
|
13
|
+
className: cn("min-w-0 shrink grow basis-auto", className),
|
|
14
|
+
children: /* @__PURE__ */ jsx(SiderRegistryContext.Provider, {
|
|
15
|
+
value: null,
|
|
16
|
+
children
|
|
17
|
+
})
|
|
18
|
+
}
|
|
14
19
|
});
|
|
15
20
|
};
|
|
16
21
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.mjs","names":[],"sources":["../../../../src/components/templates/layout/content.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"content.mjs","names":[],"sources":["../../../../src/components/templates/layout/content.tsx"],"sourcesContent":["'use client';\n\nimport { useRender } from '@base-ui/react/use-render';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { SiderRegistryContext } from './sider-context';\n\nexport interface Props extends Omit<\n useRender.ComponentProps<'main'>,\n 'className'\n> {\n className?: string;\n}\n\nconst Content = ({ children, className, render, ...props }: Props) => {\n // Only one <main> landmark should exist per page — a Layout nested\n // inside a page that already has its own <main> (or a Content nested\n // inside another Content) needs a way to opt out of rendering a second\n // one. Base UI's render contract merges these props/classes onto the\n // caller's own element instead.\n return useRender({\n defaultTagName: 'main',\n render,\n props: {\n ...props,\n className: cn(\n 'min-w-0 shrink grow basis-auto',\n // basis-auto (not basis-0) sizes Content from its actual content\n // height first, so flex-grow only adds extra space when content is\n // shorter than the viewport — when content is taller, Content\n // keeps its natural (larger) height instead of clipping to\n // available space and pushes Footer below it. min-h-0 is\n // intentionally omitted here: with basis-auto, the default\n // min-height:auto (content-based) is what makes that possible; on\n // the Sider row's cross axis it's harmless since min-height there\n // governs stretch, not main-axis growth.\n className,\n ),\n children: (\n <SiderRegistryContext.Provider value={null}>\n {children}\n </SiderRegistryContext.Provider>\n ),\n },\n });\n};\n\nexport default Content;\n"],"mappings":";;;;;;AAeA,MAAM,WAAW,EAAE,UAAU,WAAW,QAAQ,GAAG,YAAmB;CAMpE,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO;GACL,GAAG;GACH,WAAW,GACT,kCAUA,SACF;GACA,UACE,oBAAC,qBAAqB,UAAtB;IAA+B,OAAO;IACnC;GAC4B,CAAA;EAEnC;CACF,CAAC;AACH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "react";
|
|
2
|
-
import "@
|
|
2
|
+
import { Accordion } from "@base-ui/react/accordion";
|
package/dist/core/accordion.mjs
CHANGED
|
@@ -4,46 +4,46 @@ import { cn } from "../utils.mjs";
|
|
|
4
4
|
import "react";
|
|
5
5
|
import { ChevronDownIcon } from "lucide-react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
7
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
8
8
|
//#region src/core/accordion.tsx
|
|
9
9
|
var accordion_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
-
Accordion: () => Accordion,
|
|
10
|
+
Accordion: () => Accordion$1,
|
|
11
11
|
AccordionContent: () => AccordionContent,
|
|
12
12
|
AccordionItem: () => AccordionItem,
|
|
13
13
|
AccordionTrigger: () => AccordionTrigger
|
|
14
14
|
});
|
|
15
|
-
function Accordion({ ...props }) {
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
15
|
+
function Accordion$1({ ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Accordion.Root, {
|
|
17
17
|
"data-slot": "accordion",
|
|
18
18
|
...props
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
21
|
function AccordionItem({ className, ...props }) {
|
|
22
|
-
return /* @__PURE__ */ jsx(
|
|
22
|
+
return /* @__PURE__ */ jsx(Accordion.Item, {
|
|
23
23
|
"data-slot": "accordion-item",
|
|
24
24
|
className: cn("border-b last:border-b-0", className),
|
|
25
25
|
...props
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function AccordionTrigger({ className, children, expandIcon, ...props }) {
|
|
29
|
-
return /* @__PURE__ */ jsx(
|
|
29
|
+
return /* @__PURE__ */ jsx(Accordion.Header, {
|
|
30
30
|
className: "flex",
|
|
31
|
-
children: /* @__PURE__ */ jsxs(
|
|
31
|
+
children: /* @__PURE__ */ jsxs(Accordion.Trigger, {
|
|
32
32
|
"data-slot": "accordion-trigger",
|
|
33
33
|
className: cn(`focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1
|
|
34
34
|
items-start justify-between gap-4 rounded-md py-4 text-left text-sm
|
|
35
35
|
font-medium transition-all outline-none hover:underline
|
|
36
|
-
focus-visible:ring-[3px] disabled:pointer-events-none
|
|
37
|
-
disabled:opacity-50 [&[data-
|
|
36
|
+
focus-visible:ring-[3px] data-disabled:pointer-events-none
|
|
37
|
+
data-disabled:opacity-50 [&[data-panel-open]>svg]:rotate-180`, className),
|
|
38
38
|
...props,
|
|
39
39
|
children: [children, expandIcon || /* @__PURE__ */ jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0\n translate-y-0.5 transition-transform duration-200" })]
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function AccordionContent({ className, children, ...props }) {
|
|
44
|
-
return /* @__PURE__ */ jsx(
|
|
44
|
+
return /* @__PURE__ */ jsx(Accordion.Panel, {
|
|
45
45
|
"data-slot": "accordion-content",
|
|
46
|
-
className: "
|
|
46
|
+
className: "overflow-hidden text-sm",
|
|
47
47
|
...props,
|
|
48
48
|
children: /* @__PURE__ */ jsx("div", {
|
|
49
49
|
className: cn("pt-0 pb-4", className),
|
|
@@ -52,6 +52,6 @@ function AccordionContent({ className, children, ...props }) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, accordion_exports };
|
|
55
|
+
export { Accordion$1 as Accordion, AccordionContent, AccordionItem, AccordionTrigger, accordion_exports };
|
|
56
56
|
|
|
57
57
|
//# sourceMappingURL=accordion.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.mjs","names":[],"sources":["../../src/core/accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport
|
|
1
|
+
{"version":3,"file":"accordion.mjs","names":["Accordion","AccordionPrimitive"],"sources":["../../src/core/accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport {\n Accordion as AccordionPrimitive,\n type AccordionRoot,\n} from '@base-ui/react/accordion';\nimport { ChevronDownIcon } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\n/*\n * Base UI primitives with repo-owned styling; no longer vendored from shadcn.\n *\n * Notes on the Radix → Base UI shape change:\n * - Radix's `Accordion.Content` becomes Base UI's `Accordion.Panel`.\n * - `AccordionTrigger` keeps `expandIcon`, which *replaces* the default\n * `ChevronDownIcon`. The open-state rotation targets Base UI's\n * `data-panel-open` attribute on the trigger (Radix used `data-state=open`).\n * - The Radix-only `data-[state=…]:animate-accordion-*` classes are dropped:\n * they targeted Radix's `data-state` and relied on keyframes this package\n * never defined, so they were inert. Base UI mounts/unmounts the panel.\n */\n// Base UI's accordion is generic over the item value; this library always\n// addresses items by their stringified key (see molecules/collapse), so pin it\n// to `string` — otherwise `React.ComponentProps` erases the generic to\n// `unknown` and `value`/`onValueChange` stop lining up with the string callers.\nfunction Accordion({ ...props }: AccordionRoot.Props<string>) {\n return <AccordionPrimitive.Root data-slot=\"accordion\" {...props} />;\n}\n\nfunction AccordionItem({\n className,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Item>) {\n return (\n <AccordionPrimitive.Item\n data-slot=\"accordion-item\"\n className={cn('border-b last:border-b-0', className)}\n {...props}\n />\n );\n}\n\ninterface CustomTriggerProps {\n expandIcon?: React.ReactNode;\n}\n\nfunction AccordionTrigger({\n className,\n children,\n expandIcon,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Trigger> &\n CustomTriggerProps) {\n return (\n <AccordionPrimitive.Header className=\"flex\">\n <AccordionPrimitive.Trigger\n data-slot=\"accordion-trigger\"\n className={cn(\n `focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1\n items-start justify-between gap-4 rounded-md py-4 text-left text-sm\n font-medium transition-all outline-none hover:underline\n focus-visible:ring-[3px] data-disabled:pointer-events-none\n data-disabled:opacity-50 [&[data-panel-open]>svg]:rotate-180`,\n className,\n )}\n {...props}\n >\n {children}\n {expandIcon || (\n <ChevronDownIcon\n className=\"text-muted-foreground pointer-events-none size-4 shrink-0\n translate-y-0.5 transition-transform duration-200\"\n />\n )}\n </AccordionPrimitive.Trigger>\n </AccordionPrimitive.Header>\n );\n}\n\nfunction AccordionContent({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof AccordionPrimitive.Panel>) {\n return (\n <AccordionPrimitive.Panel\n data-slot=\"accordion-content\"\n className=\"overflow-hidden text-sm\"\n {...props}\n >\n <div className={cn('pt-0 pb-4', className)}>{children}</div>\n </AccordionPrimitive.Panel>\n );\n}\n\nexport { Accordion, AccordionItem, AccordionTrigger, AccordionContent };\n"],"mappings":";;;;;;;;;;;;;;AA4BA,SAASA,YAAU,EAAE,GAAG,SAAsC;CAC5D,OAAO,oBAACC,UAAmB,MAApB;EAAyB,aAAU;EAAY,GAAI;CAAQ,CAAA;AACpE;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,UAAmB,MAApB;EACE,aAAU;EACV,WAAW,GAAG,4BAA4B,SAAS;EACnD,GAAI;CACL,CAAA;AAEL;AAMA,SAAS,iBAAiB,EACxB,WACA,UACA,YACA,GAAG,SAEiB;CACpB,OACE,oBAACA,UAAmB,QAApB;EAA2B,WAAU;EACnC,UAAA,qBAACA,UAAmB,SAApB;GACE,aAAU;GACV,WAAW,GACT;;;;yEAKA,SACF;GACA,GAAI;GAVN,UAAA,CAYG,UACA,cACC,oBAAC,iBAAD,EACE,WAAU,6HAEX,CAAA,CAEuB;;CACH,CAAA;AAE/B;AAEA,SAAS,iBAAiB,EACxB,WACA,UACA,GAAG,SACqD;CACxD,OACE,oBAACA,UAAmB,OAApB;EACE,aAAU;EACV,WAAU;EACV,GAAI;EAEJ,UAAA,oBAAC,OAAD;GAAK,WAAW,GAAG,aAAa,SAAS;GAAI;EAAc,CAAA;CACnC,CAAA;AAE9B"}
|
package/dist/core/badge.d.mts
CHANGED
|
@@ -1,25 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
3
|
//#region src/core/badge.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Vendored from shadcn's `new-york-v4` badge registry entry.
|
|
6
|
-
*
|
|
7
|
-
* Two deliberate local adaptations, both of which must survive the next sync:
|
|
8
|
-
* - upstream imports `Slot` from the unified `radix-ui` package; this repo
|
|
9
|
-
* installs the individual `@radix-ui/*` packages (13 of them) and has no
|
|
10
|
-
* `radix-ui` dependency, so the import stays on `@radix-ui/react-slot`.
|
|
11
|
-
* - `cn` resolves through `@repo/ui/utils` rather than upstream's `cn` alias.
|
|
12
|
-
*
|
|
13
|
-
* Everything else is upstream verbatim, including the `rounded-full` /
|
|
14
|
-
* `border-transparent` base and the `ghost` / `link` variants.
|
|
15
|
-
*/
|
|
16
4
|
declare const badgeVariants: (props?: ({
|
|
17
|
-
variant?: "link" | "default" | "
|
|
5
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
18
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
-
type Props =
|
|
20
|
-
|
|
7
|
+
type Props = Omit<useRender.ComponentProps<'span'>, 'className'> & VariantProps<typeof badgeVariants> & {
|
|
8
|
+
className?: string;
|
|
21
9
|
};
|
|
22
|
-
declare function Badge({ className, variant,
|
|
10
|
+
declare function Badge({ className, variant, render, ...props }: Props): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
23
11
|
//#endregion
|
|
24
12
|
export { Badge, type Props, badgeVariants };
|
|
25
13
|
//# sourceMappingURL=badge.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.mts","names":[],"sources":["../../src/core/badge.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"badge.d.mts","names":[],"sources":["../../src/core/badge.tsx"],"mappings":";;;cAUM,gBAAa;;6CA0BlB;KAEI,QAAQ,KAAK,UAAU,uCAC1B,oBAAoB;EAClB;;iBAGK,QAAQ,WAAW,SAAqB,WAAW,SAAS,wBAAK,+CAAA"}
|