@shmidko61/lc-ui-kit 0.2.0 → 0.3.0

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.
@@ -1,56 +1,23 @@
1
- import { jsx as r, jsxs as c } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
2
  import { c as i } from "./responsive-style.config-DFuATrIM.js";
3
- import { CheckIcon as u, MediaPictureIcon as p, XMarkIcon as f } from "./icons.js";
3
+ import { MediaPictureIcon as u, XMarkIcon as p, CheckIcon as f } from "./icons.js";
4
4
  import { Typography as b } from "./typography.js";
5
- function x({ isPicked: e }) {
6
- return /* @__PURE__ */ r(
7
- "span",
8
- {
9
- className: i(
10
- "absolute right-[4px] top-[4px] inline-flex size-[20px] items-center justify-center rounded-full ",
11
- e ? " bg-[var(--color-primary-accent)] text-[var(--color-background-default)]" : "bg-[var(--color-background-default)] text-transparent"
12
- ),
13
- "aria-hidden": "true",
14
- children: /* @__PURE__ */ r(u, { className: "size-[18px]" })
15
- }
16
- );
17
- }
18
5
  function l({ fileName: e, imgUrl: n, children: a }) {
19
6
  return /* @__PURE__ */ c("div", { className: "relative flex aspect-square w-full items-center justify-center rounded-[8px] overflow-hidden bg-[var(--color-background-subtle)]", children: [
20
- n ? /* @__PURE__ */ r("img", { className: "w-full object-contain", src: n, alt: e }) : /* @__PURE__ */ r(p, { className: "size-[40px] text-[var(--color-text-secondary)]" }),
7
+ n ? /* @__PURE__ */ r("img", { className: "w-full object-contain", src: n, alt: e }) : /* @__PURE__ */ r(u, { className: "size-[40px] text-[var(--color-text-secondary)]" }),
21
8
  a
22
9
  ] });
23
10
  }
