@yr3/ui 1.0.11 → 1.0.13

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 CHANGED
@@ -60,6 +60,7 @@ __export(index_exports, {
60
60
  Modal: () => Modal,
61
61
  ModalContainer: () => ModalContainer,
62
62
  Notistack: () => Notistack,
63
+ NotistackContext: () => NotistackContext,
63
64
  NotistackProvider: () => NotistackProvider,
64
65
  Pending: () => Pending,
65
66
  Phone: () => Phone,
@@ -76,6 +77,8 @@ __export(index_exports, {
76
77
  baseTokens: () => baseTokens,
77
78
  bem: () => bem,
78
79
  bemMerge: () => bemMerge,
80
+ breakDown: () => breakDown,
81
+ breakUp: () => breakUp,
79
82
  breakpoints: () => breakpoints,
80
83
  composeStyles: () => composeStyles,
81
84
  createPaletteColor: () => createPaletteColor,
@@ -94,6 +97,7 @@ __export(index_exports, {
94
97
  times: () => times,
95
98
  uiStyle: () => uiStyle,
96
99
  useBackdrop: () => useBackdrop,
100
+ useBreakpoint: () => useBreakpoint,
97
101
  useBreakpointValue: () => useBreakpointValue,
98
102
  useClickAway: () => useClickAway,
99
103
  useControl: () => useControl,
@@ -2592,16 +2596,51 @@ var IconSearch = (props) => {
2592
2596
  };
2593
2597
 
2594
2598
  // src/theme/ThemeProvider.tsx
2599
+ var React22 = __toESM(require("react"), 1);
2600
+
2601
+ // src/theme/notistackContext.tsx
2595
2602
  var React21 = __toESM(require("react"), 1);
2596
2603
  var import_jsx_runtime39 = require("react/jsx-runtime");
2597
- var ThemeContext = React21.createContext(null);
2604
+ var NotistackContext = React21.createContext(null);
2605
+ var NotistackProvider = ({ children }) => {
2606
+ const [snacks, setSnacks] = React21.useState([]);
2607
+ const notistack = (snack) => {
2608
+ const id = Date.now();
2609
+ setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
2610
+ const duration = snack.duration || 3e3;
2611
+ const exitDuration = 300;
2612
+ setTimeout(() => {
2613
+ setSnacks(
2614
+ (prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
2615
+ );
2616
+ }, duration);
2617
+ setTimeout(() => {
2618
+ setSnacks((prev) => prev.filter((s) => s.id !== id));
2619
+ }, duration + exitDuration);
2620
+ };
2621
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
2622
+ children,
2623
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Notistack, { ...snack }, snack.id)) })
2624
+ ] });
2625
+ };
2626
+ var useNotistack = () => {
2627
+ const ctx = React21.useContext(NotistackContext);
2628
+ if (!ctx) {
2629
+ throw new Error("NotistackProvider missing");
2630
+ }
2631
+ return ctx;
2632
+ };
2633
+
2634
+ // src/theme/ThemeProvider.tsx
2635
+ var import_jsx_runtime40 = require("react/jsx-runtime");
2636
+ var ThemeContext = React22.createContext(null);
2598
2637
  var ThemeProvider = ({ theme, children }) => {
2599
- React21.useEffect(() => {
2638
+ React22.useEffect(() => {
2600
2639
  applyTheme(theme);
2601
2640
  }, [theme]);
2602
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BackdropProvider, { children }) });
2641
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BackdropProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(NotistackProvider, { children }) }) });
2603
2642
  };
2604
- var useTheme = () => React21.useContext(ThemeContext);
2643
+ var useTheme = () => React22.useContext(ThemeContext);
2605
2644
 
2606
2645
  // src/theme/tokens.ts
2607
2646
  var baseTokens = {
@@ -2621,33 +2660,6 @@ var baseTokens = {
2621
2660
  }
2622
2661
  };
2623
2662
 
