@companix/uikit 0.0.16 → 0.0.18

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 (60) hide show
  1. package/dist/DatePicker/index.d.ts +2 -3
  2. package/dist/Input/Form.scss +1 -4
  3. package/dist/Input/InlineInput.d.ts +0 -0
  4. package/dist/Input/{index.d.ts → Input.d.ts} +4 -8
  5. package/dist/Input/Input.scss +23 -0
  6. package/dist/Input/InputContainer.d.ts +11 -0
  7. package/dist/Input/InputElement.d.ts +7 -0
  8. package/dist/NumberInput/index.d.ts +2 -2
  9. package/dist/Select/SelectOptions.d.ts +12 -0
  10. package/dist/Select/SelectRight.d.ts +8 -0
  11. package/dist/Select/index.d.ts +4 -0
  12. package/dist/TimePicker/index.d.ts +10 -0
  13. package/dist/__hooks/use-input-padding.d.ts +5 -0
  14. package/dist/__hooks/use-scrollbox.d.ts +1 -1
  15. package/dist/__hooks/use-update.d.ts +1 -1
  16. package/dist/__utils/utils.d.ts +15 -1
  17. package/dist/bundle.es.js +51 -46
  18. package/dist/bundle.es10.js +1 -1
  19. package/dist/bundle.es14.js +1 -1
  20. package/dist/bundle.es16.js +37 -13
  21. package/dist/bundle.es19.js +1 -1
  22. package/dist/bundle.es20.js +1 -1
  23. package/dist/bundle.es23.js +1 -1
  24. package/dist/bundle.es24.js +2 -2
  25. package/dist/bundle.es25.js +93 -85
  26. package/dist/bundle.es26.js +67 -29
  27. package/dist/bundle.es27.js +34 -10
  28. package/dist/bundle.es28.js +11 -10
  29. package/dist/bundle.es29.js +82 -21
  30. package/dist/bundle.es30.js +10 -35
  31. package/dist/bundle.es31.js +21 -20
  32. package/dist/bundle.es32.js +36 -83
  33. package/dist/bundle.es33.js +23 -17
  34. package/dist/bundle.es34.js +87 -14
  35. package/dist/bundle.es35.js +18 -22
  36. package/dist/bundle.es36.js +20 -5
  37. package/dist/bundle.es37.js +24 -14
  38. package/dist/bundle.es38.js +39 -14
  39. package/dist/bundle.es39.js +20 -68
  40. package/dist/bundle.es40.js +5 -68
  41. package/dist/bundle.es41.js +13 -31
  42. package/dist/bundle.es42.js +14 -68
  43. package/dist/bundle.es43.js +66 -39
  44. package/dist/bundle.es44.js +67 -30
  45. package/dist/bundle.es45.js +69 -74
  46. package/dist/bundle.es46.js +10 -48
  47. package/dist/bundle.es47.js +45 -0
  48. package/dist/bundle.es48.js +34 -0
  49. package/dist/bundle.es49.js +70 -0
  50. package/dist/bundle.es50.js +77 -0
  51. package/dist/bundle.es51.js +51 -0
  52. package/dist/bundle.es52.js +16 -0
  53. package/dist/bundle.es53.js +45 -0
  54. package/dist/bundle.es54.js +16 -0
  55. package/dist/bundle.es8.js +54 -62
  56. package/dist/bundle.es9.js +35 -70
  57. package/dist/index.d.ts +4 -2
  58. package/dist/index.scss +2 -2
  59. package/dist/types.d.ts +4 -0
  60. package/package.json +2 -3
@@ -1,11 +1,10 @@
1
- import { FormProps } from '../Input';
1
+ import { InputProps } from '../Input/Input';
2
2
  import { CalendarProps } from './Calendar';
