@jbpark/ui-kit 1.1.7 → 2.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/dist/Menu.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as findKey, i as MenuProps, n as Menu, r as MenuItem, t as ClickEventHandler } from "./index-BNeH6gYs.mjs";
2
- export { ClickEventHandler, MenuItem, MenuProps, Menu as default, findKey };
1
+ import { a as MenuProps, c as buildSelectionMap, i as MenuItem, l as findKey, n as MENU_CLASSNAMES, o as Props, r as Menu, s as SelectionMap, t as ClickEventHandler } from "./index-CbElazGe.mjs";
2
+ export { ClickEventHandler, MENU_CLASSNAMES, MenuItem, MenuProps, Props, SelectionMap, buildSelectionMap, Menu as default, findKey };
package/dist/Menu.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { l as Menu_default, u as findKey } from "./src-DBVgtbBS.mjs";
3
+ import { d as buildSelectionMap, f as findKey, l as MENU_CLASSNAMES, u as Menu_default } from "./src-DbD2jnc4.mjs";
4
4
  import "./utils-DEenfsJ-.mjs";
5
5
  import "./Typography-LYvEW-c8.mjs";
6
6
  import "./Reveals-BpnYZJUk.mjs";
7
7
 
8
- export { Menu_default as default, findKey };
8
+ export { MENU_CLASSNAMES, buildSelectionMap, Menu_default as default, findKey };
@@ -1,2 +1,2 @@
1
- import { a as Reveals, i as Props, n as DELAY, o as Item, r as DURATION, s as ItemProps, t as CASCADE } from "./index-CvYPwbSk.mjs";
1
+ import { a as Reveals, i as Props, n as DELAY, o as Item, r as DURATION, s as ItemProps, t as CASCADE } from "./index-CbaWHQ3Y.mjs";
2
2
  export { CASCADE, DELAY, DURATION, Item, ItemProps, Props as RevealsProps, Reveals as default };
@@ -5,16 +5,14 @@ interface MenuItem {
5
5
  label: React.ReactNode;
6
6
  key: React.Key;
7
7
  type?: string;
8
- itemKey?: React.Key;
9
- keyPath?: React.Key[];
10
8
  path?: string;
11
9
  children?: MenuItem[];
12
10
  }
13
11
  interface Props {
14
- fullSize?: boolean;
15
12
  mode?: 'horizontal' | 'vertical' | 'inline';
16
13
  selectedKeys?: React.Key[];
17
14
  defaultSelectedKeys?: React.Key[];
15
+ selectionMap?: SelectionMap;
18
16
  offset?: [number, number];
19
17
  inlineOffset?: number;
20
18
  classNames?: {
@@ -30,8 +28,9 @@ interface Props {
30
28
  label?: React.CSSProperties;
31
29
  };
32
30
  onClick?: ClickEventHandler;
31
+ onSelect?: ClickEventHandler;
33
32
  }
34
- interface MenuProps extends Props, Omit<React.HTMLAttributes<HTMLElement>, 'onClick'> {
33
+ interface MenuProps extends Props, Omit<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onSelect'> {
35
34
  items?: MenuItem[];
36
35
  }
37
36
  type ClickEventHandler = (params: {
@@ -40,12 +39,14 @@ type ClickEventHandler = (params: {
40
39
  keyPath: React.Key[];
41
40
  item: MenuItem;
42
41
  }) => void;
43
- declare function findKey(menu: MenuItem, targetKeys: React.Key[]): boolean;
42
+ declare const MENU_CLASSNAMES: string[];
43
+ type SelectionMap = ReadonlyMap<React.Key, boolean>;
44
+ declare function buildSelectionMap(items: MenuItem[], selectedKeysSet: ReadonlySet<React.Key>): SelectionMap;
45
+ declare function findKey(menu: MenuItem, targetKeys: ReadonlySet<React.Key>): boolean;
44
46
  declare const Menu: ({
45
47
  items,
46
48
  mode,
47
- fullSize,
48
- defaultSelectedKeys: _defaultSelectedKeys,
49
+ defaultSelectedKeys,
49
50
  selectedKeys: _selectedKeys,
50
51
  className,
51
52
  classNames,
@@ -53,7 +54,8 @@ declare const Menu: ({
53
54
  offset,
54
55
  inlineOffset,
55
56
  onClick,
57
+ onSelect: _onSelect,
56
58
  ...props
57
59
  }: MenuProps) => react_jsx_runtime0.JSX.Element;
58
60
  //#endregion
59
- export { findKey as a, MenuProps as i, Menu as n, MenuItem as r, ClickEventHandler as t };
61
+ export { MenuProps as a, buildSelectionMap as c, MenuItem as i, findKey as l, MENU_CLASSNAMES as n, Props as o, Menu as r, SelectionMap as s, ClickEventHandler as t };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime7 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime8 from "react/jsx-runtime";
2
2
  import { MotionProps } from "motion/react";
3
3
 
4
4
  //#region src/components/molecules/Reveals/Item/index.d.ts
@@ -54,7 +54,7 @@ declare const Item: ({
54
54
  transition,
55
55
  className,
56
56
  ...props
57
- }: ItemProps) => react_jsx_runtime7.JSX.Element;
57
+ }: ItemProps) => react_jsx_runtime8.JSX.Element;
58
58
  //#endregion
59
59
  //#region src/components/molecules/Reveals/index.d.ts
60
60
  interface Props extends React.HTMLAttributes<HTMLDivElement>, ItemProps {
@@ -79,7 +79,7 @@ declare const Reveals: {
79
79
  duration,
80
80
  delay,
81
81
  ...props
82
- }: Props): react_jsx_runtime7.JSX.Element;
82
+ }: Props): react_jsx_runtime8.JSX.Element;
83
83
  Item: ({
84
84
  effect,
85
85
  children,
@@ -91,7 +91,7 @@ declare const Reveals: {
91
91
  transition,
92
92
  className,
93
93
  ...props
94
- }: ItemProps) => react_jsx_runtime7.JSX.Element;
94
+ }: ItemProps) => react_jsx_runtime8.JSX.Element;
95
95
  };
96
96
  //#endregion
97
97
  export { Reveals as a, Props as i, DELAY as n, Item as o, DURATION as r, ItemProps as s, CASCADE as t };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { t as Typography } from "./index-DP36DulT.mjs";
2
- import { i as MenuProps, n as Menu } from "./index-BNeH6gYs.mjs";
3
- import { a as Reveals } from "./index-CvYPwbSk.mjs";
2
+ import { a as MenuProps, r as Menu } from "./index-CbElazGe.mjs";
3
+ import { a as Reveals } from "./index-CbaWHQ3Y.mjs";
4
4
  import * as React$2 from "react";
5
5
  import React$1, { ChangeEvent, HTMLAttributes, InputHTMLAttributes, MouseEvent } from "react";
6
6
  import { VariantProps } from "class-variance-authority";
7
- import * as react_jsx_runtime19 from "react/jsx-runtime";
7
+ import * as react_jsx_runtime20 from "react/jsx-runtime";
8
8
  import * as swiper_react0 from "swiper/react";
9
9
  import { SwiperProps } from "swiper/react";
10
10
  import "swiper/css";