2624
- // src/theme/notistackContext.tsx
2625
- var React22 = __toESM(require("react"), 1);
2626
- var import_jsx_runtime40 = require("react/jsx-runtime");
2627
- var NotistackContext = React22.createContext(null);
2628
- var NotistackProvider = ({ children }) => {
2629
- const [snacks, setSnacks] = React22.useState([]);
2630
- const enqueueNotistack = (snack) => {
2631
- const id = Date.now();
2632
- setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
2633
- const duration = snack.duration || 3e3;
2634
- const exitDuration = 300;
2635
- setTimeout(() => {
2636
- setSnacks(
2637
- (prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
2638
- );
2639
- }, duration);
2640
- setTimeout(() => {
2641
- setSnacks((prev) => prev.filter((s) => s.id !== id));
2642
- }, duration + exitDuration);
2643
- };
2644
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(NotistackContext.Provider, { value: { enqueueNotistack }, children: [
2645
- children,
2646
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Notistack, { ...snack }, snack.id)) })
2647
- ] });
2648
- };
2649
- var useNotistack = () => React22.useContext(NotistackContext);
2650
-
2651
2663
  // src/theme/useMediaQuery.tsx
2652
2664
  var React23 = __toESM(require("react"), 1);
2653
2665
  function useMediaQuery(query) {
@@ -2690,6 +2702,41 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
2690
2702
  };
2691
2703
  };
2692
2704
 
2705
+ // src/hooks/useBreakpoint.ts
2706
+ var React24 = __toESM(require("react"), 1);
2707
+ var breakUp = (bp) => `(min-width: ${bp}px)`;
2708
+ var breakDown = (bp) => `(max-width: ${bp}px)`;
2709
+ function useBreakpoint(queryInput) {
2710
+ const theme = useTheme?.();
2711
+ const query = typeof queryInput === "function" ? queryInput(theme) : queryInput;
2712
+ const getMatch = () => {
2713
+ if (typeof window === "undefined") return false;
2714
+ return window.matchMedia(query).matches;
2715
+ };
2716
+ const [matches, setMatches] = React24.useState(getMatch);
2717
+ React24.useEffect(() => {
2718
+ if (typeof window === "undefined") return;
2719
+ const media = window.matchMedia(query);
2720
+ const listener = (e) => {
2721
+ setMatches(e.matches);
2722
+ };
2723
+ if (media.addEventListener) {
2724
+ media.addEventListener("change", listener);
2725
+ } else {
2726
+ media.removeEventListener("change", listener);
2727
+ }
2728
+ setMatches(media.matches);
2729
+ return () => {
2730
+ if (media.removeEventListener) {
2731
+ media.removeEventListener("change", listener);
2732
+ } else {
2733
+ media.removeEventListener("change", listener);
2734
+ }
2735
+ };
2736
+ }, [query]);
2737
+ return matches;
2738
+ }
2739
+
2693
2740
  // src/index.ts
2694
2741
  initTheme();
2695
2742
  // Annotate the CommonJS export names for ESM import in node:
@@ -2724,6 +2771,7 @@ initTheme();
2724
2771
  Modal,
2725
2772
  ModalContainer,
2726
2773
  Notistack,
2774
+ NotistackContext,
2727
2775
  NotistackProvider,
2728
2776
  Pending,
2729
2777
  Phone,
@@ -2740,6 +2788,8 @@ initTheme();
2740
2788
  baseTokens,
2741
2789
  bem,
2742
2790
  bemMerge,
2791
+ breakDown,
2792
+ breakUp,
2743
2793
  breakpoints,
2744
2794
  composeStyles,
2745
2795
  createPaletteColor,
@@ -2758,6 +2808,7 @@ initTheme();
2758
2808
  times,
2759
2809
  uiStyle,
2760
2810
  useBackdrop,
2811
+ useBreakpoint,
2761
2812
  useBreakpointValue,
2762
2813
  useClickAway,
2763
2814
  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: {
@@ -1079,8 +1079,105 @@ declare const baseTokens: {
1079
1079
  };
1080
1080
  };
1081
1081
 
