@companix/uikit 0.0.97 → 0.0.99

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.
@@ -118,7 +118,7 @@
118
118
  @include mixins.use-styles(button, size, sm);
119
119
 
120
120
  &:has(> svg:only-child) {
121
- width: var(--button_size_sm_height);
121
+ width: mixins.get-style(button, size, sm, height);
122
122
  }
123
123
  }
124
124
 
@@ -126,7 +126,7 @@
126
126
  @include mixins.use-styles(button, size, md);
127
127
 
128
128
  &:has(> svg:only-child) {
129
- width: var(--button_size_md_height);
129
+ width: mixins.get-style(button, size, md, height);
130
130
  }
131
131
  }
132
132
 
@@ -134,7 +134,7 @@
134
134
  @include mixins.use-styles(button, size, lg);
135
135
 
136
136
  &:has(> svg:only-child) {
137
- width: var(--button_size_lg_height);
137
+ width: mixins.get-style(button, size, lg, height);
138
138
  }
139
139
  }
140
140
 
@@ -92,8 +92,8 @@
92
92
  // expand icon
93
93
 
94
94
  .expand-icon {
95
- color: var(--select_expand_color);
96
95
  transition: transform 0.2s;
96
+ @include mixins.use-styles(select, expand);
97
97
  }
98
98
 
