@zuzjs/ui 0.7.8 → 0.8.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.
Files changed (248) hide show
  1. package/dist/cjs/comps/Alert/index.d.ts +2 -2
  2. package/dist/cjs/comps/Alert/index.js +1 -1
  3. package/dist/cjs/comps/Alert/types.d.ts +3 -2
  4. package/dist/cjs/comps/Box/index.d.ts +1 -2
  5. package/dist/cjs/comps/Box/index.js +14 -12
  6. package/dist/cjs/comps/Button/index.d.ts +1 -1
  7. package/dist/cjs/comps/Button/types.d.ts +1 -1
  8. package/dist/cjs/comps/ColorScheme/index.d.ts +3 -2
  9. package/dist/cjs/comps/ColorScheme/index.js +24 -9
  10. package/dist/cjs/comps/ColorScheme/types.d.ts +4 -0
  11. package/dist/cjs/comps/ColorScheme/types.js +1 -0
  12. package/dist/cjs/comps/ContextMenu/index.js +1 -2
  13. package/dist/cjs/comps/Cover/index.js +1 -1
  14. package/dist/cjs/comps/Crumb/index.d.ts +4 -0
  15. package/dist/cjs/comps/Crumb/index.js +13 -0
  16. package/dist/cjs/comps/Crumb/types.d.ts +11 -0
  17. package/dist/cjs/comps/Crumb/types.js +1 -0
  18. package/dist/cjs/comps/Drawer/index.js +16 -15
  19. package/dist/cjs/comps/Form/index.d.ts +3 -59
  20. package/dist/cjs/comps/Form/types.d.ts +43 -0
  21. package/dist/cjs/comps/Form/types.js +1 -0
  22. package/dist/cjs/comps/Icon/index.js +0 -1
  23. package/dist/cjs/comps/Image/index.js +0 -1
  24. package/dist/cjs/comps/KeyboardKeys/index.d.ts +8 -0
  25. package/dist/cjs/comps/KeyboardKeys/index.js +33 -0
  26. package/dist/cjs/comps/KeyboardKeys/types.d.ts +13 -0
  27. package/dist/cjs/comps/KeyboardKeys/types.js +51 -0
  28. package/dist/cjs/comps/Label/index.js +0 -1
  29. package/dist/cjs/comps/List/index.d.ts +4 -1
  30. package/dist/cjs/comps/List/index.js +4 -4
  31. package/dist/cjs/comps/List/item.js +5 -1
  32. package/dist/cjs/comps/List/types.d.ts +4 -1
  33. package/dist/cjs/comps/Network/index.js +3 -5
  34. package/dist/cjs/comps/Pagination/index.js +2 -2
  35. package/dist/cjs/comps/ScrollView/index.d.ts +5 -0
  36. package/dist/cjs/comps/ScrollView/index.js +13 -0
  37. package/dist/cjs/comps/ScrollView/types.d.ts +6 -0
  38. package/dist/cjs/comps/ScrollView/types.js +1 -0
  39. package/dist/cjs/comps/Search/index.d.ts +7 -10
  40. package/dist/cjs/comps/Search/index.js +10 -6
  41. package/dist/cjs/comps/Search/types.d.ts +12 -0
  42. package/dist/cjs/comps/Search/types.js +1 -0
  43. package/dist/cjs/comps/Segmented/index.d.ts +3 -2
  44. package/dist/cjs/comps/Segmented/index.js +6 -5
  45. package/dist/cjs/comps/Segmented/item.js +11 -2
  46. package/dist/cjs/comps/Segmented/types.d.ts +5 -1
  47. package/dist/cjs/comps/Select/index.d.ts +1 -1
  48. package/dist/cjs/comps/Select/types.d.ts +1 -1
  49. package/dist/cjs/comps/Sheet/index.d.ts +4 -0
  50. package/dist/cjs/comps/Sheet/index.js +11 -6
  51. package/dist/cjs/comps/Spinner/index.js +1 -2
  52. package/dist/cjs/comps/TabView/index.d.ts +1 -1
  53. package/dist/cjs/comps/TabView/types.d.ts +2 -2
  54. package/dist/cjs/comps/Table/index.js +12 -5
  55. package/dist/cjs/comps/Table/row.js +3 -2
  56. package/dist/cjs/comps/Table/types.d.ts +88 -1
  57. package/dist/cjs/comps/Text/index.d.ts +2 -0
  58. package/dist/cjs/comps/Text/index.js +4 -2
  59. package/dist/cjs/comps/TextArea/index.d.ts +2 -0
  60. package/dist/cjs/comps/TextArea/index.js +3 -4
  61. package/dist/cjs/comps/Treeview/index.js +3 -2
  62. package/dist/cjs/comps/Treeview/item.d.ts +1 -1
  63. package/dist/cjs/comps/Treeview/item.js +5 -4
  64. package/dist/cjs/comps/Treeview/types.d.ts +1 -1
  65. package/dist/cjs/comps/VideoPlayer/index.d.ts +2 -0
  66. package/dist/cjs/comps/VideoPlayer/index.js +7 -0
  67. package/dist/cjs/comps/index.d.ts +26 -18
  68. package/dist/cjs/comps/index.js +8 -0
  69. package/dist/cjs/funs/css.d.ts +3 -3
  70. package/dist/cjs/funs/css.js +20 -18
  71. package/dist/cjs/funs/index.d.ts +2 -1
  72. package/dist/cjs/funs/index.js +12 -2
  73. package/dist/cjs/funs/stylesheet.js +7 -0
  74. package/dist/cjs/hooks/index.d.ts +15 -6
  75. package/dist/cjs/hooks/index.js +16 -7
  76. package/dist/cjs/hooks/useAnchorPosition.d.ts +1 -2
  77. package/dist/cjs/hooks/useAnchorPosition.js +1 -0
  78. package/dist/cjs/hooks/useBase.js +27 -13
  79. package/dist/cjs/hooks/useCalendar.js +1 -0
  80. package/dist/cjs/hooks/useColorScheme.js +2 -2
  81. package/dist/cjs/hooks/useContextMenu.js +1 -0
  82. package/dist/cjs/hooks/useDB.js +1 -0
  83. package/dist/cjs/hooks/useDebounce.js +2 -1
  84. package/dist/cjs/hooks/useDelayed.js +2 -1
  85. package/dist/cjs/hooks/useDevice.js +1 -0
  86. package/dist/cjs/hooks/useDimensions.js +2 -1
  87. package/dist/cjs/hooks/useDom.d.ts +2 -0
  88. package/dist/cjs/hooks/useDom.js +3 -0
  89. package/dist/cjs/hooks/useDomMutation.d.ts +3 -0
  90. package/dist/cjs/hooks/useDomMutation.js +19 -0
  91. package/dist/cjs/hooks/useDrag.js +2 -1
  92. package/dist/cjs/hooks/useFileManager.d.ts +2 -0
  93. package/dist/cjs/hooks/useFileManager.js +3 -0
  94. package/dist/cjs/hooks/useImage.js +1 -0
  95. package/dist/cjs/hooks/useIntersectionObserver.js +2 -1
  96. package/dist/cjs/hooks/useMediaPlayer.d.ts +32 -0
  97. package/dist/cjs/hooks/useMediaPlayer.js +86 -0
  98. package/dist/cjs/hooks/useMergedRefs.d.ts +2 -0
  99. package/dist/cjs/hooks/useMergedRefs.js +14 -0
  100. package/dist/cjs/hooks/useMutationObserver.d.ts +3 -0
  101. package/dist/cjs/hooks/useMutationObserver.js +20 -0
  102. package/dist/cjs/hooks/useNetworkStatus.js +2 -1
  103. package/dist/cjs/hooks/usePlayer.d.ts +32 -0
  104. package/dist/cjs/hooks/usePlayer.js +85 -0
  105. package/dist/cjs/hooks/useResizeObserver.js +2 -1
  106. package/dist/cjs/hooks/useScrollbar.d.ts +16 -0
  107. package/dist/cjs/hooks/useScrollbar.js +160 -0
  108. package/dist/cjs/hooks/useSheet.js +1 -0
  109. package/dist/cjs/hooks/useShortcuts.d.ts +7 -0
  110. package/dist/cjs/hooks/useShortcuts.js +29 -0
  111. package/dist/cjs/hooks/useSlider.d.ts +7 -0
  112. package/dist/cjs/hooks/useSlider.js +23 -0
  113. package/dist/cjs/hooks/useTruncateText.d.ts +2 -0
  114. package/dist/cjs/hooks/useTruncateText.js +17 -0
  115. package/dist/cjs/hooks/useViewTransition.d.ts +2 -0
  116. package/dist/cjs/hooks/useViewTransition.js +13 -0
  117. package/dist/cjs/hooks/useWebSocket.d.ts +15 -0
  118. package/dist/cjs/hooks/useWebSocket.js +87 -0
  119. package/dist/cjs/types/enums.d.ts +1 -0
  120. package/dist/cjs/types/enums.js +1 -0
  121. package/dist/cjs/types/index.d.ts +2 -1
  122. package/dist/cjs/types/interfaces.d.ts +2 -0
  123. package/dist/css/styles.css +1 -1
  124. package/dist/esm/comps/Alert/index.d.ts +2 -2
  125. package/dist/esm/comps/Alert/index.js +1 -1
  126. package/dist/esm/comps/Alert/types.d.ts +3 -2
  127. package/dist/esm/comps/Box/index.d.ts +1 -2
  128. package/dist/esm/comps/Box/index.js +14 -12
  129. package/dist/esm/comps/Button/index.d.ts +1 -1
  130. package/dist/esm/comps/Button/types.d.ts +1 -1
  131. package/dist/esm/comps/ColorScheme/index.d.ts +3 -2
  132. package/dist/esm/comps/ColorScheme/index.js +24 -9
  133. package/dist/esm/comps/ColorScheme/types.d.ts +4 -0
  134. package/dist/esm/comps/ColorScheme/types.js +1 -0
  135. package/dist/esm/comps/ContextMenu/index.js +1 -2
  136. package/dist/esm/comps/Cover/index.js +1 -1
  137. package/dist/esm/comps/Crumb/index.d.ts +4 -0
  138. package/dist/esm/comps/Crumb/index.js +13 -0
  139. package/dist/esm/comps/Crumb/types.d.ts +11 -0
  140. package/dist/esm/comps/Crumb/types.js +1 -0
  141. package/dist/esm/comps/Drawer/index.js +16 -15
  142. package/dist/esm/comps/Form/index.d.ts +3 -59
  143. package/dist/esm/comps/Form/types.d.ts +43 -0
  144. package/dist/esm/comps/Form/types.js +1 -0
  145. package/dist/esm/comps/Icon/index.js +0 -1
  146. package/dist/esm/comps/Image/index.js +0 -1
  147. package/dist/esm/comps/KeyboardKeys/index.d.ts +8 -0
  148. package/dist/esm/comps/KeyboardKeys/index.js +33 -0
  149. package/dist/esm/comps/KeyboardKeys/types.d.ts +13 -0
  150. package/dist/esm/comps/KeyboardKeys/types.js +51 -0
  151. package/dist/esm/comps/Label/index.js +0 -1
  152. package/dist/esm/comps/List/index.d.ts +4 -1
  153. package/dist/esm/comps/List/index.js +4 -4
  154. package/dist/esm/comps/List/item.js +5 -1
  155. package/dist/esm/comps/List/types.d.ts +4 -1
  156. package/dist/esm/comps/Network/index.js +3 -5
  157. package/dist/esm/comps/Pagination/index.js +2 -2
  158. package/dist/esm/comps/ScrollView/index.d.ts +5 -0
  159. package/dist/esm/comps/ScrollView/index.js +13 -0
  160. package/dist/esm/comps/ScrollView/types.d.ts +6 -0
  161. package/dist/esm/comps/ScrollView/types.js +1 -0
  162. package/dist/esm/comps/Search/index.d.ts +7 -10
  163. package/dist/esm/comps/Search/index.js +10 -6
  164. package/dist/esm/comps/Search/types.d.ts +12 -0
  165. package/dist/esm/comps/Search/types.js +1 -0
  166. package/dist/esm/comps/Segmented/index.d.ts +3 -2
  167. package/dist/esm/comps/Segmented/index.js +6 -5
  168. package/dist/esm/comps/Segmented/item.js +11 -2
  169. package/dist/esm/comps/Segmented/types.d.ts +5 -1
  170. package/dist/esm/comps/Select/index.d.ts +1 -1
  171. package/dist/esm/comps/Select/types.d.ts +1 -1
  172. package/dist/esm/comps/Sheet/index.d.ts +4 -0
  173. package/dist/esm/comps/Sheet/index.js +11 -6
  174. package/dist/esm/comps/Spinner/index.js +1 -2
  175. package/dist/esm/comps/TabView/index.d.ts +1 -1
  176. package/dist/esm/comps/TabView/types.d.ts +2 -2
  177. package/dist/esm/comps/Table/index.js +12 -5
  178. package/dist/esm/comps/Table/row.js +3 -2
  179. package/dist/esm/comps/Table/types.d.ts +88 -1
  180. package/dist/esm/comps/Text/index.d.ts +2 -0
  181. package/dist/esm/comps/Text/index.js +4 -2
  182. package/dist/esm/comps/TextArea/index.d.ts +2 -0
  183. package/dist/esm/comps/TextArea/index.js +3 -4
  184. package/dist/esm/comps/Treeview/index.js +3 -2
  185. package/dist/esm/comps/Treeview/item.d.ts +1 -1
  186. package/dist/esm/comps/Treeview/item.js +5 -4
  187. package/dist/esm/comps/Treeview/types.d.ts +1 -1
  188. package/dist/esm/comps/VideoPlayer/index.d.ts +2 -0
  189. package/dist/esm/comps/VideoPlayer/index.js +7 -0
  190. package/dist/esm/comps/index.d.ts +26 -18
  191. package/dist/esm/comps/index.js +8 -0
  192. package/dist/esm/funs/css.d.ts +3 -3
  193. package/dist/esm/funs/css.js +20 -18
  194. package/dist/esm/funs/index.d.ts +2 -1
  195. package/dist/esm/funs/index.js +12 -2
  196. package/dist/esm/funs/stylesheet.js +7 -0
  197. package/dist/esm/hooks/index.d.ts +15 -6
  198. package/dist/esm/hooks/index.js +16 -7
  199. package/dist/esm/hooks/useAnchorPosition.d.ts +1 -2
  200. package/dist/esm/hooks/useAnchorPosition.js +1 -0
  201. package/dist/esm/hooks/useBase.js +27 -13
  202. package/dist/esm/hooks/useCalendar.js +1 -0
  203. package/dist/esm/hooks/useColorScheme.js +2 -2
  204. package/dist/esm/hooks/useContextMenu.js +1 -0
  205. package/dist/esm/hooks/useDB.js +1 -0
  206. package/dist/esm/hooks/useDebounce.js +2 -1
  207. package/dist/esm/hooks/useDelayed.js +2 -1
  208. package/dist/esm/hooks/useDevice.js +1 -0
  209. package/dist/esm/hooks/useDimensions.js +2 -1
  210. package/dist/esm/hooks/useDom.d.ts +2 -0
  211. package/dist/esm/hooks/useDom.js +3 -0
  212. package/dist/esm/hooks/useDomMutation.d.ts +3 -0
  213. package/dist/esm/hooks/useDomMutation.js +19 -0
  214. package/dist/esm/hooks/useDrag.js +2 -1
  215. package/dist/esm/hooks/useFileManager.d.ts +2 -0
  216. package/dist/esm/hooks/useFileManager.js +3 -0
  217. package/dist/esm/hooks/useImage.js +1 -0
  218. package/dist/esm/hooks/useIntersectionObserver.js +2 -1
  219. package/dist/esm/hooks/useMediaPlayer.d.ts +32 -0
  220. package/dist/esm/hooks/useMediaPlayer.js +86 -0
  221. package/dist/esm/hooks/useMergedRefs.d.ts +2 -0
  222. package/dist/esm/hooks/useMergedRefs.js +14 -0
  223. package/dist/esm/hooks/useMutationObserver.d.ts +3 -0
  224. package/dist/esm/hooks/useMutationObserver.js +20 -0
  225. package/dist/esm/hooks/useNetworkStatus.js +2 -1
  226. package/dist/esm/hooks/usePlayer.d.ts +32 -0
  227. package/dist/esm/hooks/usePlayer.js +85 -0
  228. package/dist/esm/hooks/useResizeObserver.js +2 -1
  229. package/dist/esm/hooks/useScrollbar.d.ts +16 -0
  230. package/dist/esm/hooks/useScrollbar.js +160 -0
  231. package/dist/esm/hooks/useSheet.js +1 -0
  232. package/dist/esm/hooks/useShortcuts.d.ts +7 -0
  233. package/dist/esm/hooks/useShortcuts.js +29 -0
  234. package/dist/esm/hooks/useSlider.d.ts +7 -0
  235. package/dist/esm/hooks/useSlider.js +23 -0
  236. package/dist/esm/hooks/useTruncateText.d.ts +2 -0
  237. package/dist/esm/hooks/useTruncateText.js +17 -0
  238. package/dist/esm/hooks/useViewTransition.d.ts +2 -0
  239. package/dist/esm/hooks/useViewTransition.js +13 -0
  240. package/dist/esm/hooks/useWebSocket.d.ts +15 -0
  241. package/dist/esm/hooks/useWebSocket.js +87 -0
  242. package/dist/esm/types/enums.d.ts +1 -0
  243. package/dist/esm/types/enums.js +1 -0
  244. package/dist/esm/types/index.d.ts +2 -1
  245. package/dist/esm/types/interfaces.d.ts +2 -0
  246. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  247. package/dist/tsconfig.tsbuildinfo +1 -1
  248. package/package.json +1 -1