1082
+ declare const bem: (block: string) => (element?: string, modifiers?: Record<string, any>) => string;
1083
+ declare const bemMerge: (...args: any[]) => string;
1084
+
1085
+ type CalendarDayProps = {
1086
+ day: number;
1087
+ date: Dayjs;
1088
+ isToday: boolean;
1089
+ isPast: boolean;
1090
+ isFuture: boolean;
1091
+ isCurrentMonth: boolean;
1092
+ selected: any;
1093
+ data?: any;
1094
+ };
1095
+ type CalendarComponentProps = {
1096
+ calendar: (CalendarDayProps | null)[][];
1097
+ month: number;
1098
+ monthLabel: string;
1099
+ yearLabel: string;
1100
+ daysContainer: number[];
1101
+ days: number;
1102
+ weeks: number;
1103
+ isWeekend: boolean;
1104
+ date: Dayjs;
1105
+ selected: CalendarDayProps | null;
1106
+ currentDay: CalendarDayProps;
1107
+ props?: any;
1108
+ };
1109
+ declare function getMonthCalendar(year: number, month: number, startIndex: number, selected: CalendarDayProps, props?: any): CalendarComponentProps;
1110
+
1111
+ declare const adjustColor: (hex: string, amount: number) => string;
1112
+ declare const getContrast: (hex: string) => "#000000" | "#ffffff";
1113
+ declare const createPaletteColor: (main: string) => PaletteColor;
1114
+
1115
+ declare function isEmpty(value: unknown): boolean;
1116
+ declare function times<T>(n: number, iteratee: (index: number) => T): T[];
1117
+
1118
+ declare const cx: (...args: any[]) => string;
1119
+
1120
+ type VariantConfig = {
1121
+ base: string;
1122
+ variants?: Record<string, Record<string, string>>;
1123
+ };
1124
+ declare const createVariants: (config: VariantConfig) => (props?: Record<string, any>) => string;
1125
+
1126
+ type CountriesDial = {
1127
+ code: string;
1128
+ dial: string;
1129
+ label: string;
1130
+ };
1131
+ declare const normalizePhone: (phone: string, dial: string) => {
1132
+ number: string;
1133
+ full: string;
1134
+ } | null;
1135
+ declare const getDialPhone: (phone: string, countries: CountriesDial[]) => string | null;
1136
+ declare const getCountryCodePhone: (phone: string, countries: CountriesDial[]) => string | null;
1137
+ declare const getNumberPhone: (phone: string, dial: string) => string;
1138
+
1139
+ type NotistackAnchorProps = {
1140
+ vertical: 'top' | 'bottom';
1141
+ horizontal: 'left' | 'center' | 'right';
1142
+ };
1143
+ type NotistackProps = {
1144
+ message: string;
1145
+ duration?: number;
1146
+ variant?: 'info' | 'success' | 'warning' | 'error';
1147
+ color?: keyof Theme['colors'];
1148
+ anchor?: NotistackAnchorProps;
1149
+ exiting?: boolean;
1150
+ propsComponent?: {
1151
+ notistack?: {
1152
+ ui?: UIProps;
1153
+ style?: React.CSSProperties;
1154
+ };
1155
+ container?: {
1156
+ ui?: UIProps;
1157
+ style?: React.CSSProperties;
1158
+ };
1159
+ progress?: {
1160
+ ui?: UIProps;
1161
+ style?: React.CSSProperties;
1162
+ };
1163
+ };
1164
+ };
1165
+ declare const Notistack: React.FC<NotistackProps>;
1166
+
1167
+ type Snack = NotistackProps & {
1168
+ id: number;
1169
+ message: string;
1170
+ duration?: number;
1171
+ variant?: 'success' | 'error' | 'info';
1172
+ exiting?: boolean;
1173
+ anchor?: NotistackAnchorProps;
1174
+ };
1175
+ type NotistackContextType = {
1176
+ notistack: (snack: Snack) => void;
1177
+ };
1178
+ declare const NotistackContext: React$1.Context<NotistackContextType | null>;
1082
1179
  declare const NotistackProvider: ({ children }: any) => react_jsx_runtime.JSX.Element;
1083
- declare const useNotistack: () => any;
1180
+ declare const useNotistack: () => NotistackContextType;
1084
1181
 
1085
1182
  declare function useMediaQuery(query: string | ((theme: any) => string)): boolean;
1086
1183
  type Breakpoint = keyof typeof breakpoints;
@@ -1355,63 +1452,6 @@ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAtt
1355
1452
  };
1356
1453
  } & React$1.RefAttributes<HTMLInputElement>>;
1357
1454
 