3
- interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<FormProps, 'value' | 'onChange' | 'rightElement'> {
3
+ interface DatePickerProps extends Omit<CalendarProps, 'onChange'>, Omit<InputProps, 'value' | 'onChange' | 'rightElement'> {
4
4
  onChange?: (value: Date | null) => void;
5
5
  clearButton?: boolean;
6
6
  clearButtonIcon?: boolean;
7
7
  children?: React.ReactNode;
8
- minimalOptions?: boolean;
9
8
  }
10
9
  export declare const DatePicker: (props: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
11
10
  export {};
@@ -31,10 +31,6 @@
31
31
 
32
32
  &[data-fill] {
33
33
  width: 100%;
34
-
35
- .form-input {
36
- width: 100%;
37
- }
38
34
  }
39
35
 
40
36
  &[data-required] {
@@ -56,6 +52,7 @@
56
52
 
57
53
  .form-input {
58
54
  outline: none;
55
+ width: 100%;
59
56
 
60
57
  &::-webkit-outer-spin-button,
61
58
  &::-webkit-inner-spin-button {
File without changes
@@ -1,17 +1,13 @@
1
- export interface FormProps extends React.HTMLAttributes<HTMLDivElement> {
2
- required?: boolean;
3
- disabled?: boolean;
4
- leftElement?: React.ReactNode;
5
- rightElement?: React.ReactNode;
1
+ import { InputContainerProps } from './InputContainer';
2
+ export interface InputProps extends Omit<InputContainerProps, 'inputRef' | 'children'> {
6
3
  placeholder?: string;
7
4
  value?: string | number;
8
5
  readOnly?: boolean;
9
6
  onValueChange?: (value: string, targetElement: HTMLInputElement) => void;
10
7
  onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
8
  inputRef?: React.Ref<HTMLInputElement>;
12
- size?: 'sm' | 'md' | 'lg';
13
- fill?: boolean;
9
+ inputClassName?: string;
14
10
  mask?: string;
15
11
  maskChar?: string;
16
12
  }
17
- export declare const Input: import('react').ForwardRefExoticComponent<FormProps & import('react').RefAttributes<HTMLDivElement>>;
13
+ export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -22,3 +22,26 @@
22
22
  align-items: center;
23
23
  }
24
24
  }
25
+
26
+ .inline-input {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+
33
+ &-container {
34
+ position: relative;
35
+ display: flex;
36
+ flex: 1;
37
+ align-items: center;
38
+ align-self: stretch;
39
+ overflow: hidden;
40
+ height: var(--form_size_md_height);
41
+ }
42
+
43
+ &-title {
44
+ padding: 0px var(--form_space, 0);
45
+ opacity: 0;
46
+ }
47
+ }
@@ -0,0 +1,11 @@
1
+ export interface InputContainerProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ leftElement?: React.ReactNode;
3
+ rightElement?: React.ReactNode;
4
+ size?: 'sm' | 'md' | 'lg';
5
+ fill?: boolean;
6
+ disabled?: boolean;
7
+ required?: boolean;
8
+ inputRef: React.RefObject<HTMLInputElement>;
9
+ children: React.ReactNode;
10
+ }
11
+ export declare const InputContainer: import('react').ForwardRefExoticComponent<InputContainerProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,7 @@
1
+ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'children'> {
2
+ mask?: string;
3
+ maskChar?: string;
4
+ onValueChange?: (value: string, targetElement: HTMLInputElement) => void;
5
+ }
6
+ export declare const InputElement: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
7
+ export {};
@@ -1,5 +1,5 @@
1
- import { FormProps } from '../Input';
2
- export interface NumberInputProps extends Omit<FormProps, 'value' | 'onChange'> {
1
+ import { InputProps } from '../Input/Input';
2
+ export interface NumberInputProps extends Omit<InputProps, 'value' | 'onChange'> {
3
3
  value: number | null;
4
4
  onChange: (value: number | null) => void;
5
5
  }
@@ -0,0 +1,12 @@
1
+ import { Option } from '..';
2
+ interface SelectPopoverProps<T> {
3
+ scrollboxRef?: React.RefObject<HTMLDivElement>;
4
+ optionsWrapperRef?: React.RefObject<HTMLDivElement>;
5
+ options: Option<T>[];
6
+ minimalOptions?: boolean;
7
+ active?: T | null;
8
+ onSelect?: (value: T) => void;
9
+ onOpened?: () => void;
10
+ }
11
+ export declare const SelectOptions: <T>(props: SelectPopoverProps<T>) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ interface SelectRightElementsProps {
2
+ onClear?: (event: React.MouseEvent<HTMLButtonElement>) => void;
3
+ clearButton?: boolean;
4
+ clearButtonIcon?: React.ReactNode;
5
+ value: boolean;
6
+ }
7
+ export declare const SelectRightElements: (props: SelectRightElementsProps) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -15,6 +15,10 @@ type SelectProps<T> = Omit<SelectFormProps, 'value' | 'onChange' | 'closeButton'
15
15
  children?: React.ReactNode;
16
16
  minimalOptions?: boolean;
17
17
  matchTarget?: 'width' | 'min-width';
18
+ popoverRef?: React.Ref<HTMLDivElement>;
19
+ scrollRef?: React.Ref<{
20
+ scrollTo: (index: number) => void;
21
+ }>;
18
22
  };
19
23
  export declare const Select: <T>(props: SelectProps<T>) => import("react/jsx-runtime").JSX.Element;
20
24
  export {};
@@ -0,0 +1,10 @@
1
+ import { InputProps } from '../Input/Input';
2
+ import { TimeFormat } from '..';
3
+ export interface TimePickerProps extends Omit<InputProps, 'value' | 'onChange' | 'rightElement'> {
4
+ required?: boolean;
5
+ value: TimeFormat | null;
6
+ onChange: (value: TimeFormat | null) => void;
7
+ clearButton?: boolean;
8
+ clearButtonIcon?: boolean;
9
+ }
10
+ export declare const TimePicker: (props: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ declare const useInputPadding: (inputRef: React.RefObject<HTMLInputElement>, deps?: React.DependencyList) => {
2
+ rightRef: import('react').RefObject<HTMLSpanElement>;
3
+ leftRef: import('react').RefObject<HTMLSpanElement>;
4
+ };
5
+ export { useInputPadding };
@@ -1,7 +1,7 @@
1
1
  interface UseScrollListControllerReturn {
2
2
  scrollBoxRef: React.RefObject<HTMLDivElement>;
3
3
  optionsWrapperRef: React.RefObject<HTMLDivElement>;
4
- scrollToElement: (index: number, center?: boolean) => void;
4
+ scrollToElement: (index: number, position?: 'center' | 'top') => void;
5
5
  }
6
6
  export declare const useScrollListController: () => UseScrollListControllerReturn;
7
7
  export {};
@@ -1 +1 @@
1
- export declare const useLayoutAndUpdate: (callback: () => void, deps?: React.DependencyList | undefined) => void;
1
+ export declare const useEffectWithLayout: (callback: () => void, deps?: React.DependencyList | undefined) => void;
@@ -1,4 +1,4 @@
1
- import { DateFormat, Option } from '..';
1
+ import { DateFormat, Option, TimeFormat } from '..';
2
2
  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;
@@ -23,3 +23,17 @@ export declare const DEFAULT_MAX_YEAR = 9999;
23
23
  export declare const DEFAULT_MIN_YEAR = 100;
24
24
  export declare const getYears: (currentYear: number, range: number) => Option<number>[];
25
25
  export declare const getMonths: (locale?: string) => Option<number>[];
26
+ export declare const removeDigits: (value: string, signs: string[]) => string;
27
+ export declare const convertTimeToOption: ({ hours, minutes }: TimeFormat, char?: string) => string;
28
+ interface TimeOption extends Option<string> {
29
+ hours: string;
30
+ minutes: string;
31
+ }
32
+ export declare const getTimeValue: (time: TimeFormat, char?: string) => {
33
+ title: string;
34
+ value: string;
35
+ hours: string;
36
+ minutes: string;
37
+ };
38
+ export declare const getTimesOptions: (step: number, char?: string) => TimeOption[];
39
+ export {};
package/dist/bundle.es.js CHANGED
@@ -2,59 +2,64 @@ import { Button as e } from "./bundle.es2.js";
2
2
  import { Spinner as p } from "./bundle.es3.js";
3
3
  import { Scrollable as x } from "./bundle.es4.js";
4
4
  import { ImitateScroll as a } from "./bundle.es5.js";
5
- import { Popover as i } from "./bundle.es6.js";
6
- import { Tooltip as c } from "./bundle.es7.js";
5
+ import { Popover as l } from "./bundle.es6.js";
6
+ import { Tooltip as u } from "./bundle.es7.js";
7
7
  import { Select as S } from "./bundle.es8.js";
8
- import { Input as g } from "./bundle.es9.js";
9
- import { OptionItem as b } from "./bundle.es10.js";
10
- import { NumberInput as D } from "./bundle.es11.js";
11
- import { OptionsList as d } from "./bundle.es12.js";
12
- import { ButtonGroup as B } from "./bundle.es13.js";
13
- import { Checkbox as O } from "./bundle.es14.js";
14
- import { Switch as k } from "./bundle.es15.js";
15
- import { Radio as C } from "./bundle.es16.js";
16
- import { Drawer as G } from "./bundle.es17.js";
8
+ import { Input as T } from "./bundle.es9.js";
9
+ import { OptionItem as D } from "./bundle.es10.js";
10
+ import { NumberInput as b } from "./bundle.es11.js";
11
+ import { OptionsList as A } from "./bundle.es12.js";
12
+ import { ButtonGroup as w } from "./bundle.es13.js";
13
+ import { Checkbox as G } from "./bundle.es14.js";
14
+ import { Switch as O } from "./bundle.es15.js";
15
+ import { Radio as h, RadioGroup as v } from "./bundle.es16.js";
16
+ import { Drawer as F } from "./bundle.es17.js";
17
17
  import { Dialog as y } from "./bundle.es18.js";
18
- import { AlertDialog as R } from "./bundle.es19.js";
19
- import { LoadButton as q } from "./bundle.es20.js";
20
- import { Tabs as E } from "./bundle.es21.js";
21
- import { Countdown as J } from "./bundle.es22.js";
22
- import { TextArea as M } from "./bundle.es23.js";
23
- import { SelectTags as U } from "./bundle.es24.js";
24
- import { DatePicker as W } from "./bundle.es25.js";
25
- import { FileOverlay as Y } from "./bundle.es26.js";
26
- import { FormGroup as _ } from "./bundle.es27.js";
27
- import { useLocalStorage as oo } from "./bundle.es28.js";
28
- import { createAlertAgent as eo } from "./bundle.es29.js";
29
- import { createToaster as po } from "./bundle.es30.js";
18
+ import { AlertDialog as j } from "./bundle.es19.js";
19
+ import { LoadButton as z } from "./bundle.es20.js";
20
+ import { Tabs as H } from "./bundle.es21.js";
21
+ import { Countdown as K } from "./bundle.es22.js";
22
+ import { TextArea as Q } from "./bundle.es23.js";
23
+ import { SelectTags as V } from "./bundle.es24.js";
24
+ import { DatePicker as X } from "./bundle.es25.js";
25
+ import { DateInput as Z } from "./bundle.es26.js";
26
+ import { FileOverlay as $ } from "./bundle.es27.js";
27
+ import { FormGroup as ro } from "./bundle.es28.js";
28
+ import { TimePicker as to } from "./bundle.es29.js";
29
+ import { useLocalStorage as mo } from "./bundle.es30.js";
30
+ import { createAlertAgent as fo } from "./bundle.es31.js";
31
+ import { createToaster as io } from "./bundle.es32.js";
30
32
  export {
31
- R as AlertDialog,
33
+ j as AlertDialog,
32
34
  e as Button,
33
- B as ButtonGroup,
34
- O as Checkbox,
35
- J as Countdown,
36
- W as DatePicker,
35
+ w as ButtonGroup,
36
+ G as Checkbox,
37
+ K as Countdown,
38
+ Z as DateInput,
39
+ X as DatePicker,
37
40
  y as Dialog,
38
- G as Drawer,
39
- Y as FileOverlay,
40
- _ as FormGroup,
41
+ F as Drawer,
42
+ $ as FileOverlay,
43
+ ro as FormGroup,
41
44
  a as ImitateScroll,
42
- g as Input,
43
- q as LoadButton,
44
- D as NumberInput,
45
- b as OptionItem,
46
- d as OptionsList,
47
- i as Popover,
48
- C as Radio,
45
+ T as Input,
46
+ z as LoadButton,
47
+ b as NumberInput,
48
+ D as OptionItem,
49
+ A as OptionsList,
50
+ l as Popover,
51
+ h as Radio,
52
+ v as RadioGroup,
49
53
  x as Scrollable,
50
54
  S as Select,
51
- U as SelectTags,
55
+ V as SelectTags,
52
56
  p as Spinner,
53
- k as Switch,
54
- E as Tabs,
55
- M as TextArea,
56
- c as Tooltip,
57
- eo as createAlertAgent,
58
- po as createToaster,
59
- oo as useLocalStorage
57
+ O as Switch,
58
+ H as Tabs,
59
+ Q as TextArea,
60
+ to as TimePicker,
61
+ u as Tooltip,
62
+ fo as createAlertAgent,
63
+ io as createToaster,
64
+ mo as useLocalStorage
60
65
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
2
  import N from "classnames";
3
- import { Icon as v } from "./bundle.es35.js";
3
+ import { Icon as v } from "./bundle.es39.js";
4
4
  import { attr as t } from "@companix/utils-browser";
5
5
  import { forwardRef as k } from "react";
6
6
  import { faCheck as x } from "@fortawesome/free-solid-svg-icons";
@@ -1,6 +1,6 @@
1
1
  import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
2
  import * as t from "@radix-ui/react-checkbox";
3
- import { Icon as h } from "./bundle.es35.js";
3
+ import { Icon as h } from "./bundle.es39.js";
4
4
  import { faCheck as l } from "@fortawesome/free-solid-svg-icons";
5
5
  import { useId as n } from "react";
6
6
  import { attr as c } from "@companix/utils-browser";
@@ -1,23 +1,47 @@
1
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
- import { useId as c } from "react";
3
- import * as d from "@radix-ui/react-radio-group";
4
- import { attr as i } from "@companix/utils-browser";
5
- const h = ({ value: t, label: e, size: m = "md", disabled: a, required: s }) => {
6
- const o = c();
7
- return /* @__PURE__ */ l(
1
+ import { jsxs as u, jsx as o } from "react/jsx-runtime";
2
+ import { useId as p } from "react";
3
+ import * as l from "@radix-ui/react-radio-group";
4
+ import { attr as s } from "@companix/utils-browser";
5
+ const q = (t) => {
6
+ const { options: m, value: a, onChange: r, disabled: d, required: e, size: n } = t;
7
+ return /* @__PURE__ */ o(
8
+ l.Root,
9
+ {
10
+ className: "radio-group",
11
+ disabled: d,
12
+ "data-required": s(e && !a),
13
+ "data-v": a,
14
+ value: a,
15
+ onValueChange: (i) => r(i),
16
+ children: m.map((i, c) => /* @__PURE__ */ o(
17
+ h,
18
+ {
19
+ ...i,
20
+ size: n,
21
+ disabled: d,
22
+ required: e && !a
23
+ },
24
+ `radio-${i.value}-${c}`
25
+ ))
26
+ }
27
+ );
28
+ }, h = ({ value: t, label: m, size: a = "md", disabled: r, required: d }) => {
29
+ const e = p();
30
+ return /* @__PURE__ */ u(
8
31
  "span",
9
32
  {
10
33
  className: "radio",
11
- "data-disabled": i(a),
12
- "data-size": m,
13
- "data-required": i(s),
34
+ "data-disabled": s(r),
35
+ "data-size": a,
36
+ "data-required": s(d),
14
37
  children: [
15
- /* @__PURE__ */ r(d.Item, { className: "radio-box", value: t, disabled: a, id: o, children: /* @__PURE__ */ r(d.Indicator, { className: "radio-mark" }) }),
16
- /* @__PURE__ */ r("label", { className: "radio-label", htmlFor: o, "data-disabled": i(a), children: e })
38
+ /* @__PURE__ */ o(l.Item, { className: "radio-box", value: t, disabled: r, id: e, children: /* @__PURE__ */ o(l.Indicator, { className: "radio-mark" }) }),
39
+ /* @__PURE__ */ o("label", { className: "radio-label", htmlFor: e, "data-disabled": s(r), children: m })
17
40
  ]
18
41
  }
19
42
  );
20
43
  };
21
44
  export {
22
- h as Radio
45
+ h as Radio,
46
+ q as RadioGroup
23
47
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import * as r from "@radix-ui/react-alert-dialog";
3
3
  import { Button as c } from "./bundle.es2.js";
4
- import { RemoveListener as N } from "./bundle.es36.js";
4
+ import { RemoveListener as N } from "./bundle.es40.js";
5
5
  import { VisuallyHidden as u } from "@radix-ui/react-visually-hidden";
6
6
  const C = ({
7
7
  open: d,
@@ -1,6 +1,6 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { Button as m } from "./bundle.es2.js";
3
- import { useLoading as p } from "./bundle.es37.js";
3
+ import { useLoading as p } from "./bundle.es41.js";
4
4
  const g = ({ onClick: o, appearance: r = "primary", ...i }) => {
5
5
  const { isLoading: n, isError: t, handleClick: a } = p({ onClick: o });
6
6
  return /* @__PURE__ */ e(
@@ -1,5 +1,5 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { useResizeTextarea as x } from "./bundle.es38.js";
2
+ import { useResizeTextarea as x } from "./bundle.es42.js";
3
3
  import { attr as e, callMultiple as u } from "@companix/utils-browser";
4
4
  import { useEffect as z } from "react";
5
5
  import { mergeRefs as R } from "react-merge-refs";
@@ -1,10 +1,10 @@
1
1
  import { jsx as o, jsxs as c } from "react/jsx-runtime";
2
- import { useFroozeClosing as M } from "./bundle.es31.js";
2
+ import { useFroozeClosing as M } from "./bundle.es33.js";
3
3
  import { Popover as j } from "./bundle.es6.js";
4
4
  import { OptionItem as q } from "./bundle.es10.js";
5
5
  import { OptionsList as V } from "./bundle.es12.js";
6
6
  import { useState as B, useRef as d, useMemo as h } from "react";
7
- import { Icon as g } from "./bundle.es35.js";
7
+ import { Icon as g } from "./bundle.es39.js";
8
8
  import { faClose as H, faChevronDown as Q } from "@fortawesome/free-solid-svg-icons";
9
9
  import { attr as v, getActiveElementByAnotherElement as G, contains as J } from "@companix/utils-browser";
10
10
  import { mergeRefs as K } from "react-merge-refs";