@oneplatformdev/ui 0.1.10-73 → 0.1.10-75
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/CHANGELOG.md +32 -0
- package/Dialog/Dialog.js +1 -1
- package/Dialog/Dialog.js.map +1 -1
- package/Select/Select.d.ts.map +1 -1
- package/Select/Select.js +57 -65
- package/Select/Select.js.map +1 -1
- package/Select/Select.types.d.ts +2 -2
- package/Select/Select.types.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## 0.1.10-75 (2025-11-06)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- update dialog primitive close ([5e7c577](https://github.com/oneplatformdev/core-web/commit/5e7c577))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated @oneplatformdev/utils to 0.1.1-124
|
|
10
|
+
- Updated @oneplatformdev/hooks to 0.1.0-110
|
|
11
|
+
- Updated @oneplatformdev/tokens to 0.0.1-97
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- BohdanRadchenko
|
|
16
|
+
|
|
17
|
+
## 0.1.10-74 (2025-11-06)
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- update dialog primitive close ([560b5ba](https://github.com/oneplatformdev/core-web/commit/560b5ba))
|
|
22
|
+
|
|
23
|
+
### 🧱 Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated @oneplatformdev/utils to 0.1.1-123
|
|
26
|
+
- Updated @oneplatformdev/hooks to 0.1.0-109
|
|
27
|
+
- Updated @oneplatformdev/tokens to 0.0.1-96
|
|
28
|
+
|
|
29
|
+
### ❤️ Thank You
|
|
30
|
+
|
|
31
|
+
- BohdanRadchenko
|
|
32
|
+
|
|
1
33
|
## 0.1.10-73 (2025-11-06)
|
|
2
34
|
|
|
3
35
|
### 🩹 Fixes
|
package/Dialog/Dialog.js
CHANGED
|
@@ -71,8 +71,8 @@ function D(t) {
|
|
|
71
71
|
className: n(
|
|
72
72
|
"absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100",
|
|
73
73
|
"data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",
|
|
74
|
+
"ring-offset-background focus:ring-transparent focus:ring-0 focus:ring-offset-0 focus:outline-hidden",
|
|
74
75
|
"focus:outline-none focus:ring-0",
|
|
75
|
-
"ring-offset-background focus:ring-ring focus:ring-2 focus:ring-offset-2 focus:outline-hidden",
|
|
76
76
|
"disabled:pointer-events-none [&_svg]:pointer-events-none",
|
|
77
77
|
"[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-5",
|
|
78
78
|
"cursor-pointer size-10 flex items-center justify-center"
|
package/Dialog/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\n\nfunction Dialog({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent(props: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n const {\n className,\n children,\n showCloseButton = true,\n style,\n ...rest\n } = props;\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay>\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-[50%] left-[50%] z-50 translate-x-[-50%] translate-y-[-50%]',\n 'grid w-full max-w-[calc(100%-2rem)] gap-4 sm:max-w-2xl',\n 'bg-background rounded-lg border p-6 shadow-lg duration-200',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className\n )}\n {...rest}\n style={{\n pointerEvents: 'auto',\n ...(style || {}),\n }}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={cn(\n 'absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100',\n 'data-[state=open]:bg-accent data-[state=open]:text-muted-foreground',\n '
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../src/Dialog/Dialog.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\n\nfunction Dialog({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n className,\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogContent(props: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean\n}) {\n const {\n className,\n children,\n showCloseButton = true,\n style,\n ...rest\n } = props;\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay>\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n 'fixed top-[50%] left-[50%] z-50 translate-x-[-50%] translate-y-[-50%]',\n 'grid w-full max-w-[calc(100%-2rem)] gap-4 sm:max-w-2xl',\n 'bg-background rounded-lg border p-6 shadow-lg duration-200',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n className\n )}\n {...rest}\n style={{\n pointerEvents: 'auto',\n ...(style || {}),\n }}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className={cn(\n 'absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100',\n 'data-[state=open]:bg-accent data-[state=open]:text-muted-foreground',\n 'ring-offset-background focus:ring-transparent focus:ring-0 focus:ring-offset-0 focus:outline-hidden',\n 'focus:outline-none focus:ring-0',\n 'disabled:pointer-events-none [&_svg]:pointer-events-none',\n '[&_svg]:shrink-0 [&_svg:not([class*=\\'size-\\'])]:size-5',\n 'cursor-pointer size-10 flex items-center justify-center',\n\n )}\n >\n <XIcon/>\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogOverlay>\n </DialogPortal>\n )\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction DialogTitle({\n className,\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-lg leading-none font-semibold\", className)}\n {...props}\n />\n )\n}\n\nfunction DialogDescription({\n className,\n ...props\n }: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n DialogPrimitive\n}\n"],"names":["Dialog","props","DialogPrimitive","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","jsx","cn","DialogContent","children","showCloseButton","style","rest","jsxs","XIcon","DialogHeader","DialogFooter","DialogTitle","DialogDescription"],"mappings":";;;;AAQA,SAASA,EAAO;AAAA,EACE,GAAGC;AACL,GAAsD;AACpE,2BAAQC,EAAgB,MAA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|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/Select/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,WAAW,EAIZ,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/Select/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,WAAW,EAIZ,MAAM,WAAW,CAAC;AAqGnB,eAAO,MAAM,MAAM,GAAI,gBAAgB,EACrC,OAAO,WAAW,CAAC,gBAAgB,CAAC,4CAwCrC,CAAC"}
|
package/Select/Select.js
CHANGED
|
@@ -1,97 +1,89 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createElement as
|
|
3
|
-
import { Button as
|
|
1
|
+
import { jsxs as d, jsx as l, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as m } from "react";
|
|
3
|
+
import { Button as h } from "../Button/Button.js";
|
|
4
4
|
import "../Button/buttonVariants.js";
|
|
5
|
-
import { SelectRoot as
|
|
6
|
-
import { isValidReactElement as
|
|
7
|
-
const
|
|
8
|
-
const { placeholder:
|
|
9
|
-
return
|
|
10
|
-
},
|
|
11
|
-
const { children:
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
|
|
5
|
+
import { SelectRoot as x, SelectContent as v, SelectTrigger as S, SelectValue as y, SelectItem as b } from "./SelectRoot.js";
|
|
6
|
+
import { isValidReactElement as C } from "@oneplatformdev/utils";
|
|
7
|
+
const R = (e) => {
|
|
8
|
+
const { placeholder: t, renderTrigger: n, slotProps: r } = e, o = /* @__PURE__ */ l(S, { ...r?.triggerProps || {}, children: /* @__PURE__ */ l(y, { placeholder: t }) });
|
|
9
|
+
return n && typeof n == "function" && C(n(e, o)) ? n(e, o) : o;
|
|
10
|
+
}, i = (e) => {
|
|
11
|
+
const { children: t, option: n, deep: r = 0 } = e;
|
|
12
|
+
return /* @__PURE__ */ d(
|
|
13
|
+
b,
|
|
14
14
|
{
|
|
15
|
-
value:
|
|
16
|
-
disabled:
|
|
15
|
+
value: n.value,
|
|
16
|
+
disabled: n.disabled,
|
|
17
17
|
className: "cursor-pointer",
|
|
18
|
-
style: { paddingLeft: `calc(8px + ${(
|
|
18
|
+
style: { paddingLeft: `calc(8px + ${(r || 0) * 8}px)` },
|
|
19
19
|
children: [
|
|
20
|
-
!
|
|
21
|
-
|
|
20
|
+
!t && n.label,
|
|
21
|
+
t && /* @__PURE__ */ l(g, { children: typeof t == "function" ? t({ ...e }) : t })
|
|
22
22
|
]
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
n.value
|
|
25
25
|
);
|
|
26
|
-
},
|
|
27
|
-
const { renderOption:
|
|
28
|
-
return
|
|
29
|
-
n
|
|
30
|
-
|
|
31
|
-
o,
|
|
32
|
-
l,
|
|
33
|
-
{ ...i, options: l },
|
|
34
|
-
/* @__PURE__ */ r(d, { ...t })
|
|
35
|
-
)
|
|
36
|
-
) ? /* @__PURE__ */ r(p, { value: e.value, children: n(
|
|
37
|
-
e,
|
|
26
|
+
}, p = (e) => {
|
|
27
|
+
const { renderOption: t, option: n, index: r, options: o, deep: u = 0, ...s } = e;
|
|
28
|
+
return t ? t && typeof t != "function" ? /* @__PURE__ */ l(i, { ...e }) : t && typeof t == "function" ? t(
|
|
29
|
+
n,
|
|
30
|
+
r,
|
|
38
31
|
o,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
) }, e.value) : e.children?.length ? /* @__PURE__ */ s(
|
|
32
|
+
{ ...s, options: o },
|
|
33
|
+
/* @__PURE__ */ l(i, { ...e })
|
|
34
|
+
) : n.children?.length ? /* @__PURE__ */ d(
|
|
43
35
|
"div",
|
|
44
36
|
{
|
|
45
37
|
className: "flex flex-col gap-1 truncate line-clamp-2",
|
|
46
38
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
/* @__PURE__ */ l(i, { ...e }),
|
|
40
|
+
n.children?.map((c, a, f) => /* @__PURE__ */ m(
|
|
41
|
+
p,
|
|
50
42
|
{
|
|
51
|
-
...
|
|
52
|
-
key:
|
|
53
|
-
option:
|
|
54
|
-
options:
|
|
55
|
-
index:
|
|
43
|
+
...e,
|
|
44
|
+
key: c.value,
|
|
45
|
+
option: c,
|
|
46
|
+
options: f,
|
|
47
|
+
index: a,
|
|
56
48
|
deep: (u || 0) + 1
|
|
57
49
|
}
|
|
58
50
|
))
|
|
59
51
|
]
|
|
60
52
|
},
|
|
61
|
-
|
|
62
|
-
) : /* @__PURE__ */
|
|
63
|
-
},
|
|
53
|
+
n.value
|
|
54
|
+
) : /* @__PURE__ */ l(i, { ...e }) : /* @__PURE__ */ l(i, { ...e });
|
|
55
|
+
}, j = (e) => {
|
|
64
56
|
const {
|
|
65
|
-
value:
|
|
66
|
-
options:
|
|
67
|
-
onChange:
|
|
68
|
-
nullable:
|
|
57
|
+
value: t,
|
|
58
|
+
options: n,
|
|
59
|
+
onChange: r,
|
|
60
|
+
nullable: o = !1,
|
|
69
61
|
clearLabel: u = "Clear",
|
|
70
|
-
disabled:
|
|
71
|
-
slotProps:
|
|
72
|
-
} =
|
|
73
|
-
return /* @__PURE__ */
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
disabled: s,
|
|
63
|
+
slotProps: c
|
|
64
|
+
} = e;
|
|
65
|
+
return /* @__PURE__ */ d(x, { value: t, onValueChange: r, disabled: s, children: [
|
|
66
|
+
/* @__PURE__ */ l(R, { ...e }),
|
|
67
|
+
/* @__PURE__ */ d(v, { ...c?.selectProps || {}, children: [
|
|
68
|
+
o && /* @__PURE__ */ l(
|
|
69
|
+
h,
|
|
78
70
|
{
|
|
79
71
|
className: "w-full px-2",
|
|
80
72
|
variant: "secondary",
|
|
81
73
|
size: "sm",
|
|
82
74
|
onClick: () => {
|
|
83
|
-
|
|
75
|
+
r?.("");
|
|
84
76
|
},
|
|
85
77
|
children: u
|
|
86
78
|
}
|
|
87
79
|
),
|
|
88
|
-
|
|
89
|
-
|
|
80
|
+
n.map((a, f) => /* @__PURE__ */ m(
|
|
81
|
+
p,
|
|
90
82
|
{
|
|
91
|
-
...
|
|
92
|
-
key:
|
|
93
|
-
option:
|
|
94
|
-
index:
|
|
83
|
+
...e,
|
|
84
|
+
key: a.value,
|
|
85
|
+
option: a,
|
|
86
|
+
index: f,
|
|
95
87
|
deep: 0
|
|
96
88
|
}
|
|
97
89
|
))
|
|
@@ -99,6 +91,6 @@ const P = (t) => {
|
|
|
99
91
|
] });
|
|
100
92
|
};
|
|
101
93
|
export {
|
|
102
|
-
|
|
94
|
+
j as Select
|
|
103
95
|
};
|
|
104
96
|
//# sourceMappingURL=Select.js.map
|
package/Select/Select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import { isValidElement, ReactNode } from 'react';\n\nimport { Button } from '../Button';\nimport {\n SelectContent,\n SelectItem,\n SelectOption,\n SelectProps,\n SelectRoot,\n SelectTrigger,\n SelectValue,\n} from '../Select';\nimport { isValidReactElement } from '@oneplatformdev/utils';\n\nconst RenderSelectTrigger = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData>\n) => {\n const { placeholder, renderTrigger, slotProps } = props;\n const defaultComponent = (\n <SelectTrigger {...(slotProps?.triggerProps || {})}>\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n );\n\n if (\n Boolean(renderTrigger) &&\n typeof renderTrigger === 'function' &&\n isValidReactElement(renderTrigger(props, defaultComponent))\n ) {\n return renderTrigger(props, defaultComponent);\n }\n\n return defaultComponent;\n};\n\nconst DefaultRenderSelectOption = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n deep?: number;\n children?: ((params: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n }) => ReactNode) | ReactNode;\n }\n) => {\n const { children, option, deep = 0 } = props;\n\n return (\n <SelectItem\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className='cursor-pointer'\n style={{ paddingLeft: `calc(8px + ${(deep || 0) * 8}px)` }}\n >\n {!children && option.label}\n {children && (\n <>\n {typeof children === 'function'\n ? children({ ...props })\n : children\n }\n </>\n )}\n </SelectItem>\n )\n};\n\nconst RenderSelectOption = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n deep?: number;\n }\n) => {\n const { renderOption, option, index, options, deep = 0, ...rest } = props;\n
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../src/Select/Select.tsx"],"sourcesContent":["import { isValidElement, ReactNode } from 'react';\n\nimport { Button } from '../Button';\nimport {\n SelectContent,\n SelectItem,\n SelectOption,\n SelectProps,\n SelectRoot,\n SelectTrigger,\n SelectValue,\n} from '../Select';\nimport { isValidReactElement } from '@oneplatformdev/utils';\n\nconst RenderSelectTrigger = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData>\n) => {\n const { placeholder, renderTrigger, slotProps } = props;\n const defaultComponent = (\n <SelectTrigger {...(slotProps?.triggerProps || {})}>\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n );\n\n if (\n Boolean(renderTrigger) &&\n typeof renderTrigger === 'function' &&\n isValidReactElement(renderTrigger(props, defaultComponent))\n ) {\n return renderTrigger(props, defaultComponent);\n }\n\n return defaultComponent;\n};\n\nconst DefaultRenderSelectOption = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n deep?: number;\n children?: ((params: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n }) => ReactNode) | ReactNode;\n }\n) => {\n const { children, option, deep = 0 } = props;\n\n return (\n <SelectItem\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className='cursor-pointer'\n style={{ paddingLeft: `calc(8px + ${(deep || 0) * 8}px)` }}\n >\n {!children && option.label}\n {children && (\n <>\n {typeof children === 'function'\n ? children({ ...props })\n : children\n }\n </>\n )}\n </SelectItem>\n )\n};\n\nconst RenderSelectOption = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData> & {\n option: SelectOption<ExtendOptionData>;\n index: number;\n deep?: number;\n }\n) => {\n const { renderOption, option, index, options, deep = 0, ...rest } = props;\n if(!renderOption) return <DefaultRenderSelectOption {...props} />;\n if(renderOption && typeof renderOption !== 'function') return <DefaultRenderSelectOption {...props} />;\n if(renderOption && typeof renderOption === 'function') return renderOption(\n option,\n index,\n options,\n { ...rest, options },\n <DefaultRenderSelectOption {...props} />\n )\n\n if(!option.children?.length) {\n return <DefaultRenderSelectOption {...props} />;\n }\n\n return (\n <div\n key={option.value}\n className=\"flex flex-col gap-1 truncate line-clamp-2\"\n >\n <DefaultRenderSelectOption {...props} />\n {option.children?.map((child, idx, arr) => (\n <RenderSelectOption\n {...props}\n key={child.value}\n option={child}\n options={arr}\n index={idx}\n deep={(deep || 0) + 1}\n />\n ))}\n </div>\n )\n};\n\n// TODO: add description\nexport const Select = <ExtendOptionData,>(\n props: SelectProps<ExtendOptionData>\n) => {\n const {\n value,\n options,\n onChange,\n nullable = false,\n clearLabel = 'Clear',\n disabled,\n slotProps,\n } = props;\n\n return (\n <SelectRoot value={value} onValueChange={onChange} disabled={disabled}>\n <RenderSelectTrigger {...props} />\n <SelectContent {...(slotProps?.selectProps || {})}>\n {nullable && (\n <Button\n className=\"w-full px-2\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => {\n onChange?.('');\n }}\n >\n {clearLabel}\n </Button>\n )}\n {options.map((option, index) => (\n <RenderSelectOption\n {...props}\n key={option.value}\n option={option}\n index={index}\n deep={0}\n />\n ))}\n </SelectContent>\n </SelectRoot>\n );\n};\n"],"names":["RenderSelectTrigger","props","placeholder","renderTrigger","slotProps","defaultComponent","jsx","SelectTrigger","SelectValue","isValidReactElement","DefaultRenderSelectOption","children","option","deep","jsxs","SelectItem","Fragment","RenderSelectOption","renderOption","index","options","rest","child","idx","arr","createElement","Select","value","onChange","nullable","clearLabel","disabled","SelectRoot","SelectContent","Button"],"mappings":";;;;;;AAcA,MAAMA,IAAsB,CAC1BC,MACG;AACH,QAAM,EAAE,aAAAC,GAAa,eAAAC,GAAe,WAAAC,EAAA,IAAcH,GAC5CI,IACJ,gBAAAC,EAACC,GAAA,EAAe,GAAIH,GAAW,gBAAgB,IAC7C,UAAA,gBAAAE,EAACE,GAAA,EAAY,aAAAN,EAAA,CAA0B,EAAA,CACzC;AAGF,SACUC,KACR,OAAOA,KAAkB,cACzBM,EAAoBN,EAAcF,GAAOI,CAAgB,CAAC,IAEnDF,EAAcF,GAAOI,CAAgB,IAGvCA;AACT,GAEMK,IAA4B,CAChCT,MASG;AACH,QAAM,EAAE,UAAAU,GAAU,QAAAC,GAAQ,MAAAC,IAAO,MAAMZ;AAEvC,SACE,gBAAAa;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,OAAOH,EAAO;AAAA,MACd,UAAUA,EAAO;AAAA,MACjB,WAAU;AAAA,MACV,OAAO,EAAE,aAAa,eAAeC,KAAQ,KAAK,CAAC,MAAA;AAAA,MAElD,UAAA;AAAA,QAAA,CAACF,KAAYC,EAAO;AAAA,QACpBD,KACC,gBAAAL,EAAAU,GAAA,EACG,UAAA,OAAOL,KAAa,aACjBA,EAAS,EAAE,GAAGV,EAAA,CAAO,IACrBU,EAAA,CAEN;AAAA,MAAA;AAAA,IAAA;AAAA,IAbGC,EAAO;AAAA,EAAA;AAiBlB,GAEMK,IAAqB,CACzBhB,MAKG;AACH,QAAM,EAAE,cAAAiB,GAAc,QAAAN,GAAQ,OAAAO,GAAO,SAAAC,GAAS,MAAAP,IAAO,GAAG,GAAGQ,EAAA,IAASpB;AACpE,SAAIiB,IACDA,KAAgB,OAAOA,KAAiB,aAAmB,gBAAAZ,EAACI,GAAA,EAA2B,GAAGT,GAAO,IACjGiB,KA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SAAQ;AAAA,UACR,MAAK;AAAA,UACL,SAAS,MAAM;AACb,YAAAN,IAAW,EAAE;AAAA,UACf;AAAA,UAEC,UAAAE;AAAA,QAAA;AAAA,MAAA;AAAA,MAGJV,EAAQ,IAAI,CAACR,GAAQO,MACpB,gBAAAM;AAAA,QAACR;AAAA,QAAA;AAAA,UACE,GAAGhB;AAAA,UACJ,KAAKW,EAAO;AAAA,UACZ,QAAAA;AAAA,UACA,OAAAO;AAAA,UACA,MAAM;AAAA,QAAA;AAAA,MAAA,CAET;AAAA,IAAA,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
|
package/Select/Select.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { SelectContent } from './SelectRoot';
|
|
3
3
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
4
|
export interface SelectOption<ExtendOptionData = unknown> {
|
|
@@ -9,7 +9,7 @@ export interface SelectOption<ExtendOptionData = unknown> {
|
|
|
9
9
|
children?: SelectOption<ExtendOptionData>[];
|
|
10
10
|
}
|
|
11
11
|
export type SelectRenderTrigger<ExtendOptionData> = (props: Omit<SelectProps<ExtendOptionData>, 'renderTrigger'>, defaultComponent: ReactNode) => ReactNode;
|
|
12
|
-
export type SelectRenderOption<ExtendOptionData> = (option: SelectOption<ExtendOptionData>, index: number, options: SelectOption<ExtendOptionData>[], props: Omit<SelectProps<ExtendOptionData>, 'renderOption'>, defaultComponent: ReactNode) =>
|
|
12
|
+
export type SelectRenderOption<ExtendOptionData> = (option: SelectOption<ExtendOptionData>, index: number, options: SelectOption<ExtendOptionData>[], props: Omit<SelectProps<ExtendOptionData>, 'renderOption'>, defaultComponent: ReactNode) => ReactElement;
|
|
13
13
|
export interface SelectProps<ExtendOptionData> {
|
|
14
14
|
/** Render options. */
|
|
15
15
|
options: SelectOption<ExtendOptionData>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.types.d.ts","sourceRoot":"","sources":["../../src/Select/Select.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Select.types.d.ts","sourceRoot":"","sources":["../../src/Select/Select.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,YAAY,CAAC,gBAAgB,GAAG,OAAO;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC;CAC7C;AAED,MAAM,MAAM,mBAAmB,CAAC,gBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,eAAe,CAAC,EAAE,gBAAgB,EAAE,SAAS,KAAK,SAAS,CAAC;AAE5J,MAAM,MAAM,kBAAkB,CAAC,gBAAgB,IAAI,CACjD,MAAM,EAAE,YAAY,CAAC,gBAAgB,CAAC,EACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,CAAC,gBAAgB,CAAC,EAAE,EACzC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC,EAC1D,gBAAgB,EAAE,SAAS,KACxB,YAAY,CAAC;AAElB,MAAM,WAAW,WAAW,CAAC,gBAAgB;IAC3C,sBAAsB;IACtB,OAAO,EAAE,YAAY,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAC1C,qBAAqB;IACrB,KAAK,CAAC,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACtD,4BAA4B;IAC5B,YAAY,CAAC,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;IACpD,wBAAwB;IACxB,SAAS,CAAC,EAAE;QACV,mCAAmC;QACnC,YAAY,CAAC,EAAE,wBAAwB,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;QACxE,2BAA2B;QAC3B,WAAW,CAAC,EAAE,wBAAwB,CAAC,OAAO,aAAa,CAAC,CAAC;KAC9D,CAAC;CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/ui",
|
|
3
|
-
"version": "0.1.10-
|
|
3
|
+
"version": "0.1.10-75",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -105,8 +105,8 @@
|
|
|
105
105
|
"recharts": "^3.2.0",
|
|
106
106
|
"sonner": "^2.0.7",
|
|
107
107
|
"vaul": "^1.1.2",
|
|
108
|
-
"@oneplatformdev/tokens": "^0.0.1-
|
|
109
|
-
"@oneplatformdev/
|
|
110
|
-
"@oneplatformdev/
|
|
108
|
+
"@oneplatformdev/tokens": "^0.0.1-97",
|
|
109
|
+
"@oneplatformdev/hooks": "^0.1.0-110",
|
|
110
|
+
"@oneplatformdev/utils": "^0.1.1-124"
|
|
111
111
|
}
|
|
112
112
|
}
|