@yr3/ui 1.0.11 → 1.0.12
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/dist/index.cjs +41 -0
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +38 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -76,6 +76,8 @@ __export(index_exports, {
|
|
|
76
76
|
baseTokens: () => baseTokens,
|
|
77
77
|
bem: () => bem,
|
|
78
78
|
bemMerge: () => bemMerge,
|
|
79
|
+
breakDown: () => breakDown,
|
|
80
|
+
breakUp: () => breakUp,
|
|
79
81
|
breakpoints: () => breakpoints,
|
|
80
82
|
composeStyles: () => composeStyles,
|
|
81
83
|
createPaletteColor: () => createPaletteColor,
|
|
@@ -94,6 +96,7 @@ __export(index_exports, {
|
|
|
94
96
|
times: () => times,
|
|
95
97
|
uiStyle: () => uiStyle,
|
|
96
98
|
useBackdrop: () => useBackdrop,
|
|
99
|
+
useBreakpoint: () => useBreakpoint,
|
|
97
100
|
useBreakpointValue: () => useBreakpointValue,
|
|
98
101
|
useClickAway: () => useClickAway,
|
|
99
102
|
useControl: () => useControl,
|
|
@@ -2690,6 +2693,41 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
2690
2693
|
};
|
|
2691
2694
|
};
|
|
2692
2695
|
|
|
2696
|
+
// src/hooks/useBreakpoint.ts
|
|
2697
|
+
var React24 = __toESM(require("react"), 1);
|
|
2698
|
+
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
2699
|
+
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
2700
|
+
function useBreakpoint(queryInput) {
|
|
2701
|
+
const theme = useTheme?.();
|
|
2702
|
+
const query = typeof queryInput === "function" ? queryInput(theme) : queryInput;
|
|
2703
|
+
const getMatch = () => {
|
|
2704
|
+
if (typeof window === "undefined") return false;
|
|
2705
|
+
return window.matchMedia(query).matches;
|
|
2706
|
+
};
|
|
2707
|
+
const [matches, setMatches] = React24.useState(getMatch);
|
|
2708
|
+
React24.useEffect(() => {
|
|
2709
|
+
if (typeof window === "undefined") return;
|
|
2710
|
+
const media = window.matchMedia(query);
|
|
2711
|
+
const listener = (e) => {
|
|
2712
|
+
setMatches(e.matches);
|
|
2713
|
+
};
|
|
2714
|
+
if (media.addEventListener) {
|
|
2715
|
+
media.addEventListener("change", listener);
|
|
2716
|
+
} else {
|
|
2717
|
+
media.removeEventListener("change", listener);
|
|
2718
|
+
}
|
|
2719
|
+
setMatches(media.matches);
|
|
2720
|
+
return () => {
|
|
2721
|
+
if (media.removeEventListener) {
|
|
2722
|
+
media.removeEventListener("change", listener);
|
|
2723
|
+
} else {
|
|
2724
|
+
media.removeEventListener("change", listener);
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
}, [query]);
|
|
2728
|
+
return matches;
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2693
2731
|
// src/index.ts
|
|
2694
2732
|
initTheme();
|
|
2695
2733
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2740,6 +2778,8 @@ initTheme();
|
|
|
2740
2778
|
baseTokens,
|
|
2741
2779
|
bem,
|
|
2742
2780
|
bemMerge,
|
|
2781
|
+
breakDown,
|
|
2782
|
+
breakUp,
|
|
2743
2783
|
breakpoints,
|
|
2744
2784
|
composeStyles,
|
|
2745
2785
|
createPaletteColor,
|
|
@@ -2758,6 +2798,7 @@ initTheme();
|
|
|
2758
2798
|
times,
|
|
2759
2799
|
uiStyle,
|
|
2760
2800
|
useBackdrop,
|
|
2801
|
+
useBreakpoint,
|
|
2761
2802
|
useBreakpointValue,
|
|
2762
2803
|
useClickAway,
|
|
2763
2804
|
useControl,
|
package/dist/index.d.cts
CHANGED
|
@@ -1054,13 +1054,13 @@ declare const useControl: () => null;
|
|
|
1054
1054
|
|
|
1055
1055
|
declare function initTheme(): void;
|
|
1056
1056
|
|
|
1057
|
-
declare const ThemeContext: React$1.Context<null>;
|
|
1057
|
+
declare const ThemeContext: React$1.Context<Theme | null>;
|
|
1058
1058
|
type ThemeProviderProps = {
|
|
1059
1059
|
theme: any;
|
|
1060
1060
|
children: React$1.ReactNode;
|
|
1061
1061
|
};
|
|
1062
1062
|
declare const ThemeProvider: React$1.FC<ThemeProviderProps>;
|
|
1063
|
-
declare const useTheme: () => null;
|
|
1063
|
+
declare const useTheme: () => Theme | null;
|
|
1064
1064
|
|
|
1065
1065
|
declare const baseTokens: {
|
|
1066
1066
|
colors: {
|
|
@@ -1701,4 +1701,9 @@ declare const usePlaces: ({ input, language, apiKey, provider }: UsePlacesProps)
|
|
|
1701
1701
|
selectPlace: (id: string) => Promise<_yr3_autocomplete_places.Place>;
|
|
1702
1702
|
};
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
type QueryInput = string | ((theme: any) => string);
|
|
1705
|
+
declare const breakUp: (bp: number) => string;
|
|
1706
|
+
declare const breakDown: (bp: number) => string;
|
|
1707
|
+
declare function useBreakpoint(queryInput: QueryInput): boolean;
|
|
1708
|
+
|
|
1709
|
+
export { Avatar, type AvatarProps, Backdrop, BackdropContext, type BackdropContextType, BackdropProvider, Box, type BoxProps, Button, type ButtonProps, type ButtonVariant, Calendar, type CalendarComponentProps, type CalendarDayProps, type CalendarProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Collapse, type CollapseProps, Container, type ContainerProps, Control, ControlContext, type ControlProps, type ControlVariants, type CountriesDial, Divider, type DividerProps, Drawer, type DrawerProps, Fade, type FadeProps, Flex, type FlexProps, Grid, type GridProps, Group, type GroupProps, type GroupsVariant, IconClose, IconDown, IconSearch, Image, ImageDropzone, type ImageProps, Input, InputArea, type InputAreaProps, type InputAreaVariant, type InputProps, Label, type LabelProps, Modal, ModalContainer, type ModalContainerProps, type ModalProps, Notistack, type NotistackAnchorProps, type NotistackProps, NotistackProvider, type Option, Pending, type PendingProps, Phone, type PhoneInputProps, type PlaceData, PlacesAutocomplete, type PropsPlaces, Radio, type RadioVariant, Select, type SelectChangeEvent, type SelectOptionsProps, type SelectProps, type SelectorChangeEvent, type SelectorProps, Slide, type SlideContentProps, type SlideProps, Switch, type SwitchProps, Text, type TextProps, type TextVariant, type TextWeight, type Theme, ThemeContext, ThemeProvider, type UIProps, adjustColor, applyTheme, baseTokens, bem, bemMerge, breakDown, breakUp, breakpoints, composeStyles, createPaletteColor, createTheme, createVariants, cx, getContrast, getCountryCodePhone, getDialPhone, getMonthCalendar, getNumberPhone, initTheme, isEmpty, normalizePhone, text, times, uiStyle, useBackdrop, useBreakpoint, useBreakpointValue, useClickAway, useControl, useMediaQuery, useNotistack, usePlaces, useTheme };
|
package/dist/index.d.ts
CHANGED
|
@@ -1054,13 +1054,13 @@ declare const useControl: () => null;
|
|
|
1054
1054
|
|
|
1055
1055
|
declare function initTheme(): void;
|
|
1056
1056
|
|
|
1057
|
-
declare const ThemeContext: React$1.Context<null>;
|
|
1057
|
+
declare const ThemeContext: React$1.Context<Theme | null>;
|
|
1058
1058
|
type ThemeProviderProps = {
|
|
1059
1059
|
theme: any;
|
|
1060
1060
|
children: React$1.ReactNode;
|
|
1061
1061
|
};
|
|
1062
1062
|
declare const ThemeProvider: React$1.FC<ThemeProviderProps>;
|
|
1063
|
-
declare const useTheme: () => null;
|
|
1063
|
+
declare const useTheme: () => Theme | null;
|
|
1064
1064
|
|
|
1065
1065
|
declare const baseTokens: {
|
|
1066
1066
|
colors: {
|
|
@@ -1701,4 +1701,9 @@ declare const usePlaces: ({ input, language, apiKey, provider }: UsePlacesProps)
|
|
|
1701
1701
|
selectPlace: (id: string) => Promise<_yr3_autocomplete_places.Place>;
|
|
1702
1702
|
};
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
type QueryInput = string | ((theme: any) => string);
|
|
1705
|
+
declare const breakUp: (bp: number) => string;
|
|
1706
|
+
declare const breakDown: (bp: number) => string;
|
|
1707
|
+
declare function useBreakpoint(queryInput: QueryInput): boolean;
|
|
1708
|
+
|
|
1709
|
+
export { Avatar, type AvatarProps, Backdrop, BackdropContext, type BackdropContextType, BackdropProvider, Box, type BoxProps, Button, type ButtonProps, type ButtonVariant, Calendar, type CalendarComponentProps, type CalendarDayProps, type CalendarProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Collapse, type CollapseProps, Container, type ContainerProps, Control, ControlContext, type ControlProps, type ControlVariants, type CountriesDial, Divider, type DividerProps, Drawer, type DrawerProps, Fade, type FadeProps, Flex, type FlexProps, Grid, type GridProps, Group, type GroupProps, type GroupsVariant, IconClose, IconDown, IconSearch, Image, ImageDropzone, type ImageProps, Input, InputArea, type InputAreaProps, type InputAreaVariant, type InputProps, Label, type LabelProps, Modal, ModalContainer, type ModalContainerProps, type ModalProps, Notistack, type NotistackAnchorProps, type NotistackProps, NotistackProvider, type Option, Pending, type PendingProps, Phone, type PhoneInputProps, type PlaceData, PlacesAutocomplete, type PropsPlaces, Radio, type RadioVariant, Select, type SelectChangeEvent, type SelectOptionsProps, type SelectProps, type SelectorChangeEvent, type SelectorProps, Slide, type SlideContentProps, type SlideProps, Switch, type SwitchProps, Text, type TextProps, type TextVariant, type TextWeight, type Theme, ThemeContext, ThemeProvider, type UIProps, adjustColor, applyTheme, baseTokens, bem, bemMerge, breakDown, breakUp, breakpoints, composeStyles, createPaletteColor, createTheme, createVariants, cx, getContrast, getCountryCodePhone, getDialPhone, getMonthCalendar, getNumberPhone, initTheme, isEmpty, normalizePhone, text, times, uiStyle, useBackdrop, useBreakpoint, useBreakpointValue, useClickAway, useControl, useMediaQuery, useNotistack, usePlaces, useTheme };
|
package/dist/index.js
CHANGED
|
@@ -2584,6 +2584,41 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
2584
2584
|
};
|
|
2585
2585
|
};
|
|
2586
2586
|
|
|
2587
|
+
// src/hooks/useBreakpoint.ts
|
|
2588
|
+
import * as React24 from "react";
|
|
2589
|
+
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
2590
|
+
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
2591
|
+
function useBreakpoint(queryInput) {
|
|
2592
|
+
const theme = useTheme?.();
|
|
2593
|
+
const query = typeof queryInput === "function" ? queryInput(theme) : queryInput;
|
|
2594
|
+
const getMatch = () => {
|
|
2595
|
+
if (typeof window === "undefined") return false;
|
|
2596
|
+
return window.matchMedia(query).matches;
|
|
2597
|
+
};
|
|
2598
|
+
const [matches, setMatches] = React24.useState(getMatch);
|
|
2599
|
+
React24.useEffect(() => {
|
|
2600
|
+
if (typeof window === "undefined") return;
|
|
2601
|
+
const media = window.matchMedia(query);
|
|
2602
|
+
const listener = (e) => {
|
|
2603
|
+
setMatches(e.matches);
|
|
2604
|
+
};
|
|
2605
|
+
if (media.addEventListener) {
|
|
2606
|
+
media.addEventListener("change", listener);
|
|
2607
|
+
} else {
|
|
2608
|
+
media.removeEventListener("change", listener);
|
|
2609
|
+
}
|
|
2610
|
+
setMatches(media.matches);
|
|
2611
|
+
return () => {
|
|
2612
|
+
if (media.removeEventListener) {
|
|
2613
|
+
media.removeEventListener("change", listener);
|
|
2614
|
+
} else {
|
|
2615
|
+
media.removeEventListener("change", listener);
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
}, [query]);
|
|
2619
|
+
return matches;
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2587
2622
|
// src/index.ts
|
|
2588
2623
|
initTheme();
|
|
2589
2624
|
export {
|
|
@@ -2633,6 +2668,8 @@ export {
|
|
|
2633
2668
|
baseTokens,
|
|
2634
2669
|
bem,
|
|
2635
2670
|
bemMerge,
|
|
2671
|
+
breakDown,
|
|
2672
|
+
breakUp,
|
|
2636
2673
|
breakpoints,
|
|
2637
2674
|
composeStyles,
|
|
2638
2675
|
createPaletteColor,
|
|
@@ -2651,6 +2688,7 @@ export {
|
|
|
2651
2688
|
times,
|
|
2652
2689
|
uiStyle,
|
|
2653
2690
|
useBackdrop,
|
|
2691
|
+
useBreakpoint,
|
|
2654
2692
|
useBreakpointValue,
|
|
2655
2693
|
useClickAway,
|
|
2656
2694
|
useControl,
|