1358
- declare const bem: (block: string) => (element?: string, modifiers?: Record<string, any>) => string;
1359
- declare const bemMerge: (...args: any[]) => string;
1360
-
1361
- type CalendarDayProps = {
1362
- day: number;
1363
- date: Dayjs;
1364
- isToday: boolean;
1365
- isPast: boolean;
1366
- isFuture: boolean;
1367
- isCurrentMonth: boolean;
1368
- selected: any;
1369
- data?: any;
1370
- };
1371
- type CalendarComponentProps = {
1372
- calendar: (CalendarDayProps | null)[][];
1373
- month: number;
1374
- monthLabel: string;
1375
- yearLabel: string;
1376
- daysContainer: number[];
1377
- days: number;
1378
- weeks: number;
1379
- isWeekend: boolean;
1380
- date: Dayjs;
1381
- selected: CalendarDayProps | null;
1382
- currentDay: CalendarDayProps;
1383
- props?: any;
1384
- };
1385
- declare function getMonthCalendar(year: number, month: number, startIndex: number, selected: CalendarDayProps, props?: any): CalendarComponentProps;
1386
-
1387
- declare const adjustColor: (hex: string, amount: number) => string;
1388
- declare const getContrast: (hex: string) => "#000000" | "#ffffff";
1389
- declare const createPaletteColor: (main: string) => PaletteColor;
1390
-
1391
- declare function isEmpty(value: unknown): boolean;
1392
- declare function times<T>(n: number, iteratee: (index: number) => T): T[];
1393
-
1394
- declare const cx: (...args: any[]) => string;
1395
-
1396
- type VariantConfig = {
1397
- base: string;
1398
- variants?: Record<string, Record<string, string>>;
1399
- };
1400
- declare const createVariants: (config: VariantConfig) => (props?: Record<string, any>) => string;
1401
-
1402
- type CountriesDial = {
1403
- code: string;
1404
- dial: string;
1405
- label: string;
1406
- };
1407
- declare const normalizePhone: (phone: string, dial: string) => {
1408
- number: string;
1409
- full: string;
1410
- } | null;
1411
- declare const getDialPhone: (phone: string, countries: CountriesDial[]) => string | null;
1412
- declare const getCountryCodePhone: (phone: string, countries: CountriesDial[]) => string | null;
1413
- declare const getNumberPhone: (phone: string, dial: string) => string;
1414
-
1415
1455
  type InputAreaVariant = 'filled' | 'outlined' | 'base' | 'lined';
1416
1456
  type InputAreaProps = {
1417
1457
  value?: string;
@@ -1454,34 +1494,6 @@ type ModalProps = {
1454
1494
  };
1455
1495
  declare const Modal: React$1.FC<ModalProps>;
1456
1496
 
1457
- type NotistackAnchorProps = {
1458
- vertical: 'top' | 'bottom';
1459
- horizontal: 'left' | 'center' | 'right';
1460
- };
1461
- type NotistackProps = {
1462
- message: string;
1463
- duration?: number;
1464
- variant?: 'info' | 'success' | 'warning' | 'error';
1465
- color?: keyof Theme['colors'];
1466
- anchor?: NotistackAnchorProps;
1467
- exiting?: boolean;
1468
- propsComponent?: {
1469
- notistack?: {
1470
- ui?: UIProps;
1471
- style?: React.CSSProperties;
1472
- };
1473
- container?: {
1474
- ui?: UIProps;
1475
- style?: React.CSSProperties;
1476
- };
1477
- progress?: {
1478
- ui?: UIProps;
1479
- style?: React.CSSProperties;
1480
- };
1481
- };
1482
- };
1483
- declare const Notistack: React.FC<NotistackProps>;
1484
-
1485
1497
  type PendingProps = {
1486
1498
  variant?: 'rect' | 'circle' | 'text';
1487
1499
  width?: number | string;
@@ -1701,4 +1713,9 @@ declare const usePlaces: ({ input, language, apiKey, provider }: UsePlacesProps)
1701
1713
  selectPlace: (id: string) => Promise<_yr3_autocomplete_places.Place>;
1702
1714
  };
1703
1715
 
1704
- 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, breakpoints, composeStyles, createPaletteColor, createTheme, createVariants, cx, getContrast, getCountryCodePhone, getDialPhone, getMonthCalendar, getNumberPhone, initTheme, isEmpty, normalizePhone, text, times, uiStyle, useBackdrop, useBreakpointValue, useClickAway, useControl, useMediaQuery, useNotistack, usePlaces, useTheme };
1716
+ type QueryInput = string | ((theme: any) => string);
1717
+ declare const breakUp: (bp: number) => string;
1718
+ declare const breakDown: (bp: number) => string;
1719
+ declare function useBreakpoint(queryInput: QueryInput): boolean;
1720
+
1721
+ 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, NotistackContext, type NotistackContextType, 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, type Snack, 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: {
@@ -1079,8 +1079,105 @@ declare const baseTokens: {
1079
1079
  };
1080
1080
  };