@@ -20,18 +20,19 @@ declare const buttonVariants: (props?: ({
20
20
  variant?: "outline" | "link" | "default" | "destructive" | "secondary" | "ghost" | null | undefined;
21
21
  size?: "icon" | "default" | "sm" | "lg" | null | undefined;
22
22
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
23
- type Props$22 = React$2.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
23
+ type Props$23 = React$2.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
24
24
  asChild?: boolean;
25
25
  };
26
26
  //#endregion
27
27
  //#region src/components/atoms/Button/index.d.ts
28
28
  type PresetColors = 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
29
- interface Props$21 extends Omit<Props$22, 'size'> {
29
+ interface Props$22 extends Omit<Props$23, 'size' | 'variant'> {
30
30
  icon?: React.ReactNode;
31
31
  block?: boolean;
32
32
  danger?: boolean;
33
33
  disabled?: boolean;
34
34
  size?: 'small' | 'medium' | 'large';
35
+ variant?: 'solid' | 'outlined' | 'dashed' | 'filled' | 'text' | 'link';
35
36
  color?: PresetColors | 'default' | 'primary' | 'danger';
36
37
  loading?: boolean | {
37
38
  icon: React.ReactNode;
@@ -50,7 +51,7 @@ declare const Button: ({
50
51
  children,
51
52
  onMouseDown,
52
53
  ...props
53
- }: Props$21) => react_jsx_runtime19.JSX.Element;
54
+ }: Props$22) => react_jsx_runtime20.JSX.Element;
54
55
  //#endregion
55
56
  //#region src/components/atoms/Checkbox/Group/index.d.ts
56
57
  type Option = {
@@ -59,7 +60,7 @@ type Option = {
59
60
  checked?: boolean;
60
61
  };
61
62
  type Options = string[] | number[] | boolean[] | Option[];
62
- interface Props$20 extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
63
+ interface Props$21 extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
63
64
  options?: Options;
64
65
  direction?: string;
65
66
  placement?: string;
@@ -69,7 +70,7 @@ interface Props$20 extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'
69
70
  //#endregion
70
71
  //#region src/components/atoms/Checkbox/index.d.ts
71
72
  type OptionValue = string | number | boolean;
72
- interface Props$19 extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
73
+ interface Props$20 extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
73
74
  placement?: string;
74
75
  checked?: boolean;
75
76
  value?: OptionValue;
@@ -90,7 +91,7 @@ declare const Checkbox: {
90
91
  checked: _checked,
91
92
  onChange: _onChange,
92
93
  ...props
93
- }: Props$19): react_jsx_runtime19.JSX.Element;
94
+ }: Props$20): react_jsx_runtime20.JSX.Element;
94
95
  Group: ({
95
96
  direction,
96
97
  placement,
@@ -98,33 +99,33 @@ declare const Checkbox: {
98
99
  classNames,
99
100
  options: _options,
100
101
  onChange
101
- }: Props$20) => react_jsx_runtime19.JSX.Element;
102
+ }: Props$21) => react_jsx_runtime20.JSX.Element;
102
103
  };
103
104
  //#endregion
104
105
  //#region src/components/atoms/FloatButton/BackTop/index.d.ts
105
- interface Props$18 extends Props$21 {
106
+ interface Props$19 extends Props$22 {
106
107
  visibilityHeight?: number;
107
108
  onClick?: (e: MouseEvent<HTMLElement>) => void;
108
109
  }
109
110
  //#endregion
110
111
  //#region src/components/atoms/FloatButton/index.d.ts
111
- interface Props$17 extends Props$21 {}
112
+ interface Props$18 extends Props$22 {}
112
113
  declare const FloatButton: {
113
114
  ({
114
115
  className,
115
116
  children,
116
117
  ...props
117
- }: Props$17): react_jsx_runtime19.JSX.Element;
118
+ }: Props$18): react_jsx_runtime20.JSX.Element;
118
119
  BackTop: ({
119
120
  visibilityHeight,
120
121
  className,
121
122
  onClick,
122
123
  ...props
123
- }: Props$18) => react_jsx_runtime19.JSX.Element;
124
+ }: Props$19) => react_jsx_runtime20.JSX.Element;
124
125
  };
125
126
  //#endregion
126
127
  //#region src/components/atoms/Input/Search/index.d.ts
127
- interface Props$16 extends InputHTMLAttributes<HTMLInputElement> {
128
+ interface Props$17 extends InputHTMLAttributes<HTMLInputElement> {
128
129
  allowClear?: boolean;
129
130
  onChange: (e: ChangeEvent<HTMLInputElement> | {
130
131
  target: {
@@ -138,17 +139,29 @@ interface Props$16 extends InputHTMLAttributes<HTMLInputElement> {
138
139
  declare const Input: {
139
140
  ({
140
141
  ...props
141
- }: InputHTMLAttributes<HTMLInputElement>): react_jsx_runtime19.JSX.Element;
142
- Search: React$2.ForwardRefExoticComponent<Props$16 & React$2.RefAttributes<HTMLInputElement>>;
142
+ }: InputHTMLAttributes<HTMLInputElement>): react_jsx_runtime20.JSX.Element;
143
+ Search: React$2.ForwardRefExoticComponent<Props$17 & React$2.RefAttributes<HTMLInputElement>>;
143
144
  TextArea: ({
144
145
  className,
145
146
  ref,
146
147
  ...props
147
148
  }: React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
148
149
  ref?: React.Ref<HTMLTextAreaElement>;
149
- }) => react_jsx_runtime19.JSX.Element;
150
+ }) => react_jsx_runtime20.JSX.Element;
150
151
  };
151
152
  //#endregion
153
+ //#region src/components/atoms/Popover/index.d.ts
154
+ interface Props$16 {
155
+ title?: React.ReactNode;
156
+ content: React.ReactNode;
157
+ children: React.ReactNode;
158
+ }
159
+ declare const Popover: ({
160
+ title,
161
+ content,
162
+ children
163
+ }: Props$16) => react_jsx_runtime20.JSX.Element;
164
+ //#endregion
152
165
  //#region src/components/atoms/Progress/index.d.ts
153
166
  interface Props$15 extends React.HTMLAttributes<HTMLElement> {
154
167
  value: number;
@@ -163,7 +176,7 @@ declare const Progress: ({
163
176
  className,
164
177
  direction,
165
178
  classNames
166
- }: Props$15) => react_jsx_runtime19.JSX.Element;
179
+ }: Props$15) => react_jsx_runtime20.JSX.Element;
167
180
  //#endregion
168
181
  //#region src/components/atoms/Skeleton/index.d.ts
169
182
  interface Props$14 extends React.HTMLAttributes<HTMLDivElement> {
@@ -198,15 +211,15 @@ declare const Skeleton: {
198
211
  height,
199
212
  children,
200
213
  ...props
201
- }: Props$14): string | number | bigint | boolean | react_jsx_runtime19.JSX.Element | Iterable<React$2.ReactNode> | Promise<string | number | bigint | boolean | React$2.ReactPortal | React$2.ReactElement<unknown, string | React$2.JSXElementConstructor<any>> | Iterable<React$2.ReactNode> | null | undefined> | null | undefined;
214
+ }: Props$14): string | number | bigint | boolean | react_jsx_runtime20.JSX.Element | Iterable<React$2.ReactNode> | Promise<string | number | bigint | boolean | React$2.ReactPortal | React$2.ReactElement<unknown, string | React$2.JSXElementConstructor<any>> | Iterable<React$2.ReactNode> | null | undefined> | null | undefined;
202
215
  Button: ({
203
216
  className,
204
217
  ...props
205
- }: Props$14) => react_jsx_runtime19.JSX.Element;
218
+ }: Props$14) => react_jsx_runtime20.JSX.Element;
206
219
  Node: ({
207
220
  className,
208
221
  ...props
209
- }: Props$14) => react_jsx_runtime19.JSX.Element;
222
+ }: Props$14) => react_jsx_runtime20.JSX.Element;
210
223
  };
211
224
  //#endregion
212
225
  //#region src/components/atoms/Spin/index.d.ts
@@ -217,7 +230,7 @@ declare const Spin: ({
217
230
  spinning,
218
231
  className,
219
232
  ...props
220
- }: Props$13) => react_jsx_runtime19.JSX.Element | null;
233
+ }: Props$13) => react_jsx_runtime20.JSX.Element | null;
221
234
  //#endregion
222
235
  //#region src/components/atoms/Switch/index.d.ts
223
236
  interface Props$12 extends Omit<React.HTMLAttributes<HTMLElement>, 'onChange'> {
@@ -234,7 +247,7 @@ declare const Switch: ({
234
247
  className,
235
248
  classNames,
236
249
  ...props
237
- }: Props$12) => react_jsx_runtime19.JSX.Element;
250
+ }: Props$12) => react_jsx_runtime20.JSX.Element;
238
251
  //#endregion
