colibri-ui 0.8.77 → 0.8.80

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.
package/Modal/index.js CHANGED
@@ -51,7 +51,7 @@ var ModalRoot = function ModalRoot(_ref) {
51
51
  var parentContainer = withinParent ? parentModal === null || parentModal === void 0 ? void 0 : parentModal.container : undefined;
52
52
  var isContained = Boolean(parentContainer);
53
53
  var isDesktop = index$4.useMediaSizes(function (bp) {
54
- return bp.up("md");
54
+ return bp.up("lg");
55
55
  });
56
56
  var titleId = React.useId();
57
57
  var _useState3 = React.useState(0),
package/README.md CHANGED
@@ -131,6 +131,71 @@ If you add a theme inside the library itself, create both layers:
131
131
 
132
132
  Then export it from `src/components/Theme/index.tsx` and update `scripts/variables.ts` if you want a generated CSS variables file in the package build.
133
133
 
134
+ ## Breakpoints
135
+
136
+ Colibri UI uses one fixed set of breakpoints, shared with the apps that use the kit.
137
+
138
+ | Name | Value | px |
139
+ | ----- | ------- | ---- |
140
+ | `sm` | `40rem` | 640 |
141
+ | `md` | `48rem` | 768 |
142
+ | `lg` | `64rem` | 1024 |
143
+ | `xl` | `80rem` | 1280 |
144
+ | `2xl` | `96rem` | 1536 |
145
+
146
+ The values match the Tailwind CSS defaults on purpose, because they are an industry standard. Tailwind is not a dependency of Colibri UI.
147
+
148
+ Rules:
149
+
150
+ - **Mobile first.** Base styles are for screens narrower than `sm`. There is no `xs`.
151
+ - **rem, not px.** Layout follows the user's browser font size.
152
+ - **Range syntax only.** Write `(width >= 48rem)` and `(width < 48rem)`. Do not use `min-width` / `max-width` or `- 1px` arithmetic: each edge belongs to exactly one side.
153
+
154
+ ### CSS
155
+
156
+ CSS cannot read variables inside media queries, so write the value as a literal:
157
+
158
+ ```css
159
+ .card {
160
+ padding: var(--space-4);
161
+ }
162
+
163
+ @media (width >= 64rem) {
164
+ .card {
165
+ padding: var(--space-6);
166
+ }
167
+ }
168
+ ```
169
+
170
+ Inside the kit, a test and a stylelint rule reject `min-width` / `max-width` and any width value outside the table.
171
+
172
+ ### JavaScript
173
+
174
+ ```ts
175
+ import { BREAKPOINTS, media, useMediaSizes } from "colibri-ui";
176
+
177
+ BREAKPOINTS.md; // "48rem"
178
+ media.up("md"); // "(width >= 48rem)"
179
+ media.down("md"); // "(width < 48rem)"
180
+ media.between("md", "lg"); // "(48rem <= width < 64rem)"
181
+
182
+ window.matchMedia(media.up("lg")).matches;
183
+
184
+ // in a component
185
+ const isDesktop = useMediaSizes((bp) => bp.up("lg"));
186
+
187
+ // CSS-in-JS: add the @media prefix yourself
188
+ const css = `@media ${media.down("sm")} { … }`;
189
+ ```
190
+
191
+ `BREAKPOINTS` and `media` are also exported from `colibri-ui/Theme`.
192
+
193
+ ### useMediaSizes
194
+
195
+ `useMediaSizes(query)` takes a query string or a function that receives `media`, and returns whether the query matches. It updates when the viewport crosses the edge.
196
+
197
+ Returns `false` on the server and during hydration. Use it to decide whether to mount a heavy component; to show/hide markup use CSS media queries, otherwise the wrong variant renders until hydration.
198
+
134
199
  ## License
135
200
 
136
201
  MIT
@@ -1,18 +1,22 @@
1
- export type Breakpoints = {
2
- hd: number;
3
- xl: number;
4
- lg: number;
5
- md: number;
6
- sm: number;
7
- xs: number;
1
+ /**
2
+ * Breakpoints shared with the apps that use the kit.
3
+ * The values match the Tailwind CSS defaults on purpose; Tailwind is not a dependency.
4
+ */
5
+ export declare const BREAKPOINTS: {
6
+ readonly sm: "40rem";
7
+ readonly md: "48rem";
8
+ readonly lg: "64rem";
9
+ readonly xl: "80rem";
10
+ readonly "2xl": "96rem";
8
11
  };
9
- export type BreakpointName = keyof Breakpoints;
10
- export type BreakpointsTheme = {
11
- values: Breakpoints;
12
- up: (breakpoint: BreakpointName, isMedial?: boolean) => string;
13
- under: (breakpoint: BreakpointName, isMedial?: boolean) => string;
14
- between: ([from, to]: [BreakpointName, BreakpointName], isMedial?: boolean) => string;
12
+ export type BreakpointName = keyof typeof BREAKPOINTS;
13
+ export type Media = {
14
+ /** `(width >= <name>)` */
15
+ up: (name: BreakpointName) => string;
16
+ /** `(width < <name>)` */
17
+ down: (name: BreakpointName) => string;
18
+ /** `(<from> <= width < <to>)` */
19
+ between: (from: BreakpointName, to: BreakpointName) => string;
15
20
  };
16
- export type BreakpointMap<T = number> = Map<BreakpointName, T>;
17
- declare const Breakpoints: BreakpointsTheme;
18
- export default Breakpoints;
21
+ /** Bare media queries, usable in `window.matchMedia`. Prefix with `@media ` in CSS-in-JS. */
22
+ export declare const media: Media;
@@ -1,39 +1,28 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
10
-
11
- var Breakpoints = {
12
- values: {
13
- hd: 2560,
14
- xl: 1920,
15
- lg: 1450,
16
- md: 1075,
17
- sm: 680,
18
- xs: 320
19
- },
20
- up: function up(breakpoint) {
21
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
22
- return "".concat(isMedia ? "@media " : "", "(min-width: ").concat(this.values[breakpoint], "px)");
3
+ /**
4
+ * Breakpoints shared with the apps that use the kit.
5
+ * The values match the Tailwind CSS defaults on purpose; Tailwind is not a dependency.
6
+ */
7
+ var BREAKPOINTS = {
8
+ sm: "40rem",
9
+ md: "48rem",
10
+ lg: "64rem",
11
+ xl: "80rem",
12
+ "2xl": "96rem"
13
+ };
14
+ /** Bare media queries, usable in `window.matchMedia`. Prefix with `@media ` in CSS-in-JS. */
15
+ var media = {
16
+ up: function up(name) {
17
+ return "(width >= ".concat(BREAKPOINTS[name], ")");
23
18
  },
24
- under: function under(breakpoint) {
25
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
26
- return "".concat(isMedia ? "@media " : "", "(max-width: ").concat(this.values[breakpoint] - 1, "px)");
19
+ down: function down(name) {
20
+ return "(width < ".concat(BREAKPOINTS[name], ")");
27
21
  },
28
- between: function between(_ref) {
29
- var _ref2 = _slicedToArray__default.default(_ref, 2),
30
- min = _ref2[0],
31
- max = _ref2[1];
32
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
33
- var from = this.values[min];
34
- var to = this.values[max] - 1;
35
- return "".concat(isMedia ? "@media " : "", "(min-width: ").concat(from, "px) and (max-width: ").concat(to, "px)");
22
+ between: function between(from, to) {
23
+ return "(".concat(BREAKPOINTS[from], " <= width < ").concat(BREAKPOINTS[to], ")");
36
24
  }
37
25
  };
38
26
 
39
- exports.default = Breakpoints;
27
+ exports.BREAKPOINTS = BREAKPOINTS;
28
+ exports.media = media;
package/Theme/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { BREAKPOINTS, media } from "./breakpoints";
2
+ export type { BreakpointName, Media } from "./breakpoints";
1
3
  export declare const THEMES: {
2
4
  JAIPUR: {
3
5
  "component-button-primary-bg": "var(--color-action-primary)";
package/Theme/index.js CHANGED
@@ -3,10 +3,13 @@
3
3
  var tokens = require('../Button/tokens.js');
4
4
  var jaipur = require('./themes/jaipur.js');
5
5
  var buenos_aires = require('./themes/buenos_aires.js');
6
+ var breakpoints = require('./breakpoints.js');
6
7
 
7
8
  var THEMES = {
8
9
  JAIPUR: Object.assign(Object.assign({}, jaipur.default), tokens.BUTTON_TOKENS),
9
10
  BA: Object.assign(Object.assign({}, buenos_aires.default), tokens.BUTTON_TOKENS)
10
11
  };
11
12
 
13
+ exports.BREAKPOINTS = breakpoints.BREAKPOINTS;
14
+ exports.media = breakpoints.media;
12
15
  exports.THEMES = THEMES;
@@ -0,0 +1 @@
1
+ export { Autocomplete } from './Autocomplete.js';
@@ -0,0 +1 @@
1
+ export { Calendar } from './Calendar.js';
@@ -0,0 +1 @@
1
+ export { Card, CardContent, CardInnerContent } from './Card.js';
@@ -0,0 +1 @@
1
+ export { CodeField, ONLY_CHARS_PATTERN, ONLY_DIGITS_AND_CHARS_PATTERN, ONLY_DIGITS_PATTERN } from './CodeField.js';
@@ -0,0 +1 @@
1
+ export { Drawer, DrawerContent, DrawerFooter, DrawerHeader } from './Drawer.js';
@@ -0,0 +1 @@
1
+ export { Dropzone } from './Dropzone.js';
@@ -0,0 +1 @@
1
+ export { Editable } from './Editable.js';
@@ -0,0 +1,21 @@
1
+ export { ArrowNext } from './ArrowNext.js';
2
+ export { Cart } from './Cart.js';
3
+ export { Check } from './Check.js';
4
+ export { Chevron } from './Chevron.js';
5
+ export { Close } from './Close.js';
6
+ export { Copy } from './Copy.js';
7
+ export { Cross } from './Cross.js';
8
+ export { CrossFill } from './CrossFill.js';
9
+ export { Edit } from './Edit.js';
10
+ export { Exit } from './Exit.js';
11
+ export { EyeOpen } from './EyeOpen.js';
12
+ export { EyeClosed } from './EyeClosed.js';
13
+ export { Help } from './Help.js';
14
+ export { Info } from './Info.js';
15
+ export { Minus } from './Minus.js';
16
+ export { More } from './More.js';
17
+ export { Plus } from './Plus.js';
18
+ export { Setting } from './Setting.js';
19
+ export { Shield } from './Shield.js';
20
+ export { Trash } from './Trash.js';
21
+ export { User } from './User.js';
@@ -0,0 +1 @@
1
+ export { List, ListItem, ListSection } from './List.js';
@@ -41,7 +41,7 @@ var ModalRoot = function ModalRoot(_ref) {
41
41
  var parentContainer = withinParent ? parentModal === null || parentModal === void 0 ? void 0 : parentModal.container : undefined;
42
42
  var isContained = Boolean(parentContainer);
43
43
  var isDesktop = useMediaSizes(function (bp) {
44
- return bp.up("md");
44
+ return bp.up("lg");
45
45
  });
46
46
  var titleId = useId();
47
47
  var _useState3 = useState(0),
@@ -0,0 +1 @@
1
+ export { NumberInput } from './NumberInput.js';
@@ -0,0 +1 @@
1
+ export { Progress } from './Progress.js';
@@ -0,0 +1 @@
1
+ export { Rating } from './Rating.js';
@@ -0,0 +1 @@
1
+ export { Slider } from './Slider.js';
@@ -1,18 +1,22 @@
1
- export type Breakpoints = {
2
- hd: number;
3
- xl: number;
4
- lg: number;
5
- md: number;
6
- sm: number;
7
- xs: number;
1
+ /**
2
+ * Breakpoints shared with the apps that use the kit.
3
+ * The values match the Tailwind CSS defaults on purpose; Tailwind is not a dependency.
4
+ */
5
+ export declare const BREAKPOINTS: {
6
+ readonly sm: "40rem";
7
+ readonly md: "48rem";
8
+ readonly lg: "64rem";
9
+ readonly xl: "80rem";
10
+ readonly "2xl": "96rem";
8
11
  };
9
- export type BreakpointName = keyof Breakpoints;
10
- export type BreakpointsTheme = {
11
- values: Breakpoints;
12
- up: (breakpoint: BreakpointName, isMedial?: boolean) => string;
13
- under: (breakpoint: BreakpointName, isMedial?: boolean) => string;
14
- between: ([from, to]: [BreakpointName, BreakpointName], isMedial?: boolean) => string;
12
+ export type BreakpointName = keyof typeof BREAKPOINTS;
13
+ export type Media = {
14
+ /** `(width >= <name>)` */
15
+ up: (name: BreakpointName) => string;
16
+ /** `(width < <name>)` */
17
+ down: (name: BreakpointName) => string;
18
+ /** `(<from> <= width < <to>)` */
19
+ between: (from: BreakpointName, to: BreakpointName) => string;
15
20
  };
16
- export type BreakpointMap<T = number> = Map<BreakpointName, T>;
17
- declare const Breakpoints: BreakpointsTheme;
18
- export default Breakpoints;
21
+ /** Bare media queries, usable in `window.matchMedia`. Prefix with `@media ` in CSS-in-JS. */
22
+ export declare const media: Media;
@@ -1,31 +1,25 @@
1
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
-
3
- var Breakpoints = {
4
- values: {
5
- hd: 2560,
6
- xl: 1920,
7
- lg: 1450,
8
- md: 1075,
9
- sm: 680,
10
- xs: 320
11
- },
12
- up: function up(breakpoint) {
13
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
14
- return "".concat(isMedia ? "@media " : "", "(min-width: ").concat(this.values[breakpoint], "px)");
1
+ /**
2
+ * Breakpoints shared with the apps that use the kit.
3
+ * The values match the Tailwind CSS defaults on purpose; Tailwind is not a dependency.
4
+ */
5
+ var BREAKPOINTS = {
6
+ sm: "40rem",
7
+ md: "48rem",
8
+ lg: "64rem",
9
+ xl: "80rem",
10
+ "2xl": "96rem"
11
+ };
12
+ /** Bare media queries, usable in `window.matchMedia`. Prefix with `@media ` in CSS-in-JS. */
13
+ var media = {
14
+ up: function up(name) {
15
+ return "(width >= ".concat(BREAKPOINTS[name], ")");
15
16
  },
16
- under: function under(breakpoint) {
17
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
18
- return "".concat(isMedia ? "@media " : "", "(max-width: ").concat(this.values[breakpoint] - 1, "px)");
17
+ down: function down(name) {
18
+ return "(width < ".concat(BREAKPOINTS[name], ")");
19
19
  },
20
- between: function between(_ref) {
21
- var _ref2 = _slicedToArray(_ref, 2),
22
- min = _ref2[0],
23
- max = _ref2[1];
24
- var isMedia = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
25
- var from = this.values[min];
26
- var to = this.values[max] - 1;
27
- return "".concat(isMedia ? "@media " : "", "(min-width: ").concat(from, "px) and (max-width: ").concat(to, "px)");
20
+ between: function between(from, to) {
21
+ return "(".concat(BREAKPOINTS[from], " <= width < ").concat(BREAKPOINTS[to], ")");
28
22
  }
29
23
  };
30
24
 
31
- export { Breakpoints as default };
25
+ export { BREAKPOINTS, media };
@@ -1,3 +1,5 @@
1
+ export { BREAKPOINTS, media } from "./breakpoints";
2
+ export type { BreakpointName, Media } from "./breakpoints";
1
3
  export declare const THEMES: {
2
4
  JAIPUR: {
3
5
  "component-button-primary-bg": "var(--color-action-primary)";
@@ -1,6 +1,7 @@
1
1
  import { BUTTON_TOKENS } from '../Button/tokens.js';
2
2
  import theme_jaipur from './themes/jaipur.js';
3
3
  import THEME_BA from './themes/buenos_aires.js';
4
+ export { BREAKPOINTS, media } from './breakpoints.js';
4
5
 
5
6
  var THEMES = {
6
7
  JAIPUR: Object.assign(Object.assign({}, theme_jaipur), BUTTON_TOKENS),
@@ -1,5 +1,9 @@
1
- import type { BreakpointsTheme } from "../../Theme/breakpoints";
2
- export type QueryInputFunction = (breakpoints: BreakpointsTheme) => string;
1
+ import type { Media } from "../../Theme/breakpoints";
2
+ export type QueryInputFunction = (breakpoints: Media) => string;
3
3
  type QueryInput = QueryInputFunction | string;
4
+ /**
5
+ * Returns whether the media query matches.
6
+ * Returns `false` on the server and during hydration, the real value right after.
7
+ */
4
8
  export declare const useMediaSizes: (queryInput: QueryInput) => boolean;
5
9
  export {};
@@ -1,38 +1,32 @@
1
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
- import { useState, useEffect } from 'react';
3
- import Breakpoints from '../../Theme/breakpoints.js';
1
+ import { useCallback, useSyncExternalStore } from 'react';
2
+ import { media } from '../../Theme/breakpoints.js';
4
3
 
5
- var supportMatchMedia = typeof window !== "undefined" && typeof window.matchMedia !== "undefined";
4
+ var getServerSnapshot = function getServerSnapshot() {
5
+ return false;
6
+ };
7
+ var getMediaQueryList = function getMediaQueryList(query) {
8
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
9
+ };
10
+ /**
11
+ * Returns whether the media query matches.
12
+ * Returns `false` on the server and during hydration, the real value right after.
13
+ */
6
14
  var useMediaSizes = function useMediaSizes(queryInput) {
7
- var query = typeof queryInput === "function" ? queryInput(Breakpoints) : queryInput;
8
- query = query.replace(/^@media( ?)/m, "");
9
- var matchMedia = supportMatchMedia ? window.matchMedia : null;
10
- var _useState = useState(function () {
11
- if (matchMedia) {
12
- return matchMedia(query).matches;
13
- }
14
- return false;
15
- }),
16
- _useState2 = _slicedToArray(_useState, 2),
17
- match = _useState2[0],
18
- setMatch = _useState2[1];
19
- useEffect(function () {
20
- if (!matchMedia) return undefined;
21
- var active = true;
22
- var queryList = matchMedia(query);
23
- var updateMatch = function updateMatch() {
24
- if (active) {
25
- setMatch(queryList.matches);
26
- }
27
- };
28
- updateMatch();
29
- queryList.addEventListener("change", updateMatch);
15
+ // A function input is a new function every render: memoize on the query string.
16
+ var query = (typeof queryInput === "function" ? queryInput(media) : queryInput).replace(/^\s*@media\s*/, "");
17
+ var subscribe = useCallback(function (onChange) {
18
+ var queryList = getMediaQueryList(query);
19
+ if (!queryList) return function () {};
20
+ queryList.addEventListener("change", onChange);
30
21
  return function () {
31
- active = false;
32
- queryList.removeEventListener("change", updateMatch);
22
+ return queryList.removeEventListener("change", onChange);
33
23
  };
34
- });
35
- return match;
24
+ }, [query]);
25
+ var getSnapshot = useCallback(function () {
26
+ var _a, _b;
27
+ return (_b = (_a = getMediaQueryList(query)) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : false;
28
+ }, [query]);
29
+ return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
36
30
  };
37
31
 
38
32
  export { useMediaSizes };
package/esm/index.d.ts CHANGED
@@ -78,7 +78,8 @@ export { TabsPanels } from "./TabsPanels";
78
78
  export type { TabsPanelsProps } from "./TabsPanels/index.props";
79
79
  export { TextArea } from "./TextArea";
80
80
  export type { ITextAreaProps } from "./TextArea/index.props";
81
- export { THEMES } from "./Theme";
81
+ export { THEMES, BREAKPOINTS, media } from "./Theme";
82
+ export type { BreakpointName, Media } from "./Theme";
82
83
  export { TimeSelect } from "./TimeSelect";
83
84
  export type { TimeSelectProps } from "./TimeSelect/index.props";
84
85
  export { Tooltip } from "./Tooltip";
package/esm/index.js CHANGED
@@ -65,6 +65,7 @@ export { Setting } from './Icons/Setting.js';
65
65
  export { Shield } from './Icons/Shield.js';
66
66
  export { Trash } from './Icons/Trash.js';
67
67
  export { User } from './Icons/User.js';
68
+ export { BREAKPOINTS, media } from './Theme/breakpoints.js';
68
69
  export { Body as ModalBody } from './Modal/components/Body/index.js';
69
70
  export { Footer as ModalFooter } from './Modal/components/Footer/index.js';
70
71
  export { Header as ModalHeader } from './Modal/components/Header/index.js';
@@ -1,5 +1,9 @@
1
- import type { BreakpointsTheme } from "../../Theme/breakpoints";
2
- export type QueryInputFunction = (breakpoints: BreakpointsTheme) => string;
1
+ import type { Media } from "../../Theme/breakpoints";
2
+ export type QueryInputFunction = (breakpoints: Media) => string;
3
3
  type QueryInput = QueryInputFunction | string;
4
+ /**
5
+ * Returns whether the media query matches.
6
+ * Returns `false` on the server and during hydration, the real value right after.
7
+ */
4
8
  export declare const useMediaSizes: (queryInput: QueryInput) => boolean;
5
9
  export {};
@@ -1,44 +1,34 @@
1
1
  'use strict';
2
2
 
3
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
4
3
  var React = require('react');
5
4
  var breakpoints = require('../../Theme/breakpoints.js');
6
5
 
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
10
-
11
- var supportMatchMedia = typeof window !== "undefined" && typeof window.matchMedia !== "undefined";
6
+ var getServerSnapshot = function getServerSnapshot() {
7
+ return false;
8
+ };
9
+ var getMediaQueryList = function getMediaQueryList(query) {
10
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" ? window.matchMedia(query) : null;
11
+ };
12
+ /**
13
+ * Returns whether the media query matches.
14
+ * Returns `false` on the server and during hydration, the real value right after.
15
+ */
12
16
  var useMediaSizes = function useMediaSizes(queryInput) {
13
- var query = typeof queryInput === "function" ? queryInput(breakpoints.default) : queryInput;
14
- query = query.replace(/^@media( ?)/m, "");
15
- var matchMedia = supportMatchMedia ? window.matchMedia : null;
16
- var _useState = React.useState(function () {
17
- if (matchMedia) {
18
- return matchMedia(query).matches;
19
- }
20
- return false;
21
- }),
22
- _useState2 = _slicedToArray__default.default(_useState, 2),
23
- match = _useState2[0],
24
- setMatch = _useState2[1];
25
- React.useEffect(function () {
26
- if (!matchMedia) return undefined;
27
- var active = true;
28
- var queryList = matchMedia(query);
29
- var updateMatch = function updateMatch() {
30
- if (active) {
31
- setMatch(queryList.matches);
32
- }
33
- };
34
- updateMatch();
35
- queryList.addEventListener("change", updateMatch);
17
+ // A function input is a new function every render: memoize on the query string.
18
+ var query = (typeof queryInput === "function" ? queryInput(breakpoints.media) : queryInput).replace(/^\s*@media\s*/, "");
19
+ var subscribe = React.useCallback(function (onChange) {
20
+ var queryList = getMediaQueryList(query);
21
+ if (!queryList) return function () {};
22
+ queryList.addEventListener("change", onChange);
36
23
  return function () {
37
- active = false;
38
- queryList.removeEventListener("change", updateMatch);
24
+ return queryList.removeEventListener("change", onChange);
39
25
  };
40
- });
41
- return match;
26
+ }, [query]);
27
+ var getSnapshot = React.useCallback(function () {
28
+ var _a, _b;
29
+ return (_b = (_a = getMediaQueryList(query)) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : false;
30
+ }, [query]);
31
+ return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
42
32
  };
43
33
 
44
34
  exports.useMediaSizes = useMediaSizes;
package/index.d.ts CHANGED
@@ -78,7 +78,8 @@ export { TabsPanels } from "./TabsPanels";
78
78
  export type { TabsPanelsProps } from "./TabsPanels/index.props";
79
79
  export { TextArea } from "./TextArea";
80
80
  export type { ITextAreaProps } from "./TextArea/index.props";
81
- export { THEMES } from "./Theme";
81
+ export { THEMES, BREAKPOINTS, media } from "./Theme";
82
+ export type { BreakpointName, Media } from "./Theme";
82
83
  export { TimeSelect } from "./TimeSelect";
83
84
  export type { TimeSelectProps } from "./TimeSelect/index.props";
84
85
  export { Tooltip } from "./Tooltip";
package/index.js CHANGED
@@ -49,6 +49,7 @@ var index$B = require('./hooks/useScrollLock/index.js');
49
49
  require('./Icons/index.js');
50
50
  var ArrowNext = require('./Icons/ArrowNext.js');
51
51
  var Autocomplete = require('./Autocomplete/Autocomplete.js');
52
+ var breakpoints = require('./Theme/breakpoints.js');
52
53
  var Calendar = require('./Calendar/Calendar.js');
53
54
  var Card = require('./Card/Card.js');
54
55
  var Cart = require('./Icons/Cart.js');
@@ -124,6 +125,8 @@ exports.useMediaSizes = index$A.useMediaSizes;
124
125
  exports.useScrollLock = index$B.useScrollLock;
125
126
  exports.ArrowNext = ArrowNext.ArrowNext;
126
127
  exports.Autocomplete = Autocomplete.Autocomplete;
128
+ exports.BREAKPOINTS = breakpoints.BREAKPOINTS;
129
+ exports.media = breakpoints.media;
127
130
  exports.Calendar = Calendar.Calendar;
128
131
  exports.Card = Card.Card;
129
132
  exports.CardContent = Card.CardContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "colibri-ui",
3
- "version": "0.8.77",
3
+ "version": "0.8.80",
4
4
  "description": "React UI components library",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",