1081
1081
 
1082
+ declare const bem: (block: string) => (element?: string, modifiers?: Record<string, any>) => string;
1083
+ declare const bemMerge: (...args: any[]) => string;
1084
+
1085
+ type CalendarDayProps = {
1086
+ day: number;
1087
+ date: Dayjs;
1088
+ isToday: boolean;
1089
+ isPast: boolean;
1090
+ isFuture: boolean;
1091
+ isCurrentMonth: boolean;
1092
+ selected: any;
1093
+ data?: any;
1094
+ };
1095
+ type CalendarComponentProps = {
1096
+ calendar: (CalendarDayProps | null)[][];
1097
+ month: number;
1098
+ monthLabel: string;
1099
+ yearLabel: string;
1100
+ daysContainer: number[];
1101
+ days: number;
1102
+ weeks: number;
1103
+ isWeekend: boolean;
1104
+ date: Dayjs;
1105
+ selected: CalendarDayProps | null;
1106
+ currentDay: CalendarDayProps;
1107
+ props?: any;
1108
+ };
1109
+ declare function getMonthCalendar(year: number, month: number, startIndex: number, selected: CalendarDayProps, props?: any): CalendarComponentProps;
1110
+
1111
+ declare const adjustColor: (hex: string, amount: number) => string;
1112
+ declare const getContrast: (hex: string) => "#000000" | "#ffffff";
1113
+ declare const createPaletteColor: (main: string) => PaletteColor;
1114
+
1115
+ declare function isEmpty(value: unknown): boolean;
1116
+ declare function times<T>(n: number, iteratee: (index: number) => T): T[];
1117
+
1118
+ declare const cx: (...args: any[]) => string;
1119
+
1120
+ type VariantConfig = {
1121
+ base: string;
1122
+ variants?: Record<string, Record<string, string>>;
1123
+ };
1124
+ declare const createVariants: (config: VariantConfig) => (props?: Record<string, any>) => string;
1125
+
1126
+ type CountriesDial = {
1127
+ code: string;
1128
+ dial: string;
1129
+ label: string;
1130
+ };
1131
+ declare const normalizePhone: (phone: string, dial: string) => {
1132
+ number: string;
1133
+ full: string;
1134
+ } | null;
1135
+ declare const getDialPhone: (phone: string, countries: CountriesDial[]) => string | null;
1136
+ declare const getCountryCodePhone: (phone: string, countries: CountriesDial[]) => string | null;
1137
+ declare const getNumberPhone: (phone: string, dial: string) => string;
1138
+
1139
+ type NotistackAnchorProps = {
1140
+ vertical: 'top' | 'bottom';
1141
+ horizontal: 'left' | 'center' | 'right';
1142
+ };
1143
+ type NotistackProps = {
1144
+ message: string;
1145
+ duration?: number;
1146
+ variant?: 'info' | 'success' | 'warning' | 'error';
1147
+ color?: keyof Theme['colors'];
1148
+ anchor?: NotistackAnchorProps;
1149
+ exiting?: boolean;
1150
+ propsComponent?: {
1151
+ notistack?: {
1152
+ ui?: UIProps;
1153
+ style?: React.CSSProperties;
1154
+ };
1155
+ container?: {
1156
+ ui?: UIProps;
1157
+ style?: React.CSSProperties;
1158
+ };
1159
+ progress?: {
1160
+ ui?: UIProps;
1161
+ style?: React.CSSProperties;
1162
+ };
1163
+ };
1164
+ };
1165
+ declare const Notistack: React.FC<NotistackProps>;
1166
+
1167
+ type Snack = NotistackProps & {
1168
+ id: number;
1169
+ message: string;
1170
+ duration?: number;
1171
+ variant?: 'success' | 'error' | 'info';
1172
+ exiting?: boolean;
1173
+ anchor?: NotistackAnchorProps;
1174
+ };
1175
+ type NotistackContextType = {
1176
+ notistack: (snack: Snack) => void;
1177
+ };
1178
+ declare const NotistackContext: React$1.Context<NotistackContextType | null>;
1082
1179
  declare const NotistackProvider: ({ children }: any) => react_jsx_runtime.JSX.Element;
