mimir-ui-kit 1.7.1 → 1.8.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.
Files changed (45) hide show
  1. package/dist/DatePickerModal-DUUCHAWF.js +204 -0
  2. package/dist/assets/DatePickerModal.css +1 -0
  3. package/dist/assets/Input.css +1 -1
  4. package/dist/assets/SelectSearch.css +1 -1
  5. package/dist/assets/index.css +1 -1
  6. package/dist/components/DatePicker/DatePicker.d.ts +44 -0
  7. package/dist/components/DatePicker/DatePicker.js +69 -0
  8. package/dist/components/DatePicker/DatePickerModal.d.ts +8 -0
  9. package/dist/components/DatePicker/DatePickerModal.js +9 -0
  10. package/dist/components/DatePicker/constants.d.ts +6 -0
  11. package/dist/components/DatePicker/constants.js +11 -0
  12. package/dist/components/DatePicker/index.d.ts +2 -0
  13. package/dist/components/DatePicker/index.js +4 -0
  14. package/dist/components/Input/Input.d.ts +2 -2
  15. package/dist/components/Input/Input.js +14 -14
  16. package/dist/components/RadioGroup/RadioGroup.d.ts +18 -2
  17. package/dist/components/RadioGroup/RadioGroup.js +50 -44
  18. package/dist/components/RadioGroup/index.d.ts +1 -1
  19. package/dist/components/SelectSearch/SelectSearch.d.ts +10 -16
  20. package/dist/components/SelectSearch/SelectSearch.js +100 -104
  21. package/dist/components/SelectSearch/index.d.ts +1 -2
  22. package/dist/components/Switch/Switch.d.ts +293 -3
  23. package/dist/components/Switch/Switch.js +27 -22
  24. package/dist/components/Switch/index.d.ts +1 -1
  25. package/dist/components/index.d.ts +4 -2
  26. package/dist/components/index.js +2 -0
  27. package/dist/hooks/useClickOutside/index.d.ts +1 -0
  28. package/dist/hooks/useClickOutside/index.js +4 -0
  29. package/dist/hooks/useClickOutside/useClickOutside.d.ts +7 -0
  30. package/dist/hooks/useClickOutside/useClickOutside.js +25 -0
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +4 -0
  33. package/dist/utils/formating/Date.d.ts +1 -0
  34. package/dist/utils/formating/Date.js +26 -0
  35. package/dist/utils/formating/Month.d.ts +8 -0
  36. package/dist/utils/formating/Month.js +80 -0
  37. package/dist/utils/formating/Numbers.d.ts +6 -0
  38. package/dist/utils/formating/Numbers.js +8 -0
  39. package/dist/utils/index.d.ts +9 -0
  40. package/dist/utils/index.js +11 -0
  41. package/package.json +1 -1
  42. package/dist/components/SelectSearch/types.d.ts +0 -17
  43. package/dist/components/SelectSearch/types.js +0 -1
  44. package/dist/components/Switch/types.d.ts +0 -4
  45. package/dist/components/Switch/types.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { W, K, w, b as a, z as z$1, U, y, l, T, o, j as j$1, H, s, n, $ as $f7dceffc5ad7768b$export$4e328f61c538687f, c as $6179b936705e76d3$export$ae780daf29e6d456, D, d as u$1, I, G, a as u$2, u as u$3, e as o$1, f as p, r } from "../../label-BXAcSLy0.js";
3
- import React__default, { createContext, useId, useReducer, useRef, useMemo, useCallback, useContext } from "react";
3
+ import React__default, { createContext, useId, useReducer, useRef, useMemo, useCallback, useContext, forwardRef } from "react";
4
4
  import { u, P, F, T as T$1, _ } from "../../focus-management-CFDo6ZSc.js";
5
5
  import { c as classNames } from "../../index-CweZ_OcN.js";
6
6
  import '../../assets/RadioGroup.css';var Le = ((e) => (e[e.RegisterOption = 0] = "RegisterOption", e[e.UnregisterOption = 1] = "UnregisterOption", e))(Le || {});
@@ -116,51 +116,57 @@ const cls = {
116
116
  frame,
117
117
  checked
118
118
  };