239
252
  //#region src/components/molecules/Card/index.d.ts
240
253
  interface Props$11 extends Omit<React.HTMLProps<HTMLDivElement>, 'title'> {
@@ -252,7 +265,7 @@ declare const Card: ({
252
265
  classNames,
253
266
  variant,
254
267
  ...props
255
- }: Props$11) => react_jsx_runtime19.JSX.Element;
268
+ }: Props$11) => react_jsx_runtime20.JSX.Element;
256
269
  //#endregion
257
270
  //#region src/components/molecules/Collapse/index.d.ts
258
271
  interface Item {
@@ -279,7 +292,7 @@ declare const Collapse: ({
279
292
  className,
280
293
  classNames,
281
294
  defaultActiveKey
282
- }: Props$10) => react_jsx_runtime19.JSX.Element;
295
+ }: Props$10) => react_jsx_runtime20.JSX.Element;
283
296
  //#endregion
284
297
  //#region src/components/molecules/Dropdown/index.d.ts
285
298
  type ChangeEventHandler = (open: boolean) => void;
@@ -297,7 +310,7 @@ declare const Dropdown: ({
297
310
  open: _open,
298
311
  onOpenChange,
299
312
  ...props
300
- }: Props$9) => react_jsx_runtime19.JSX.Element;
313
+ }: Props$9) => react_jsx_runtime20.JSX.Element;
301
314
  //#endregion
302
315
  //#region src/components/molecules/Marquees/Item/index.d.ts
303
316
  interface ItemProps {
@@ -327,7 +340,7 @@ declare const Marquees: {
327
340
  pauseOnHover,
328
341
  autoFill,
329
342
  ...props
330
- }: Props$7): react_jsx_runtime19.JSX.Element;
343
+ }: Props$7): react_jsx_runtime20.JSX.Element;
331
344
  Item: ({
332
345
  width: _width,
333
346
  speed,
@@ -335,7 +348,7 @@ declare const Marquees: {
335
348
  pause: _pause,
336
349
  pauseOnHover,
337
350
  children
338
- }: Props$8) => react_jsx_runtime19.JSX.Element;
351
+ }: Props$8) => react_jsx_runtime20.JSX.Element;
339
352
  };
340
353
  //#endregion
341
354
  //#region src/components/molecules/Space/index.d.ts
@@ -366,7 +379,7 @@ declare const Space: ({
366
379
  hidden,
367
380
  style,
368
381
  ...props
369
- }: Props$6) => react_jsx_runtime19.JSX.Element;
382
+ }: Props$6) => react_jsx_runtime20.JSX.Element;
370
383
  //#endregion
371
384
  //#region src/components/organisms/Drawer/index.d.ts
372
385
  interface Props$5 {
@@ -416,7 +429,7 @@ declare const Drawer: ({
416
429
  container,
417
430
  onClose,
418
431
  ...props
419
- }: Props$5) => react_jsx_runtime19.JSX.Element | null;
432
+ }: Props$5) => react_jsx_runtime20.JSX.Element | null;
420
433
  //#endregion
421
434
  //#region src/components/organisms/List/index.d.ts
422
435
  interface Props$4<T> extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -455,12 +468,12 @@ declare const List: {
455
468
  classNames,
456
469
  renderItem,
457
470
  ...props
458
- }: Props$4<T>): string | number | bigint | true | react_jsx_runtime19.JSX.Element | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined>;
471
+ }: Props$4<T>): string | number | bigint | true | react_jsx_runtime20.JSX.Element | Iterable<React$1.ReactNode> | Promise<string | number | bigint | boolean | React$1.ReactPortal | React$1.ReactElement<unknown, string | React$1.JSXElementConstructor<any>> | Iterable<React$1.ReactNode> | null | undefined>;
459
472
  Item: ({
460
473
  children,
461
474
  className,
462
475
  ...props
463
- }: React$1.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime19.JSX.Element;
476
+ }: React$1.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime20.JSX.Element;
464
477
  };
465
478
  //#endregion
466
479
  //#region src/components/organisms/Modal/index.d.ts
@@ -514,7 +527,7 @@ declare const Modal: {
514
527
  onOk,
515
528
  onCancel,
516
529
  ...props
517
- }: Props$3): react_jsx_runtime19.JSX.Element | null;
530
+ }: Props$3): react_jsx_runtime20.JSX.Element | null;
518
531
  destroy(id?: string): void;
519
532
  destroyAll(): void;
520
533
  info(props: StaticProps): string | undefined;
@@ -543,13 +556,13 @@ declare const Swiper: {
543
556
  renderItem,
544
557
  loadingClassName,
545
558
  ...props
546
- }: Props$2<T>): react_jsx_runtime19.JSX.Element;
559
+ }: Props$2<T>): react_jsx_runtime20.JSX.Element;
547
560
  Slide: {
548
561
  ({
549
562
  children,
550
563
  className,
551
564
  ...props
552
- }: swiper_react0.SwiperSlideProps): react_jsx_runtime19.JSX.Element;
565
+ }: swiper_react0.SwiperSlideProps): react_jsx_runtime20.JSX.Element;
553
566
  displayName: string;
554
567
  };
555
568
  };
@@ -564,27 +577,27 @@ declare const Layout: {
564
577
  children,
565
578
  className,
566
579
  ...props
567
- }: Props): react_jsx_runtime19.JSX.Element;
580
+ }: Props): react_jsx_runtime20.JSX.Element;
568
581
  Content: ({
569
582
  children,
570
583
  className,
571
584
  ...props
572
- }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime19.JSX.Element;
585
+ }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime20.JSX.Element;
573
586
  Footer: ({
574
587
  children,
575
588
  className,
576
589
  ...props
577
- }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime19.JSX.Element;
590
+ }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime20.JSX.Element;
578
591
  Header: ({
579
592
  children,
580
593
  className,
581
594
  ...props
582
- }: Props$1) => react_jsx_runtime19.JSX.Element;
595
+ }: Props$1) => react_jsx_runtime20.JSX.Element;
583
596
  Sider: ({
584
597
  children,
585
598
  className,
586
599
  ...props
587
- }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime19.JSX.Element;
600
+ }: React.HTMLAttributes<HTMLDivElement>) => react_jsx_runtime20.JSX.Element;
588
601
  };
589
602
  //#endregion
590
- export { Button, Card, Checkbox, Collapse, Drawer, Dropdown, FloatButton, Input, Layout, List, Marquees, Menu, Modal, Progress, Reveals, Skeleton, Space, Spin, Swiper, Switch, Typography };
603
+ export { Button, Card, Checkbox, Collapse, Drawer, Dropdown, FloatButton, Input, Layout, List, Marquees, Menu, Modal, Popover, Progress, Reveals, Skeleton, Space, Spin, Swiper, Switch, Typography };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as Input_default, a as Drawer_default, b as Button_default, c as Dropdown_default, d as Collapse_default, f as Card_default, g as Progress_default, h as Skeleton_default, i as List_default, l as Menu_default, m as Spin_default, n as Swiper_default, o as Space_default, p as Switch_default, r as Modal_default, s as Marquees_default, t as Layout_default, v as FloatButton_default, y as Checkbox_default } from "./src-DBVgtbBS.mjs";
1
+ import { C as Button_default, S as Checkbox_default, _ as Skeleton_default, a as Drawer_default, b as Input_default, c as Dropdown_default, g as Spin_default, h as Switch_default, i as List_default, m as Card_default, n as Swiper_default, o as Space_default, p as Collapse_default, r as Modal_default, s as Marquees_default, t as Layout_default, u as Menu_default, v as Progress_default, x as FloatButton_default, y as Popover_default } from "./src-DbD2jnc4.mjs";
2
2
  import "./utils-DEenfsJ-.mjs";
3
3
  import { t as Typography_default } from "./Typography-LYvEW-c8.mjs";
4
4
  import { i as Reveals_default } from "./Reveals-BpnYZJUk.mjs";
5
5
 