1083
- declare const useNotistack: () => any;
1180
+ declare const useNotistack: () => NotistackContextType;
1084
1181
 
1085
1182
  declare function useMediaQuery(query: string | ((theme: any) => string)): boolean;
1086
1183
  type Breakpoint = keyof typeof breakpoints;
@@ -1355,63 +1452,6 @@ declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.InputHTMLAtt
1355
1452
  };
1356
1453
  } & React$1.RefAttributes<HTMLInputElement>>;
1357
1454
 
1358
- declare const bem: (block: string) => (element?: string, modifiers?: Record<string, any>) => string;
1359
- declare const bemMerge: (...args: any[]) => string;
1360
-
1361
- type CalendarDayProps = {
1362
- day: number;
1363
- date: Dayjs;
1364
- isToday: boolean;
1365
- isPast: boolean;
1366
- isFuture: boolean;
1367
- isCurrentMonth: boolean;
1368
- selected: any;
1369
- data?: any;
1370
- };
1371
- type CalendarComponentProps = {
1372
- calendar: (CalendarDayProps | null)[][];
1373
- month: number;
1374
- monthLabel: string;
1375
- yearLabel: string;
1376
- daysContainer: number[];
1377
- days: number;
1378
- weeks: number;
1379
- isWeekend: boolean;
1380
- date: Dayjs;
1381
- selected: CalendarDayProps | null;
1382
- currentDay: CalendarDayProps;
1383
- props?: any;
1384
- };
1385
- declare function getMonthCalendar(year: number, month: number, startIndex: number, selected: CalendarDayProps, props?: any): CalendarComponentProps;
1386
-
1387
- declare const adjustColor: (hex: string, amount: number) => string;
1388
- declare const getContrast: (hex: string) => "#000000" | "#ffffff";
1389
- declare const createPaletteColor: (main: string) => PaletteColor;
1390
-
1391
- declare function isEmpty(value: unknown): boolean;
1392
- declare function times<T>(n: number, iteratee: (index: number) => T): T[];
1393
-
1394
- declare const cx: (...args: any[]) => string;
1395
-
1396
- type VariantConfig = {
1397
- base: string;
1398
- variants?: Record<string, Record<string, string>>;
1399
- };
1400
- declare const createVariants: (config: VariantConfig) => (props?: Record<string, any>) => string;
1401
-
1402
- type CountriesDial = {
1403
- code: string;
1404
- dial: string;
1405
- label: string;
1406
- };
1407
- declare const normalizePhone: (phone: string, dial: string) => {
1408
- number: string;
1409
- full: string;
1410
- } | null;
1411
- declare const getDialPhone: (phone: string, countries: CountriesDial[]) => string | null;
1412
- declare const getCountryCodePhone: (phone: string, countries: CountriesDial[]) => string | null;
1413
- declare const getNumberPhone: (phone: string, dial: string) => string;
1414
-
1415
1455
  type InputAreaVariant = 'filled' | 'outlined' | 'base' | 'lined';