119
- function RadioGroup({
120
- options,
121
- value,
122
- onChange,
123
- label: label2,
124
- ...props
125
- }) {
126
- const radioClasses = classNames(cls["radio-wrapper"], {
127
- [cls.disabled]: props.disabled
128
- });
129
- return /* @__PURE__ */ jsxs(Tt, { value, className: cls.group, onChange, ...props, children: [
130
- label2 && /* @__PURE__ */ jsx(K, { as: "p", className: cls.label, children: label2 }),
131
- /* @__PURE__ */ jsx("div", { className: cls["content-wrapper"], children: options.map(({ label: label22, value: value2 }) => /* @__PURE__ */ jsx(
132
- Be,
119
+ const RadioGroup = forwardRef(
120
+ ({ options, value, onChange, label: label2, ...props }, ref) => {
121
+ const radioClasses = classNames(cls["radio-wrapper"], {
122
+ [cls.disabled]: props.disabled
123
+ });
124
+ return /* @__PURE__ */ jsxs(
125
+ Tt,
133
126
  {
134
- as: "span",
135
- value: value2,
136
- disabled: props.disabled,
137
- className: radioClasses,
138
- children: ({ checked: checked2, disabled: disabled2 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
139
- /* @__PURE__ */ jsx(
140
- K,
127
+ ref,
128
+ value,
129
+ className: cls.group,
130
+ onChange,
131
+ ...props,
132
+ children: [
133
+ label2 && /* @__PURE__ */ jsx(K, { as: "p", className: cls.label, children: label2 }),
134
+ /* @__PURE__ */ jsx("div", { className: cls["content-wrapper"], children: options.map(({ label: label22, value: value2 }) => /* @__PURE__ */ jsx(
135
+ Be,
141
136
  {
142
- as: "button",
143
- className: classNames(cls.radio, {
144
- [cls.disabled]: props.disabled
145
- }),
146
- children: /* @__PURE__ */ jsx(
147
- "span",
148
- {
149
- className: classNames(cls.frame, {
150
- [cls.checked]: checked2,
151
- [cls.disabled]: disabled2
152
- })
153
- }
154
- )
155
- }
156
- ),
157
- label22
158
- ] })
159
- },
160
- label22
161
- )) })
162
- ] });
163
- }
137
+ as: "span",
138
+ value: value2,
139
+ disabled: props.disabled,
140
+ className: radioClasses,
141
+ children: ({ checked: checked2, disabled: disabled2 }) => /* @__PURE__ */ jsxs(Fragment, { children: [
142
+ /* @__PURE__ */ jsx(
143
+ K,
144
+ {
145
+ as: "button",
146
+ className: classNames(cls.radio, {
147
+ [cls.disabled]: props.disabled
148
+ }),
149
+ children: /* @__PURE__ */ jsx(
150
+ "span",
151
+ {
152
+ className: classNames(cls.frame, {
153
+ [cls.checked]: checked2,
154
+ [cls.disabled]: disabled2
155
+ })
156
+ }
157
+ )
158
+ }
159
+ ),
160
+ label22
161
+ ] })
162
+ },
163
+ label22
164
+ )) })
165
+ ]
166
+ }
167
+ );
168
+ }
169
+ );
164
170
  export {
165
171
  RadioGroup
166
172
  };
@@ -1,2 +1,2 @@
1
1
  export { RadioGroup } from './RadioGroup';
2
- export type { TRadioOption } from './RadioGroup';
2
+ export type { TRadioOption, TRadioGroupProps } from './RadioGroup';
@@ -1,21 +1,15 @@
1
- import { TSelectSearchItem, TSelectSearchProps } from './types';
1
+ import { ESelectSearchSize } from './constants';
2
2
 
