@companix/uikit 0.0.63 → 0.0.65

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.
@@ -22,7 +22,12 @@ export interface SelectAddOption {
22
22
  closeOnClick?: boolean;
23
23
  onClick: () => void;
24
24
  }
25
- interface InternalListProps<T> {
25
+ export interface SelectOptionsPopoverParams {
26
+ minimalOptions?: boolean;
27
+ addOption?: SelectAddOption;
28
+ emptyText?: string;
29
+ }
30
+ interface InternalListProps<T> extends SelectOptionsPopoverParams {
26
31
  options: Option<T>[];
27
32
  scrollboxRef?: React.RefObject<HTMLDivElement>;
28
33
  optionsWrapperRef?: React.RefObject<HTMLDivElement>;
@@ -31,9 +36,6 @@ interface InternalListProps<T> {
31
36
  onOpened?: (activeIndex: number) => void;
32
37
  filterOptions?: (option: Option<T>) => boolean;
33
38
  disableFiltering?: boolean;
34
- minimalOptions?: boolean;
35
- addOption?: SelectAddOption;
36
- emptyText?: string;
37
39
  }
38
40
  export type OptionsPopoverProps<T> = OptionsSourceControl<T> & Omit<InternalListProps<T>, 'options'>;
39
41
  export declare const OptionsPopover: <T>(props: OptionsPopoverProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,24 @@
1
1
  import { SelectFormProps } from './SelectInput';
2
- import { OptionsSource, SelectAddOption } from './OptionsPopover';
2
+ import { OptionsSource, SelectOptionsPopoverParams } from './OptionsPopover';
3
3
  interface Cleanable<T> {
4
4
  clearButton: true;
5
- onChange: (event: T | null) => void;
5
+ onChange: (value: T | null) => void;
6
6
  }
7
7
  interface UnCleanable<T> {
8
8
  clearButton?: false;
9
- onChange: (event: T) => void;
9
+ onChange: (value: T) => void;
10
10
  }
11
- type DependedValueType<T> = Cleanable<T> | UnCleanable<T>;
12
- export interface SelectParams {
11
+ type OnChangeValueType<T> = Cleanable<T> | UnCleanable<T>;
12
+ export interface SelectParams extends SelectOptionsPopoverParams {
13
13
  matchTarget?: 'width' | 'min-width';
14
14
  popoverRef?: React.Ref<HTMLDivElement>;
15
15
  scrollRef?: React.Ref<{
16
16
  scrollTo: (index: number) => void;
17
17
  }>;
18
- emptyText?: string;
19
- minimalOptions?: boolean;
20
- addOption?: SelectAddOption;
21
18
  }
22
- export type SelectProps<T> = Omit<SelectFormProps, 'value' | 'onChange' | 'closeButton'> & DependedValueType<T> & SelectParams & OptionsSource<T> & {
19
+ export type SelectProps<T> = OptionsSource<T> & Omit<SelectFormProps, 'value'> & SelectParams & OnChangeValueType<T> & {
23
20
  value: T | null;
24
21
  children?: React.ReactNode;
25
22
  };
26
- export declare const Select: <T extends string | number>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const Select: <T>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
27
24
  export {};
@@ -1,19 +1,16 @@
1
- import { OptionsSource, SelectAddOption } from '../Select/OptionsPopover';
2
- export interface SelectParams<T> {
1
+ import { OptionsSource, SelectOptionsPopoverParams } from '../Select/OptionsPopover';
2
+ export interface SelectTagsParams<T> extends SelectOptionsPopoverParams {
3
3
  closeAfterSelect?: boolean;
4
4
  onInputChange?: (text: string) => void;
5
5
  onChange: (event: T[]) => void;
6
- placeholder?: string;
7
6
  value: T[];
7
+ placeholder?: string;
8
8
  disabled?: boolean;
9
9
  readOnly?: boolean;
10
10
  size?: 'sm' | 'md' | 'lg';
11
11
  fill?: boolean;
12
12
  inputRef?: React.Ref<HTMLInputElement>;
13
13
  required?: boolean;
14
- minimalOptions?: boolean;
15
- addOption?: SelectAddOption;
16
- emptyText?: string;
17
14
  }
18
- export type SelectTagsProps<T> = OptionsSource<T> & SelectParams<T>;
15
+ export type SelectTagsProps<T> = OptionsSource<T> & SelectTagsParams<T>;
19
16
  export declare const SelectTags: <T extends string | number>(props: SelectTagsProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -3,6 +3,10 @@ export declare const getMonthMaxDay: (month: number, year: number) => number;
3
3
  export declare const getFirstDay: (month: number, year: number) => number;
4
4
  export declare const getDayIndex: (day: number) => number;
5
5
  export declare const createVoids: (length: number) => any[];
6
+ export declare const arrays: {
7
+ add: <T>(values: T[], value: T) => T[];
8
+ remove: <T>(values: T[], value: T) => T[];
9
+ };
6
10
  export declare const dateToFormat: (date: Date) => DateFormat;
7
11
  export declare const createDateValidation: ({ min, max }: {
8
12
  min: DateFormat;
package/dist/bundle.es.js CHANGED
@@ -9,21 +9,21 @@ import { Segments as g } from "./bundle.es9.js";
9
9
  import { Popover as h } from "./bundle.es10.js";
10
10
  import { Tooltip as v } from "./bundle.es11.js";
11
11
  import { Select as P } from "./bundle.es12.js";
12
- import { Input as A } from "./bundle.es13.js";
13
- import { OptionItem as b } from "./bundle.es14.js";
14
- import { NumberInput as R } from "./bundle.es15.js";
15
- import { OptionsList as y } from "./bundle.es16.js";
16
- import { Checkbox as G } from "./bundle.es17.js";
17
- import { Switch as O } from "./bundle.es18.js";
18
- import { Radio as z, RadioGroup as N } from "./bundle.es19.js";
19
- import { Drawer as q } from "./bundle.es20.js";
20
- import { Dialog as H } from "./bundle.es21.js";
21
- import { AlertDialog as K } from "./bundle.es22.js";
22
- import { LoadingButton as Q } from "./bundle.es23.js";
23
- import { Tabs as V } from "./bundle.es24.js";
24
- import { Countdown as X } from "./bundle.es25.js";
25
- import { TextArea as Z } from "./bundle.es26.js";
26
- import { SelectTags as $ } from "./bundle.es27.js";
12
+ import { SelectTags as A } from "./bundle.es13.js";
13
+ import { Input as b } from "./bundle.es14.js";
14
+ import { OptionItem as R } from "./bundle.es15.js";
15
+ import { NumberInput as y } from "./bundle.es16.js";
16
+ import { OptionsList as G } from "./bundle.es17.js";
17
+ import { Checkbox as O } from "./bundle.es18.js";
18
+ import { Switch as z } from "./bundle.es19.js";
19
+ import { Radio as j, RadioGroup as q } from "./bundle.es20.js";
20
+ import { Drawer as H } from "./bundle.es21.js";
21
+ import { Dialog as K } from "./bundle.es22.js";
22
+ import { AlertDialog as Q } from "./bundle.es23.js";
23
+ import { LoadingButton as V } from "./bundle.es24.js";
24
+ import { Tabs as X } from "./bundle.es25.js";
25
+ import { Countdown as Z } from "./bundle.es26.js";
26
+ import { TextArea as $ } from "./bundle.es27.js";
27
27
  import { DatePicker as ro } from "./bundle.es28.js";
28
28
  import { DateInput as to } from "./bundle.es29.js";
29
29
  import { FileOverlay as mo } from "./bundle.es30.js";
@@ -42,40 +42,40 @@ import { Toast as Go } from "./bundle.es42.js";
42
42
  import { DialogShell as Oo, createDialogsRegistry as Fo } from "./bundle.es43.js";
43
43
  import { createPopoversRegistry as No } from "./bundle.es44.js";
44
44
  export {
45
- K as AlertDialog,
45
+ Q as AlertDialog,
46
46
  e as Avatar,
47
47
  x as Button,
48
48
  a as ButtonGroup,
49
- G as Checkbox,
49
+ O as Checkbox,
50
50
  vo as ColorSchemeScript,
51
- X as Countdown,
51
+ Z as Countdown,
52
52
  to as DateInput,
53
53
  ro as DatePicker,
54
- H as Dialog,
54
+ K as Dialog,
55
55
  Oo as DialogShell,
56
- q as Drawer,
56
+ H as Drawer,
57
57
  mo as FileOverlay,
58
58
  fo as FormGroup,
59
59
  co as Icon,
60
60
  S as ImitateScroll,
61
- A as Input,
62
- Q as LoadingButton,
63
- R as NumberInput,
64
- b as OptionItem,
65
- y as OptionsList,
61
+ b as Input,
62
+ V as LoadingButton,
63
+ y as NumberInput,
64
+ R as OptionItem,
65
+ G as OptionsList,
66
66
  h as Popover,
67
67
  so as ProgressBar,
68
- z as Radio,
69
- N as RadioGroup,
68
+ j as Radio,
69
+ q as RadioGroup,
70
70
  n as Scrollable,
71
71
  g as Segments,
72
72
  P as Select,
73
- $ as SelectTags,
73
+ A as SelectTags,
74
74
  uo as Skeleton,
75
75
  l as Spinner,
76
- O as Switch,
77
- V as Tabs,
78
- Z as TextArea,
76
+ z as Switch,
77
+ X as Tabs,
78
+ $ as TextArea,
79
79
  To as ThemeProvider,
80
80
  io as TimePicker,
81
81
  Go as Toast,
@@ -1,15 +1,15 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
- import { useMemo as L, useImperativeHandle as j } from "react";
3
- import { Popover as k } from "./bundle.es10.js";
4
- import { useFroozeClosing as q } from "./bundle.es47.js";
5
- import { SelectInput as w } from "./bundle.es48.js";
6
- import { useScrollListController as H } from "./bundle.es49.js";
7
- import { OptionsPopover as M } from "./bundle.es50.js";
8
- import { mergeRefs as N } from "react-merge-refs";
9
- const Y = (t) => {
2
+ import { useRef as L, useMemo as j, useImperativeHandle as k } from "react";
3
+ import { Popover as q } from "./bundle.es10.js";
4
+ import { useFroozeClosing as w } from "./bundle.es47.js";
5
+ import { SelectInput as H } from "./bundle.es48.js";
6
+ import { useScrollListController as M } from "./bundle.es49.js";
7
+ import { OptionsPopover as N } from "./bundle.es50.js";
8
+ import { mergeRefs as W } from "react-merge-refs";
9
+ const Z = (t) => {
10
10
  const {
11
11
  onChange: i,
12
- value: r,
12
+ value: n,
13
13
  matchTarget: u = "width",
14
14
  children: f,
15
15
  scrollRef: m,
@@ -20,22 +20,23 @@ const Y = (t) => {
20
20
  required: v,
21
21
  className: h,
22
22
  clearButtonIcon: O,
23
- leftElement: C,
24
- inputRef: R,
25
- onClear: W,
23
+ leftElement: R,
24
+ inputRef: C,
25
+ onClear: y,
26
26
  fill: P,
27
27
  size: g,
28
28
  placeholder: E,
29
29
  onClick: A,
30
30
  // options popover
31
31
  ...S
32
- } = t, p = L(() => {
33
- const o = {};
34
- return (t.options ?? t.defaultOptions ?? []).forEach((n) => {
35
- o[n.value] = n;
36
- }), o;
37
- }, [t.options, t.defaultOptions]), x = r === null ? null : p[r] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = q(), { scrollToElement: c, optionsWrapperRef: I, scrollBoxRef: T } = H();
38
- j(m, () => ({
32
+ } = t, r = L({});
33
+ j(() => {
34
+ (t.options ?? t.defaultOptions ?? []).forEach((e) => {
35
+ r.current[e.value] = e;
36
+ });
37
+ }, [t.options, t.defaultOptions]);
38
+ const x = n === null ? null : r.current[n] ?? null, { popoverRef: z, froozePopoverPosition: B, handleAnimationEnd: F } = w(), { scrollToElement: c, optionsWrapperRef: I, scrollBoxRef: T } = M();
39
+ k(m, () => ({
39
40
  scrollTo: (o) => c(o, "top")
40
41
  }));
41
42
  const b = (o, e) => {
@@ -44,10 +45,10 @@ const Y = (t) => {
44
45
  o.stopPropagation(), s && i(null);
45
46
  };
46
47
  return /* @__PURE__ */ l(
47
- k,
48
+ q,
48
49
  {
49
50
  minimal: !0,
50
- ref: N([z, d]),
51
+ ref: W([z, d]),
51
52
  sideOffset: 0,
52
53
  matchTarget: u,
53
54
  onAnimationEnd: F,
@@ -55,28 +56,28 @@ const Y = (t) => {
55
56
  onCloseAutoFocus: (o) => o.preventDefault(),
56
57
  disabled: a,
57
58
  content: ({ close: o }) => /* @__PURE__ */ l(
58
- M,
59
+ N,
59
60
  {
60
61
  ...S,
61
- isActive: (e) => e === r,
62
+ isActive: (e) => e === n,
62
63
  onSelect: (e) => b(e, o),
63
64
  scrollboxRef: T,
64
65
  optionsWrapperRef: I,
65
66
  onOpened: (e) => c(e, "center"),
66
67
  onOptionsLoaded: (e) => {
67
- e.forEach((n) => {
68
- p[n.value] = n;
68
+ e.forEach((p) => {
69
+ r.current[p.value] = p;
69
70
  });
70
71
  }
71
72
  }
72
73
  ),
73
74
  children: f ?? /* @__PURE__ */ l(
74
- w,
75
+ H,
75
76
  {
76
77
  required: v,
77
78
  className: h,
78
- leftElement: C,
79
- inputRef: R,
79
+ leftElement: R,
80
+ inputRef: C,
80
81
  onClear: D,
81
82
  fill: P,
82
83
  size: g,
@@ -92,5 +93,5 @@ const Y = (t) => {
92
93
  );
93
94
  };
94
95
  export {
95
- Y as Select
96
+ Z as Select
96
97
  };
@@ -1,43 +1,124 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as b, useRef as R } from "react";
3
- import { mergeRefs as c } from "react-merge-refs";
4
- import { InputElement as x } from "./bundle.es51.js";
5
- import { InputContainer as I } from "./bundle.es52.js";
6
- import g from "classnames";
7
- const N = b(
8
- ({
9
- onChange: m,
10
- onValueChange: f,
11
- readOnly: i,
12
- inputClassName: o,
13
- value: p,
14
- placeholder: n,
15
- mask: d,
16
- inputType: s = "text",
17
- maskChar: u,
18
- inputRef: a,
19
- ...e
20
- }, l) => {
21
- const r = R(null);
22
- return /* @__PURE__ */ t(I, { ref: l, inputRef: r, ...e, children: /* @__PURE__ */ t(
23
- x,
24
- {
25
- type: s,
26
- ref: c([r, a]),
27
- className: g("form-input form-input-base", o),
28
- "aria-disabled": e.disabled,
29
- onChange: m,
30
- onValueChange: f,
31
- value: p,
32
- placeholder: n,
33
- disabled: e.disabled,
34
- readOnly: i,
35
- maskChar: u,
36
- mask: d
37
- }
38
- ) });
39
- }
40
- );
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
+ import { mergeRefs as T } from "react-merge-refs";
3
+ import { useState as M, useRef as h, useMemo as j } from "react";
4
+ import { matchPattern as q } from "@companix/utils-js";
5
+ import { faXmark as V, faChevronDown as $ } from "@companix/icons-solid";
6
+ import { useFroozeClosing as B } from "./bundle.es47.js";
7
+ import { Popover as L } from "./bundle.es10.js";
8
+ import { Icon as g } from "./bundle.es33.js";
9
+ import { attr as l, getActiveElementByAnotherElement as X, contains as G } from "@companix/utils-browser";
10
+ import { OptionsPopover as H } from "./bundle.es50.js";
11
+ import { arrays as v } from "./bundle.es51.js";
12
+ const ne = (r) => {
13
+ const {
14
+ closeAfterSelect: C,
15
+ placeholder: x,
16
+ onChange: c,
17
+ onInputChange: N,
18
+ readOnly: u,
19
+ size: O = "md",
20
+ fill: R,
21
+ value: n,
22
+ inputRef: A,
23
+ disabled: f,
24
+ required: P,
25
+ // options popover
26
+ ...b
27
+ } = r, [m, z] = M(""), a = h(null), D = h(null), i = h({});
28
+ j(() => {
29
+ (r.options ?? r.defaultOptions ?? []).forEach((t) => {
30
+ i.current[t.value] = t;
31
+ });
32
+ }, [r.options, r.defaultOptions]);
33
+ const { popoverRef: d, froozePopoverPosition: E, handleAnimationEnd: S } = B(), k = (e, t) => {
34
+ C ? (E(), c(e), t()) : c(e);
35
+ }, y = (e) => {
36
+ if (f) return;
37
+ d.current && d.current.getAttribute("data-state") === "open" && e.preventDefault();
38
+ const t = X(e.currentTarget);
39
+ e.defaultPrevented || G(e.currentTarget, t) || a.current && a.current.focus();
40
+ }, I = (e) => {
41
+ e.target !== a.current && e.preventDefault();
42
+ }, w = (e, t) => {
43
+ e.stopPropagation(), c(v.remove(n, t));
44
+ }, F = ({ target: e }) => {
45
+ z(e.value), N?.(e.value);
46
+ };
47
+ return /* @__PURE__ */ o(
48
+ L,
49
+ {
50
+ minimal: !0,
51
+ ref: d,
52
+ sideOffset: 0,
53
+ matchTarget: "width",
54
+ onAnimationEnd: S,
55
+ onOpenAutoFocus: (e) => e.preventDefault(),
56
+ onCloseAutoFocus: (e) => e.preventDefault(),
57
+ content: ({ close: e }) => /* @__PURE__ */ o(
58
+ H,
59
+ {
60
+ ...b,
61
+ isActive: (t) => n.includes(t),
62
+ onSelect: (t) => k(v.add(n, t), e),
63
+ disableFiltering: !m.trim(),
64
+ filterOptions: ({ title: t }) => q(t, m),
65
+ onOptionsLoaded: (t) => {
66
+ t.forEach((s) => {
67
+ i.current[s.value] = s;
68
+ });
69
+ }
70
+ }
71
+ ),
72
+ children: /* @__PURE__ */ o(
73
+ "div",
74
+ {
75
+ className: "form",
76
+ onClick: y,
77
+ onMouseDown: I,
78
+ "data-size": O ?? "md",
79
+ "data-fill": l(R),
80
+ "data-required": l(P),
81
+ "data-disabled": l(f),
82
+ children: /* @__PURE__ */ p("div", { className: "select-tags-container", children: [
83
+ /* @__PURE__ */ p("div", { className: "select-tags", children: [
84
+ n.length > 0 && /* @__PURE__ */ o(
85
+ "div",
86
+ {
87
+ className: "tag-container",
88
+ ref: D,
89
+ role: "listbox",
90
+ "data-readonly": l(u),
91
+ children: n.map((e, t) => i.current[e] ? /* @__PURE__ */ p("div", { className: "tag", children: [
92
+ /* @__PURE__ */ o("span", { className: "tag-name", children: i.current[e].title }),
93
+ /* @__PURE__ */ o("button", { className: "tag-close-button", onClick: (s) => w(s, e), children: /* @__PURE__ */ o(g, { className: "tag-close-icon", icon: V, size: "xxxs" }) })
94
+ ] }, `tag-option-${e}-${t}`) : null)
95
+ }
96
+ ),
97
+ (!u || n.length === 0) && /* @__PURE__ */ o(
98
+ "input",
99
+ {
100
+ ref: T([A, a]),
101
+ type: "text",
102
+ autoCapitalize: "none",
103
+ autoComplete: "off",
104
+ autoCorrect: "off",
105
+ className: "form-input",
106
+ spellCheck: !1,
107
+ value: m,
108
+ disabled: f,
109
+ readOnly: u,
110
+ placeholder: x,
111
+ onChange: F
112
+ }
113
+ )
114
+ ] }),
115
+ /* @__PURE__ */ o(g, { className: "expand-icon", icon: $, size: "xxxs" })
116
+ ] })
117
+ }
118
+ )
119
+ }
120
+ );
121
+ };
41
122
  export {
42
- N as Input
123
+ ne as SelectTags
43
124
  };
@@ -1,38 +1,43 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import N from "classnames";
3
- import { Icon as v } from "./bundle.es33.js";
4
- import { attr as t } from "@companix/utils-browser";
5
- import { forwardRef as k } from "react";
6
- import { faCheck as x } from "@companix/icons-solid";
7
- const O = k(
8
- ({ title: d, icon: n, active: c, label: e, disabled: r, minimal: a, onClick: l, className: m, ...s }, p) => {
9
- const f = (h) => {
10
- r || l?.(h);
11
- };
12
- return /* @__PURE__ */ i(
13
- "div",
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as b, useRef as R } from "react";
3
+ import { mergeRefs as c } from "react-merge-refs";
4
+ import { InputElement as x } from "./bundle.es52.js";
5
+ import { InputContainer as I } from "./bundle.es53.js";
6
+ import g from "classnames";
7
+ const N = b(
8
+ ({
9
+ onChange: m,
10
+ onValueChange: f,
11
+ readOnly: i,
12
+ inputClassName: o,
13
+ value: p,
14
+ placeholder: n,
15
+ mask: d,
16
+ inputType: s = "text",
17
+ maskChar: u,
18
+ inputRef: a,
19
+ ...e
20
+ }, l) => {
21
+ const r = R(null);
22
+ return /* @__PURE__ */ t(I, { ref: l, inputRef: r, ...e, children: /* @__PURE__ */ t(
23
+ x,
14
24
  {
15
- ref: p,
16
- ...s,
17
- className: N("option", m),
18
- "data-selected": t(c),
19
- "data-disabled": t(r),
20
- "data-minimal": t(a),
21
- onClick: f,
22
- children: [
23
- /* @__PURE__ */ i("div", { className: "option-content", children: [
24
- n && /* @__PURE__ */ o("div", { className: "option-icon", children: n }),
25
- /* @__PURE__ */ i("div", { className: "option-content-layout", children: [
26
- /* @__PURE__ */ o("div", { className: "option-title", children: d }),
27
- e && /* @__PURE__ */ o("div", { className: "option-label", children: e })
28
- ] })
29
- ] }),
30
- c && !a && /* @__PURE__ */ o("div", { className: "option-check", children: /* @__PURE__ */ o(v, { icon: x }) })
31
- ]
25
+ type: s,
26
+ ref: c([r, a]),
27
+ className: g("form-input form-input-base", o),
28
+ "aria-disabled": e.disabled,
29
+ onChange: m,
30
+ onValueChange: f,
31
+ value: p,
32
+ placeholder: n,
33
+ disabled: e.disabled,
34
+ readOnly: i,
35
+ maskChar: u,
36
+ mask: d
32
37
  }
33
- );
38
+ ) });
34
39
  }
35
40
  );
36
41
  export {
37
- O as OptionItem
42
+ N as Input
38
43
  };
@@ -1,58 +1,38 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import C from "classnames";
3
- import { forwardRef as j, useRef as w } from "react";
4
- import { mergeRefs as y } from "react-merge-refs";
5
- import { InputContainer as F } from "./bundle.es52.js";
6
- import { NumericFormat as V } from "react-number-format";
7
- const D = j(
8
- ({
9
- onChange: m,
10
- onValueChange: o,
11
- readOnly: f,
12
- inputClassName: i,
13
- value: n,
14
- placeholder: u,
15
- thousandSeparator: a,
16
- decimalSeparator: p,
17
- allowedDecimalSeparators: l,
18
- thousandsGroupStyle: s,
19
- decimalScale: d,
20
- fixedDecimalScale: b,
21
- allowNegative: R = !1,
22
- allowLeadingZeros: c,
23
- suffix: g,
24
- prefix: x,
25
- inputRef: I,
26
- ...e
27
- }, N) => {
28
- const r = w(null);
29
- return /* @__PURE__ */ t(F, { ref: N, inputRef: r, ...e, children: /* @__PURE__ */ t(
30
- V,
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import N from "classnames";
3
+ import { Icon as v } from "./bundle.es33.js";
4
+ import { attr as t } from "@companix/utils-browser";
5
+ import { forwardRef as k } from "react";
6
+ import { faCheck as x } from "@companix/icons-solid";
7
+ const O = k(
8
+ ({ title: d, icon: n, active: c, label: e, disabled: r, minimal: a, onClick: l, className: m, ...s }, p) => {
9
+ const f = (h) => {
10
+ r || l?.(h);
11
+ };
12
+ return /* @__PURE__ */ i(
13
+ "div",
31
14
  {
32
- type: "text",
33
- getInputRef: y([r, I]),
34
- className: C("form-input form-input-base", i),
35
- "aria-disabled": e.disabled,
36
- onChange: m,
37
- onValueChange: ({ floatValue: h }) => o?.(h ?? null),
38
- value: n,
39
- placeholder: u,
40
- disabled: e.disabled,
41
- readOnly: f,
42
- thousandSeparator: a,
43
- decimalSeparator: p,
44
- allowedDecimalSeparators: l,
45
- thousandsGroupStyle: s,
46
- decimalScale: d,
47
- fixedDecimalScale: b,
48
- allowNegative: R,
49
- allowLeadingZeros: c,
50
- suffix: g,
51
- prefix: x
15
+ ref: p,
16
+ ...s,
17
+ className: N("option", m),
18
+ "data-selected": t(c),
19
+ "data-disabled": t(r),
20
+ "data-minimal": t(a),
21
+ onClick: f,
22
+ children: [
23
+ /* @__PURE__ */ i("div", { className: "option-content", children: [
24
+ n && /* @__PURE__ */ o("div", { className: "option-icon", children: n }),
25
+ /* @__PURE__ */ i("div", { className: "option-content-layout", children: [
26
+ /* @__PURE__ */ o("div", { className: "option-title", children: d }),
27
+ e && /* @__PURE__ */ o("div", { className: "option-label", children: e })
28
+ ] })
29
+ ] }),
30
+ c && !a && /* @__PURE__ */ o("div", { className: "option-check", children: /* @__PURE__ */ o(v, { icon: x }) })
31
+ ]
52
32
  }
53
- ) });
33
+ );
54
34
  }
55
35
  );
56
36
  export {
57
- D as NumberInput
37
+ O as OptionItem
58
38
  };