@jbpark/ui-kit 3.6.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Card.d.mts +1 -1
- package/dist/Card.d.mts.map +1 -1
- package/dist/Card.mjs.map +1 -1
- package/dist/Space.d.mts +1 -1
- package/dist/Space.d.mts.map +1 -1
- package/dist/Space.mjs +3 -1
- package/dist/Space.mjs.map +1 -1
- package/dist/components/atoms/checkbox/group.d.mts.map +1 -1
- package/dist/components/atoms/checkbox/group.mjs +4 -3
- package/dist/components/atoms/checkbox/group.mjs.map +1 -1
- package/dist/components/atoms/color-picker.d.mts +7 -1
- package/dist/components/atoms/color-picker.d.mts.map +1 -1
- package/dist/components/atoms/color-picker.mjs +8 -1
- package/dist/components/atoms/color-picker.mjs.map +1 -1
- package/dist/components/atoms/option-group.mjs +11 -1
- package/dist/components/atoms/option-group.mjs.map +1 -1
- package/dist/components/atoms/radio/group.d.mts.map +1 -1
- package/dist/components/atoms/radio/group.mjs +3 -2
- package/dist/components/atoms/radio/group.mjs.map +1 -1
- package/dist/components/atoms/spin.d.mts +2 -1
- package/dist/components/atoms/spin.d.mts.map +1 -1
- package/dist/components/atoms/spin.mjs +3 -2
- package/dist/components/atoms/spin.mjs.map +1 -1
- package/dist/components/molecules/collapse.d.mts +1 -1
- package/dist/components/molecules/collapse.d.mts.map +1 -1
- package/dist/components/molecules/collapse.mjs +1 -1
- package/dist/components/molecules/collapse.mjs.map +1 -1
- package/dist/components/molecules/dropdown.d.mts +2 -2
- package/dist/components/molecules/dropdown.d.mts.map +1 -1
- package/dist/components/molecules/dropdown.mjs +25 -12
- package/dist/components/molecules/dropdown.mjs.map +1 -1
- package/dist/components/molecules/index.d.mts +9 -6
- package/dist/components/molecules/marquees/item.d.mts.map +1 -1
- package/dist/components/molecules/marquees/item.mjs +3 -8
- package/dist/components/molecules/marquees/item.mjs.map +1 -1
- package/dist/components/molecules/menu/item/item.mjs +27 -11
- package/dist/components/molecules/menu/item/item.mjs.map +1 -1
- package/dist/components/molecules/menu/menu.d.mts.map +1 -1
- package/dist/components/molecules/menu/menu.mjs +9 -7
- package/dist/components/molecules/menu/menu.mjs.map +1 -1
- package/dist/components/molecules/reveals/reveals.d.mts +5 -0
- package/dist/components/molecules/reveals/reveals.d.mts.map +1 -1
- package/dist/components/molecules/reveals/reveals.mjs +6 -1
- package/dist/components/molecules/reveals/reveals.mjs.map +1 -1
- package/dist/components/molecules/splitter/splitter.mjs +2 -2
- package/dist/components/molecules/splitter/splitter.mjs.map +1 -1
- package/dist/components/molecules/upload.d.mts +11 -2
- package/dist/components/molecules/upload.d.mts.map +1 -1
- package/dist/components/molecules/upload.mjs +23 -6
- package/dist/components/molecules/upload.mjs.map +1 -1
- package/dist/components/organisms/modal.mjs +1 -1
- package/dist/components/organisms/toast.mjs +1 -1
- package/dist/components/templates/layout/header.mjs +1 -1
- package/dist/components/templates/layout/header.mjs.map +1 -1
- package/dist/components/templates/layout/layout.d.mts.map +1 -1
- package/dist/components/templates/layout/layout.mjs +23 -7
- package/dist/components/templates/layout/layout.mjs.map +1 -1
- package/dist/components/templates/layout/sider-context.mjs +20 -0
- package/dist/components/templates/layout/sider-context.mjs.map +1 -0
- package/dist/components/templates/layout/sider.d.mts.map +1 -1
- package/dist/components/templates/layout/sider.mjs +4 -2
- package/dist/components/templates/layout/sider.mjs.map +1 -1
- package/dist/index.d.mts +12 -9
- package/dist/providers/Config/index.mjs +6 -2
- package/dist/providers/Config/index.mjs.map +1 -1
- package/dist/style.css +72 -9
- package/package.json +2 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext, useContext, useLayoutEffect, useRef } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/templates/layout/sider-context.ts
|
|
4
|
+
const SiderRegistryContext = createContext(null);
|
|
5
|
+
const useRegisterSider = () => {
|
|
6
|
+
const registry = useContext(SiderRegistryContext);
|
|
7
|
+
const idRef = useRef({});
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
|
+
if (!registry) return;
|
|
10
|
+
const id = idRef.current;
|
|
11
|
+
registry.registerSider(id);
|
|
12
|
+
return () => {
|
|
13
|
+
registry.unregisterSider(id);
|
|
14
|
+
};
|
|
15
|
+
}, [registry]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { SiderRegistryContext, useRegisterSider };
|
|
20
|
+
//# sourceMappingURL=sider-context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sider-context.mjs","names":[],"sources":["../../../../src/components/templates/layout/sider-context.ts"],"sourcesContent":["import { createContext, useContext, useLayoutEffect, useRef } from 'react';\n\n// `Layout` needs to know whether a `Sider` exists anywhere in its subtree\n// to decide flex-row vs flex-col — but `Children.toArray(children).some(...)`\n// only ever sees direct children, and doesn't flatten Fragments, so a\n// `Sider` wrapped in a Fragment (or a custom wrapper component) went\n// undetected. Registering presence via context instead survives any\n// amount of wrapping, since it's `Sider` itself reporting in, not `Layout`\n// inspecting its children's shape.\nexport interface SiderRegistry {\n registerSider: (id: object) => void;\n unregisterSider: (id: object) => void;\n}\n\nexport const SiderRegistryContext = createContext<SiderRegistry | null>(null);\n\nexport const useRegisterSider = () => {\n const registry = useContext(SiderRegistryContext);\n const idRef = useRef({});\n\n // `useLayoutEffect` (not `useEffect`) so the registration — and the\n // resulting flex-row switch on `Layout` — commits before the browser\n // paints, avoiding a flash of the flex-col fallback layout on mount.\n useLayoutEffect(() => {\n if (!registry) {\n return;\n }\n\n const id = idRef.current;\n registry.registerSider(id);\n\n return () => {\n registry.unregisterSider(id);\n };\n }, [registry]);\n};\n"],"mappings":";;;AAcA,MAAa,uBAAuB,cAAoC,KAAK;AAE7E,MAAa,yBAAyB;CACpC,MAAM,WAAW,WAAW,qBAAqB;CACjD,MAAM,QAAQ,OAAO,EAAE,CAAC;AAKxB,uBAAsB;AACpB,MAAI,CAAC,SACH;EAGF,MAAM,KAAK,MAAM;AACjB,WAAS,cAAc,GAAG;AAE1B,eAAa;AACX,YAAS,gBAAgB,GAAG;;IAE7B,CAAC,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sider.d.mts","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sider.d.mts","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"mappings":";;;UAUiB,KAAA,SAAc,IAAA,CAC7B,KAAA,CAAM,wBAAA;EAGN,KAAA;EACA,cAAA;EACA,WAAA;EACA,gBAAA;EACA,SAAA;EACA,YAAA;EACA,OAAA,GAAU,KAAA,CAAM,SAAA;EAChB,UAAA;IACE,OAAA;EAAA;EAEF,UAAA,IAAc,SAAA;AAAA;AAAA,cAMV,KAAA;EAAS,QAAA;EAAA,SAAA;EAAA,UAAA;EAAA,KAAA;EAAA,KAAA;EAAA,cAAA;EAAA,WAAA;EAAA,gBAAA;EAAA,SAAA,EAAA,UAAA;EAAA,YAAA;EAAA,OAAA;EAAA,UAAA,EAAA,WAAA;EAAA,GAAA;AAAA,GAcZ,KAAA,KAAK,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../../utils.mjs";
|
|
4
|
+
import { useRegisterSider } from "./sider-context.mjs";
|
|
4
5
|
import { PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
5
6
|
import { useState } from "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -8,6 +9,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
9
|
//#region src/components/templates/layout/sider.tsx
|
|
9
10
|
const toCssSize = (value) => typeof value === "number" ? `${value}px` : value;
|
|
10
11
|
const Sider = ({ children, className, classNames, style, width = 200, collapsedWidth = 80, collapsible = false, defaultCollapsed = false, collapsed: _collapsed, reverseArrow = false, trigger, onCollapse: _onCollapse = () => {}, ...props }) => {
|
|
12
|
+
useRegisterSider();
|
|
11
13
|
const [uncontrolledCollapsed, setUncontrolledCollapsed] = useState(defaultCollapsed);
|
|
12
14
|
const controlled = _collapsed !== void 0;
|
|
13
15
|
const collapsed = controlled ? _collapsed : uncontrolledCollapsed;
|
|
@@ -18,7 +20,7 @@ const Sider = ({ children, className, classNames, style, width = 200, collapsedW
|
|
|
18
20
|
};
|
|
19
21
|
const TriggerIcon = collapsed !== reverseArrow ? PanelLeftOpen : PanelLeftClose;
|
|
20
22
|
return /* @__PURE__ */ jsxs("aside", {
|
|
21
|
-
className: cn("z-
|
|
23
|
+
className: cn("z-10 flex h-full shrink-0 flex-col overflow-hidden", "transition-[width] duration-200", className),
|
|
22
24
|
style: {
|
|
23
25
|
width: toCssSize(collapsed ? collapsedWidth : width),
|
|
24
26
|
...style
|
|
@@ -32,7 +34,7 @@ const Sider = ({ children, className, classNames, style, width = 200, collapsedW
|
|
|
32
34
|
"aria-label": collapsed ? "펼치기" : "접기",
|
|
33
35
|
onClick: onCollapse,
|
|
34
36
|
className: cn("flex w-full shrink-0 items-center justify-center py-2", "cursor-pointer transition-colors hover:bg-black/5", classNames?.trigger),
|
|
35
|
-
children: trigger
|
|
37
|
+
children: trigger === void 0 ? /* @__PURE__ */ jsx(TriggerIcon, { className: "size-4" }) : trigger
|
|
36
38
|
})]
|
|
37
39
|
});
|
|
38
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sider.mjs","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { PanelLeftClose, PanelLeftOpen } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'aside'>,\n 'onCollapse'\n> {\n width?: number | string;\n collapsedWidth?: number | string;\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n collapsed?: boolean;\n reverseArrow?: boolean;\n trigger?: React.ReactNode;\n classNames?: {\n trigger?: string;\n };\n onCollapse?: (collapsed: boolean) => void;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Sider = ({\n children,\n className,\n classNames,\n style,\n width = 200,\n collapsedWidth = 80,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: _collapsed,\n reverseArrow = false,\n trigger,\n onCollapse: _onCollapse = () => {},\n ...props\n}: Props) => {\n const [uncontrolledCollapsed, setUncontrolledCollapsed] =\n useState(defaultCollapsed);\n\n const controlled = _collapsed !== undefined;\n const collapsed = controlled ? _collapsed : uncontrolledCollapsed;\n\n const onCollapse = () => {\n const next = !collapsed;\n\n if (!controlled) {\n setUncontrolledCollapsed(next);\n }\n _onCollapse(next);\n };\n\n const TriggerIcon =\n collapsed !== reverseArrow ? PanelLeftOpen : PanelLeftClose;\n\n return (\n <aside\n className={cn(\n 'z-100 flex h-full shrink-0 flex-col overflow-hidden',\n 'transition-[width] duration-200',\n className,\n //\n )}\n style={{\n width: toCssSize(collapsed ? collapsedWidth : width),\n ...style,\n }}\n {...props}\n >\n <div className=\"min-h-0 flex-1 overflow-auto\">{children}</div>\n {collapsible && (\n <button\n type=\"button\"\n aria-label={collapsed ? '펼치기' : '접기'}\n onClick={onCollapse}\n className={cn(\n 'flex w-full shrink-0 items-center justify-center py-2',\n 'cursor-pointer transition-colors hover:bg-black/5',\n classNames?.trigger,\n //\n )}\n >\n {trigger
|
|
1
|
+
{"version":3,"file":"sider.mjs","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\n\nimport { PanelLeftClose, PanelLeftOpen } from 'lucide-react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { useRegisterSider } from './sider-context';\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'aside'>,\n 'onCollapse'\n> {\n width?: number | string;\n collapsedWidth?: number | string;\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n collapsed?: boolean;\n reverseArrow?: boolean;\n trigger?: React.ReactNode;\n classNames?: {\n trigger?: string;\n };\n onCollapse?: (collapsed: boolean) => void;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Sider = ({\n children,\n className,\n classNames,\n style,\n width = 200,\n collapsedWidth = 80,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: _collapsed,\n reverseArrow = false,\n trigger,\n onCollapse: _onCollapse = () => {},\n ...props\n}: Props) => {\n useRegisterSider();\n\n const [uncontrolledCollapsed, setUncontrolledCollapsed] =\n useState(defaultCollapsed);\n\n const controlled = _collapsed !== undefined;\n const collapsed = controlled ? _collapsed : uncontrolledCollapsed;\n\n const onCollapse = () => {\n const next = !collapsed;\n\n if (!controlled) {\n setUncontrolledCollapsed(next);\n }\n _onCollapse(next);\n };\n\n const TriggerIcon =\n collapsed !== reverseArrow ? PanelLeftOpen : PanelLeftClose;\n\n return (\n <aside\n className={cn(\n // Below Header's z-50 (and every other floating/overlay primitive\n // in this library, which all use z-50) — Sider is a static layout\n // column, not floating chrome, and previously outranked Header\n // with an arbitrary z-100, covering it once Header stuck to the\n // viewport top on scroll.\n 'z-10 flex h-full shrink-0 flex-col overflow-hidden',\n 'transition-[width] duration-200',\n className,\n //\n )}\n style={{\n width: toCssSize(collapsed ? collapsedWidth : width),\n ...style,\n }}\n {...props}\n >\n <div className=\"min-h-0 flex-1 overflow-auto\">{children}</div>\n {collapsible && (\n <button\n type=\"button\"\n aria-label={collapsed ? '펼치기' : '접기'}\n onClick={onCollapse}\n className={cn(\n 'flex w-full shrink-0 items-center justify-center py-2',\n 'cursor-pointer transition-colors hover:bg-black/5',\n classNames?.trigger,\n //\n )}\n >\n {trigger === undefined ? <TriggerIcon className=\"size-4\" /> : trigger}\n </button>\n )}\n </aside>\n );\n};\n\nexport default Sider;\n"],"mappings":";;;;;;;;;AA2BA,MAAM,aAAa,UACjB,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;AAE7C,MAAM,SAAS,EACb,UACA,WACA,YACA,OACA,QAAQ,KACR,iBAAiB,IACjB,cAAc,OACd,mBAAmB,OACnB,WAAW,YACX,eAAe,OACf,SACA,YAAY,oBAAoB,IAChC,GAAG,YACQ;AACX,mBAAkB;CAElB,MAAM,CAAC,uBAAuB,4BAC5B,SAAS,iBAAiB;CAE5B,MAAM,aAAa,eAAe;CAClC,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,mBAAmB;EACvB,MAAM,OAAO,CAAC;AAEd,MAAI,CAAC,WACH,0BAAyB,KAAK;AAEhC,cAAY,KAAK;;CAGnB,MAAM,cACJ,cAAc,eAAe,gBAAgB;AAE/C,QACE,qBAAC;EACC,WAAW,GAMT,sDACA,mCACA,UAED;EACD,OAAO;GACL,OAAO,UAAU,YAAY,iBAAiB,MAAM;GACpD,GAAG;GACJ;EACD,GAAI;aAEJ,oBAAC;GAAI,WAAU;GAAgC;IAAe,EAC7D,eACC,oBAAC;GACC,MAAK;GACL,cAAY,YAAY,QAAQ;GAChC,SAAS;GACT,WAAW,GACT,yDACA,qDACA,YAAY,QAEb;aAEA,YAAY,SAAY,oBAAC,eAAY,WAAU,WAAW,GAAG;IACvD;GAEL"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import Button from "./Button.mjs";
|
|
2
2
|
import Tag from "./Tag.mjs";
|
|
3
3
|
import Typography from "./Typography.mjs";
|
|
4
|
-
import Card from "./Card.mjs";
|
|
5
|
-
import { Menu } from "./components/molecules/menu/menu.mjs";
|
|
4
|
+
import Card, { Props } from "./Card.mjs";
|
|
5
|
+
import { Menu, Props as Props$6 } from "./components/molecules/menu/menu.mjs";
|
|
6
|
+
import { Props as Props$7 } from "./components/molecules/reveals/reveals.mjs";
|
|
6
7
|
import Reveals from "./Reveals.mjs";
|
|
7
|
-
import Space from "./Space.mjs";
|
|
8
|
+
import Space, { Props as Props$8 } from "./Space.mjs";
|
|
8
9
|
import Layout from "./Layout.mjs";
|
|
9
10
|
import { Checkbox } from "./components/atoms/checkbox/index.mjs";
|
|
10
11
|
import { ColorPicker } from "./components/atoms/color-picker.mjs";
|
|
@@ -19,13 +20,15 @@ import { Skeleton } from "./components/atoms/skeleton/index.mjs";
|
|
|
19
20
|
import { Spin } from "./components/atoms/spin.mjs";
|
|
20
21
|
import { Switch } from "./components/atoms/switch.mjs";
|
|
21
22
|
import "./components/atoms/index.mjs";
|
|
22
|
-
import { Collapse } from "./components/molecules/collapse.mjs";
|
|
23
|
-
import { Dropdown } from "./components/molecules/dropdown.mjs";
|
|
23
|
+
import { Collapse, Props as Props$1 } from "./components/molecules/collapse.mjs";
|
|
24
|
+
import { Dropdown, Props as Props$4 } from "./components/molecules/dropdown.mjs";
|
|
25
|
+
import { Props as Props$5 } from "./components/molecules/marquees/marquees.mjs";
|
|
24
26
|
import { Marquees } from "./components/molecules/marquees/index.mjs";
|
|
27
|
+
import { Props as Props$9 } from "./components/molecules/splitter/splitter.mjs";
|
|
25
28
|
import { Splitter } from "./components/molecules/splitter/index.mjs";
|
|
26
|
-
import { Upload, UploadFile } from "./components/molecules/upload.mjs";
|
|
29
|
+
import { Props as Props$10, Upload, UploadFile } from "./components/molecules/upload.mjs";
|
|
27
30
|
import "./components/molecules/index.mjs";
|
|
28
|
-
import { Drawer, Props as Props$
|
|
31
|
+
import { Drawer, Props as Props$3 } from "./components/organisms/drawer.mjs";
|
|
29
32
|
import { List } from "./components/organisms/list/index.mjs";
|
|
30
33
|
import { Modal } from "./components/organisms/modal.mjs";
|
|
31
34
|
import { Swiper } from "./components/organisms/swiper/index.mjs";
|
|
@@ -34,6 +37,6 @@ import "./components/organisms/index.mjs";
|
|
|
34
37
|
import "./components/templates/index.mjs";
|
|
35
38
|
import { ThemeConfig, ThemeToken } from "./providers/Config/types.mjs";
|
|
36
39
|
import { useConfig } from "./providers/Config/context.mjs";
|
|
37
|
-
import { Config, Props } from "./providers/Config/index.mjs";
|
|
40
|
+
import { Config, Props as Props$2 } from "./providers/Config/index.mjs";
|
|
38
41
|
import "./providers/index.mjs";
|
|
39
|
-
export { Button, Card, Checkbox, Collapse, ColorPicker, Config, Props as ConfigProps, DatePicker, Drawer, Props$
|
|
42
|
+
export { Button, Card, Props as CardProps, Checkbox, Collapse, Props$1 as CollapseProps, ColorPicker, Config, Props$2 as ConfigProps, DatePicker, Drawer, Props$3 as DrawerProps, Dropdown, Props$4 as DropdownProps, FloatButton, Input, Layout, List, Marquees, Props$5 as MarqueesProps, Menu, Props$6 as MenuProps, Modal, Popover, Progress, Radio, Reveals, Props$7 as RevealsProps, Select, Skeleton, Space, Props$8 as SpaceProps, Spin, Splitter, Props$9 as SplitterProps, Swiper, Switch, Tag, ThemeConfig, ThemeToken, Toast, StaticProps as ToastOptions, Typography, Upload, UploadFile, Props$10 as UploadProps, useConfig };
|
|
@@ -39,6 +39,7 @@ const buildCssVars = (token) => {
|
|
|
39
39
|
};
|
|
40
40
|
const Config = ({ theme = {}, className, children }) => {
|
|
41
41
|
const parent = useConfig();
|
|
42
|
+
const themeKey = JSON.stringify(theme);
|
|
42
43
|
const mergedTheme = useMemo(() => ({
|
|
43
44
|
...parent.theme,
|
|
44
45
|
...theme,
|
|
@@ -46,7 +47,7 @@ const Config = ({ theme = {}, className, children }) => {
|
|
|
46
47
|
...parent.theme.token,
|
|
47
48
|
...theme.token
|
|
48
49
|
}
|
|
49
|
-
}), [parent.theme,
|
|
50
|
+
}), [JSON.stringify(parent.theme), themeKey]);
|
|
50
51
|
const contextValue = useMemo(() => ({ theme: mergedTheme }), [mergedTheme]);
|
|
51
52
|
const cssVars = useMemo(() => buildCssVars(mergedTheme.token), [mergedTheme.token]);
|
|
52
53
|
const hasCssVars = Object.keys(cssVars).length > 0;
|
|
@@ -56,7 +57,10 @@ const Config = ({ theme = {}, className, children }) => {
|
|
|
56
57
|
value: contextValue,
|
|
57
58
|
children: needsWrapper ? /* @__PURE__ */ jsx("div", {
|
|
58
59
|
className: cn(mergedTheme.dark && "dark", className),
|
|
59
|
-
style:
|
|
60
|
+
style: {
|
|
61
|
+
...hasCssVars ? cssVars : void 0,
|
|
62
|
+
display: "contents"
|
|
63
|
+
},
|
|
60
64
|
children
|
|
61
65
|
}) : children
|
|
62
66
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/providers/Config/index.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { Context, useConfig } from './context';\nimport type { ThemeConfig, ThemeToken } from './types';\n\nconst tokenToCssVar: Record<keyof ThemeToken, string> = {\n colorPrimary: '--primary',\n colorPrimaryForeground: '--primary-foreground',\n colorBackground: '--background',\n colorForeground: '--foreground',\n colorCard: '--card',\n colorCardForeground: '--card-foreground',\n colorPopover: '--popover',\n colorPopoverForeground: '--popover-foreground',\n colorSecondary: '--secondary',\n colorSecondaryForeground: '--secondary-foreground',\n colorMuted: '--muted',\n colorMutedForeground: '--muted-foreground',\n colorAccent: '--accent',\n colorAccentForeground: '--accent-foreground',\n colorDestructive: '--destructive',\n colorBorder: '--border',\n colorInput: '--input',\n colorRing: '--ring',\n borderRadius: '--radius',\n};\n\nconst buildCssVars = (token?: ThemeToken): React.CSSProperties => {\n if (!token) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(token)) {\n if (value === undefined) {\n continue;\n }\n const cssVar = tokenToCssVar[key as keyof ThemeToken];\n if (cssVar) {\n vars[cssVar] = value;\n }\n }\n\n return vars as React.CSSProperties;\n};\n\ninterface Props {\n theme?: ThemeConfig;\n className?: string;\n children: React.ReactNode;\n}\n\nconst Config = ({ theme = {}, className, children }: Props) => {\n const parent = useConfig();\n\n const mergedTheme = useMemo<ThemeConfig>(\n () => ({\n ...parent.theme,\n ...theme,\n token: {\n ...parent.theme.token,\n ...theme.token,\n },\n }),\n [
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/providers/Config/index.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo } from 'react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { Context, useConfig } from './context';\nimport type { ThemeConfig, ThemeToken } from './types';\n\nconst tokenToCssVar: Record<keyof ThemeToken, string> = {\n colorPrimary: '--primary',\n colorPrimaryForeground: '--primary-foreground',\n colorBackground: '--background',\n colorForeground: '--foreground',\n colorCard: '--card',\n colorCardForeground: '--card-foreground',\n colorPopover: '--popover',\n colorPopoverForeground: '--popover-foreground',\n colorSecondary: '--secondary',\n colorSecondaryForeground: '--secondary-foreground',\n colorMuted: '--muted',\n colorMutedForeground: '--muted-foreground',\n colorAccent: '--accent',\n colorAccentForeground: '--accent-foreground',\n colorDestructive: '--destructive',\n colorBorder: '--border',\n colorInput: '--input',\n colorRing: '--ring',\n borderRadius: '--radius',\n};\n\nconst buildCssVars = (token?: ThemeToken): React.CSSProperties => {\n if (!token) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(token)) {\n if (value === undefined) {\n continue;\n }\n const cssVar = tokenToCssVar[key as keyof ThemeToken];\n if (cssVar) {\n vars[cssVar] = value;\n }\n }\n\n return vars as React.CSSProperties;\n};\n\ninterface Props {\n theme?: ThemeConfig;\n className?: string;\n children: React.ReactNode;\n}\n\nconst Config = ({ theme = {}, className, children }: Props) => {\n const parent = useConfig();\n\n // `theme` is typically a fresh inline object literal at the call site\n // (and `parent.theme` inherits the same problem from its own Config\n // ancestor), so depending on them directly meant mergedTheme/contextValue\n // got a new identity on every render regardless of whether the actual\n // values changed — every useConfig() consumer in the tree re-rendered on\n // every render of whatever's above this Config, which for the common\n // app-root usage is everything. Depend on a serialized key instead so\n // the memo only invalidates when the content actually changes; these\n // are small, string/boolean-only objects, so JSON.stringify is cheap.\n const themeKey = JSON.stringify(theme);\n const parentThemeKey = JSON.stringify(parent.theme);\n\n const mergedTheme = useMemo<ThemeConfig>(\n () => ({\n ...parent.theme,\n ...theme,\n token: {\n ...parent.theme.token,\n ...theme.token,\n },\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [parentThemeKey, themeKey],\n );\n\n const contextValue = useMemo(() => ({ theme: mergedTheme }), [mergedTheme]);\n\n const cssVars = useMemo(\n () => buildCssVars(mergedTheme.token),\n [mergedTheme.token],\n );\n\n const hasCssVars = Object.keys(cssVars).length > 0;\n const hasDarkMode = mergedTheme.dark !== undefined;\n const needsWrapper = hasCssVars || hasDarkMode || className;\n\n return (\n <Context.Provider value={contextValue}>\n {needsWrapper ? (\n <div\n className={cn(mergedTheme.dark && 'dark', className)}\n style={{\n ...(hasCssVars ? cssVars : undefined),\n // Keeps this element out of the layout box tree — so it\n // doesn't intercept flex/grid child relationships or break\n // height chains like min-h-screen — while custom properties\n // and the `dark` class selector still cascade to children\n // normally (inheritance and box generation are separate\n // mechanisms in CSS). Note this means className shouldn't be\n // used here for anything that needs a real box (padding,\n // background, borders); Config's className is meant for\n // theming hooks (the `dark` class, arbitrary selector hooks),\n // not layout.\n display: 'contents',\n }}\n >\n {children}\n </div>\n ) : (\n children\n )}\n </Context.Provider>\n );\n};\n\nexport default Config;\nexport { useConfig };\nexport type { Props, ThemeConfig, ThemeToken };\n"],"mappings":";;;;;;;;AASA,MAAM,gBAAkD;CACtD,cAAc;CACd,wBAAwB;CACxB,iBAAiB;CACjB,iBAAiB;CACjB,WAAW;CACX,qBAAqB;CACrB,cAAc;CACd,wBAAwB;CACxB,gBAAgB;CAChB,0BAA0B;CAC1B,YAAY;CACZ,sBAAsB;CACtB,aAAa;CACb,uBAAuB;CACvB,kBAAkB;CAClB,aAAa;CACb,YAAY;CACZ,WAAW;CACX,cAAc;CACf;AAED,MAAM,gBAAgB,UAA4C;AAChE,KAAI,CAAC,MACH,QAAO,EAAE;CAGX,MAAM,OAA+B,EAAE;AAEvC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE;AAChD,MAAI,UAAU,OACZ;EAEF,MAAM,SAAS,cAAc;AAC7B,MAAI,OACF,MAAK,UAAU;;AAInB,QAAO;;AAST,MAAM,UAAU,EAAE,QAAQ,EAAE,EAAE,WAAW,eAAsB;CAC7D,MAAM,SAAS,WAAW;CAW1B,MAAM,WAAW,KAAK,UAAU,MAAM;CAGtC,MAAM,cAAc,eACX;EACL,GAAG,OAAO;EACV,GAAG;EACH,OAAO;GACL,GAAG,OAAO,MAAM;GAChB,GAAG,MAAM;GACV;EACF,GAED,CAZqB,KAAK,UAAU,OAAO,MAAM,EAYhC,SAAS,CAC3B;CAED,MAAM,eAAe,eAAe,EAAE,OAAO,aAAa,GAAG,CAAC,YAAY,CAAC;CAE3E,MAAM,UAAU,cACR,aAAa,YAAY,MAAM,EACrC,CAAC,YAAY,MAAM,CACpB;CAED,MAAM,aAAa,OAAO,KAAK,QAAQ,CAAC,SAAS;CACjD,MAAM,cAAc,YAAY,SAAS;CACzC,MAAM,eAAe,cAAc,eAAe;AAElD,QACE,oBAAC,QAAQ;EAAS,OAAO;YACtB,eACC,oBAAC;GACC,WAAW,GAAG,YAAY,QAAQ,QAAQ,UAAU;GACpD,OAAO;IACL,GAAI,aAAa,UAAU;IAW3B,SAAS;IACV;GAEA;IACG,GAEN;GAEe"}
|
package/dist/style.css
CHANGED
|
@@ -302,18 +302,12 @@
|
|
|
302
302
|
.left-full {
|
|
303
303
|
left: 100%;
|
|
304
304
|
}
|
|
305
|
-
.z-0 {
|
|
306
|
-
z-index: 0;
|
|
307
|
-
}
|
|
308
305
|
.z-10 {
|
|
309
306
|
z-index: 10;
|
|
310
307
|
}
|
|
311
308
|
.z-50 {
|
|
312
309
|
z-index: 50;
|
|
313
310
|
}
|
|
314
|
-
.z-100 {
|
|
315
|
-
z-index: 100;
|
|
316
|
-
}
|
|
317
311
|
.z-10000 {
|
|
318
312
|
z-index: 10000;
|
|
319
313
|
}
|
|
@@ -416,6 +410,9 @@
|
|
|
416
410
|
.block {
|
|
417
411
|
display: block;
|
|
418
412
|
}
|
|
413
|
+
.contents {
|
|
414
|
+
display: contents;
|
|
415
|
+
}
|
|
419
416
|
.flex {
|
|
420
417
|
display: flex;
|
|
421
418
|
}
|
|
@@ -732,9 +729,6 @@
|
|
|
732
729
|
.cursor-pointer {
|
|
733
730
|
cursor: pointer;
|
|
734
731
|
}
|
|
735
|
-
.resize {
|
|
736
|
-
resize: both;
|
|
737
|
-
}
|
|
738
732
|
.scroll-my-1 {
|
|
739
733
|
scroll-margin-block: calc(var(--spacing) * 1);
|
|
740
734
|
}
|
|
@@ -1407,6 +1401,9 @@
|
|
|
1407
1401
|
outline-style: var(--tw-outline-style);
|
|
1408
1402
|
outline-width: 1px;
|
|
1409
1403
|
}
|
|
1404
|
+
.filter {
|
|
1405
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1406
|
+
}
|
|
1410
1407
|
.transition {
|
|
1411
1408
|
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
|
|
1412
1409
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
@@ -3605,6 +3602,59 @@
|
|
|
3605
3602
|
inherits: false;
|
|
3606
3603
|
initial-value: solid;
|
|
3607
3604
|
}
|
|
3605
|
+
@property --tw-blur {
|
|
3606
|
+
syntax: "*";
|
|
3607
|
+
inherits: false;
|
|
3608
|
+
}
|
|
3609
|
+
@property --tw-brightness {
|
|
3610
|
+
syntax: "*";
|
|
3611
|
+
inherits: false;
|
|
3612
|
+
}
|
|
3613
|
+
@property --tw-contrast {
|
|
3614
|
+
syntax: "*";
|
|
3615
|
+
inherits: false;
|
|
3616
|
+
}
|
|
3617
|
+
@property --tw-grayscale {
|
|
3618
|
+
syntax: "*";
|
|
3619
|
+
inherits: false;
|
|
3620
|
+
}
|
|
3621
|
+
@property --tw-hue-rotate {
|
|
3622
|
+
syntax: "*";
|
|
3623
|
+
inherits: false;
|
|
3624
|
+
}
|
|
3625
|
+
@property --tw-invert {
|
|
3626
|
+
syntax: "*";
|
|
3627
|
+
inherits: false;
|
|
3628
|
+
}
|
|
3629
|
+
@property --tw-opacity {
|
|
3630
|
+
syntax: "*";
|
|
3631
|
+
inherits: false;
|
|
3632
|
+
}
|
|
3633
|
+
@property --tw-saturate {
|
|
3634
|
+
syntax: "*";
|
|
3635
|
+
inherits: false;
|
|
3636
|
+
}
|
|
3637
|
+
@property --tw-sepia {
|
|
3638
|
+
syntax: "*";
|
|
3639
|
+
inherits: false;
|
|
3640
|
+
}
|
|
3641
|
+
@property --tw-drop-shadow {
|
|
3642
|
+
syntax: "*";
|
|
3643
|
+
inherits: false;
|
|
3644
|
+
}
|
|
3645
|
+
@property --tw-drop-shadow-color {
|
|
3646
|
+
syntax: "*";
|
|
3647
|
+
inherits: false;
|
|
3648
|
+
}
|
|
3649
|
+
@property --tw-drop-shadow-alpha {
|
|
3650
|
+
syntax: "<percentage>";
|
|
3651
|
+
inherits: false;
|
|
3652
|
+
initial-value: 100%;
|
|
3653
|
+
}
|
|
3654
|
+
@property --tw-drop-shadow-size {
|
|
3655
|
+
syntax: "*";
|
|
3656
|
+
inherits: false;
|
|
3657
|
+
}
|
|
3608
3658
|
@property --tw-duration {
|
|
3609
3659
|
syntax: "*";
|
|
3610
3660
|
inherits: false;
|
|
@@ -3654,6 +3704,19 @@
|
|
|
3654
3704
|
--tw-ring-offset-color: #fff;
|
|
3655
3705
|
--tw-ring-offset-shadow: 0 0 #0000;
|
|
3656
3706
|
--tw-outline-style: solid;
|
|
3707
|
+
--tw-blur: initial;
|
|
3708
|
+
--tw-brightness: initial;
|
|
3709
|
+
--tw-contrast: initial;
|
|
3710
|
+
--tw-grayscale: initial;
|
|
3711
|
+
--tw-hue-rotate: initial;
|
|
3712
|
+
--tw-invert: initial;
|
|
3713
|
+
--tw-opacity: initial;
|
|
3714
|
+
--tw-saturate: initial;
|
|
3715
|
+
--tw-sepia: initial;
|
|
3716
|
+
--tw-drop-shadow: initial;
|
|
3717
|
+
--tw-drop-shadow-color: initial;
|
|
3718
|
+
--tw-drop-shadow-alpha: 100%;
|
|
3719
|
+
--tw-drop-shadow-size: initial;
|
|
3657
3720
|
--tw-duration: initial;
|
|
3658
3721
|
--tw-content: "";
|
|
3659
3722
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbpark/ui-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Modern React UI component library built with TypeScript, Tailwind CSS, and Radix UI. Featuring atoms, molecules, organisms and layout templates for building beautiful interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
"scripts": {
|
|
108
108
|
"build": "tsdown",
|
|
109
109
|
"lint": "eslint .",
|
|
110
|
+
"check-dynamic-classes": "node scripts/check-dynamic-tailwind-classes.mjs",
|
|
110
111
|
"generate:component": "turbo gen react-component",
|
|
111
112
|
"check-types": "tsc -b",
|
|
112
113
|
"prepublishOnly": "node scripts/prepare-publish.mjs",
|