3
- export type TProps = TSelectSearchProps & {
4
- /**
5
- * Список элементов для выбора в SelectSearch.
6
- */
3
+ export type TSelectSearchItem = {
4
+ id: number;
5
+ name: string;
6
+ };
7
+ export type TSelectSearchProps = {
7
8
  items: TSelectSearchItem[];
8
- /**
9
- * Текст-заполнитель для поля ввода.
10
- */
9
+ value?: TSelectSearchItem | null;
10
+ onChange?: (value: TSelectSearchItem | null) => void;
11
11
  placeholder?: string;
12
- /**
13
- * Размер SelectSearch. Допустимые значения: `l`, `xxl`.
14
- */
15
- size?: 'l' | 'xxl';
16
- /**
17
- * Флаг, указывающий, что элемент занимает все доступное пространство.
18
- */
12
+ size?: ESelectSearchSize;
19
13
  full?: boolean;
20
14
  };
21
- export declare const SelectSearch: ({ items, placeholder, size, onChange, value, full }: TProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const SelectSearch: import('react').ForwardRefExoticComponent<TSelectSearchProps & import('react').RefAttributes<HTMLElement>>;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import { c as classNames } from "../../index-CweZ_OcN.js";
3
3
  import * as React from "react";
4
- import React__default, { useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useRef, useState, useLayoutEffect, createContext, useContext, Fragment, createRef } from "react";
4
+ import React__default, { useReducer, useMemo, useSyncExternalStore, useId as useId$1, useEffect, useCallback, useRef, useState, useLayoutEffect, createContext, useContext, Fragment, createRef, forwardRef } from "react";
5
5
  import { ESelectSearchSize } from "./constants.js";
6
6
  import { useMediaQuery } from "../../hooks/useMediaQuery/useMediaQuery.js";
7
7
  import { EMediaQuery } from "../../hooks/useMediaQuery/constants.js";
@@ -3841,125 +3841,121 @@ function No(o2, r2) {
3841
3841
  return H({ ourProps: { id: d2, ref: M2, role: "option", tabIndex: s2 === true ? void 0 : -1, "aria-disabled": s2 === true ? true : void 0, "aria-selected": C, disabled: void 0, onMouseDown: y2, onFocus: A2, onPointerEnter: h2, onMouseEnter: h2, onPointerMove: O, onMouseMove: O, onPointerLeave: G2, onMouseLeave: G2 }, theirProps: a3, slot: J2, defaultTag: ko, name: "Combobox.Option" });
3842
3842
  }
3843
3843
  let Uo = W$1(ho), Ho = W$1(Vo), Go = W$1(Mo), jo = K, zo = W$1(Bo), Ko = W$1(No), Nt = Object.assign(Uo, { Input: Go, Button: Ho, Label: jo, Options: zo, Option: Ko });
3844
- const container = "_container_1oxs1_6";
3845
- const full = "_full_1oxs1_20";
3846
- const placeholder = "_placeholder_1oxs1_28";
3847
- const input = "_input_1oxs1_43";
3848
- const button = "_button_1oxs1_61";
3849
- const options = "_options_1oxs1_69";
3850
- const option = "_option_1oxs1_69";
3851
- const l = "_l_1oxs1_118";
3852
- const xxl = "_xxl_1oxs1_128";
3844
+ const container = "_container_xswn2_6";
3845
+ const full = "_full_xswn2_20";
3846
+ const placeholder = "_placeholder_xswn2_28";
3847
+ const input = "_input_xswn2_43";
3848
+ const button = "_button_xswn2_61";
3849
+ const options = "_options_xswn2_69";
3850
+ const option = "_option_xswn2_69";
3851
+ const l = "_l_xswn2_118";
3852
+ const xxl = "_xxl_xswn2_128";
3853
3853
  const cls = {
3854
- "select-search": "_select-search_1oxs1_2",
3854
+ "select-search": "_select-search_xswn2_2",
3855
3855
  container,
3856
- "container-open": "_container-open_1oxs1_16",
3856
+ "container-open": "_container-open_xswn2_16",
3857
3857
  full,
3858
- "selectorIcon-open": "_selectorIcon-open_1oxs1_24",
3858
+ "selectorIcon-open": "_selectorIcon-open_xswn2_24",
3859
3859
  placeholder,
3860
- "placeholder-top": "_placeholder-top_1oxs1_37",
3860
+ "placeholder-top": "_placeholder-top_xswn2_37",
3861
3861
  input,
3862
- "input-container": "_input-container_1oxs1_55",
3862
+ "input-container": "_input-container_xswn2_55",
3863
3863
  button,
3864
3864
  options,
3865
3865
  option,
3866
- "option-active": "_option-active_1oxs1_103",
3867
- "option-inner": "_option-inner_1oxs1_106",
3868
- "no-options": "_no-options_1oxs1_113",
3866
+ "option-active": "_option-active_xswn2_103",
3867
+ "option-inner": "_option-inner_xswn2_106",
3868
+ "no-options": "_no-options_xswn2_113",
3869
3869
  l,
3870
3870
  xxl,
3871
- "selected-icon": "_selected-icon_1oxs1_138"
3871
+ "selected-icon": "_selected-icon_xswn2_138"
3872
3872
  };
3873
- const SelectSearch = ({
3874
- items,
3875
- placeholder: placeholder2,
3876
- size: size2 = ESelectSearchSize.L,
3877
- onChange,
3878
- value,
3879
- full: full2
3880
- }) => {
3881
- const [searchValue, setSearchValue] = useState("");
3882
- const [isItemSelected, setIsItemSelected] = useState(false);
3883
- const isMobile = useMediaQuery(EMediaQuery.XSS);
3884
- const filteredItems = useMemo(() => {
3885
- return searchValue.trim().toLowerCase() ? items.filter(
3886
- (item) => item.name.toLowerCase().includes(searchValue.toLowerCase())
3887
- ) : items;
3888
- }, [searchValue, items]);
3889
- const handleOneChange = (newValue) => {
3890
- onChange == null ? void 0 : onChange(newValue);
3891
- setIsItemSelected(!!newValue);
3892
- };
3893
- return /* @__PURE__ */ jsx(
3894
- Nt,
3895
- {
3896
- as: "div",
3897
- onChange: handleOneChange,
3898
- value,
3899
- className: classNames(cls["select-search"], { [cls.full]: full2 }),
3900
- children: ({ open }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
3901
- /* @__PURE__ */ jsxs(
3902
- "div",
3903
- {
3904
- className: classNames(cls.container, cls[size2], {
3905
- [cls["container-open"]]: open
3906
- }),
3907
- children: [
3908
- /* @__PURE__ */ jsxs("div", { className: cls["input-container"], children: [
3909
- /* @__PURE__ */ jsx(
3910
- Go,
3873
+ const SelectSearch = forwardRef(
3874
+ ({ items, placeholder: placeholder2, size: size2 = ESelectSearchSize.L, onChange, value, full: full2 }, ref) => {
3875
+ const [searchValue, setSearchValue] = useState("");
3876
+ const [isItemSelected, setIsItemSelected] = useState(false);
3877
+ const isMobile = useMediaQuery(EMediaQuery.XSS);
3878
+ const filteredItems = useMemo(() => {
3879
+ return searchValue.trim().toLowerCase() ? items.filter(
3880
+ (item) => item.name.toLowerCase().includes(searchValue.toLowerCase())
3881
+ ) : items;
3882
+ }, [searchValue, items]);
3883
+ const handleOneChange = (newValue) => {
3884
+ onChange == null ? void 0 : onChange(newValue);
3885
+ setIsItemSelected(!!newValue);
3886
+ };
3887
+ return /* @__PURE__ */ jsx(
3888
+ Nt,
3889
+ {
3890
+ as: "div",
3891
+ onChange: handleOneChange,
3892
+ value,
3893
+ className: classNames(cls["select-search"], { [cls.full]: full2 }),
3894
+ ref,
3895
+ children: ({ open }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
3896
+ /* @__PURE__ */ jsxs(
3897
+ "div",
3898
+ {
3899
+ className: classNames(cls.container, cls[size2], {
3900
+ [cls["container-open"]]: open
3901
+ }),
3902
+ children: [
3903
+ /* @__PURE__ */ jsxs("div", { className: cls["input-container"], children: [
3904
+ /* @__PURE__ */ jsx(
3905
+ Go,
3906
+ {
3907
+ className: cls.input,
3908
+ onChange: (event) => setSearchValue(event.target.value),
3909
+ displayValue: (item) => item == null ? void 0 : item.name
3910
+ }
3911
+ ),
3912
+ /* @__PURE__ */ jsx(
3913
+ "span",
3914
+ {
3915
+ className: classNames(cls.placeholder, {
3916
+ [cls["placeholder-top"]]: isItemSelected || open || searchValue
3917
+ }),
3918
+ children: placeholder2
3919
+ }
3920
+ )
3921
+ ] }),
3922
+ /* @__PURE__ */ jsx(Ho, { className: cls.button, children: /* @__PURE__ */ jsx(
3923
+ Icon,
3911
3924
  {
3912
- className: cls.input,
3913
- onChange: (event) => setSearchValue(event.target.value),
3914
- displayValue: (item) => item == null ? void 0 : item.name
3925
+ iconName: isMobile ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
3926
+ className: classNames(cls["selector-icon"], {
3927
+ [cls["selector-icon-open"]]: open
3928
+ })
3915
3929
  }
3916
- ),
3917
- /* @__PURE__ */ jsx(
3918
- "span",
3930
+ ) })
3931
+ ]
3932
+ }
3933
+ ),
3934
+ /* @__PURE__ */ jsx(zo, { className: classNames(cls.options, cls[size2]), children: !items.length ? /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Нет данных" }) : !filteredItems.length && searchValue.trim() ? /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Ничего не найдено" }) : filteredItems.map((item) => /* @__PURE__ */ jsx(
3935
+ Ko,
3936
+ {
3937
+ value: item,
3938
+ className: ({ focus }) => classNames(cls.option, {
3939
+ [cls["option-active"]]: focus
3940
+ }),
3941
+ children: ({ selected }) => /* @__PURE__ */ jsxs("div", { className: cls["option-inner"], children: [
3942
+ /* @__PURE__ */ jsx("span", { className: cls["option-text"], children: item.name }),
3943
+ selected && /* @__PURE__ */ jsx(
3944
+ Icon,
3919
3945
  {
3920
- className: classNames(cls.placeholder, {
3921
- [cls["placeholder-top"]]: isItemSelected || open || searchValue
3922
- }),
3923
- children: placeholder2
3946
+ iconName: "Done16px",
3947
+ className: cls["selected-icon"]
3924
3948
  }
3925
3949
  )
3926
- ] }),
3927
- /* @__PURE__ */ jsx(Ho, { className: cls.button, children: /* @__PURE__ */ jsx(
3928
- Icon,
3929
- {
3930
- iconName: isMobile ? "DropdownArrowBottom16px" : "DropdownArrowDown24px",
3931
- className: classNames(cls["selector-icon"], {
3932
- [cls["selector-icon-open"]]: open
3933
- })
3934
- }
3935
- ) })
3936
- ]
3937
- }
3938
- ),
3939
- /* @__PURE__ */ jsx(zo, { className: classNames(cls.options, cls[size2]), children: !items.length ? /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Нет данных" }) : !filteredItems.length && searchValue.trim() ? /* @__PURE__ */ jsx("div", { className: cls["no-options"], children: "Ничего не найдено" }) : filteredItems.map((item) => /* @__PURE__ */ jsx(
3940
- Ko,
3941
- {
3942
- value: item,
3943
- className: ({ focus }) => classNames(cls.option, {
3944
- [cls["option-active"]]: focus
3945
- }),
3946
- children: ({ selected }) => /* @__PURE__ */ jsxs("div", { className: cls["option-inner"], children: [
3947
- /* @__PURE__ */ jsx("span", { className: cls["option-text"], children: item.name }),
3948
- selected && /* @__PURE__ */ jsx(
3949
- Icon,
3950
- {
3951
- iconName: "Done16px",
3952
- className: cls["selected-icon"]
3953
- }
3954
- )
3955
- ] })
3956
- },
3957
- item.id
3958
- )) })
3959
- ] })
3960
- }
3961
- );
3962
- };
3950
+ ] })
3951
+ },
3952
+ item.id
3953
+ )) })
3954
+ ] })
3955
+ }
3956
+ );
3957
+ }
3958
+ );
3963
3959
  export {
3964
3960
  SelectSearch
3965
3961
  };
@@ -1,3 +1,2 @@
1
- export { SelectSearch, type TProps as TSelectSearchProps } from './SelectSearch';
1
+ export { SelectSearch, type TSelectSearchProps, type TSelectSearchItem } from './SelectSearch';
2
2
  export { ESelectSearchSize } from './constants';
3
- export type { TSelectSearchItem, TSelectSearchSize } from './types';