1416
1456
  type InputAreaProps = {
1417
1457
  value?: string;
@@ -1454,34 +1494,6 @@ type ModalProps = {
1454
1494
  };
1455
1495
  declare const Modal: React$1.FC<ModalProps>;
1456
1496
 
1457
- type NotistackAnchorProps = {
1458
- vertical: 'top' | 'bottom';
1459
- horizontal: 'left' | 'center' | 'right';
1460
- };
1461
- type NotistackProps = {
1462
- message: string;
1463
- duration?: number;
1464
- variant?: 'info' | 'success' | 'warning' | 'error';
1465
- color?: keyof Theme['colors'];
1466
- anchor?: NotistackAnchorProps;
1467
- exiting?: boolean;
1468
- propsComponent?: {
1469
- notistack?: {
1470
- ui?: UIProps;
1471
- style?: React.CSSProperties;
1472
- };
1473
- container?: {
1474
- ui?: UIProps;
1475
- style?: React.CSSProperties;
1476
- };
1477
- progress?: {
1478
- ui?: UIProps;
1479
- style?: React.CSSProperties;
1480
- };
1481
- };
1482
- };
1483
- declare const Notistack: React.FC<NotistackProps>;
1484
-
1485
1497
  type PendingProps = {
1486
1498
  variant?: 'rect' | 'circle' | 'text';
1487
1499
  width?: number | string;
@@ -1701,4 +1713,9 @@ declare const usePlaces: ({ input, language, apiKey, provider }: UsePlacesProps)
1701
1713
  selectPlace: (id: string) => Promise<_yr3_autocomplete_places.Place>;
1702
1714
  };
1703
1715
 
1704
- 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, breakpoints, composeStyles, createPaletteColor, createTheme, createVariants, cx, getContrast, getCountryCodePhone, getDialPhone, getMonthCalendar, getNumberPhone, initTheme, isEmpty, normalizePhone, text, times, uiStyle, useBackdrop, useBreakpointValue, useClickAway, useControl, useMediaQuery, useNotistack, usePlaces, useTheme };
1716
+ type QueryInput = string | ((theme: any) => string);
1717
+ declare const breakUp: (bp: number) => string;
1718
+ declare const breakDown: (bp: number) => string;
1719
+ declare function useBreakpoint(queryInput: QueryInput): boolean;
1720
+
1721
+ 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, NotistackContext, type NotistackContextType, 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, type Snack, 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
@@ -2486,16 +2486,51 @@ var IconSearch = (props) => {
2486
2486
  };
2487
2487
 
2488
2488
  // src/theme/ThemeProvider.tsx
2489
+ import * as React22 from "react";
2490
+
2491
+ // src/theme/notistackContext.tsx
2489
2492
  import * as React21 from "react";
