@konstructio/ui 0.1.2-alpha.67 → 0.1.2-alpha.69

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.
Files changed (47) hide show
  1. package/dist/AdditionalOptions-C2FDVZhu.js +45 -0
  2. package/dist/Modal-BGcucTHv.js +120 -0
  3. package/dist/assets/icons/components/CloudLockOutline.d.ts +3 -0
  4. package/dist/assets/icons/components/CloudLockOutline.js +28 -0
  5. package/dist/assets/icons/components/index.d.ts +1 -0
  6. package/dist/assets/icons/components/index.js +106 -104
  7. package/dist/assets/icons/index.js +106 -104
  8. package/dist/components/ButtonGroup/ButtonGroup.js +65 -61
  9. package/dist/components/ButtonGroup/ButtonGroup.types.d.ts +6 -0
  10. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.js +32 -30
  11. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.types.d.ts +3 -1
  12. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.d.ts +4 -1
  13. package/dist/components/ButtonGroup/components/ButtonGroupItem/ButtonGroupItem.variants.js +37 -17
  14. package/dist/components/DateRangePicker/components/CalendarPanel/components/IndependentModeCalendar/IndependentModeCalendar.js +1 -1
  15. package/dist/components/DateRangePicker/components/CalendarPanel/components/TogetherModeCalendar/TogetherModeCalendar.js +1 -1
  16. package/dist/components/Modal/Modal.js +1 -1
  17. package/dist/components/Modal/Modal.types.d.ts +7 -2
  18. package/dist/components/Modal/components/Wrapper/Wrapper.js +3 -2
  19. package/dist/components/Modal/components/Wrapper/Wrapper.types.d.ts +3 -0
  20. package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +2 -2
  21. package/dist/components/Modal/components/index.js +1 -1
  22. package/dist/components/Select/Select.d.ts +1 -0
  23. package/dist/components/Select/Select.js +65 -42
  24. package/dist/components/Select/Select.types.d.ts +18 -2
  25. package/dist/components/Select/Select.variants.js +1 -1
  26. package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.d.ts +3 -0
  27. package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.js +11 -0
  28. package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.types.d.ts +4 -0
  29. package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.variants.d.ts +1 -0
  30. package/dist/components/Select/components/AdditionalOptions/AdditionalOptions.variants.js +26 -0
  31. package/dist/components/Select/components/List/List.js +131 -132
  32. package/dist/components/Select/components/List/List.types.d.ts +1 -0
  33. package/dist/components/Select/components/List/List.variants.d.ts +1 -0
  34. package/dist/components/Select/components/List/List.variants.js +18 -3
  35. package/dist/components/Select/components/Wrapper.d.ts +3 -1
  36. package/dist/components/Select/components/Wrapper.js +65 -63
  37. package/dist/components/Select/components/index.d.ts +1 -0
  38. package/dist/components/Select/components/index.js +8 -6
  39. package/dist/components/index.js +1 -1
  40. package/dist/icons.d.ts +1 -1
  41. package/dist/icons.js +106 -104
  42. package/dist/index.js +1 -1
  43. package/dist/package.json +3 -3
  44. package/dist/{proxy-BIRlSMN_.js → proxy-CngVm5qA.js} +1834 -1852
  45. package/dist/styles.css +1 -1
  46. package/package.json +3 -3
  47. package/dist/Modal--z642-Wv.js +0 -112
@@ -1,5 +1,5 @@
1
1
  import { c as t } from "../../../../index-D29mdTf5.js";
2
- const s = t(
2
+ const r = t(
3
3
  [
4
4
  "flex",
5
5
  "flex-1",
@@ -38,20 +38,20 @@ const s = t(
38
38
  isLast: !1
39
39
  }
40
40
  }
41
- ), r = t(
41
+ ), s = t(
42
42
  ["flex", "flex-col", "flex-1", "rounded-lg", "px-4", "py-2"],
43
43
  {
44
44
  variants: {
45
45
  hasDescription: {
46
- true: "items-start text-left justify-start",
47
- false: "items-center text-center justify-center"
46
+ true: "justify-start",
47
+ false: "justify-center"
48
48
  }
49
49
  },
50
50
  defaultVariants: {
51
51
  hasDescription: !1
52
52
  }
53
53
  }
54
- ), a = t(
54
+ ), n = t(
55
55
  [
56
56
  "text-sm",
57
57
  "font-medium",
@@ -70,22 +70,42 @@ const s = t(
70
70
  selected: {
71
71
  true: "text-aurora-500",
72
72
  false: "text-metal-50"
73
+ },
74
+ labelAlign: {
75
+ left: "justify-between",
76
+ center: "justify-center",
77
+ right: "justify-end"
78
+ }
79
+ },
80
+ defaultVariants: {
81
+ selected: !1,
82
+ labelAlign: "left"
83
+ }
84
+ }
85
+ ), a = t(
86
+ [
87
+ "text-sm",
88
+ "font-normal",
89
+ "leading-5",
90
+ "tracking-[0.15px]",
91
+ "text-metal-300"
92
+ ],
93
+ {
94
+ variants: {
95
+ descriptionAlign: {
96
+ left: "text-left",
97
+ center: "text-center",
98
+ right: "text-right"
73
99
  }
74
100
  },
75
101
  defaultVariants: {
76
- selected: !1
102
+ descriptionAlign: "left"
77
103
  }
78
104
  }
79
- ), n = t([
80
- "text-sm",
81
- "font-normal",
82
- "leading-5",
83
- "tracking-[0.15px]",
84
- "text-metal-300"
85
- ]);
105
+ );
86
106
  export {
87
- n as buttonGroupDescriptionVariants,
88
- r as buttonGroupItemContentVariants,
89
- s as buttonGroupItemVariants,
90
- a as buttonGroupLabelVariants
107
+ a as buttonGroupDescriptionVariants,
108
+ s as buttonGroupItemContentVariants,
109
+ r as buttonGroupItemVariants,
110
+ n as buttonGroupLabelVariants
91
111
  };