6
- export { Button_default as Button, Card_default as Card, Checkbox_default as Checkbox, Collapse_default as Collapse, Drawer_default as Drawer, Dropdown_default as Dropdown, FloatButton_default as FloatButton, Input_default as Input, Layout_default as Layout, List_default as List, Marquees_default as Marquees, Menu_default as Menu, Modal_default as Modal, Progress_default as Progress, Reveals_default as Reveals, Skeleton_default as Skeleton, Space_default as Space, Spin_default as Spin, Swiper_default as Swiper, Switch_default as Switch, Typography_default as Typography };
6
+ export { Button_default as Button, Card_default as Card, Checkbox_default as Checkbox, Collapse_default as Collapse, Drawer_default as Drawer, Dropdown_default as Dropdown, FloatButton_default as FloatButton, Input_default as Input, Layout_default as Layout, List_default as List, Marquees_default as Marquees, Menu_default as Menu, Modal_default as Modal, Popover_default as Popover, Progress_default as Progress, Reveals_default as Reveals, Skeleton_default as Skeleton, Space_default as Space, Spin_default as Spin, Swiper_default as Swiper, Switch_default as Switch, Typography_default as Typography };
package/dist/output.css CHANGED
@@ -11,7 +11,6 @@
11
11
  --color-yellow-400: oklch(85.2% 0.199 91.936);
12
12
  --color-green-400: oklch(79.2% 0.209 151.711);
13
13
  --color-blue-400: oklch(70.7% 0.165 254.624);
14
- --color-gray-100: oklch(96.7% 0.003 264.542);
15
14
  --color-gray-200: oklch(92.8% 0.006 264.531);
16
15
  --color-black: #000;
17
16
  --color-white: #fff;
@@ -232,12 +231,6 @@
232
231
  .inset-0 {
233
232
  inset: calc(var(--spacing) * 0);
234
233
  }
235
- .inset-x-0 {
236
- inset-inline: calc(var(--spacing) * 0);
237
- }
238
- .inset-y-0 {
239
- inset-block: calc(var(--spacing) * 0);
240
- }
241
234
  .top-0 {
242
235
  top: calc(var(--spacing) * 0);
243
236
  }
@@ -409,9 +402,6 @@
409
402
  .h-full {
410
403
  height: 100%;
411
404
  }
412
- .h-screen {
413
- height: 100vh;
414
- }
415
405
  .min-h-\[60px\] {
416
406
  min-height: 60px;
417
407
  }
@@ -448,18 +438,12 @@
448
438
  .w-full {
449
439
  width: 100%;
450
440
  }
451
- .w-screen {
452
- width: 100vw;
453
- }
454
441
  .max-w-\[calc\(100\%-2rem\)\] {
455
442
  max-width: calc(100% - 2rem);
456
443
  }
457
444
  .min-w-80 {
458
445
  min-width: calc(var(--spacing) * 80);
459
446
  }
460
- .min-w-\[180px\] {
461
- min-width: 180px;
462
- }
463
447
  .min-w-\[200px\] {
464
448
  min-width: 200px;
465
449
  }
@@ -484,8 +468,8 @@
484
468
  .basis-0 {
485
469
  flex-basis: calc(var(--spacing) * 0);
486
470
  }
487
- .basis-1\/6 {
488
- flex-basis: calc(1/6 * 100%);
471
+ .origin-\[--radix-popover-content-transform-origin\] {
472
+ transform-origin: --radix-popover-content-transform-origin;
489
473
  }
490
474
  .translate-x-\[-50\%\] {
491
475
  --tw-translate-x: -50%;
@@ -604,9 +588,6 @@
604
588
  .gap-y-0 {
605
589
  row-gap: calc(var(--spacing) * 0);
606
590
  }
607
- .gap-y-4 {
608
- row-gap: calc(var(--spacing) * 4);
609
- }
610
591
  .gap-y-5 {
611
592
  row-gap: calc(var(--spacing) * 5);
612
593
  }
@@ -669,10 +650,20 @@
669
650
  border-bottom-style: var(--tw-border-style);
670
651
  border-bottom-width: 2px;
671
652
  }
653
+ .border-dashed {
654
+ --tw-border-style: dashed;
655
+ border-style: dashed;
656
+ }
672
657
  .border-none {
673
658
  --tw-border-style: none;
674
659
  border-style: none;
675
660
  }
661
+ .border-\(--btn-border\) {
662
+ border-color: var(--btn-border);
663
+ }
664
+ .border-\[rgb\(var\(--btn-border\)\/0\.5\)\] {
665
+ border-color: rgb(var(--btn-border)/0.5);
666
+ }
676
667
  .border-current {
677
668
  border-color: currentcolor;
678
669
  }
@@ -718,15 +709,15 @@
718
709
  .bg-destructive {
719
710
  background-color: var(--destructive);
720
711
  }
721
- .bg-gray-100 {
722
- background-color: var(--color-gray-100);
723
- }
724
712
  .bg-inherit {
725
713
  background-color: inherit;
726
714
  }
727
715
  .bg-muted {
728
716
  background-color: var(--muted);
729
717
  }
718
+ .bg-popover {
719
+ background-color: var(--popover);
720
+ }
730
721
  .bg-primary {
731
722
  background-color: var(--primary);
732
723
  }
@@ -760,9 +751,6 @@
760
751
  .p-6 {
761
752
  padding: calc(var(--spacing) * 6);
762
753
  }
763
- .p-8 {
764
- padding: calc(var(--spacing) * 8);
765
- }
766
754
  .px-3 {
767
755
  padding-inline: calc(var(--spacing) * 3);
768
756
  }
@@ -884,9 +872,6 @@
884
872
  .text-nowrap {
885
873
  text-wrap: nowrap;
886
874
  }
887
- .text-wrap {
888
- text-wrap: wrap;
889
- }
890
875
  .break-all {
891
876
  word-break: break-all;
892
877
  }
@@ -896,6 +881,9 @@
896
881
  .whitespace-pre-wrap {
897
882
  white-space: pre-wrap;
898
883
  }
884
+ .text-\(--btn-bg\) {
885
+ color: var(--btn-bg);
886
+ }
899
887
  .text-\(--btn-fg\) {
900
888
  color: var(--btn-fg);
901
889
  }
@@ -914,6 +902,9 @@
914
902
  .text-muted-foreground {
915
903
  color: var(--muted-foreground);
916
904
  }
905
+ .text-popover-foreground {
906
+ color: var(--popover-foreground);
907
+ }
917
908
  .text-primary {
918
909
  color: var(--primary);
919
910
  }
@@ -1114,6 +1105,26 @@
1114
1105
  }
1115
1106
  }
1116
1107
  }
