mimir-ui-kit 1.38.21 → 1.38.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import { ESelectSearchSize as r } from "./constants.js";
2
- import "../../Input-BYrIS5GU.js";
2
+ import "../../Input-CQ7LgZWK.js";
3
3
  import { EInputSize as t } from "../Input/constants.js";
4
4
  const c = (o) => {
5
5
  switch (o) {
@@ -5,7 +5,7 @@ import { useAutoResizeTextArea as Z } from "./hooks.js";
5
5
  import { useMergeRefs as $ } from "../../hooks/useMergeRefs/useMergeRefs.js";
6
6
  import { Icon as ee } from "../../icons/Icon.js";
7
7
  import { Button as te } from "../Button/Button.js";
8
- import { c as e } from "../../Input-BYrIS5GU.js";
8
+ import { c as e } from "../../Input-CQ7LgZWK.js";
9
9
  import { EInputVariant as ae } from "../Input/constants.js";
10
10
  import '../../assets/TextArea.css';const re = "_textarea_rk5xe_2", se = "_clear_rk5xe_11", le = "_label_rk5xe_26", ne = "_s_rk5xe_71", oe = "_m_rk5xe_84", ce = "_l_rk5xe_26", t = {
11
11
  "textarea-wrapper": "_textarea-wrapper_rk5xe_2",
@@ -1,6 +1,6 @@
1
1
  import { Button as e } from "./Button/Button.js";
2
2
  import { EButtonForm as p, EButtonSize as a, EButtonVariantBorderless as i, EButtonVariantDefault as m, EButtonVariantOutline as f, EButtonVariantRound as x } from "./Button/constants.js";
3
- import { I as S } from "../Input-BYrIS5GU.js";
3
+ import { I as S } from "../Input-CQ7LgZWK.js";
4
4
  import { EInputSize as E, EInputStatus as l, EInputVariant as u } from "./Input/constants.js";
5
5
  import { TextArea as c } from "./TextArea/TextArea.js";
6
6
  import { ETextAreaInputSize as g } from "./TextArea/constants.js";
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Button as e } from "./components/Button/Button.js";
2
2
  import { EButtonForm as p, EButtonSize as a, EButtonVariantBorderless as m, EButtonVariantDefault as f, EButtonVariantOutline as i, EButtonVariantRound as x } from "./components/Button/constants.js";
3
- import { I as s } from "./Input-BYrIS5GU.js";
3
+ import { I as s } from "./Input-CQ7LgZWK.js";
4
4
  import { EInputSize as S, EInputStatus as l, EInputVariant as E } from "./components/Input/constants.js";
5
5
  import { TextArea as c } from "./components/TextArea/TextArea.js";
6
6
  import { ETextAreaInputSize as g } from "./components/TextArea/constants.js";
@@ -1 +1 @@
1
- export type { Props, PolymorphicRef, ComponentCustomProps } from './propsWithAs';
1
+ export type { Props, PolymorphicRef } from './propsWithAs';
@@ -1,16 +1,15 @@
1
- import { ElementType, ComponentPropsWithoutRef, ComponentPropsWithRef, JSXElementConstructor, ReactElement, ReactNode } from 'react';
1
+ import { ElementType, ComponentPropsWithoutRef, ComponentPropsWithRef, JSXElementConstructor } from 'react';
2
2
 
3
3
  export type PropsOf<C extends keyof JSX.IntrinsicElements | JSXElementConstructor<unknown>> = JSX.LibraryManagedAttributes<C, ComponentPropsWithoutRef<C>>;
4
4
  type AsProp<C extends ElementType> = {
5
5
  as?: C;
6
6
  };
7
- export type ExtendableProps<ExtendedProps = NonNullable<unknown>, OverrideProps = NonNullable<unknown>> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;
8
- export type InheritableElementProps<C extends ElementType, Props = NonNullable<unknown>> = ExtendableProps<PropsOf<C>, Props>;
9
- export type PolymorphicComponentProps<C extends ElementType, Props = NonNullable<unknown>> = InheritableElementProps<C, Props & AsProp<C>>;
7
+ export type ExtendableProps<ExtendedProps = object, OverrideProps = object> = OverrideProps & Omit<ExtendedProps, keyof OverrideProps>;
8
+ export type InheritableElementProps<C extends ElementType, Props = object> = ExtendableProps<PropsOf<C>, Props>;
9
+ export type PolymorphicComponentProps<C extends ElementType, Props = object> = InheritableElementProps<C, Props & AsProp<C>>;
10
10
  export type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
11
- export type PolymorphicComponentPropsWithRef<C extends ElementType, Props = NonNullable<unknown>> = PolymorphicComponentProps<C, Props> & {
11
+ export type PolymorphicComponentPropsWithRef<C extends ElementType, Props extends object> = PolymorphicComponentProps<C, Props> & {
12
12
  ref?: PolymorphicRef<C>;
13
13
  };
14
- export type Props<C extends ElementType, P> = PolymorphicComponentPropsWithRef<C, P>;
15
- export type ComponentCustomProps = <C extends ElementType = 'span', P = NonNullable<unknown>>(props: Props<C, P>) => ReactElement | ReactNode;
14
+ export type Props<C extends ElementType, P extends object> = PolymorphicComponentPropsWithRef<C, P>;
16
15
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.38.21",
4
+ "version": "1.38.23",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -22,6 +22,9 @@
22
22
  },
23
23
  "./styles": {
24
24
  "default": "./dist/assets/index.css"
25
+ },
26
+ "./types": {
27
+ "types": "./dist/index.d.ts"
25
28
  }
26
29
  },
27
30
  "module": "./dist/index.js",
@@ -1,225 +0,0 @@
1
- import { jsxs as V, jsx as n, Fragment as Z } from "react/jsx-runtime";
2
- import { c as o } from "./index-DIxK0V-G.js";
3
- import { memo as $, forwardRef as ee, useState as B, useRef as se, useEffect as R } from "react";
4
- import { EInputVariant as te } from "./components/Input/constants.js";
5
- import { useMergeRefs as ae } from "./hooks/useMergeRefs/useMergeRefs.js";
6
- import { Icon as le } from "./icons/Icon.js";
7
- import { Button as re } from "./components/Button/Button.js";
8
- import './assets/Input.css';const oe = "_label_zg2ds_27", ne = "_input_zg2ds_3", de = "_focused_zg2ds_82", ce = "_disabled_zg2ds_88", ie = "_clear_zg2ds_130", ue = "_s_zg2ds_181", _e = "_m_zg2ds_196", me = "_l_zg2ds_27", fe = "_success_zg2ds_252", pe = "_alarm_zg2ds_272", ge = "_error_zg2ds_292", e = {
9
- "input-wrapper": "_input-wrapper_zg2ds_3",
10
- "required-mark": "_required-mark_zg2ds_17",
11
- label: oe,
12
- "has-left-slot": "_has-left-slot_zg2ds_42",
13
- "active-label": "_active-label_zg2ds_45",
14
- input: ne,
15
- "has-right-slot": "_has-right-slot_zg2ds_79",
16
- focused: de,
17
- "has-label": "_has-label_zg2ds_85",
18
- disabled: ce,
19
- "addon-icon": "_addon-icon_zg2ds_94",
20
- "left-slot": "_left-slot_zg2ds_98",
21
- "right-slot": "_right-slot_zg2ds_99",
22
- clear: ie,
23
- s: ue,
24
- m: _e,
25
- l: me,
26
- "default-gray": "_default-gray_zg2ds_225",
27
- "default-white": "_default-white_zg2ds_237",
28
- success: fe,
29
- alarm: pe,
30
- error: ge
31
- }, L = (s) => {
32
- var m, a;
33
- if (!s)
34
- return null;
35
- switch (s.addonType) {
36
- case "icon": {
37
- const f = (m = s.addonContent) == null ? void 0 : m.includes("16px"), b = (a = s.addonContent) == null ? void 0 : a.includes("24px");
38
- return /* @__PURE__ */ n(
39
- le,
40
- {
41
- style: {
42
- "--icon-size": o({
43
- "16px": f,
44
- "24px": b
45
- })
46
- },
47
- className: e["addon-icon"],
48
- iconName: s.addonContent
49
- }
50
- );
51
- }
52
- case "text":
53
- return s.addonContent;
54
- case "react-node":
55
- return /* @__PURE__ */ n(Z, { children: s.addonContent });
56
- default:
57
- return null;
58
- }
59
- }, he = $(
60
- ee(
61
- (s, m) => {
62
- const {
63
- value: a,
64
- className: f,
65
- wrapperClassName: b,
66
- rightSlotClassName: j,
67
- requiredMarkClassName: D,
68
- variant: q = te.DefaultGray,
69
- type: E = "text",
70
- autofocus: z,
71
- readonly: d,
72
- id: A,
73
- onFocus: N,
74
- onBlur: x,
75
- label: u,
76
- withClearButton: M,
77
- disabled: t,
78
- onChange: c,
79
- rightAddon: O,
80
- status: F,
81
- leftAddon: S,
82
- size: C = "m",
83
- numbersOnly: T,
84
- required: y,
85
- maxLength: v,
86
- autocomplete: G = "on",
87
- ...P
88
- } = s, [_, w] = B(z), [p, g] = B(!!a), i = se(null), W = ae(i, m);
89
- R(() => {
90
- z && w(!0);
91
- }, [z]), R(() => {
92
- g(!!a);
93
- }, [a]);
94
- const H = (l) => {
95
- const r = l.currentTarget.value;
96
- x == null || x(l), w(!1), g(!!r);
97
- }, J = (l) => {
98
- d || (w(!0), N == null || N(l));
99
- }, K = () => {
100
- i != null && i.current && (i.current.value = "", i.current.focus(), g(!1), c == null || c({
101
- target: { value: "" }
102
- }));
103
- }, Q = (l) => {
104
- let r = l.target.value;
105
- T && (r = r.replace(/\D/g, "")), v !== void 0 && (r = r.slice(0, v)), l.target.value = r, c == null || c(l), g(!!r);
106
- }, h = L(S), I = L(O), U = {
107
- [e.readonly]: t || d,
108
- [e.focused]: _,
109
- [e.disabled]: t || d,
110
- [e["has-label"]]: !!u,
111
- [e["has-left-slot"]]: !!h,
112
- [e["has-right-slot"]]: !!I
113
- }, k = _ || p || !!a, X = o(e.label, f, e[C], {
114
- [e["active-label"]]: k,
115
- [e.disabled]: t || d,
116
- [e["has-left-slot"]]: !!h
117
- }), Y = o(e.input, U, f, [
118
- e[q],
119
- e[F ?? ""],
120
- e[C]
121
- ]);
122
- return /* @__PURE__ */ V(
123
- "div",
124
- {
125
- className: o(
126
- e["input-wrapper"],
127
- e[q],
128
- e[F ?? ""],
129
- e[C],
130
- {
131
- [e.disabled]: t || d,
132
- [e.focused]: _
133
- },
134
- b
135
- ),
136
- children: [
137
- u && /* @__PURE__ */ V("label", { htmlFor: A, className: X, children: [
138
- u,
139
- y && (p || _) && /* @__PURE__ */ n(
140
- "span",
141
- {
142
- className: e["required-mark"],
143
- "data-testid": "required-mark"
144
- }
145
- )
146
- ] }),
147
- h && /* @__PURE__ */ n(
148
- "span",
149
- {
150
- className: o(e["left-slot"], {
151
- [e.focused]: k,
152
- [e["has-label"]]: !!u,
153
- [e.disabled]: t
154
- }),
155
- children: h
156
- }
157
- ),
158
- /* @__PURE__ */ n(
159
- "input",
160
- {
161
- ref: W,
162
- type: E,
163
- id: A,
164
- className: Y,
165
- onFocus: J,
166
- onBlur: H,
167
- readOnly: d,
168
- value: a,
169
- onChange: Q,
170
- maxLength: v,
171
- disabled: t,
172
- required: y,
173
- autoComplete: G,
174
- ...P
175
- }
176
- ),
177
- I && /* @__PURE__ */ n(
178
- "span",
179
- {
180
- className: o(e["right-slot"], j, {
181
- [e.focused]: k,
182
- [e["has-label"]]: !!u,
183
- [e.disabled]: t
184
- }),
185
- children: I
186
- }
187
- ),
188
- y && !p && !_ && /* @__PURE__ */ n(
189
- "span",
190
- {
191
- className: o(
192
- e["required-mark"],
193
- D
194
- ),
195
- "data-testid": "required-mark"
196
- }
197
- ),
198
- M && p && /* @__PURE__ */ n(
199
- re,
200
- {
201
- tabIndex: -1,
202
- className: o(e.clear, {
203
- [e.disabled]: t
204
- }),
205
- isIconButton: !0,
206
- iconName: "Close16px",
207
- size: "m-s",
208
- clear: !0,
209
- disabled: t || d,
210
- variant: "secondary-gray",
211
- onClick: K,
212
- "data-testid": "clear-button"
213
- }
214
- )
215
- ]
216
- }
217
- );
218
- }
219
- )
220
- );
221
- he.displayName = "Input";
222
- export {
223
- he as I,
224
- e as c
225
- };