@@ -5,7 +5,7 @@ declare const Alert: import("react").ForwardRefExoticComponent<BoxProps & {
5
5
  type?: ALERT;
6
6
  icon?: string;
7
7
  iconSize?: number;
8
- message?: string;
9
- title: string;
8
+ message?: string | import("react").ReactNode;
9
+ title: string | import("react").ReactNode;
10
10
  } & import("react").RefAttributes<AlertHandler>>;
11
11
  export default Alert;
@@ -8,7 +8,7 @@ import Text from "../Text";
8
8
  const Alert = forwardRef((props, ref) => {
9
9
  const { type, icon, title, message, iconSize, ...pops } = props;
10
10
  const { className, style, rest } = useBase(pops);
11
- return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
11
+ return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { fontSize: iconSize, width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
12
12
  });
13
13
  Alert.displayName = `Alert`;
14
14
  export default Alert;
@@ -1,11 +1,12 @@
1
+ import { ReactNode } from "react";
1
2
  import { ALERT } from "../../types/enums";
2
3
  import { BoxProps } from "../Box";
3
4
  export type AlertProps = BoxProps & {
4
5
  type?: ALERT;
5
6
  icon?: string;
6
7
  iconSize?: number;
7
- message?: string;
8
- title: string;
8
+ message?: string | ReactNode;
9
+ title: string | ReactNode;
9
10
  };
10
11
  export interface AlertHandler {
11
12
  open: () => void;
@@ -1,7 +1,6 @@
1
- import React from "react";
2
1
  import { Props } from "../../types";
3
2
  export interface BoxProps extends Partial<Props<`div`>> {
4
3
  name?: string;
5
4
  }
6
- declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
5
+ declare const Box: import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<HTMLDivElement>>;
7
6
  export default Box;
@@ -4,18 +4,20 @@ import { useBase } from "../../hooks";
4
4
  const Box = forwardRef((props, ref) => {
5
5
  const { style, withEditor, ...pops } = props;
6
6
  const { style: _style, className, rest } = useBase(pops);
7
- const handleInternalClick = (e) => {
8
- // if ( withEditor && isBrowser ) {
9
- // // window.dispatchEvent(new CustomEvent(`ZUZ_COMP_SELECTED`, {
10
- // // detail: {
11
- // // compName: 'Box',
12
- // // target: e.target,
13
- // // props
14
- // // }
15
- // // }))
16
- // }
17
- };
18
- return _jsx("div", { ref: ref, onClick: handleInternalClick, className: `${className} ${withEditor ? `--with-zuz-editor` : ``}`.trim(), style: {
7
+ // const handleInternalClick = (e: React.MouseEvent<HTMLDivElement>) => {
8
+ // // if ( withEditor && isBrowser ) {
9
+ // // // window.dispatchEvent(new CustomEvent(`ZUZ_COMP_SELECTED`, {
10
+ // // // detail: {
11
+ // // // compName: 'Box',
12
+ // // // target: e.target,
13
+ // // // props
14
+ // // // }
15
+ // // // }))
16
+ // // }
17
+ // }
18
+ return _jsx("div", { ref: ref,
19
+ // onClick={handleInternalClick}
20
+ className: `${className} ${withEditor ? `--with-zuz-editor` : ``}`.trim(), style: {
19
21
  ..._style,
20
22
  ...(style || {})
21
23
  }, ...rest });
@@ -1,7 +1,7 @@
1
1
  import { Size, SPINNER } from '../../types/enums';
2
2
  import { ButtonState } from './types';
3
3
  declare const Button: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, keyof import("../..").ZuzProps> & {
4
- icon?: string;
4
+ icon?: string | null;
5
5
  iconSize?: Size;
6
6
  withLabel?: boolean;
7
7
  spinner?: SPINNER;
@@ -1,7 +1,7 @@
1
1
  import { Props } from "../../types";
2
2
  import { Size, SPINNER, Variant } from "../../types/enums";
3
3
  export type ButtonProps = Props<`button`> & {
4
- icon?: string;
4
+ icon?: string | null;
5
5
  iconSize?: Size;
6
6
  withLabel?: boolean;
7
7
  spinner?: SPINNER;
@@ -1,4 +1,5 @@
1
1
  import { ColorScheme } from "../../hooks/useColorScheme";
2
- import { SegmentProps } from "../Segmented/types";
3
- declare const ColorScheme: import("react").ForwardRefExoticComponent<Omit<SegmentProps, "items"> & import("react").RefAttributes<HTMLDivElement>>;
2
+ declare const ColorScheme: import("react").ForwardRefExoticComponent<Omit<import("..").SegmentProps, "items"> & {
3
+ type?: "switch" | "toggle" | "system";
4
+ } & import("react").RefAttributes<HTMLDivElement>>;
4
5
  export default ColorScheme;
@@ -1,24 +1,39 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { forwardRef, useMemo } from "react";
4
- import { useDelayed } from "../..";
3
+ import { forwardRef, useCallback, useMemo } from "react";
4
+ import { Button, useBase, useDelayed, Variant } from "../..";
5
5
  import { useColorScheme } from "../../hooks/useColorScheme";
6
6
  import Segmented from "../Segmented";
7
7
  import SVGIcons from "../svgicons";
8
8
  const ColorScheme = forwardRef((props, ref) => {
9
+ const { type, ...pops } = props;
9
10
  const mounted = useDelayed();
10
11
  const { colorScheme, setColorScheme } = useColorScheme();
11
- const items = useMemo(() => [
12
- { tag: `light`, index: 0, label: "", icon: SVGIcons.colorSchemeLight },
13
- { tag: `system`, index: 1, label: "", icon: SVGIcons.colorSchemeSystem },
14
- { tag: `dark`, index: 2, label: "", icon: SVGIcons.colorSchemeDark },
15
- ], []);
12
+ const loopSchemes = useCallback(() => {
13
+ setColorScheme(colorScheme == `dark` ? `light`
14
+ : colorScheme == `light` ? `system`
15
+ : `dark`);
16
+ }, [colorScheme]);
17
+ const { className, style } = useBase(pops);
18
+ const items = useMemo(() => type == `system` ?
19
+ [
20
+ { tag: `light`, index: 0, label: "", icon: SVGIcons.colorSchemeLight },
21
+ { tag: `system`, index: 1, label: "", icon: SVGIcons.colorSchemeSystem },
22
+ { tag: `dark`, index: 2, label: "", icon: SVGIcons.colorSchemeDark },
23
+ ]
24
+ :
25
+ [
26
+ { tag: `light`, index: 0, label: "", icon: SVGIcons.colorSchemeLight },
27
+ { tag: `dark`, index: 2, label: "", icon: SVGIcons.colorSchemeDark },
28
+ ], []);
16
29
  const selected = useMemo(() => [`light`, `system`, `dark`].indexOf(colorScheme), [colorScheme]);
17
30
  if (!mounted || selected == -1)
18
31
  return null;
19
- return _jsx(Segmented, { className: `--color-scheme`, onSwitch: ({ tag }) => {
32
+ return type == `system` || type == `switch` ? _jsx(Segmented, { className: `--color-scheme --${type}`, onSwitch: ({ tag }) => {
20
33
  setColorScheme(tag);
21
- }, selected: selected, items: items, ...props });
34
+ }, selected: selected, items: items, ...pops }) : _jsx(Button, { onClick: loopSchemes, style: style, as: `--color-scheme-switch --${pops.variant || Variant.Small} ${className}`.trim(), children: colorScheme == `system` ? SVGIcons.colorSchemeSystem
35
+ : colorScheme == `light` ? SVGIcons.colorSchemeLight
36
+ : SVGIcons.colorSchemeDark });
22
37
  });
23
38
  ColorScheme.displayName = `ColorScheme`;
24
39
  export default ColorScheme;
@@ -0,0 +1,4 @@
1
+ import { SegmentProps } from "../..";
2
+ export type ColorSchemeProps = Omit<SegmentProps, `items`> & {
3
+ type?: "switch" | "toggle" | "system";
4
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -5,7 +5,6 @@ import { useAnchorPosition, useBase } from "../../hooks";
5
5
  import { TRANSITION_CURVES } from "../../types/enums";
6
6
  import Box from "../Box";
7
7
  import MenuItem from "./item";
8
- // import { dynamicObject } from "../../types";
9
8
  const ContextMenu = forwardRef((props, ref) => {
10
9
  const { as, offsetX, offsetY, parent, items: _items, ...pops } = props;
11
10
  const { className, style, rest } = useBase(pops);
@@ -30,7 +29,7 @@ const ContextMenu = forwardRef((props, ref) => {
30
29
  ...style,
31
30
  top: position.top,
32
31
  left: position.left
33
- }, animate: {
32
+ }, fx: {
34
33
  from: { opacity: 0, y: 20 },
35
34
  to: { opacity: 1, y: 0 },
36
35
  curve: TRANSITION_CURVES.EaseInOut,
@@ -12,7 +12,7 @@ const Cover = forwardRef((props, ref) => {
12
12
  if (`when` in props && props.when == false) {
13
13
  return null;
14
14
  }
15
- return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous`, style: {
15
+ return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous ${className}`.trim(), style: {
16
16
  ...style,
17
17
  backgroundColor: `var(--cover-bg)`
18
18
  }, ...rest, children: [_jsx(Spinner, { type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
@@ -0,0 +1,4 @@
1
+ declare const Crumb: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
2
+ items: import("./types").CrumbItem[];
3
+ } & import("react").RefAttributes<HTMLOListElement | HTMLUListElement>>;
4
+ export default Crumb;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import Box from "../Box";
4
+ import Button from "../Button";
5
+ import Icon from "../Icon";
6
+ import List from "../List";
7
+ import SVGIcons from "../svgicons";
8
+ import Text from "../Text";
9
+ const Crumb = forwardRef((props, ref) => {
10
+ const { items } = props;
11
+ return _jsx(List, { ref: ref, className: `--crumb flex aic`, direction: `rows`, seperator: _jsx(Box, { as: `--crumb-chevron`, children: SVGIcons.chevronRightOutline }), items: items.map((item, index, _items) => _jsxs(Button, { onClick: () => item.action?.(), className: `--crumb-item`, disabled: !_items[index + 1], children: [item.icon && _jsx(Icon, { as: `--crumb-icon`, name: item.icon }), _jsx(Text, { as: `--crumb-label`, children: item.label })] })) });
12
+ });
13
+ export default Crumb;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from "react";
2
+ import { BoxProps } from "../Box";
3
+ export type CrumbItem = {
4
+ ID?: string;
5
+ label: string;
6
+ icon?: string | ReactNode;
7
+ action?: () => void;
8
+ };
9
+ export type CrumbProps = BoxProps & {
10
+ items: CrumbItem[];
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,28 +1,29 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
4
- import { bindKey } from "../../funs";
4
+ import { useBase, useShortcuts } from "../../hooks";
5
5
  import { DRAWER_SIDE, KeyCode, TRANSITION_CURVES } from "../../types/enums";
6
6
  import Box from "../Box";
7
7
  import Overlay from "../Overlay";
8
8
  const Drawer = forwardRef((props, ref) => {
9
- const { as, from, speed, children, prerender, onClose, ...pops } = props;
9
+ const { from, speed, children, prerender, onClose, ...pops } = props;
10
10
  const [render, setRender] = useState(undefined == prerender ? true : prerender);
11
11
  const [visible, setVisible] = useState(false);
12
12
  const divRef = useRef(null);
13
13
  const [content, setContent] = useState(children);
14
+ const { className, style, rest } = useBase(pops);
15
+ useShortcuts([
16
+ { keys: [KeyCode.Escape], callback: () => {
17
+ if (visible) {
18
+ onClose?.();
19
+ setVisible(false);
20
+ }
21
+ } }
22
+ ]);
14
23
  useEffect(() => {
15
24
  setContent(children);
16
25
  }, [children]);
17
- useEffect(() => {
18
- bindKey(KeyCode.Escape, () => {
19
- if (visible) {
20
- onClose?.();
21
- setVisible(false);
22
- }
23
- });
24
- }, []);
25
- const style = useMemo(() => {
26
+ const _style = useMemo(() => {
26
27
  switch (from) {
27
28
  case DRAWER_SIDE.Left:
28
29
  return { from: { x: `-100vh` }, to: { x: 0 } };
@@ -52,13 +53,13 @@ const Drawer = forwardRef((props, ref) => {
52
53
  onClose?.();
53
54
  setVisible(false);
54
55
  }
55
- }, when: visible }), _jsxs(Box, { ref: divRef, className: `--drawer flex cols --${from ? from.toLowerCase() : `left`} fixed`, fx: {
56
- from: { ...style.from, opacity: 0 },
57
- to: { ...style.to, opacity: 1 },
56
+ }, when: visible }), _jsxs(Box, { ref: divRef, style: style, className: `--drawer flex cols ${className} --${from ? from.toLowerCase() : `left`} fixed`, fx: {
57
+ from: { ..._style.from, opacity: 0 },
58
+ to: { ..._style.to, opacity: 1 },
58
59
  when: visible,
59
60
  curve: TRANSITION_CURVES.EaseInOut,
60
61
  duration: speed || .5,
61
- }, ...pops, children: [from == DRAWER_SIDE.Top || from == DRAWER_SIDE.Bottom ? _jsx(Box, { className: `--handle` }) : null, render ? content : visible ? content : null] })] });
62
+ }, ...rest, children: [from == DRAWER_SIDE.Top || from == DRAWER_SIDE.Bottom ? _jsx(Box, { className: `--handle` }) : null, render ? content : visible ? content : null] })] });
62
63
  });
63
64
  Drawer.displayName = `Drawer`;
64
65
  export default Drawer;
@@ -1,48 +1,6 @@
1
1
  import { dynamicObject } from "../../types";
2
- import { SPINNER } from "../../types/enums";
3
- import { BoxProps } from "../Box";
4
2
  import { SheetHandler } from "../Sheet";
5
- export type FormProps = BoxProps & {
6
- /** Name of form, will be appended to --form-{name} in className
7
- * whitespace will be replaced with dash (-)
8
- */
9
- name?: string;
10
- /** The URL to which the form data is submitted */
11
- action?: string;
12
- /** List of error messages for form validation */
13
- errors?: dynamicObject;
14
- /** Spinner properties for loading indicator */
15
- spinner?: SPINNER;
16
- /** Additional data to include with form submission */
17
- withData?: dynamicObject;
18
- /** Handler function called before form submission with validated form data */
19
- beforeSubmit?: (data: FormData | dynamicObject) => void;
20
- /** Handler function called on form submission with validated form data */
21
- onSubmit?: (data: FormData | dynamicObject) => void;
22
- /** Callback triggered upon successful form submission */
23
- onSuccess?: (data: dynamicObject) => void;
24
- /** Callback triggered when form submission encounters an error */
25
- onError?: (error: any) => void;
26
- /** Cover properties to display loading or processing message */
27
- cover?: {
28
- /** Background color of the loading cover */
29
- color?: string;
30
- /** Message displayed during loading */
31
- message?: string;
32
- } | SheetHandler;
33
- resetOnSuccess?: boolean;
34
- };
35
- /**
36
- * Exposes control methods for the Form component, such as setting loading states or hiding errors.
37
- */
38
- export interface FormHandler {
39
- /** Sets the loading state of the form */
40
- setLoading: (mode: boolean) => void;
41
- /** Hides any currently displayed error message */
42
- hideError: () => void;
43
- /** Resets the form to its initial state */
44
- init: () => void;
45
- }
3
+ import { FormHandler } from "./types";
46
4
  /**
47
5
  * {@link Form} is a controlled component designed to handle form data submission, validation, and display of loading or error states.
48
6
  * It allows for optional server-side submission through an action endpoint and customizable success/error handling callbacks.
@@ -52,32 +10,18 @@ export interface FormHandler {
52
10
  * @param props - Properties to configure form behavior, validation messages, submission handling, and visual feedback.
53
11
  * @param ref - Reference to the {@link FormHandler} interface, exposing methods to control loading and error states from the parent.
54
12
  */
55
- declare const Form: import("react").ForwardRefExoticComponent<BoxProps & {
56
- /** Name of form, will be appended to --form-{name} in className
57
- * whitespace will be replaced with dash (-)
58
- */
13
+ declare const Form: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
59
14
  name?: string;
60
- /** The URL to which the form data is submitted */
61
15
  action?: string;
62
- /** List of error messages for form validation */
63
16
  errors?: dynamicObject;
64
- /** Spinner properties for loading indicator */
65
- spinner?: SPINNER;
66
- /** Additional data to include with form submission */
17
+ spinner?: import("../..").SPINNER;
67
18
  withData?: dynamicObject;
68
- /** Handler function called before form submission with validated form data */
69
19
  beforeSubmit?: (data: FormData | dynamicObject) => void;
70
- /** Handler function called on form submission with validated form data */
71
20
  onSubmit?: (data: FormData | dynamicObject) => void;
72
- /** Callback triggered upon successful form submission */
73
21
  onSuccess?: (data: dynamicObject) => void;
74
- /** Callback triggered when form submission encounters an error */
75
22
  onError?: (error: any) => void;
76
- /** Cover properties to display loading or processing message */
77
23
  cover?: {
78
- /** Background color of the loading cover */
79
24
  color?: string;
80
- /** Message displayed during loading */
81
25
  message?: string;
82
26
  } | SheetHandler;
83
27
  resetOnSuccess?: boolean;
@@ -0,0 +1,43 @@
1
+ import { dynamicObject, SheetHandler, SPINNER } from "../..";
2
+ import { BoxProps } from "../Box";
3
+ export type FormProps = BoxProps & {
4
+ /** Name of form, will be appended to --form-{name} in className
5
+ * whitespace will be replaced with dash (-)
6
+ */
7
+ name?: string;
8
+ /** The URL to which the form data is submitted */
9
+ action?: string;
10
+ /** List of error messages for form validation */
11
+ errors?: dynamicObject;
12
+ /** Spinner properties for loading indicator */
13
+ spinner?: SPINNER;
14
+ /** Additional data to include with form submission */
15
+ withData?: dynamicObject;
16
+ /** Handler function called before form submission with validated form data */
17
+ beforeSubmit?: (data: FormData | dynamicObject) => void;
18
+ /** Handler function called on form submission with validated form data */
19
+ onSubmit?: (data: FormData | dynamicObject) => void;
20
+ /** Callback triggered upon successful form submission */
21
+ onSuccess?: (data: dynamicObject) => void;
22
+ /** Callback triggered when form submission encounters an error */
23
+ onError?: (error: any) => void;
24
+ /** Cover properties to display loading or processing message */
25
+ cover?: {
26
+ /** Background color of the loading cover */
27
+ color?: string;
28
+ /** Message displayed during loading */
29
+ message?: string;
30
+ } | SheetHandler;
31
+ resetOnSuccess?: boolean;
32
+ };
33
+ /**
34
+ * Exposes control methods for the Form component, such as setting loading states or hiding errors.
35
+ */
36
+ export interface FormHandler {
37
+ /** Sets the loading state of the form */
38
+ setLoading: (mode: boolean) => void;
39
+ /** Hides any currently displayed error message */
40
+ hideError: () => void;
41
+ /** Resets the form to its initial state */
42
+ init: () => void;
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { forwardRef } from "react";
4
3
  import { useBase } from "../../hooks";
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { forwardRef } from 'react';
4
3
  import { useBase } from '../../hooks';
@@ -0,0 +1,8 @@
1
+ import { Variant } from "../../types/enums";
2
+ import { KeyboardKey } from "./types";
3
+ declare const KeyBoardKeys: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
4
+ keys: KeyboardKey | KeyboardKey[] | import("./types").KeyCombination;
5
+ children?: import("react").ReactNode;
6
+ variant?: Variant;
7
+ } & import("react").RefAttributes<HTMLDivElement>>;
8
+ export default KeyBoardKeys;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from "react";
3
+ import { Variant } from "../../types/enums";
4
+ import Box from "../Box";
5
+ import Span from "../Span";
6
+ import { isKeyCombination, KeysLabelMap, KeysMap } from "./types";
7
+ const KeyBoardKeys = forwardRef(({ children, keys, variant }, ref) => {
8
+ const _meta = useMemo(() => {
9
+ if (isKeyCombination(keys)) {
10
+ let c = null;
11
+ let ks = String(keys).split(`+`)
12
+ .reduce((pa, ca, i, nxt) => {
13
+ if (nxt[i + 1]) {
14
+ pa.push(ca);
15
+ }
16
+ else
17
+ c = ca.toUpperCase();
18
+ return pa;
19
+ }, []);
20
+ return {
21
+ keys: ks,
22
+ children: c
23
+ };
24
+ }
25
+ return {
26
+ keys,
27
+ children: String(children).toUpperCase()
28
+ };
29
+ }, [keys]);
30
+ return _jsxs(Box, { as: `--keyboard-keys --${variant || Variant.Small} flex aic`, children: [(Array.isArray(_meta.keys) ? _meta.keys : [_meta.keys]).map((k) => _jsx("abbr", { title: KeysLabelMap[k], children: KeysMap[k] }, k)), _jsx(Span, { children: _meta?.children ?? children })] });
31
+ });
32
+ KeyBoardKeys.displayName = `ZuzUI.KeyboardKeys`;
33
+ export default KeyBoardKeys;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ import { Variant } from "../../types/enums";
3
+ import { BoxProps } from "../Box";
4
+ export type KeyboardKey = "command" | "shift" | "ctrl" | "option" | "enter" | "delete" | "escape" | "tab" | "capslock" | "up" | "right" | "down" | "left" | "pageup" | "pagedown" | "home" | "end" | "help" | "space" | "fn" | "win" | "alt";
5
+ export type KeyCombination = `${KeyboardKey}+${KeyboardKey | string}`;
6
+ export declare const isKeyCombination: (value: KeyboardKey | KeyboardKey[] | KeyCombination) => value is KeyCombination;
7
+ export declare const KeysMap: Record<KeyboardKey, string>;
8
+ export declare const KeysLabelMap: Record<KeyboardKey, string>;
9
+ export type KeyboardKeyProps = BoxProps & {
10
+ keys: KeyboardKey | KeyboardKey[] | KeyCombination;
11
+ children?: ReactNode;
12
+ variant?: Variant;
13
+ };
@@ -0,0 +1,51 @@
1
+ export const isKeyCombination = (value) => {
2
+ return typeof value === "string" && value.includes("+");
3
+ };
4
+ export const KeysMap = {
5
+ command: "⌘",
6
+ shift: "⇧",
7
+ ctrl: "⌃",
8
+ option: "⌥",
9
+ enter: "↵",
10
+ delete: "⌫",
11
+ escape: "⎋",
12
+ tab: "⇥",
13
+ capslock: "⇪",
14
+ up: "↑",
15
+ right: "→",
16
+ down: "↓",
17
+ left: "←",
18
+ pageup: "⇞",
19
+ pagedown: "⇟",
20
+ home: "↖",
21
+ end: "↘",
22
+ help: "?",
23
+ space: "␣",
24
+ fn: "Fn",
25
+ win: "⌘",
26
+ alt: "⌥",
27
+ };
28
+ export const KeysLabelMap = {
29
+ command: "Command",
30
+ shift: "Shift",
31
+ ctrl: "Control",
32
+ option: "Option",
33
+ enter: "Enter",
34
+ delete: "Delete",
35
+ escape: "Escape",
36
+ tab: "Tab",
37
+ capslock: "Caps Lock",
38
+ up: "Up",
39
+ right: "Right",
40
+ down: "Down",
41
+ left: "Left",
42
+ pageup: "Page Up",
43
+ pagedown: "Page Down",
44
+ home: "Home",
45
+ end: "End",
46
+ help: "Help",
47
+ space: "Space",
48
+ fn: "Fn",
49
+ win: "Win",
50
+ alt: "Alt",
51
+ };
@@ -1,4 +1,3 @@
1
- "use client";
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { forwardRef } from 'react';
4
3
  import { useBase } from '../../hooks';
@@ -1,7 +1,10 @@
1
1
  import { Size } from "../../types/enums";
2
2
  declare const List: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> | Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, keyof import("../..").ZuzProps> & {
3
3
  size?: Size;
4
+ variant?: import("../..").Variant;
4
5
  items: import("./types").ListItem[];
6
+ direction?: "cols" | "rows";
7
+ seperator?: import("react").ReactNode;
5
8
  ol?: boolean;
6
- } & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
9
+ } & import("react").RefAttributes<HTMLOListElement | HTMLUListElement>>;
7
10
  export default List;
@@ -1,17 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createElement, forwardRef } from "react";
3
3
  import { useBase } from "../../hooks";
4
4
  import { Size } from "../../types/enums";
5
5
  import Item from "./item";
6
6
  const List = forwardRef((props, ref) => {
7
- const { items, size, ol, ...pops } = props;
7
+ const { items, size, direction, seperator, ol, ...pops } = props;
8
8
  const { className, style, rest } = useBase(pops);
9
9
  const Tag = ol == true ? 'ol' : 'ul';
10
10
  return createElement(Tag, {
11
- className: `--list --${size || Size.Small} flex cols ${className}`.trim(),
11
+ className: `--list --${size || Size.Small} flex ${direction ?? `cols`} ${className}`.trim(),
12
12
  style, ref,
13
13
  ...rest,
14
- children: items.map((item, index) => _jsx(Item, { meta: item }, `list-item-${typeof item == `string` ? String(item) : item.label}-${index}`))
14
+ children: items.map((item, index, _items) => _jsxs(_Fragment, { children: [_jsx(Item, { meta: item }, `list-item-${typeof item == `string` ? String(item) : item.label}-${index}`), seperator && _items[index + 1] ? _jsx("li", { className: `--list-seperator`, children: seperator }) : null] }))
15
15
  });
16
16
  });
17
17
  List.displayName = `List`;
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { isValidElement } from "react";
2
3
  import { useBase, useDelayed } from "../../hooks";
3
4
  const Item = (props) => {
4
5
  const { meta } = props;
5
6
  const mounted = useDelayed();
6
- const { label, ...pops } = meta;
7
+ const { label, ...pops } = isValidElement(meta) ? {} : meta;
7
8
  const { className, style, rest } = useBase({
8
9
  ...pops,
9
10
  ...(pops.animate ? { animate: {
@@ -11,6 +12,9 @@ const Item = (props) => {
11
12
  when: mounted
12
13
  } } : {})
13
14
  });
15
+ if (isValidElement(meta)) {
16
+ return _jsx("li", { style: style, className: className, children: meta });
17
+ }
14
18
  return _jsx("li", { style: style, className: className, ...rest, children: typeof meta == `string` ? meta : label });
15
19
  };
16
20
  Item.displayName = `ListItem`;
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from "react";
2
2
  import { Props } from "../../types";
3
- import { Size } from "../../types/enums";
3
+ import { Size, Variant } from "../../types/enums";
4
4
  import { animationProps } from "../../types/interfaces";
5
5
  export type ListItemObject = {
6
6
  icon?: ReactNode;
@@ -13,6 +13,9 @@ export type ListItemObject = {
13
13
  export type ListItem = Props<`li`> & (ReactNode | ListItemObject);
14
14
  export type ListProps = Props<`ul` | `ol`> & {
15
15
  size?: Size;
16
+ variant?: Variant;
16
17
  items: ListItem[];
18
+ direction?: "cols" | "rows";
19
+ seperator?: ReactNode;
17
20
  ol?: boolean;
18
21
  };