24
- function m({
25
- className: e,
26
- fileName: n,
27
- imgUrl: a,
28
- isPicked: o = !1,
29
- onSubmit: t
30
- }) {
31
- return /* @__PURE__ */ r(
32
- "button",
33
- {
34
- type: "button",
35
- className: i(
36
- "block w-full overflow-hidden rounded-[10px] border border-[var(--color-primary-accent)] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--color-primary-accent)_35%,transparent)]",
37
- e
38
- ),
39
- onClick: t,
40
- children: /* @__PURE__ */ r(l, { fileName: n, imgUrl: a, children: /* @__PURE__ */ r(x, { isPicked: o }) })
41
- }
42
- );
43
- }
44
- function v({
11
+ function x({
45
12
  fileName: e,
46
13
  onDelete: n
47
14
  }) {
48
15
  return /* @__PURE__ */ c("div", { className: "flex justify-between items-center gap-[8px]", children: [
49
16
  /* @__PURE__ */ r(b, { variant: "b3", children: e }),
50
- n ? /* @__PURE__ */ r("button", { type: "button", "aria-label": `Удалить ${e}`, onClick: n, children: /* @__PURE__ */ r(f, { className: "size-[16px]" }) }) : null
17
+ n ? /* @__PURE__ */ r("button", { type: "button", "aria-label": `Удалить ${e}`, onClick: n, children: /* @__PURE__ */ r(p, { className: "size-[16px]" }) }) : null
51
18
  ] });
52
19
  }
53
- function g({
20
+ function m({
54
21
  className: e,
55
22
  fileName: n,
56
23
  imgUrl: a,
@@ -65,11 +32,44 @@ function g({
65
32
  ),
66
33
  children: [
67
34
  /* @__PURE__ */ r(l, { fileName: n, imgUrl: a }),
68
- /* @__PURE__ */ r(v, { fileName: n, onDelete: o })
35
+ /* @__PURE__ */ r(x, { fileName: n, onDelete: o })
69
36
  ]
70
37
  }
71
38
  );
72
39
  }
40
+ function v({ isPicked: e }) {
41
+ return /* @__PURE__ */ r(
42
+ "span",
43
+ {
44
+ className: i(
45
+ "absolute right-[4px] top-[4px] inline-flex size-[20px] items-center justify-center rounded-full ",
46
+ e ? " bg-[var(--color-primary-accent)] text-[var(--color-background-default)]" : "bg-[var(--color-background-default)] text-transparent"
47
+ ),
48
+ "aria-hidden": "true",
49
+ children: /* @__PURE__ */ r(f, { className: "size-[18px]" })
50
+ }
51
+ );
52
+ }
53
+ function g({
54
+ className: e,
55
+ fileName: n,
56
+ imgUrl: a,
57
+ isPicked: o = !1,
58
+ onSubmit: t
59
+ }) {
60
+ return /* @__PURE__ */ r(
61
+ "button",
62
+ {
63
+ type: "button",
64
+ className: i(
65
+ "block w-full overflow-hidden rounded-[10px] border border-[var(--color-primary-accent)] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--color-primary-accent)_35%,transparent)]",
66
+ e
67
+ ),
68
+ onClick: t,
69
+ children: /* @__PURE__ */ r(l, { fileName: n, imgUrl: a, children: /* @__PURE__ */ r(v, { isPicked: o }) })
70
+ }
71
+ );
72
+ }
73
73
  function w({
74
74
  className: e,
75
75
  fileName: n,
@@ -80,7 +80,7 @@ function w({
80
80
  variant: s
81
81
  }) {
82
82
  return s === "img-pick" ? /* @__PURE__ */ r(
83
- m,
83
+ g,
84
84
  {
85
85
  className: e,
86
86
  fileName: n,
@@ -89,7 +89,7 @@ function w({
89
89
  onSubmit: d
90
90
  }
91
91
  ) : /* @__PURE__ */ r(
92
- g,
92
+ m,
93
93
  {
94
94
  className: e,
95
95
  fileName: n,
@@ -39,7 +39,7 @@ export interface MediaGalleryProps<TItem extends MediaGalleryItem = MediaGallery
39
39
  /** Дополнительный className для grid-области с карточками. */
40
40
  gridClassName?: string;
41
41
  /** Список медиа-элементов для отображения. */
42
- items: TItem[];
42
+ items: Array<TItem>;
43
43
  /** Показывает loading-state вместо пустого состояния. */
44
44
  isLoading?: boolean;
45
45
  /** Responsive-настройки сетки для lg и шире. */
@@ -1,6 +1,6 @@
1
+ import { ButtonHTMLAttributes, JSX, ReactNode } from 'react';
1
2
  import { AriaModalOverlayProps } from 'react-aria';
2
3
  import { OverlayTriggerProps as OverlayTriggerStateProps, OverlayTriggerState } from 'react-stately';
3
- import { ButtonHTMLAttributes, JSX, ReactNode } from 'react';
4
4
  import { BoxProps } from '../box/box';
5
5
  import { ButtonProps } from '../button/button';
6
6
  import { FlexProps } from '../flex/flex';
package/dist/modal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("react-aria"),O=require("react-stately"),B=require("react"),k=require("./box.cjs"),j=require("./button.cjs"),b=require("./flex.cjs"),z=require("./icons.cjs"),y=require("./responsive-style.config-B2m9jVlX.cjs");function h({children:e,className:o,closeButtonSlot:a,contentWrapperProps:l,isDismissable:i=!0,overlayBackground:u="rgb(0 0 0 / 40%)",overlayBlur:d=4,portalContainer:g,state:t,style:p,...n}){const c=B.useRef(null),{modalProps:P,underlayProps:q}=s.useModalOverlay({...n,isDismissable:i},t,c);if(!t.isOpen)return null;const x=q,f=P,M=l?.className,m=S(d),F={backdropFilter:m,WebkitBackdropFilter:m,...x.style};return r.jsx(s.Overlay,{portalContainer:g,children:r.jsx(s.FocusScope,{contain:!0,restoreFocus:!0,autoFocus:!0,children:r.jsx(b.Flex,{...x,align:"center",bg:u,height:"100dvh",justify:"center",p:{px:16,py:16},position:{type:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50},style:F,width:"100%",children:r.jsx("div",{...f,className:y.cn("size-full outline-none",f.className),ref:c,children:r.jsxs(k.Box,{bg:"transparent",className:y.cn("relative size-full overflow-y-auto",o),height:"100dvh",style:p,width:"100%",...n,children:[i?R(t.close,a):null,r.jsx(b.Flex,{align:"center",height:"100%",justify:"center",width:"100%",...l,className:y.cn(M),children:e})]})})})})})}function v({children:e,customTrigger:o,defaultOpen:a,isOpen:l,label:i="Открыть",onOpenChange:u,triggerButtonProps:d,...g}){const t=O.useOverlayTriggerState({defaultOpen:a,isOpen:l,onOpenChange:u}),{triggerProps:p}=s.useOverlayTrigger({type:"dialog"},t),n=T(p),c=o?o({close:t.close,open:t.open,state:t,triggerProps:n}):r.jsx(j.Button,{...d,...n,type:"button",onClick:t.open,children:i});return r.jsxs(r.Fragment,{children:[c,r.jsx(h,{state:t,...g,children:e(t.close)})]})}const N=Object.assign(h,{Trigger:v});function R(e,o){return o?o(e):r.jsx(j.Button,{"aria-label":"Закрыть модальное окно",p:10,position:{type:"absolute",right:20,top:20,zIndex:1},size:"md",type:"button",variant:"secondary",onClick:e,children:r.jsx(z.XMarkIcon,{})})}function S(e){return typeof e=="number"?`blur(${e}px)`:e}function T(e){const o={...e};return delete o.onPress,s.mergeProps(o)}exports.Modal=N;exports.ModalRoot=h;exports.ModalTrigger=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),s=require("react-aria"),B=require("react-stately"),k=require("./box.cjs"),j=require("./button.cjs"),b=require("./flex.cjs"),z=require("./icons.cjs"),y=require("./responsive-style.config-B2m9jVlX.cjs");function h({children:e,className:o,closeButtonSlot:a,contentWrapperProps:l,isDismissable:i=!0,overlayBackground:u="rgb(0 0 0 / 40%)",overlayBlur:d=4,portalContainer:g,state:t,style:p,...n}){const c=O.useRef(null),{modalProps:P,underlayProps:q}=s.useModalOverlay({...n,isDismissable:i},t,c);if(!t.isOpen)return null;const x=q,f=P,M=l?.className,m=S(d),F={backdropFilter:m,WebkitBackdropFilter:m,...x.style};return r.jsx(s.Overlay,{portalContainer:g,children:r.jsx(s.FocusScope,{contain:!0,restoreFocus:!0,autoFocus:!0,children:r.jsx(b.Flex,{...x,align:"center",bg:u,height:"100dvh",justify:"center",p:{px:16,py:16},position:{type:"fixed",top:0,right:0,bottom:0,left:0,zIndex:50},style:F,width:"100%",children:r.jsx("div",{...f,className:y.cn("size-full outline-none",f.className),ref:c,children:r.jsxs(k.Box,{bg:"transparent",className:y.cn("relative size-full overflow-y-auto",o),height:"100dvh",style:p,width:"100%",...n,children:[i?R(t.close,a):null,r.jsx(b.Flex,{align:"center",height:"100%",justify:"center",width:"100%",...l,className:y.cn(M),children:e})]})})})})})}function v({children:e,customTrigger:o,defaultOpen:a,isOpen:l,label:i="Открыть",onOpenChange:u,triggerButtonProps:d,...g}){const t=B.useOverlayTriggerState({defaultOpen:a,isOpen:l,onOpenChange:u}),{triggerProps:p}=s.useOverlayTrigger({type:"dialog"},t),n=T(p),c=o?o({close:t.close,open:t.open,state:t,triggerProps:n}):r.jsx(j.Button,{...d,...n,type:"button",onClick:t.open,children:i});return r.jsxs(r.Fragment,{children:[c,r.jsx(h,{state:t,...g,children:e(t.close)})]})}const N=Object.assign(h,{Trigger:v});function R(e,o){return o?o(e):r.jsx(j.Button,{"aria-label":"Закрыть модальное окно",p:10,position:{type:"absolute",right:20,top:20,zIndex:1},size:"md",type:"button",variant:"secondary",onClick:e,children:r.jsx(z.XMarkIcon,{})})}function S(e){return typeof e=="number"?`blur(${e}px)`:e}function T(e){const o={...e};return delete o.onPress,s.mergeProps(o)}exports.Modal=N;exports.ModalRoot=h;exports.ModalTrigger=v;
package/dist/modal.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as b, Fragment as z } from "react/jsx-runtime";
2
- import { useModalOverlay as B, Overlay as N, FocusScope as j, useOverlayTrigger as M, mergeProps as w } from "react-aria";
3
- import { useOverlayTriggerState as C } from "react-stately";
4
- import { useRef as D } from "react";
2
+ import { useRef as B } from "react";
3
+ import { useModalOverlay as N, Overlay as j, FocusScope as M, useOverlayTrigger as w, mergeProps as C } from "react-aria";
4
+ import { useOverlayTriggerState as D } from "react-stately";
5
5
  import { Box as I } from "./box.js";
6
6
  import { Button as v } from "./button.js";
7
7
  import { Flex as h } from "./flex.js";
@@ -20,7 +20,7 @@ function x({
20
20
  style: d,
21
21
  ...n
22
22
  }) {
23
- const s = D(null), { modalProps: P, underlayProps: F } = B(
23
+ const s = B(null), { modalProps: P, underlayProps: F } = N(
24
24
  { ...n, isDismissable: l },
25
25
  r,
26
26
  s
@@ -32,7 +32,7 @@ function x({
32
32
  WebkitBackdropFilter: y,
33
33
  ...g.style
34
34
  };
35
- return /* @__PURE__ */ t(N, { portalContainer: p, children: /* @__PURE__ */ t(j, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ t(
35
+ return /* @__PURE__ */ t(j, { portalContainer: p, children: /* @__PURE__ */ t(M, { contain: !0, restoreFocus: !0, autoFocus: !0, children: /* @__PURE__ */ t(
36
36
  h,
37
37
  {
38
38
  ...g,
@@ -91,7 +91,7 @@ function T({
91
91
  triggerButtonProps: u,
92
92
  ...p
93
93
  }) {
94
- const r = C({ defaultOpen: c, isOpen: i, onOpenChange: a }), { triggerProps: d } = M({ type: "dialog" }, r), n = W(d), s = o ? o({
94
+ const r = D({ defaultOpen: c, isOpen: i, onOpenChange: a }), { triggerProps: d } = w({ type: "dialog" }, r), n = W(d), s = o ? o({
95
95
  close: r.close,
96
96
  open: r.open,
97
97
  state: r,
@@ -133,8 +133,10 @@ function V(e) {
133
133
  return typeof e == "number" ? `blur(${e}px)` : e;
134
134
  }
135
135
  function W(e) {
136
- const o = { ...e };
137
- return delete o.onPress, w(o);
136
+ const o = {
137
+ ...e
138
+ };
139
+ return delete o.onPress, C(o);
138
140
  }
139
141
  export {
140
142
  L as Modal,
@@ -40,7 +40,7 @@ export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement
40
40
  /** Callback с новым значением без synthetic event. */
41
41
  onValueChange?: (value: string) => void;
42
42
  /** Список пунктов select. */
43
- options?: SelectOption[];
43
+ options?: Array<SelectOption>;
44
44
  /** Текст, который показывается когда значение не выбрано. */
45
45
  placeholder?: string;
46
46
  /** Полная замена option-рендера. Получает готовые optionProps и defaultOption. */
@@ -11,4 +11,4 @@ import { SelectOption } from './select.types';
11
11
  * нет, helper читает React children, оставляет только валидные элементы с
12
12
  * `value` и собирает из них `SelectOption`.
13
13
  */
14
- export declare function normalizeOptions(options: SelectOption[] | undefined, children: ReactNode): SelectOption[];
14
+ export declare function normalizeOptions(options: Array<SelectOption> | undefined, children: ReactNode): Array<SelectOption>;
@@ -1,2 +1,2 @@
1
1
  import { ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
2
+ export declare function cn(...inputs: Array<ClassValue>): string;
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { UiKitTypography } from '../../design-tokens/typography.tokens';
3
- import { UiKitColors } from '../../types/index';
3
+ import { UiKitColors } from '../../types';
4
4
  /**
5
5
  * Поддерживаемые responsive breakpoints.
6
6
  *