99
99
  .form {
@@ -21,6 +21,12 @@ type PopupsRegistry<T extends Store> = {
21
21
  Open: OpenAgent<T>;
22
22
  };
23
23
  export declare const createPopupRegistry: <T extends Store>(mapping: T) => PopupsRegistry<T>;
24
+ interface PopupContextValue {
25
+ open: boolean;
26
+ onOpenChange: (value: boolean) => void;
27
+ onClosed: () => void;
28
+ }
29
+ export declare const usePopup: () => PopupContextValue;
24
30
  interface DialogShellProps extends Omit<DialogProps, 'open' | 'onOpenChange' | 'onClosed'> {
25
31
  }
26
32
  export declare const DialogShell: ({ children, ...props }: DialogShellProps) => import("react/jsx-runtime").JSX.Element;
package/dist/bundle.es.js CHANGED
@@ -2,7 +2,7 @@ import { Avatar as e } from "./bundle.es2.js";
2
2
  import { avatarSizes as p } from "./bundle.es3.js";
3
3
  import { Button as a } from "./bundle.es4.js";
4
4
  import { ButtonGroup as x } from "./bundle.es5.js";
5
- import { Spinner as s } from "./bundle.es6.js";
5
+ import { Spinner as i } from "./bundle.es6.js";
6
6
  import { Scrollable as c } from "./bundle.es7.js";
7
7
  import { ImitateScroll as u } from "./bundle.es8.js";
8
8
  import { Segments as D } from "./bundle.es9.js";
@@ -28,7 +28,7 @@ import { TextArea as or } from "./bundle.es28.js";
28
28
  import { DatePicker as tr } from "./bundle.es29.js";
29
29
  import { DateInput as mr } from "./bundle.es30.js";
30
30
  import { FileOverlay as fr } from "./bundle.es31.js";
31
- import { FormGroup as ir } from "./bundle.es32.js";
31
+ import { FormGroup as sr } from "./bundle.es32.js";
32
32
  import { TimePicker as nr } from "./bundle.es33.js";
33
33
  import { Icon as lr } from "./bundle.es34.js";
34
34
  import { ProgressBar as Sr } from "./bundle.es35.js";
@@ -46,11 +46,11 @@ import { useLoading as Er } from "./bundle.es46.js";
46
46
  import { createAlertAgent as qr } from "./bundle.es47.js";
47
47
  import { createToaster as Jr } from "./bundle.es48.js";
48
48
  import { Toast as Qr } from "./bundle.es49.js";
49
- import { DialogShell as Vr, DrawerShell as Xr, createPopupRegistry as Zr } from "./bundle.es50.js";
50
- import { createPopoversRegistry as $r } from "./bundle.es51.js";
51
- import { createScope as oo, createStaticScope as eo } from "./bundle.es52.js";
52
- import { RemoveListener as po } from "./bundle.es53.js";
53
- import { MONDAY as ao, addMonths as fo, createDayDisableChecker as xo, endOfDay as io, endOfWeek as so, isDayMinMaxRestricted as no, isSameDate as co, setMonth as lo, setYear as uo, startOfDay as So, startOfWeek as Do, subMonths as go, useDayDisableCheker as ho } from "./bundle.es54.js";
49
+ import { DialogShell as Vr, DrawerShell as Xr, createPopupRegistry as Zr, usePopup as _r } from "./bundle.es50.js";
50
+ import { createPopoversRegistry as ro } from "./bundle.es51.js";
51
+ import { createScope as eo, createStaticScope as to } from "./bundle.es52.js";
52
+ import { RemoveListener as mo } from "./bundle.es53.js";
53
+ import { MONDAY as fo, addMonths as xo, createDayDisableChecker as so, endOfDay as io, endOfWeek as no, isDayMinMaxRestricted as co, isSameDate as lo, setMonth as uo, setYear as So, startOfDay as Do, startOfWeek as go, subMonths as ho, useDayDisableCheker as Po } from "./bundle.es54.js";
54
54
  export {
55
55
  Q as AlertDialog,
56
56
  e as Avatar,
@@ -69,12 +69,12 @@ export {
69
69
  Ar as DropArea,
70
70
  Or as DropAreaProvider,
71
71
  fr as FileOverlay,
72
- ir as FormGroup,
72
+ sr as FormGroup,
73
73
  lr as Icon,
74
74
  u as ImitateScroll,
75
75
  O as Input,
76
76
  V as LoadingButton,
77
- ao as MONDAY,
77
+ fo as MONDAY,
78
78
  I as NumberInput,
79
79
  b as OptionItem,
80
80
  M as OptionsList,
@@ -84,13 +84,13 @@ export {
84
84
  Tr as ProgressRing,
85
85
  F as Radio,
86
86
  N as RadioGroup,
87
- po as RemoveListener,
87
+ mo as RemoveListener,
88
88
  c as Scrollable,
89
89
  D as Segments,
90
90
  k as Select,
91
91
  v as SelectTags,
92
92
  gr as Skeleton,
93
- s as Spinner,
93
+ i as Spinner,
94
94
  W as Switch,
95
95
  Z as Tabs,
96
96
  or as TextArea,
@@ -99,30 +99,31 @@ export {
99
99
  Qr as Toast,
100
100
  P as Tooltip,
101
101
  yr as WriteBar,
102
- fo as addMonths,
102
+ xo as addMonths,
103
103
  p as avatarSizes,
104
104
  Cr as colorSchemeScript,
105
105
  qr as createAlertAgent,
106
- xo as createDayDisableChecker,
107
- $r as createPopoversRegistry,
106
+ so as createDayDisableChecker,
107
+ ro as createPopoversRegistry,
108
108
  Zr as createPopupRegistry,
109
- oo as createScope,
110
- eo as createStaticScope,
109
+ eo as createScope,
110
+ to as createStaticScope,
111
111
  Jr as createToaster,
112
112
  io as endOfDay,
113
- so as endOfWeek,
114
- no as isDayMinMaxRestricted,
115
- co as isSameDate,
116
- lo as setMonth,
117
- uo as setYear,
118
- So as startOfDay,
119
- Do as startOfWeek,
120
- go as subMonths,
113
+ no as endOfWeek,
114
+ co as isDayMinMaxRestricted,
115
+ lo as isSameDate,
116
+ uo as setMonth,
117
+ So as setYear,
118
+ Do as startOfDay,
119
+ go as startOfWeek,
120
+ ho as subMonths,
121
121
  zr as useBooleanState,
122
- ho as useDayDisableCheker,
122
+ Po as useDayDisableCheker,
123
123
  Rr as useDragEnter,
124
124
  Er as useLoading,
125
125
  Gr as useLocalStorage,
126
+ _r as usePopup,
126
127
  Nr as useResizeTextarea,
127
128
  Ir as useTheme
128
129
  };
@@ -1,50 +1,54 @@
1
- import { jsx as r, Fragment as h } from "react/jsx-runtime";
2
- import { useContext as C, createContext as x, useState as P, useEffect as g, useCallback as u } from "react";
3
- import { hash as v } from "@companix/utils-js";
4
- import { Dialog as w } from "./bundle.es22.js";
5
- import { Drawer as D } from "./bundle.es21.js";
6
- const j = (o) => {
7
- const t = {}, e = {}, p = [], c = v();
8
- for (const n in o)
9
- t[n] = () => {
1
+ import { jsx as r, Fragment as C } from "react/jsx-runtime";
2
+ import { useContext as h, createContext as x, useState as P, useEffect as g, useCallback as u, memo as v } from "react";
3
+ import { hash as w } from "@companix/utils-js";
4
+ import { Dialog as D } from "./bundle.es22.js";
5
+ import { Drawer as S } from "./bundle.es21.js";
6
+ const F = (t) => {
7
+ const o = {}, e = {}, p = [], c = w();
8
+ for (const n in t)
9
+ o[n] = () => {
10
10
  }, e[n] = () => {
11
- }, p.push(() => /* @__PURE__ */ r(S, { Open: t, Close: e, name: n, Content: o[n] }));
11
+ }, p.push(() => /* @__PURE__ */ r(O, { Open: o, Close: e, name: n, Content: t[n] }));
12
12
  return {
13
- Open: t,
13
+ Open: o,
14
14
  Close: e,
15
- Overlay: () => /* @__PURE__ */ r(h, { children: p.map((n, s) => /* @__PURE__ */ r(n, {}, `popup-${c}-${s}`)) })
15
+ Overlay: () => /* @__PURE__ */ r(C, { children: p.map((n, s) => /* @__PURE__ */ r(n, {}, `popup-${c}-${s}`)) })
16
16
  };
17
- }, S = ({ name: o, Open: t, Close: e, Content: p }) => {
18
- const [{ data: c, open: n }, s] = P({ data: null, open: !1 });
17
+ }, O = ({ name: t, Open: o, Close: e, Content: p }) => {
18
+ const [{ data: c, open: n }, s] = P({
19
+ data: null,
20
+ open: !1
21
+ });
19
22
  g(() => {
20
- t[o] = (a) => {
23
+ o[t] = (a) => {
21
24
  s({ data: a, open: !0 });
22
- }, e[o] = () => {
25
+ }, e[t] = () => {
23
26
  n && l();
24
27
  };
25
28
  }, []);
26
29
  const l = u(() => {
27
30
  s(({ data: a }) => ({ data: a, open: !1 }));
28
- }, []), d = u(() => {
31
+ }, []), m = u(() => {
29
32
  s({ data: null, open: !1 });
30
- }, []), m = u((a) => {
33
+ }, []), d = u((a) => {
31
34
  a || l();
32
35
  }, []);
33
- return c ? /* @__PURE__ */ r(i.Provider, { value: { open: n, onOpenChange: m, onClosed: d }, children: /* @__PURE__ */ r(p, { data: c, close: l }) }) : null;
34
- }, i = x(null), f = () => {
35
- const o = C(i);
36
- if (!o)
36
+ return c ? /* @__PURE__ */ r(i.Provider, { value: { open: n, onOpenChange: d, onClosed: m }, children: /* @__PURE__ */ r(y, { data: c, close: l, Content: p }) }) : null;
37
+ }, y = v(({ data: t, close: o, Content: e }) => /* @__PURE__ */ r(e, { data: t, close: o })), i = x(null), f = () => {
38
+ const t = h(i);
39
+ if (!t)
37
40
  throw new Error("Popup context not provided");
38
- return o;
39
- }, k = ({ children: o, ...t }) => {
41
+ return t;
42
+ }, R = ({ children: t, ...o }) => {
40
43
  const e = f();
41
- return /* @__PURE__ */ r(w, { ...e, ...t, children: o });
42
- }, F = ({ children: o, ...t }) => {
44
+ return /* @__PURE__ */ r(D, { ...e, ...o, children: t });
45
+ }, W = ({ children: t, ...o }) => {
43
46
  const e = f();
44
- return /* @__PURE__ */ r(D, { ...e, ...t, children: o });
47
+ return /* @__PURE__ */ r(S, { ...e, ...o, children: t });
45
48
  };
46
49
  export {
47
- k as DialogShell,
48
- F as DrawerShell,
49
- j as createPopupRegistry
50
+ R as DialogShell,
51
+ W as DrawerShell,
52
+ F as createPopupRegistry,
53
+ f as usePopup
50
54
  };
package/dist/index.d.ts CHANGED
@@ -88,7 +88,7 @@ export { Toast } from './Toaster/Toast';
88
88
  export * from './types';
89
89
  export type { CalendarProps } from './Calendar/Calendar';
90
90
  export type { OptionsSource, UseOptionsResponse } from './Select/OptionsPopover';
91
- export { createPopupRegistry, DialogShell, DrawerShell } from './__helpers/createPopupRegistry';
91
+ export { createPopupRegistry, DialogShell, DrawerShell, usePopup } from './__helpers/createPopupRegistry';
92
92
  export { createPopoversRegistry } from './__helpers/createPopoversRegistry';
93
93
  export { createScope, createStaticScope } from './__helpers/createScope';
94
94
  export type { PopupProps } from './__helpers/createPopupRegistry';
package/dist/mixins.scss CHANGED
@@ -53,11 +53,11 @@
53
53
 
54
54
  @mixin set-style($property, $source, $keys...) {
55
55
  $path: list.append($keys, $property);
56
- $var-name: get-value($source, $path...);
56
+ $value: get-value($source, $path...);
57
57
 
58
- @if $var-name != null {
59
- @if meta.type-of($var-name) != 'map' {
60
- #{$property}: $var-name;
58
+ @if $value != null {
59
+ @if meta.type-of($value) != 'map' {
60
+ #{$property}: $value;
61
61
  }
62
62
  }
63
63
  }
@@ -70,6 +70,11 @@
70
70
  }
71
71
  }
72
72
 
73
+ @function get-style($component, $keys...) {
74
+ $source: map.get(theme.$tokens, $component);
75
+ @return get-value($source, $keys...);
76
+ }
77
+
73
78
  @mixin use-styles-debug($component, $keys...) {
74
79
  $source: map.get(theme.$tokens, $component);
75
80
 
package/dist/theme.scss CHANGED
@@ -1,6 +1,7 @@
1
1
  @use 'sass:map';
2
2
  @use 'sass:string';
3
3
  @use 'sass:list';
4
+ @use 'sass:meta';
4
5
 
5
6
  $button-appearances: ();
6
7
  $tokens: ();
@@ -65,6 +66,14 @@ $tokens: ();
65
66
  );
66
67
  }
67
68
 
69
+ @function unquote-value($value) {
70
+ @if meta.type-of($value) == 'string' {
71
+ @return string.unquote($value);
72
+ }
73
+
74
+ @return $value;
75
+ }
76
+
68
77
  @mixin use-button-properties($vars) {
69
78
  @each $full-name, $v in $vars {
70
79
  // Разбиваем путь: primary-default-enabled-background → ('primary', 'default', 'enabled', 'background')
@@ -94,6 +103,21 @@ $tokens: ();
94
103
  }
95
104
  }
96
105
 
106
+ @mixin use-layout($components) {
107
+ @each $component-name, $v in $components {
108
+ $component-vars: map.get($components, $component-name);
109
+
110
+ @each $path, $v in $component-vars {
111
+ $name: #{$component-name}_#{$path};
112
+ // Разбиваем путь: primary_default_enabled_background → ('primary', 'default', 'enabled', 'background')
113
+ $keys: str-split($name, '_');
114
+ $value: unquote-value(map.get($component-vars, $path));
115
+ // Глубоко добавляем значение в структуру
116
+ $tokens: map-deep-set($tokens, $keys, $value) !global;
117
+ }
118
+ }
119
+ }
120
+
97
121
  @mixin use-css-vars($prefix, $map) {
98
122
  @each $name, $value in $map {
99
123
  --#{$prefix}_#{$name}: #{$value};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companix/uikit",
3
- "version": "0.0.97",
3
+ "version": "0.0.99",
4
4
  "main": "./dist/bundle.es.js",
5
5
  "module": "./dist/bundle.es.js",
6
6
  "types": "./dist/index.d.ts",