1108
+ .hover\:bg-muted\/80 {
1109
+ &:hover {
1110
+ @media (hover: hover) {
1111
+ background-color: var(--muted);
1112
+ @supports (color: color-mix(in lab, red, red)) {
1113
+ background-color: color-mix(in oklab, var(--muted) 80%, transparent);
1114
+ }
1115
+ }
1116
+ }
1117
+ }
1118
+ .hover\:bg-primary\/10 {
1119
+ &:hover {
1120
+ @media (hover: hover) {
1121
+ background-color: var(--primary);
1122
+ @supports (color: color-mix(in lab, red, red)) {
1123
+ background-color: color-mix(in oklab, var(--primary) 10%, transparent);
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1117
1128
  .hover\:bg-primary\/90 {
1118
1129
  &:hover {
1119
1130
  @media (hover: hover) {
@@ -1295,6 +1306,26 @@
1295
1306
  }
1296
1307
  }
1297
1308
  }
1309
+ .data-\[side\=bottom\]\:slide-in-from-top-2 {
1310
+ &[data-side="bottom"] {
1311
+ --tw-enter-translate-y: calc(2*var(--spacing)*-1);
1312
+ }
1313
+ }
1314
+ .data-\[side\=left\]\:slide-in-from-right-2 {
1315
+ &[data-side="left"] {
1316
+ --tw-enter-translate-x: calc(2*var(--spacing));
1317
+ }
1318
+ }
1319
+ .data-\[side\=right\]\:slide-in-from-left-2 {
1320
+ &[data-side="right"] {
1321
+ --tw-enter-translate-x: calc(2*var(--spacing)*-1);
1322
+ }
1323
+ }
1324
+ .data-\[side\=top\]\:slide-in-from-bottom-2 {
1325
+ &[data-side="top"] {
1326
+ --tw-enter-translate-y: calc(2*var(--spacing));
1327
+ }
1328
+ }
1298
1329
  .data-\[state\=checked\]\:translate-x-\[calc\(100\%-2px\)\] {
1299
1330
  &[data-state="checked"] {
1300
1331
  --tw-translate-x: calc(100% - 2px);
@@ -1817,6 +1848,7 @@
1817
1848
  @layer components {
1818
1849
  [data-slot='button'][data-color] {
1819
1850
  --btn-fg: white;
1851
+ --btn-border: var(--btn-bg);
1820
1852
  --btn-bg-hover: var(--btn-bg);
1821
1853
  @supports (color: color-mix(in lab, red, red)) {
1822
1854
  --btn-bg-hover: color-mix(in oklch, var(--btn-bg), black 12%);
@@ -1829,52 +1861,71 @@
1829
1861
  [data-slot='button'][data-color='yellow'], [data-slot='button'][data-color='lime'], [data-slot='button'][data-color='gold'] {
1830
1862
  --btn-fg: black;
1831
1863
  }
1864
+ [data-slot='button'][data-color='default'] {
1865
+ --btn-bg: var(--muted);
1866
+ --btn-border: 107 114 128;
1867
+ }
1832
1868
  [data-slot='button'][data-color='primary'] {
1833
1869
  --btn-bg: var(--primary);
1870
+ --btn-border: var(--primary);
1834
1871
  --btn-fg: var(--primary-foreground);
1835
1872
  }
1836
1873
  [data-slot='button'][data-color='danger'] {
1837
1874
  --btn-bg: var(--destructive);
1875
+ --btn-border: 239 68 68;
1838
1876
  --btn-fg: white;
1839
1877
  }
1840
1878
  [data-slot='button'][data-color='blue'] {
1841
1879
  --btn-bg: #3b82f6;
1880
+ --btn-border: 59 130 246;
1842
1881
  }
1843
1882
  [data-slot='button'][data-color='purple'] {
1844
1883
  --btn-bg: #a855f7;
1884
+ --btn-border: 168 85 247;
1845
1885
  }
1846
1886
  [data-slot='button'][data-color='cyan'] {
1847
1887
  --btn-bg: #06b6d4;
1888
+ --btn-border: 6 182 212;
1848
1889
  }
1849
1890
  [data-slot='button'][data-color='green'] {
1850
1891
  --btn-bg: #22c55e;
1892
+ --btn-border: 34 197 94;
1851
1893
  }
1852
1894
  [data-slot='button'][data-color='magenta'] {
1853
1895
  --btn-bg: #d946ef;
1896
+ --btn-border: 217 70 239;
1854
1897
  }
1855
1898
  [data-slot='button'][data-color='pink'] {
1856
1899
  --btn-bg: #ec4899;
1900
+ --btn-border: 236 72 153;
1857
1901
  }
1858
1902
  [data-slot='button'][data-color='red'] {
1859
1903
  --btn-bg: #ef4444;
1904
+ --btn-border: 239 68 68;
1860
1905
  }
1861
1906
  [data-slot='button'][data-color='orange'] {
1862
1907
  --btn-bg: #f97316;
1908
+ --btn-border: 249 115 22;
1863
1909
  }
1864
1910
  [data-slot='button'][data-color='yellow'] {
1865
1911
  --btn-bg: #eab308;
1912
+ --btn-border: 234 179 8;
1866
1913
  }
1867
1914
  [data-slot='button'][data-color='volcano'] {
1868
1915
  --btn-bg: #ea580c;
1916
+ --btn-border: 234 88 12;
1869
1917
  }
1870
1918
  [data-slot='button'][data-color='geekblue'] {
1871
1919
  --btn-bg: #6366f1;
1920
+ --btn-border: 99 102 241;
1872
1921
  }
1873
1922
  [data-slot='button'][data-color='lime'] {
1874
1923
  --btn-bg: #84cc16;
1924
+ --btn-border: 132 204 22;
1875
1925
  }
1876
1926
  [data-slot='button'][data-color='gold'] {
1877
1927
  --btn-bg: #f59e0b;
1928
+ --btn-border: 245 158 11;
1878
1929
  }
1879
1930
  }
1880
1931
  @property --tw-translate-x {
@@ -125,6 +125,7 @@
125
125
  @layer components {
126
126
  [data-slot='button'][data-color] {
127
127
  --btn-fg: white;
128
+ --btn-border: var(--btn-bg);
128
129
  --btn-bg-hover: color-mix(in oklch, var(--btn-bg), black 12%);
129
130
  --btn-bg-active: color-mix(in oklch, var(--btn-bg), black 22%);
130
131
  }
@@ -135,53 +136,74 @@
135
136
  --btn-fg: black;
136
137
  }
137
138
 
139
+ [data-slot='button'][data-color='default'] {
140
+ --btn-bg: var(--muted);
141
+ --btn-border: 107 114 128;
142
+ }
143
+
138
144
  [data-slot='button'][data-color='primary'] {
139
145
  --btn-bg: var(--primary);
146
+ --btn-border: var(--primary);
140
147
  --btn-fg: var(--primary-foreground);
141
148
  }
149
+
142
150
  [data-slot='button'][data-color='danger'] {
143
151
  --btn-bg: var(--destructive);
152
+ --btn-border: 239 68 68;
144
153
  --btn-fg: white;
145
154
  }
146
155
 
147
156
  [data-slot='button'][data-color='blue'] {
148
157
  --btn-bg: #3b82f6;
158
+ --btn-border: 59 130 246;
149
159
  } /* blue-500 */
150
160
  [data-slot='button'][data-color='purple'] {
151
161
  --btn-bg: #a855f7;
162
+ --btn-border: 168 85 247;
152
163
  } /* purple-500 */
153
164
  [data-slot='button'][data-color='cyan'] {
154
165
  --btn-bg: #06b6d4;
166
+ --btn-border: 6 182 212;
155
167
  } /* cyan-500 */
156
168
  [data-slot='button'][data-color='green'] {
157
169
  --btn-bg: #22c55e;
170
+ --btn-border: 34 197 94;
158
171
  } /* green-500 */
159
172
  [data-slot='button'][data-color='magenta'] {
160
173
  --btn-bg: #d946ef;
174
+ --btn-border: 217 70 239;
161
175
  } /* fuchsia-500 */
162
176
  [data-slot='button'][data-color='pink'] {
163
177
  --btn-bg: #ec4899;
178
+ --btn-border: 236 72 153;
164
179
  } /* pink-500 */
165
180
  [data-slot='button'][data-color='red'] {
166
181
  --btn-bg: #ef4444;
182
+ --btn-border: 239 68 68;
167
183
  } /* red-500 */
168
184
  [data-slot='button'][data-color='orange'] {
169
185
  --btn-bg: #f97316;
186
+ --btn-border: 249 115 22;
170
187
  } /* orange-500 */
171
188
  [data-slot='button'][data-color='yellow'] {
172
189
  --btn-bg: #eab308;
190
+ --btn-border: 234 179 8;
173
191
  } /* yellow-500 */
174
192
  [data-slot='button'][data-color='volcano'] {
175
193
  --btn-bg: #ea580c;
194
+ --btn-border: 234 88 12;
176
195
  } /* orange-600 */
177
196
  [data-slot='button'][data-color='geekblue'] {
178
197
  --btn-bg: #6366f1;
198
+ --btn-border: 99 102 241;
179
199
  } /* indigo-500 */
180
200
  [data-slot='button'][data-color='lime'] {
181
201
  --btn-bg: #84cc16;
202
+ --btn-border: 132 204 22;
182
203
  } /* lime-500 */
183
204
  [data-slot='button'][data-color='gold'] {
184
205
  --btn-bg: #f59e0b;
206
+ --btn-border: 245 158 11;
185
207
  } /* amber-500 */
186
208
  }
187
209
 
@@ -2,13 +2,14 @@ import { t as cn } from "./utils-DEenfsJ-.mjs";
2
2
  import { t as Typography_default } from "./Typography-LYvEW-c8.mjs";
3
3
  import { ArrowUp, Check, ChevronDown, CircleQuestionMark, CircleX, Info, Loader2, LoaderCircle, OctagonAlert, OctagonX, Search, Square, SquareCheck, X, XIcon } from "lucide-react";
4
4
  import * as React$1 from "react";
5
- import React, { Children, createElement, forwardRef, useEffect, useId, useRef, useState } from "react";
5
+ import React, { Children, createElement, forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
6
6
  import { Slot } from "@radix-ui/react-slot";
7
7
  import { cva } from "class-variance-authority";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
10
10
  import * as LabelPrimitive from "@radix-ui/react-label";
11
11
  import { useIntersectionObserver, useThrottle, useWindowScroll } from "@uidotdev/usehooks";
12
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
12
13
  import * as ProgressPrimitive from "@radix-ui/react-progress";
13
14
  import * as SwitchPrimitive from "@radix-ui/react-switch";
14
15
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
@@ -66,9 +67,12 @@ function Button$2({ className, variant, size, asChild = false, ...props }) {
66
67
  //#endregion
67
68
  //#region src/components/atoms/Button/index.tsx
68
69
  const variantClasses = {
69
- default: "",
70
- secondary: "",
71
- ghost: ""
70
+ solid: "",
71
+ outlined: cn("border border-[rgb(var(--btn-border)/0.5)]", "bg-background text-foreground", "hover:bg-accent"),
72
+ dashed: cn("border border-dashed border-[rgb(var(--btn-border)/0.5)]", "bg-background text-foreground", "hover:bg-accent"),
73
+ filled: cn("bg-muted text-foreground", "hover:bg-muted/80"),
74
+ text: cn("bg-transparent text-foreground", "hover:bg-accent"),
75
+ link: cn("bg-transparent text-primary", "underline-offset-4 hover:underline", "hover:bg-primary/10")
72
76
  };
73
77
  const sizesClasses = {
74
78
  small: "h-6 px-3 text-sm",
@@ -80,20 +84,21 @@ const iconSizes = {
80
84
  medium: "size-8",
81
85
  large: "size-10"
82
86
  };
83
- const Button$1 = ({ icon, className, variant = "default", size = "medium", color = "default", block = false, disabled, loading, danger, children, onMouseDown, ...props }) => {
87
+ const Button$1 = ({ icon, className, variant = "solid", size = "medium", color = "default", block = false, disabled, loading, danger, children, onMouseDown, ...props }) => {
84
88
  const iconOnly = icon && !children;
85
89
  const computedColor = danger ? "danger" : color;
86
90
  const colored = computedColor && computedColor !== "default";
87
91
  return /* @__PURE__ */ jsxs(Button$2, {
88
- variant,
89
92
  disabled,
90
- "data-color": colored ? computedColor : void 0,
91
- className: cn(variantClasses[variant || "default"], "inline-flex items-center justify-center gap-x-2", "rounded-lg", "cursor-pointer", "h-auto py-0", sizesClasses[size || "medium"], iconOnly && iconSizes[size || "medium"], block && "w-full", colored && [
93
+ variant: "default",
94
+ "data-color": computedColor,
95
+ className: cn("inline-flex items-center justify-center gap-x-2", "rounded-lg", "cursor-pointer", "h-auto py-0", "transition-all", variantClasses[variant || "solid"], sizesClasses[size || "medium"], iconOnly && iconSizes[size || "medium"], block && "w-full", colored && (variant === "solid" ? [
92
96
  "bg-(--btn-bg)",
93
97
  "hover:bg-(--btn-bg-hover)",
94
98
  "active:bg-(--btn-bg-active)",
95
- "text-(--btn-fg)"
96
- ], className),
99
+ "text-(--btn-fg)",
100
+ "border-(--btn-border)"
101
+ ] : ["text-(--btn-bg)", "border-[rgb(var(--btn-border)/0.5)]"]), className),
97
102
  onMouseDown: (e) => {
98
103
  e.preventDefault();
99
104
  onMouseDown?.(e);
@@ -246,7 +251,7 @@ var BackTop_default = BackTop;
246
251
  const FloatButton = ({ className, children, ...props }) => {
247
252
  return /* @__PURE__ */ jsx(Button_default$1, {
248
253
  className: cn("fixed right-5 bottom-5 rounded-full", "bg-white hover:bg-white", "z-50 h-12 w-12", "shadow-md", className),
249
- variant: "outline",
254
+ variant: "outlined",
250
255
  ...props,
251
256
  children
252
257
  });
@@ -335,6 +340,44 @@ Input.Search = Search_default;
335
340
  Input.TextArea = TextArea_default;
336
341
  var Input_default = Input;
337
342
 
343
+ //#endregion
344
+ //#region src/core/popover.tsx
345
+ const Popover$1 = PopoverPrimitive.Root;
346
+ const PopoverTrigger = PopoverPrimitive.Trigger;
347
+ const PopoverAnchor = PopoverPrimitive.Anchor;
348
+ const PopoverContent = React$1.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
349
+ ref,
350
+ align,
351
+ sideOffset,
352
+ className: cn(`bg-popover text-popover-foreground data-[state=open]:animate-in
353
+ data-[state=closed]:animate-out data-[state=closed]:fade-out-0
354
+ data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
355
+ data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2
356
+ data-[side=left]:slide-in-from-right-2
357
+ data-[side=right]:slide-in-from-left-2
358
+ data-[side=top]:slide-in-from-bottom-2 z-50 w-72
359
+ origin-[--radix-popover-content-transform-origin] rounded-md border p-4
360
+ shadow-md outline-none`, className),
361
+ ...props
362
+ }) }));
363
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
364
+
365
+ //#endregion
366
+ //#region src/components/atoms/Popover/index.tsx
367
+ const Popover = ({ title, content, children }) => {
368
+ return /* @__PURE__ */ jsxs(Popover$1, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
369
+ asChild: true,
370
+ children
371
+ }), /* @__PURE__ */ jsxs(PopoverContent, {
372
+ align: "start",
373
+ children: [title && typeof title === "string" ? /* @__PURE__ */ jsx(Typography_default.Title, {
374
+ level: 5,
375
+ children: title
376
+ }) : title, content]
377
+ })] });
378
+ };
379
+ var Popover_default = Popover;
380
+
338
381
  //#endregion
339
382
  //#region src/core/progress.tsx
340
383
  const Progress$1 = React$1.forwardRef(({ className, barClassName, barStyle, value, ...props }, ref) => /* @__PURE__ */ jsx(ProgressPrimitive.Root, {
@@ -570,24 +613,7 @@ const Collapse = ({ expandIcon, accordion = false, items: _items = [], className
570
613
  var Collapse_default = Collapse;
571
614
 
572
615
  //#endregion
573
- //#region src/components/molecules/Menu/index.tsx
574
- const MENU_CLASSNAMES = [
575
- "p-0",
576
- "bg-white",
577
- "shadow-md",
578
- "rounded-md"
579
- ];
580
- const OPEN_CLASSNAMES = ["underline", "underline-offset-8"];
581
- const HOVER_CLASSNAMES = ["hover:underline", "hover:underline-offset-8"];
582
- const OFFSET = [8, 8];
583
- const INLINE_OFFSET = 16;
584
- function findKey(menu, targetKeys) {
585
- if (targetKeys.includes(menu.key)) return true;
586
- if (menu.children && Array.isArray(menu.children)) {
587
- for (const child of menu.children) if (findKey(child, targetKeys)) return true;
588
- }
589
- return false;
590
- }
616
+ //#region src/components/molecules/Menu/Item/Label/index.tsx
591
617
  const Label = ({ children, level = 4, className, ...props }) => {
592
618
  if (typeof children === "string") return /* @__PURE__ */ jsx(Typography_default.Text, {
593
619
  level,
@@ -597,94 +623,39 @@ const Label = ({ children, level = 4, className, ...props }) => {
597
623
  });
598
624
  return children;
599
625
  };
600
- const Item$2 = ({ itemKey = "", keyPath = [], root = false, mode, label, children, selectedKeys = [], fullSize, classNames, styles, offset = OFFSET, inlineOffset = INLINE_OFFSET, onClick, ...props }) => {
626
+ var Label_default = Label;
627
+
628
+ //#endregion
629
+ //#region src/components/molecules/Menu/Item/index.tsx
630
+ const OFFSET = [8, 8];
631
+ const INLINE_OFFSET = 16;
632
+ const STYLES = {
633
+ hover: { classes: ["hover:underline", "hover:underline-offset-8"] },
634
+ open: { classes: ["underline", "underline-offset-8"] }
635
+ };
636
+ const getItemClasses = (root, isHorizontal, isInline, hasChildren, customClasses) => cn("px-4 py-2", "cursor-pointer", "whitespace-nowrap", root && isHorizontal ? "inline-flex" : "flex", ...root ? [
637
+ "h-full",
638
+ "rounded-none border-transparent",
639
+ hasChildren && "hover:border-current",
640
+ isHorizontal ? "border-b-2" : "border-r-2",
641
+ isInline && "border-none"
642
+ ] : ["rounded-md", ...STYLES.hover.classes], customClasses);
643
+ const Item$2 = ({ itemKey, keyPath, root = false, mode, label, children, selectedKeys = [], selectionMap, classNames, styles, offset = OFFSET, inlineOffset = INLINE_OFFSET, onClick, onSelect, ...props }) => {
601
644
  const [open, setOpen] = useState(false);
602
- const [position, setPosition] = useState({
603
- top: 0,
604
- left: 0
605
- });
606
645
  const itemRef = useRef(null);
607
646
  const isHorizontal = mode === "horizontal";
608
647
  const isInline = mode === "inline";
609
648
  const [left, top] = offset;
649
+ const selected = selectionMap?.get(itemKey) ?? false;
610
650
  const item = {
611
651
  ...props,
612
652
  label,
613
653
  key: itemKey,
614
654
  children
615
655
  };
616
- const itemClassNames = cn("px-4 py-2", "cursor-pointer", "whitespace-nowrap", root && isHorizontal ? "inline-flex" : "flex", ...root ? [
617
- "h-full",
618
- "rounded-none border-transparent",
619
- !!children?.length && "hover:border-current",
620
- isHorizontal ? "border-b-2" : "border-r-2",
621
- isInline && "border-none",
622
- classNames?.rootItem
623
- ] : [
624
- "rounded-md",
625
- ...HOVER_CLASSNAMES,
626
- classNames?.item
627
- ]);
628
- const childrenContainerClassNames = cn(isInline ? "relative overflow-hidden" : "absolute min-w-[200px]", !isInline && root && isHorizontal ? "left-0 top-full pt-2 pl-0" : !isInline ? "left-full top-0 pl-2 pt-0" : "pl-4", ...fullSize ? [
629
- ...MENU_CLASSNAMES,
630
- "fixed flex justify-center items-start",
631
- isHorizontal ? "inset-x-0 w-screen" : "inset-y-0 h-screen"
632
- ] : []);
633
- const childrenContainerStyle = fullSize ? isHorizontal ? {
634
- top: position.top,
635
- marginTop: top
636
- } : {
637
- left: position.left,
638
- marginLeft: left
639
- } : isInline ? { paddingLeft: inlineOffset } : root && isHorizontal ? { paddingTop: top } : { paddingLeft: left };
640
- useEffect(() => {
641
- if (!itemRef.current) return;
642
- const $item = itemRef.current;
643
- const onResize = () => {
644
- setPosition({
645
- top: $item.offsetTop + $item.offsetHeight,
646
- left: $item.offsetLeft + $item.offsetWidth
647
- });
648
- };
649
- onResize();
650
- window.addEventListener("resize", onResize);
651
- return () => window.removeEventListener("resize", onResize);
652
- }, []);
653
- if (!root && fullSize) return /* @__PURE__ */ jsxs("li", {
654
- className: cn("basis-1/6", "min-w-[180px]"),
655
- children: [/* @__PURE__ */ jsx("div", {
656
- className: cn(itemClassNames, "justify-center"),
657
- onClick: (e) => {
658
- e.stopPropagation();
659
- onClick?.({
660
- domEvent: e,
661
- key: itemKey,
662
- keyPath,
663
- item
664
- });
665
- },
666
- children: /* @__PURE__ */ jsx(Label, {
667
- className: "font-semibold",
668
- children: label
669
- })
670
- }), /* @__PURE__ */ jsx("ul", { children: children?.map((child) => /* @__PURE__ */ jsx("li", {
671
- className: cn(itemClassNames, "justify-center", ...findKey(child, selectedKeys) ? [...OPEN_CLASSNAMES, ...HOVER_CLASSNAMES] : []),
672
- onClick: (e) => {
673
- e.stopPropagation();
674
- onClick?.({
675
- domEvent: e,
676
- key: child.key,
677
- keyPath: [...keyPath, child.key],
678
- item: child
679
- });
680
- },
681
- children: /* @__PURE__ */ jsx(Label, {
682
- level: 5,
683
- className: "text-center text-wrap",
684
- children: child.label
685
- })
686
- }, child.key)) })]
687
- });
656
+ const itemClassNames = getItemClasses(root, isHorizontal, isInline, !!children?.length, root ? classNames?.rootItem : classNames?.item);
657
+ const childrenContainerClassNames = cn(isInline ? "relative overflow-hidden" : "absolute min-w-[200px]", !isInline && root && isHorizontal ? "left-0 top-full pt-2 pl-0" : !isInline ? "left-full top-0 pl-2 pt-0" : "pl-4");
658
+ const childrenContainerStyle = isInline ? { paddingLeft: inlineOffset } : root && isHorizontal ? { paddingTop: top } : { paddingLeft: left };
688
659
  return /* @__PURE__ */ jsxs("li", {
689
660
  ref: itemRef,
690
661
  className: cn("group", "relative", root && isHorizontal ? "inline-block" : "block"),
@@ -697,23 +668,29 @@ const Item$2 = ({ itemKey = "", keyPath = [], root = false, mode, label, childre
697
668
  setOpen(false);
698
669
  },
699
670
  children: [/* @__PURE__ */ jsx("div", {
700
- className: cn(itemClassNames, ...findKey(item, selectedKeys) ? root ? ["border-current"] : [...OPEN_CLASSNAMES, ...HOVER_CLASSNAMES] : root && !!children?.length ? ["group-hover:border-current"] : []),
671
+ role: "menuitem",
672
+ "aria-expanded": children?.length ? open : void 0,
673
+ "aria-haspopup": children?.length ? "menu" : void 0,
674
+ "aria-selected": selected,
675
+ className: cn(itemClassNames, ...selected ? root ? ["border-current"] : [...STYLES.open.classes, ...STYLES.hover.classes] : root && !!children?.length ? ["group-hover:border-current"] : []),
701
676
  style: root ? styles?.rootItem : styles?.item,
702
677
  onClick: (e) => {
703
678
  e.stopPropagation();
704
679
  if (isInline) setOpen(!open);
705
- onClick?.({
680
+ const params = {
706
681
  domEvent: e,
707
682
  key: itemKey,
708
683
  keyPath,
709
684
  item
710
- });
685
+ };
686
+ onClick?.(params);
687
+ if (!selected) onSelect?.(params);
711
688
  },
712
689
  children: /* @__PURE__ */ jsxs("div", {
713
690
  className: cn("w-full", "inline-flex items-center justify-between"),
714
691
  children: [
715
- /* @__PURE__ */ jsx(Label, {
716
- className: cn(classNames?.label, root && classNames?.rootItem, ...findKey(item, selectedKeys) ? root ? [] : [...OPEN_CLASSNAMES, ...HOVER_CLASSNAMES] : []),
692
+ /* @__PURE__ */ jsx(Label_default, {
693
+ className: cn(classNames?.label),
717
694
  style: styles?.label,
718
695
  children: label
719
696
  }),
@@ -738,59 +715,85 @@ const Item$2 = ({ itemKey = "", keyPath = [], root = false, mode, label, childre
738
715
  } : { opacity: 0 },
739
716
  transition: { duration: .2 },
740
717
  children: /* @__PURE__ */ jsx("ul", {
741
- className: cn(fullSize ? [
742
- "h-auto",
743
- "flex flex-nowrap gap-y-4",
744
- "p-8"
745
- ] : MENU_CLASSNAMES, isInline && "shadow-none", classNames?.subMenu),
718
+ className: cn(MENU_CLASSNAMES, isInline && "shadow-none", classNames?.subMenu),
746
719
  style: styles?.subMenu,
747
720
  children: children.map((child) => /* @__PURE__ */ createElement(Item$2, {
748
721
  ...child,
749
722
  key: child.key,
750
723
  itemKey: child.key,
751
724
  keyPath: [...keyPath, child.key],
725
+ selectionMap,
752
726
  mode,
753
727
  selectedKeys,
754
- fullSize,
755
728
  classNames,
756
729
  styles,
757
730
  offset,
758
731
  inlineOffset,
759
- onClick
732
+ onClick,
733
+ onSelect
760
734
  }))
761
735
  })
762
736
  }) })]
763
737
  });
764
738
  };
765
- const Menu = ({ items, mode = "vertical", fullSize = false, defaultSelectedKeys: _defaultSelectedKeys = [], selectedKeys: _selectedKeys = [], className, classNames, styles, offset, inlineOffset, onClick = () => {}, ...props }) => {
766
- const [selectedKeys, setSelectedKeys] = useState(_defaultSelectedKeys);
767
- useEffect(() => {
768
- if (!_defaultSelectedKeys.length) return;
769
- setSelectedKeys(_defaultSelectedKeys);
770
- return () => setSelectedKeys([]);
771
- }, [_defaultSelectedKeys]);
772
- useEffect(() => {
773
- if (!_selectedKeys.length) return;
774
- setSelectedKeys(_selectedKeys);
775
- return () => setSelectedKeys([]);
776
- }, [_selectedKeys]);
739
+ var Item_default$2 = Item$2;
740
+
741
+ //#endregion
742
+ //#region src/components/molecules/Menu/index.tsx
743
+ const MENU_CLASSNAMES = [
744
+ "p-0",
745
+ "bg-white",
746
+ "shadow-md",
747
+ "rounded-md"
748
+ ];
749
+ function buildSelectionMap(items, selectedKeysSet) {
750
+ const map = /* @__PURE__ */ new Map();
751
+ const dfs = (node) => {
752
+ const self = selectedKeysSet.has(node.key);
753
+ const hasSelectedChild = node.children?.some((child) => dfs(child)) ?? false;
754
+ const isSelected = self || hasSelectedChild;
755
+ map.set(node.key, isSelected);
756
+ return isSelected;
757
+ };
758
+ items.forEach(dfs);
759
+ return map;
760
+ }
761
+ function findKey(menu, targetKeys) {
762
+ if (targetKeys.has(menu.key)) return true;
763
+ if (menu.children && Array.isArray(menu.children)) {
764
+ for (const child of menu.children) if (findKey(child, targetKeys)) return true;
765
+ }
766
+ return false;
767
+ }
768
+ const Menu = ({ items, mode = "vertical", defaultSelectedKeys = [], selectedKeys: _selectedKeys, className, classNames, styles, offset, inlineOffset, onClick, onSelect: _onSelect, ...props }) => {
769
+ const isControlled = _selectedKeys !== void 0;
770
+ const [uncontrolledSelectedKeys, setUncontrolledSelectedKeys] = useState(defaultSelectedKeys ?? []);
771
+ const selectedKeys = isControlled ? _selectedKeys : uncontrolledSelectedKeys;
772
+ const selectedKeysSet = useMemo(() => new Set(selectedKeys ?? []), [selectedKeys]);
773
+ const selectionMap = useMemo(() => buildSelectionMap(items ?? [], selectedKeysSet), [items, selectedKeysSet]);
774
+ const onSelect = (params) => {
775
+ if (!isControlled) setUncontrolledSelectedKeys([params.key]);
776
+ _onSelect?.(params);
777
+ };
777
778
  return /* @__PURE__ */ jsx("ul", {
779
+ role: "menu",
778
780
  className: cn(MENU_CLASSNAMES, mode === "horizontal" ? "flex" : "inline-block", className),
779
781
  ...props,
780
- children: items?.map((item) => /* @__PURE__ */ createElement(Item$2, {
782
+ children: items?.map((item) => /* @__PURE__ */ createElement(Item_default$2, {
781
783
  root: true,
782
784
  ...item,
783
785
  key: item.key,
784
786
  itemKey: item.key,
785
787
  keyPath: [item.key],
786
788
  selectedKeys,
789
+ selectionMap,
787
790
  mode,
788
- fullSize,
789
791
  classNames,
790
792
  styles,
791
793
  offset,
792
794
  inlineOffset,
793
- onClick
795
+ onClick,
796
+ onSelect
794
797
  }))
795
798
  });
796
799
  };
@@ -5033,7 +5036,7 @@ const Modal = ({ open = false, maskClosable = false, closable = false, closeIcon
5033
5036
  onClick: onOk,
5034
5037
  children: okText
5035
5038
  }), /* @__PURE__ */ jsx(Button_default$1, {
5036
- variant: "outline",
5039
+ variant: "outlined",
5037
5040
  onClick: onCancel,
5038
5041
  children: cancelText
5039
5042
  })] })
@@ -5061,7 +5064,7 @@ const StaticModal = ({ type, title, content, okText = "OK", cancelText = "Cancel
5061
5064
  const footer = type === "confirm" ? /* @__PURE__ */ jsxs("div", {
5062
5065
  className: "grid w-full grid-cols-5 gap-x-2",
5063
5066
  children: [/* @__PURE__ */ jsx(Button_default$1, {
5064
- variant: "outline",
5067
+ variant: "outlined",
5065
5068
  className: "col-span-2",
5066
5069
  onClick: () => closeModal(onCancel),
5067
5070
  children: cancelText
@@ -5273,4 +5276,4 @@ Layout.Sider = Sider_default;
5273
5276
  var Layout_default = Layout;
5274
5277
 
5275
5278
  //#endregion
5276
- export { Input_default as _, Drawer_default as a, Button_default$1 as b, Dropdown_default as c, Collapse_default as d, Card_default as f, Progress_default as g, Skeleton_default as h, List_default as i, Menu_default as l, Spin_default as m, Swiper_default as n, Space_default as o, Switch_default as p, Modal_default as r, Marquees_default as s, Layout_default as t, findKey as u, FloatButton_default as v, Checkbox_default as y };
5279
+ export { Button_default$1 as C, Checkbox_default as S, Skeleton_default as _, Drawer_default as a, Input_default as b, Dropdown_default as c, buildSelectionMap as d, findKey as f, Spin_default as g, Switch_default as h, List_default as i, MENU_CLASSNAMES as l, Card_default as m, Swiper_default as n, Space_default as o, Collapse_default as p, Modal_default as r, Marquees_default as s, Layout_default as t, Menu_default as u, Progress_default as v, FloatButton_default as x, Popover_default as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbpark/ui-kit",
3
- "version": "1.1.7",
3
+ "version": "2.0.1",
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",
@@ -88,6 +88,7 @@
88
88
  "@radix-ui/react-checkbox": "^1.3.3",
89
89
  "@radix-ui/react-dialog": "^1.1.15",
90
90
  "@radix-ui/react-label": "^2.1.8",
91
+ "@radix-ui/react-popover": "^1.1.15",
91
92
  "@radix-ui/react-progress": "^1.1.7",
92
93
  "@radix-ui/react-slot": "^1.2.3",
93
94
  "@radix-ui/react-switch": "^1.2.6",