2490
- import { jsx as jsx39 } from "react/jsx-runtime";
2491
- var ThemeContext = React21.createContext(null);
2493
+ import { jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
2494
+ var NotistackContext = React21.createContext(null);
2495
+ var NotistackProvider = ({ children }) => {
2496
+ const [snacks, setSnacks] = React21.useState([]);
2497
+ const notistack = (snack) => {
2498
+ const id = Date.now();
2499
+ setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
2500
+ const duration = snack.duration || 3e3;
2501
+ const exitDuration = 300;
2502
+ setTimeout(() => {
2503
+ setSnacks(
2504
+ (prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
2505
+ );
2506
+ }, duration);
2507
+ setTimeout(() => {
2508
+ setSnacks((prev) => prev.filter((s) => s.id !== id));
2509
+ }, duration + exitDuration);
2510
+ };
2511
+ return /* @__PURE__ */ jsxs16(NotistackContext.Provider, { value: { notistack }, children: [
2512
+ children,
2513
+ /* @__PURE__ */ jsx39("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx39(Notistack, { ...snack }, snack.id)) })
2514
+ ] });
2515
+ };
2516
+ var useNotistack = () => {
2517
+ const ctx = React21.useContext(NotistackContext);
2518
+ if (!ctx) {
2519
+ throw new Error("NotistackProvider missing");
2520
+ }
2521
+ return ctx;
2522
+ };
2523
+
2524
+ // src/theme/ThemeProvider.tsx
2525
+ import { jsx as jsx40 } from "react/jsx-runtime";
2526
+ var ThemeContext = React22.createContext(null);
2492
2527
  var ThemeProvider = ({ theme, children }) => {
2493
- React21.useEffect(() => {
2528
+ React22.useEffect(() => {
2494
2529
  applyTheme(theme);
2495
2530
  }, [theme]);
2496
- return /* @__PURE__ */ jsx39(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx39(BackdropProvider, { children }) });
2531
+ return /* @__PURE__ */ jsx40(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx40(BackdropProvider, { children: /* @__PURE__ */ jsx40(NotistackProvider, { children }) }) });
2497
2532
  };
2498
- var useTheme = () => React21.useContext(ThemeContext);
2533
+ var useTheme = () => React22.useContext(ThemeContext);
2499
2534
 
2500
2535
  // src/theme/tokens.ts
2501
2536
  var baseTokens = {
@@ -2515,33 +2550,6 @@ var baseTokens = {
2515
2550
  }
2516
2551
  };
2517
2552
 
2518
- // src/theme/notistackContext.tsx
2519
- import * as React22 from "react";
2520
- import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
2521
- var NotistackContext = React22.createContext(null);
2522
- var NotistackProvider = ({ children }) => {
2523
- const [snacks, setSnacks] = React22.useState([]);
2524
- const enqueueNotistack = (snack) => {
2525
- const id = Date.now();
2526
- setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
2527
- const duration = snack.duration || 3e3;
2528
- const exitDuration = 300;
2529
- setTimeout(() => {
2530
- setSnacks(
2531
- (prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
2532
- );
2533
- }, duration);
2534
- setTimeout(() => {
2535
- setSnacks((prev) => prev.filter((s) => s.id !== id));
2536
- }, duration + exitDuration);
2537
- };
2538
- return /* @__PURE__ */ jsxs16(NotistackContext.Provider, { value: { enqueueNotistack }, children: [
2539
- children,
2540
- /* @__PURE__ */ jsx40("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx40(Notistack, { ...snack }, snack.id)) })
2541
- ] });
2542
- };
2543
- var useNotistack = () => React22.useContext(NotistackContext);
2544
-
2545
2553
  // src/theme/useMediaQuery.tsx
2546
2554
  import * as React23 from "react";
2547
2555
  function useMediaQuery(query) {
@@ -2584,6 +2592,41 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
2584
2592
  };
2585
2593
  };
2586
2594
 
2595
+ // src/hooks/useBreakpoint.ts
2596
+ import * as React24 from "react";
2597
+ var breakUp = (bp) => `(min-width: ${bp}px)`;
2598
+ var breakDown = (bp) => `(max-width: ${bp}px)`;
2599
+ function useBreakpoint(queryInput) {
2600
+ const theme = useTheme?.();
2601
+ const query = typeof queryInput === "function" ? queryInput(theme) : queryInput;
2602
+ const getMatch = () => {
2603
+ if (typeof window === "undefined") return false;
2604
+ return window.matchMedia(query).matches;
2605
+ };
2606
+ const [matches, setMatches] = React24.useState(getMatch);
2607
+ React24.useEffect(() => {
2608
+ if (typeof window === "undefined") return;
2609
+ const media = window.matchMedia(query);
2610
+ const listener = (e) => {
2611
+ setMatches(e.matches);
2612
+ };
2613
+ if (media.addEventListener) {
2614
+ media.addEventListener("change", listener);
2615
+ } else {
2616
+ media.removeEventListener("change", listener);
2617
+ }
2618
+ setMatches(media.matches);
2619
+ return () => {
2620
+ if (media.removeEventListener) {
2621
+ media.removeEventListener("change", listener);
2622
+ } else {
2623
+ media.removeEventListener("change", listener);
2624
+ }
2625
+ };
2626
+ }, [query]);
2627
+ return matches;
2628
+ }
2629
+
2587
2630
  // src/index.ts
2588
2631
  initTheme();
2589
2632
  export {
@@ -2617,6 +2660,7 @@ export {
2617
2660
  Modal,
2618
2661
  ModalContainer,
2619
2662
  Notistack,
2663
+ NotistackContext,
2620
2664
  NotistackProvider,
2621
2665
  Pending,
2622
2666
  Phone,
@@ -2633,6 +2677,8 @@ export {
2633
2677
  baseTokens,
2634
2678
  bem,
2635
2679
  bemMerge,
2680
+ breakDown,
2681
+ breakUp,
2636
2682
  breakpoints,
2637
2683
  composeStyles,
2638
2684
  createPaletteColor,
@@ -2651,6 +2697,7 @@ export {
2651
2697
  times,
2652
2698
  uiStyle,
2653
2699
  useBackdrop,
2700
+ useBreakpoint,
2654
2701
  useBreakpointValue,
2655
2702
  useClickAway,
2656
2703
  useControl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yr3/ui",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",