@@ -7,7 +7,7 @@ import { CalendarDivider as tt } from "../CalendarDivider/CalendarDivider.js";
7
7
  import { CalendarMonth as d } from "../CalendarMonth/CalendarMonth.js";
8
8
  import { NavigationButton as g } from "../NavigationButton/NavigationButton.js";
9
9
  import { useIndependentCarousel as nt } from "../../hooks/useIndependentCarousel.js";
10
- import { m as et } from "../../../../../../proxy-BIRlSMN_.js";
10
+ import { m as et } from "../../../../../../proxy-CngVm5qA.js";
11
11
  const at = ({
12
12
  className: b,
13
13
  calendarWidth: x = 550,
@@ -6,7 +6,7 @@ import { CalendarDivider as F } from "../CalendarDivider/CalendarDivider.js";
6
6
  import { CalendarMonth as G } from "../CalendarMonth/CalendarMonth.js";
7
7
  import { NavigationButton as m } from "../NavigationButton/NavigationButton.js";
8
8
  import { useTogetherCarousel as H } from "../../hooks/useTogetherCarousel.js";
9
- import { m as R } from "../../../../../../proxy-BIRlSMN_.js";
9
+ import { m as R } from "../../../../../../proxy-CngVm5qA.js";
10
10
  const S = ({
11
11
  className: s,
12
12
  calendarWidth: h = 550,
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "react-dom";
4
- import { M as d } from "../../Modal--z642-Wv.js";
4
+ import { M as d } from "../../Modal-BGcucTHv.js";
5
5
  import "./components/Header/Header.js";
6
6
  import "./components/Body/Body.js";
7
7
  import "./components/Footer/Footer.js";
@@ -1,7 +1,8 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
2
1
  import { VariantProps } from 'class-variance-authority';
3
- import { modalVariants } from './components/Wrapper/Wrapper.variants';
2
+ import { Transition } from 'motion/react';
3
+ import { PropsWithChildren, ReactNode } from 'react';
4
4
  import { Theme } from '../../domain/theme';
5
+ import { modalVariants } from './components/Wrapper/Wrapper.variants';
5
6
  /**
6
7
  * Props for the Modal component.
7
8
  *
@@ -21,6 +22,8 @@ export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
21
22
  buttonCloseClassName?: string;
22
23
  /** Additional CSS classes for the modal */
23
24
  className?: string;
25
+ /** CSS classes for the outer container (the overlay grid wrapper) */
26
+ containerClassName?: string;
24
27
  /** DOM element to portal the modal into (defaults to document.body) */
25
28
  container?: Element | DocumentFragment;
26
29
  /** Whether the modal is open */
@@ -29,6 +32,8 @@ export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
29
32
  showCloseButton?: boolean;
30
33
  /** Theme override for this component */
31
34
  theme?: Theme;
35
+ /** Motion transition config for the modal animation */
36
+ transition?: Transition;
32
37
  /** Callback when modal is closed (Escape key or close button) */
33
38
  onClose?: () => void;
34
39
  };
@@ -2,10 +2,11 @@ import "react/jsx-runtime";
2
2
  import "../../../../index-BKjcReYh.js";
3
3
  import "react";
4
4
  import "../../../../Combination-BtmnusWq.js";
5
- import { W as f } from "../../../../Modal--z642-Wv.js";
5
+ import { W as s } from "../../../../Modal-BGcucTHv.js";
6
6
  import "../../../../utils/index.js";
7
7
  import "./Wrapper.variants.js";
8
+ import "../../../../proxy-CngVm5qA.js";
8
9
  import "../../../../x-Eoa9FJjA.js";
9
10
  export {
10
- f as Wrapper
11
+ s as Wrapper
11
12
  };
@@ -1,11 +1,14 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
+ import { Transition } from 'motion/react';
2
3
  import { PropsWithChildren } from 'react';
3
4
  import { Theme } from '../../../../domain/theme';
4
5
  import { modalVariants } from './Wrapper.variants';
5
6
  export type Props = PropsWithChildren & VariantProps<typeof modalVariants> & {
6
7
  buttonCloseClassName?: string;
7
8
  className?: string;
9
+ containerClassName?: string;
8
10
  showCloseButton?: boolean;
9
11
  theme?: Theme;
12
+ transition?: Transition;
10
13
  onClose?: () => void;
11
14
  };
@@ -8,8 +8,8 @@ const a = t([
8
8
  "flex",
9
9
  "flex-col",
10
10
  "justify-between",
11
- "min-h-[450px]",
12
- "min-w-[500px]",
11
+ "min-h-112.5",
12
+ "min-w-125",
13
13
  "relative",
14
14
  "rounded-md",
15
15
  "shadow-xs",
@@ -1,7 +1,7 @@
1
1
  import { Body as e } from "./Body/Body.js";
2
2
  import { Footer as t } from "./Footer/Footer.js";
3
3
  import { Header as m } from "./Header/Header.js";
4
- import { W as a } from "../../../Modal--z642-Wv.js";
4
+ import { W as a } from "../../../Modal-BGcucTHv.js";
5
5
  export {
6
6
  e as Body,
7
7
  t as Footer,
@@ -1,5 +1,6 @@
1
1
  import { FC } from 'react';
2
2
  import { SelectProps } from './Select.types';
3
+ export type { OptionGroup, AdditionalOptionGroup } from './Select.types';
3
4
  /**
4
5
  * A dropdown select component with search, icons, and infinite scroll support.
5
6
  * Also exported as `Dropdown` for convenience.
@@ -1,47 +1,70 @@
1
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
- import { forwardRef as v } from "react";
3
- import { cn as l } from "../../utils/index.js";
4
- import { SelectProvider as N } from "./contexts/select.provider.js";
5
- import { Wrapper as j } from "./components/Wrapper.js";
6
- const W = v(
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { forwardRef as N, useMemo as O } from "react";
3
+ import { cn as a } from "../../utils/index.js";
4
+ import { i as g } from "../../AdditionalOptions-C2FDVZhu.js";
5
+ import { SelectProvider as j } from "./contexts/select.provider.js";
6
+ import { Wrapper as k } from "./components/Wrapper.js";
7
+ const W = N(
7
8
  ({
8
- error: t,
9
- errorClassName: r,
10
- helperText: s,
11
- helperTextClassName: a,
12
- highlightSearch: c,
13
- mainWrapperClassName: o,
14
- name: m,
15
- value: p,
16
- options: d,
17
- onChange: f,
9
+ error: e,
10
+ errorClassName: m,
11
+ helperText: l,
12
+ helperTextClassName: n,
13
+ highlightSearch: o,
14
+ mainWrapperClassName: p,
15
+ name: s,
16
+ value: c,
17
+ options: t,
18
+ onChange: d,
18
19
  onBlur: i,
19
- ...n
20
- }, x) => /* @__PURE__ */ e(
21
- N,
22
- {
23
- highlightSearch: c,
24
- name: m,
25
- value: p,
26
- options: d,
27
- onBlur: i,
28
- onChange: f,
29
- children: /* @__PURE__ */ h("div", { className: l("relative w-full", o), children: [
30
- /* @__PURE__ */ e(
31
- j,
32
- {
33
- error: t,
34
- name: m,
35
- ref: x,
36
- onBlur: i,
37
- ...n
38
- }
39
- ),
40
- t ? /* @__PURE__ */ e("span", { className: l("text-xs text-red-700", r), children: t }) : null,
41
- !t && s ? /* @__PURE__ */ e("span", { className: l("text-xs text-metal-600", a), children: s }) : null
42
- ] })
43
- }
44
- )
20
+ ...f
21
+ }, x) => {
22
+ const u = O(() => t.length ? g(t.at(0)) ? t.flatMap((h) => h.options) : t : [], [t]);
23
+ return /* @__PURE__ */ r(
24
+ j,
25
+ {
26
+ highlightSearch: o,
27
+ name: s,
28
+ value: c,
29
+ options: u,
30
+ onBlur: i,
31
+ onChange: d,
32
+ children: /* @__PURE__ */ v("div", { className: a("relative w-full", p), children: [
33
+ /* @__PURE__ */ r(
34
+ k,
35
+ {
36
+ error: e,
37
+ name: s,
38
+ ref: x,
39
+ onBlur: i,
40
+ groupedOptions: t,
41
+ ...f
42
+ }
43
+ ),
44
+ e ? /* @__PURE__ */ r(
45
+ "span",
46
+ {
47
+ className: a(
48
+ "text-xs text-red-700 dark:text-red-400",
49
+ m
50
+ ),
51
+ children: e
52
+ }
53
+ ) : null,
54
+ !e && l ? /* @__PURE__ */ r(
55
+ "span",
56
+ {
57
+ className: a(
58
+ "text-xs text-slate-600 dark:text-slate-200",
59
+ n
60
+ ),
61
+ children: l
62
+ }
63
+ ) : null
64
+ ] })
65
+ }
66
+ );
67
+ }
45
68
  );
46
69
  export {
47
70
  W as Select
@@ -33,6 +33,22 @@ export type Option = {
33
33
  /** Unique value for the option */
34
34
  value: string;
35
35
  };
36
+ /**
37
+ * A group of options with a non-interactive header label.
38
+ */
39
+ export type OptionGroup = {
40
+ groupLabel: string;
41
+ options: Option[];
42
+ };
43
+ /**
44
+ * A group of additional options with a non-interactive header label.
45
+ */
46
+ export type AdditionalOptionGroup = {
47
+ groupLabel: string;
48
+ options: ReactNode[];
49
+ };
50
+ export declare const isOptionGroup: (item: Option | OptionGroup) => item is OptionGroup;
51
+ export declare const isAdditionalOptionGroup: (item: unknown) => item is AdditionalOptionGroup;
36
52
  type OnChangeFn = (params: {
37
53
  target: {
38
54
  value: string;
@@ -74,7 +90,7 @@ type OnChangeFn = (params: {
74
90
  * @see {@link https://konstructio.github.io/konstruct-ui/?path=/docs/components-select--docs Storybook}
75
91
  */
76
92
  export type SelectProps = VariantProps<typeof selectVariants> & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'> & {
77
- additionalOptions?: ReactNode[] | string[];
93
+ additionalOptions?: ReactNode[] | string[] | AdditionalOptionGroup[];
78
94
  className?: string;
79
95
  disabled?: boolean;
80
96
  error?: string;
@@ -95,7 +111,7 @@ export type SelectProps = VariantProps<typeof selectVariants> & Omit<InputHTMLAt
95
111
  listItemSecondRowClassName?: string;
96
112
  mainWrapperClassName?: string;
97
113
  noOptionsText?: string;
98
- options: Option[];
114
+ options: Option[] | OptionGroup[];
99
115
  searchable?: boolean;
100
116
  showSearchIcon?: boolean;
101
117
  theme?: Theme;
@@ -11,7 +11,7 @@ const a = e(
11
11
  "px-3",
12
12
  "py-1",
13
13
  "relative",
14
- "rounded-md",
14
+ "rounded",
15
15
  "transition-all",
16
16
  "w-full",
17
17
  "outline-none",
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { Props } from './AdditionalOptions.types';
3
+ export declare const AdditionalOptions: FC<Props>;
@@ -0,0 +1,11 @@
1
+ import "react/jsx-runtime";
2
+ import "../../../../index-BvoZGpli.js";
3
+ import "react";
4
+ import "../../../../utils/index.js";
5
+ import { A as s } from "../../../../AdditionalOptions-C2FDVZhu.js";
6
+ import "../List/List.variants.js";
7
+ import "./AdditionalOptions.variants.js";
8
+ import "../../contexts/select.hook.js";
9
+ export {
10
+ s as AdditionalOptions
11
+ };
@@ -0,0 +1,4 @@
1
+ import { SelectProps } from '../../Select.types';
2
+ export type Props = {
3
+ additionalOptions?: SelectProps['additionalOptions'];
4
+ };
@@ -0,0 +1 @@
1
+ export declare const additionalOptionSlotClassName: string;
@@ -0,0 +1,26 @@
1
+ import { cn as e } from "../../../../utils/index.js";
2
+ const o = e(
3
+ "flex",
4
+ "min-h-10",
5
+ "py-2",
6
+ "px-6",
7
+ "w-full",
8
+ "h-full",
9
+ "gap-1",
10
+ "items-center",
11
+ "text-sm",
12
+ "[&>svg]:-ml-1",
13
+ "[&>svg]:w-3.5",
14
+ "[&>svg]:h-3.5",
15
+ "[&>svg]:shrink-0",
16
+ "cursor-pointer",
17
+ "select-none",
18
+ "hover:bg-gray-50",
19
+ "hover:dark:bg-metal-700",
20
+ "focus:outline-0",
21
+ "text-blue-600",
22
+ "dark:text-aurora-500"
23
+ );
24
+ export {
25
+ o as additionalOptionSlotClassName
26
+ };