@zuzjs/ui 0.5.6 → 0.5.8

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 (213) hide show
  1. package/dist/bin.js +0 -0
  2. package/dist/comps/Accordion/index.d.ts +6 -0
  3. package/dist/comps/Accordion/index.js +12 -0
  4. package/dist/comps/Accordion/types.d.ts +10 -0
  5. package/dist/comps/Actionbar/index.d.ts +21 -0
  6. package/dist/comps/Actionbar/index.js +58 -0
  7. package/dist/comps/Actionbar/item.d.ts +6 -0
  8. package/dist/comps/Actionbar/item.js +7 -0
  9. package/dist/comps/Actionbar/types.d.ts +29 -0
  10. package/dist/comps/Actionbar/types.js +1 -0
  11. package/dist/comps/Avatar/index.d.ts +19 -0
  12. package/dist/comps/Avatar/index.js +35 -0
  13. package/dist/comps/Box/index.d.ts +7 -0
  14. package/dist/comps/Box/index.js +24 -0
  15. package/dist/comps/Button/index.d.ts +10 -0
  16. package/dist/comps/Button/index.js +12 -0
  17. package/dist/comps/CheckBox/index.d.ts +7 -0
  18. package/dist/comps/{checkbox.js → CheckBox/index.js} +10 -9
  19. package/dist/comps/CheckBox/types.d.ts +10 -0
  20. package/dist/comps/CheckBox/types.js +1 -0
  21. package/dist/comps/ContextMenu/index.d.ts +6 -0
  22. package/dist/comps/ContextMenu/index.js +37 -0
  23. package/dist/comps/ContextMenu/item.d.ts +3 -0
  24. package/dist/comps/ContextMenu/item.js +11 -0
  25. package/dist/comps/ContextMenu/types.d.ts +20 -0
  26. package/dist/comps/ContextMenu/types.js +1 -0
  27. package/dist/comps/Cover/index.d.ts +17 -0
  28. package/dist/comps/Cover/index.js +19 -0
  29. package/dist/comps/Drawer/index.d.ts +12 -0
  30. package/dist/comps/{drawer.js → Drawer/index.js} +8 -10
  31. package/dist/comps/{drawer.d.ts → Drawer/types.d.ts} +4 -5
  32. package/dist/comps/Drawer/types.js +1 -0
  33. package/dist/comps/Editor/Timeline/index.d.ts +3 -0
  34. package/dist/comps/Editor/Timeline/index.js +57 -0
  35. package/dist/comps/Editor/Timeline/layer.d.ts +3 -0
  36. package/dist/comps/Editor/Timeline/layer.js +67 -0
  37. package/dist/comps/Editor/Timeline/prop.d.ts +3 -0
  38. package/dist/comps/Editor/Timeline/prop.js +33 -0
  39. package/dist/comps/Editor/index.d.ts +4 -0
  40. package/dist/comps/Editor/index.js +9 -0
  41. package/dist/comps/Editor/selectionBox.d.ts +4 -0
  42. package/dist/comps/Editor/selectionBox.js +48 -0
  43. package/dist/comps/Editor/types.d.ts +58 -0
  44. package/dist/comps/Editor/types.js +15 -0
  45. package/dist/comps/Editor/withEditor.d.ts +3 -0
  46. package/dist/comps/Editor/withEditor.js +13 -0
  47. package/dist/comps/{form.d.ts → Form/index.d.ts} +34 -10
  48. package/dist/comps/{form.js → Form/index.js} +11 -15
  49. package/dist/comps/Icon/index.d.ts +11 -0
  50. package/dist/comps/Icon/index.js +11 -0
  51. package/dist/comps/Image/index.d.ts +4 -0
  52. package/dist/comps/Image/index.js +9 -0
  53. package/dist/comps/Input/index.d.ts +8 -0
  54. package/dist/comps/Input/index.js +15 -0
  55. package/dist/comps/Label/index.d.ts +4 -0
  56. package/dist/comps/Label/index.js +9 -0
  57. package/dist/comps/Overlay/index.d.ts +8 -0
  58. package/dist/comps/Overlay/index.js +12 -0
  59. package/dist/comps/Password/index.d.ts +4 -0
  60. package/dist/comps/Password/index.js +18 -0
  61. package/dist/comps/PinInput/index.d.ts +12 -0
  62. package/dist/comps/{otp → PinInput}/index.js +10 -18
  63. package/dist/comps/ProgressBar/index.d.ts +7 -0
  64. package/dist/comps/ProgressBar/index.js +21 -0
  65. package/dist/comps/ProgressBar/types.d.ts +9 -0
  66. package/dist/comps/ProgressBar/types.js +1 -0
  67. package/dist/comps/Search/index.d.ts +14 -0
  68. package/dist/comps/{search → Search}/index.js +9 -19
  69. package/dist/comps/Segmented/index.d.ts +26 -0
  70. package/dist/comps/{segmented → Segmented}/index.js +3 -9
  71. package/dist/comps/Segmented/item.d.ts +3 -0
  72. package/dist/comps/{segmented → Segmented}/item.js +3 -9
  73. package/dist/comps/Segmented/types.d.ts +31 -0
  74. package/dist/comps/Segmented/types.js +1 -0
  75. package/dist/comps/Select/index.d.ts +13 -0
  76. package/dist/comps/Select/index.js +60 -0
  77. package/dist/comps/Select/optionItem.d.ts +3 -0
  78. package/dist/comps/Select/optionItem.js +6 -0
  79. package/dist/comps/Select/types.d.ts +53 -0
  80. package/dist/comps/Select/types.js +1 -0
  81. package/dist/comps/{sheet.d.ts → Sheet/index.d.ts} +16 -5
  82. package/dist/comps/Sheet/index.js +175 -0
  83. package/dist/comps/Slider/index.d.ts +21 -0
  84. package/dist/comps/Slider/index.js +81 -0
  85. package/dist/comps/Span/index.d.ts +4 -0
  86. package/dist/comps/Span/index.js +10 -0
  87. package/dist/comps/Spinner/index.d.ts +21 -0
  88. package/dist/comps/Spinner/index.js +31 -0
  89. package/dist/comps/Switch/index.d.ts +7 -0
  90. package/dist/comps/Switch/index.js +8 -0
  91. package/dist/comps/TabView/index.d.ts +9 -0
  92. package/dist/comps/TabView/index.js +41 -0
  93. package/dist/comps/TabView/tab.d.ts +3 -0
  94. package/dist/comps/TabView/tab.js +9 -0
  95. package/dist/comps/{tabview.d.ts → TabView/types.d.ts} +10 -5
  96. package/dist/comps/TabView/types.js +1 -0
  97. package/dist/comps/Text/index.d.ts +11 -0
  98. package/dist/comps/Text/index.js +12 -0
  99. package/dist/comps/TextWheel/index.d.ts +8 -0
  100. package/dist/comps/{textwheel.js → TextWheel/index.js} +9 -9
  101. package/dist/comps/TextWheel/types.d.ts +10 -0
  102. package/dist/comps/TextWheel/types.js +1 -0
  103. package/dist/comps/Tooltip/index.d.ts +4 -0
  104. package/dist/comps/Tooltip/index.js +19 -0
  105. package/dist/comps/Treeview/index.d.ts +11 -0
  106. package/dist/comps/{treeview → Treeview}/index.js +3 -3
  107. package/dist/comps/Treeview/item.d.ts +11 -0
  108. package/dist/comps/Treeview/item.js +26 -0
  109. package/dist/comps/{treeview/index.d.ts → Treeview/types.d.ts} +14 -5
  110. package/dist/comps/Treeview/types.js +1 -0
  111. package/dist/comps/index.d.ts +48 -0
  112. package/dist/comps/index.js +48 -0
  113. package/dist/comps/svgicons.d.ts +26 -2
  114. package/dist/comps/svgicons.js +44 -5
  115. package/dist/funs/css.js +52 -6
  116. package/dist/funs/index.d.ts +18 -17
  117. package/dist/funs/index.js +70 -69
  118. package/dist/funs/stylesheet.d.ts +3 -2
  119. package/dist/funs/stylesheet.js +26 -1
  120. package/dist/hooks/index.d.ts +7 -3
  121. package/dist/hooks/index.js +8 -3
  122. package/dist/hooks/useBase.d.ts +8 -0
  123. package/dist/{comps/useBase/index.js → hooks/useBase.js} +24 -6
  124. package/dist/hooks/useContextMenu.d.ts +7 -0
  125. package/dist/hooks/useContextMenu.js +21 -0
  126. package/dist/hooks/useDebounce.d.ts +2 -0
  127. package/dist/hooks/useDebounce.js +14 -0
  128. package/dist/hooks/useDrag.d.ts +21 -0
  129. package/dist/hooks/useDrag.js +71 -0
  130. package/dist/index.d.ts +5 -31
  131. package/dist/index.js +5 -32
  132. package/dist/styles.css +1 -1
  133. package/dist/types/enums.d.ts +9 -0
  134. package/dist/types/enums.js +11 -0
  135. package/dist/types/index.d.ts +54 -20
  136. package/dist/types/interfaces.d.ts +45 -51
  137. package/package.json +3 -4
  138. package/dist/comps/accordion.d.ts +0 -12
  139. package/dist/comps/accordion.js +0 -10
  140. package/dist/comps/alert.d.ts +0 -15
  141. package/dist/comps/alert.js +0 -15
  142. package/dist/comps/animate.d.ts +0 -6
  143. package/dist/comps/animate.js +0 -8
  144. package/dist/comps/avatar.d.ts +0 -13
  145. package/dist/comps/avatar.js +0 -11
  146. package/dist/comps/base.d.ts +0 -15
  147. package/dist/comps/base.js +0 -68
  148. package/dist/comps/box.d.ts +0 -6
  149. package/dist/comps/box.js +0 -12
  150. package/dist/comps/button.d.ts +0 -7
  151. package/dist/comps/button.js +0 -19
  152. package/dist/comps/checkbox.d.ts +0 -18
  153. package/dist/comps/contextmenu.d.ts +0 -15
  154. package/dist/comps/contextmenu.js +0 -9
  155. package/dist/comps/cover.d.ts +0 -15
  156. package/dist/comps/cover.js +0 -31
  157. package/dist/comps/dialog.d.ts +0 -0
  158. package/dist/comps/dialog.js +0 -1
  159. package/dist/comps/editor.d.ts +0 -12
  160. package/dist/comps/editor.js +0 -92
  161. package/dist/comps/grid/index.d.ts +0 -10
  162. package/dist/comps/grid/index.js +0 -16
  163. package/dist/comps/heading.d.ts +0 -8
  164. package/dist/comps/heading.js +0 -16
  165. package/dist/comps/icon.d.ts +0 -7
  166. package/dist/comps/icon.js +0 -23
  167. package/dist/comps/image.d.ts +0 -13
  168. package/dist/comps/image.js +0 -8
  169. package/dist/comps/input.d.ts +0 -6
  170. package/dist/comps/input.js +0 -19
  171. package/dist/comps/otp/index.d.ts +0 -6
  172. package/dist/comps/password.d.ts +0 -3
  173. package/dist/comps/password.js +0 -30
  174. package/dist/comps/progressbar.d.ts +0 -11
  175. package/dist/comps/progressbar.js +0 -14
  176. package/dist/comps/search/index.d.ts +0 -7
  177. package/dist/comps/segmented/index.d.ts +0 -46
  178. package/dist/comps/segmented/item.d.ts +0 -8
  179. package/dist/comps/select/index.d.ts +0 -15
  180. package/dist/comps/select/index.js +0 -79
  181. package/dist/comps/select/select.d.ts +0 -0
  182. package/dist/comps/select/select.js +0 -1
  183. package/dist/comps/sheet.js +0 -229
  184. package/dist/comps/span.d.ts +0 -6
  185. package/dist/comps/span.js +0 -12
  186. package/dist/comps/spinner.d.ts +0 -16
  187. package/dist/comps/spinner.js +0 -42
  188. package/dist/comps/tabview.js +0 -64
  189. package/dist/comps/textwheel.d.ts +0 -15
  190. package/dist/comps/treeview/item.d.ts +0 -15
  191. package/dist/comps/treeview/item.js +0 -23
  192. package/dist/comps/useBase/base.types.d.ts +0 -80
  193. package/dist/comps/useBase/index.d.ts +0 -10
  194. package/dist/funs/lexer.d.ts +0 -3
  195. package/dist/funs/lexer.js +0 -37
  196. package/dist/hooks/useCompEditor.d.ts +0 -2
  197. package/dist/hooks/useCompEditor.js +0 -5
  198. package/dist/hooks/useInteractionObserver.d.ts +0 -8
  199. package/dist/hooks/useInteractionObserver.js +0 -21
  200. package/dist/hooks/usePub.d.ts +0 -0
  201. package/dist/hooks/usePub.js +0 -1
  202. package/dist/hooks/usePubSub.d.ts +0 -3
  203. package/dist/hooks/usePubSub.js +0 -19
  204. package/dist/hooks/useSub.d.ts +0 -3
  205. package/dist/hooks/useSub.js +0 -17
  206. package/dist/hooks/useToast.d.ts +0 -2
  207. package/dist/hooks/useToast.js +0 -10
  208. package/dist/hooks/useWindowFocus.d.ts +0 -2
  209. package/dist/hooks/useWindowFocus.js +0 -11
  210. package/dist/media/edit-ui.d.ts +0 -2
  211. package/dist/media/edit-ui.js +0 -2
  212. package/dist/mixins.css +0 -1
  213. /package/dist/comps/{useBase/base.types.js → Accordion/types.js} +0 -0
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import With from "./base";
4
- const Animate = forwardRef((props, ref) => {
5
- const { as, ...rest } = props;
6
- return _jsx(With, { as: as, ...rest, ref: ref });
7
- });
8
- export default Animate;
@@ -1,13 +0,0 @@
1
- import { BaseProps } from "../types/interfaces";
2
- import { AVATAR } from "../types/enums";
3
- export interface AvatarProps {
4
- type?: AVATAR;
5
- size?: number;
6
- src: string;
7
- crossOrigin?: 'anonymous' | 'use-credentials';
8
- referrerPolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url';
9
- }
10
- export interface AvatarHandler {
11
- }
12
- declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & BaseProps & import("react").RefAttributes<AvatarHandler>>;
13
- export default Avatar;
@@ -1,11 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { AVATAR } from "../types/enums";
4
- import With from "./base";
5
- import { useImage } from "../hooks";
6
- const Avatar = forwardRef((props, ref) => {
7
- const { src, size, type, crossOrigin, referrerPolicy, ...rest } = props;
8
- const [img, imgStatus, imgError] = useImage(src, crossOrigin, referrerPolicy);
9
- return _jsx(With, { tag: `img`, src: img, style: size ? { width: size, height: size } : {}, crossOrigin: crossOrigin, referrerPolicy: referrerPolicy, className: `--avatar --${(type || AVATAR.Circle).toLowerCase()}`, ...rest });
10
- });
11
- export default Avatar;
@@ -1,15 +0,0 @@
1
- import { ComponentPropsWithoutRef, ElementType } from "react";
2
- import { SHIMMER } from "../types/enums";
3
- import { animationProps, Skeleton } from "../types/interfaces";
4
- interface BaseProps<T extends ElementType> {
5
- tag?: T;
6
- as?: string | string[];
7
- animate?: animationProps;
8
- className?: string;
9
- propsToRemove?: string[];
10
- skeleton?: Skeleton;
11
- shimmer?: SHIMMER;
12
- }
13
- export type Props<T extends ElementType> = BaseProps<T> & Omit<ComponentPropsWithoutRef<T>, keyof BaseProps<T>>;
14
- declare const With: import("react").ForwardRefExoticComponent<Omit<Props<ElementType>, "ref"> & import("react").RefAttributes<Element>>;
15
- export default With;
@@ -1,68 +0,0 @@
1
- import { createElement, forwardRef } from "react";
2
- import { css, cleanProps } from "../funs";
3
- import { buildWithStyles, getAnimationCurve, getAnimationTransition } from "../funs/css";
4
- const buildSkeletonStyle = (s) => {
5
- const makeValue = (v, unit = `px`) => {
6
- return v ?
7
- `string` == typeof v ? v : `${v}${unit}`
8
- : `inherit`;
9
- };
10
- const style = {};
11
- if (s.radius) {
12
- style.borderRadius = makeValue(s.radius);
13
- }
14
- if (s.size) {
15
- style.width = style.minWidth = style.maxWidth = style.height = style.minHeight = style.maxHeight = makeValue(s.size);
16
- }
17
- else if (s.width || s.height) {
18
- if (s.width) {
19
- style.width = style.minWidth = style.maxWidth = makeValue(s.width);
20
- }
21
- if (s.height) {
22
- style.height = style.minHeight = style.maxHeight = makeValue(s.height);
23
- }
24
- }
25
- else {
26
- style.minWidth = style.minHeight = `100%`;
27
- }
28
- return style;
29
- };
30
- const With = forwardRef(({ tag, as, animate, className, propsToRemove, style, skeleton, ...rest }, ref) => {
31
- const Comp = tag || 'div';
32
- let cx = [];
33
- if (as) {
34
- cx = css().Build(`string` == typeof as ? as : as.join(` `)).cx;
35
- }
36
- const { transition, from, to, when, duration, delay, curve } = animate || {};
37
- let _style = {};
38
- const _transition = transition || (from && to) ? { transition: `all ${duration || `0.2`}s ${getAnimationCurve(curve)} ${delay || 0}s` } : {};
39
- if (undefined === when) {
40
- _style = transition ? getAnimationTransition(transition, true) : { ...from, ...to };
41
- }
42
- else if (true === when) {
43
- _style = transition ? getAnimationTransition(transition, false) : { ...(to || {}) };
44
- }
45
- else {
46
- _style = transition ? getAnimationTransition(transition, false, true) : from || {};
47
- }
48
- const { children, shimmer, ...restProps } = cleanProps(rest, propsToRemove ? [...propsToRemove, `skeleton`] : [`skeleton`]);
49
- return createElement(Comp, {
50
- style: {
51
- ...buildWithStyles(_style),
52
- ..._transition,
53
- ...style,
54
- ...(skeleton?.enabled ? buildSkeletonStyle(skeleton) : {})
55
- },
56
- className: [
57
- className,
58
- ...cx,
59
- skeleton?.enabled ? `--skeleton` : ``,
60
- shimmer ? `--shimmer --${shimmer.toLowerCase()}` : ``,
61
- ].join(' ').trim(),
62
- children: skeleton?.enabled ? ` `.repeat(6)
63
- : children,
64
- ...restProps,
65
- ref
66
- });
67
- });
68
- export default With;
@@ -1,6 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- export interface BoxProps extends Props<'div'> {
3
- name?: string;
4
- }
5
- declare const Box: import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<HTMLDivElement>>;
6
- export default Box;
package/dist/comps/box.js DELETED
@@ -1,12 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import useBase from "./useBase";
4
- const Box = forwardRef((props, ref) => {
5
- const { style, ...pops } = props;
6
- const { className, style: _style, rest } = useBase(pops);
7
- return _jsx("div", { ref: ref, className: className, style: {
8
- ..._style,
9
- ...(style || {})
10
- }, ...rest });
11
- });
12
- export default Box;
@@ -1,7 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- export interface ButtonProps extends Props<`button`> {
3
- icon?: string;
4
- withLabel?: boolean;
5
- }
6
- declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
7
- export default Button;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- // import With, { Props } from "./base";
4
- import useBase from "./useBase";
5
- const Button = forwardRef((props, ref) => {
6
- const { icon, children, withLabel, ...pops } = props;
7
- const { className, style, rest } = useBase(pops);
8
- return _jsxs("button", { className: `${className} flex aic ${icon ? `ico-btn` : ``}`, style: style, ref: ref, ...rest, children: [icon && _jsx("div", { ...{ className: `icon-${icon}` } }), undefined == withLabel || withLabel == true ?
9
- _jsx("span", { ...{ className: `b-label` }, children: children })
10
- : children] });
11
- });
12
- // const Button = forwardRef<HTMLButtonElement, ButtonProps>((props, ref ) => {
13
- // const { as, icon, ...rest } = props;
14
- // return <With tag={`button`} as={as} className={`flex aic ${icon ? `ico-btn` : ``}`.trim()} {...rest} ref={ref}>
15
- // {icon && <With className={`icon-${icon}`} />}
16
- // <With tag={`span`} className={`b-label`}>{props.children}</With>
17
- // </With>
18
- // });
19
- export default Button;
@@ -1,18 +0,0 @@
1
- import { CHECKBOX } from "../types/enums";
2
- import { animationProps } from "../types/interfaces";
3
- export interface CheckboxProps {
4
- as?: string;
5
- type?: CHECKBOX;
6
- required?: boolean;
7
- name?: string;
8
- value?: string;
9
- checked?: boolean;
10
- onChange?: (checked: boolean, value: string | string[]) => void;
11
- animate?: animationProps;
12
- }
13
- export interface CheckboxHandler {
14
- setChecked: (mode: boolean, triggerChange?: boolean) => void;
15
- toggle: (triggerChange?: boolean) => void;
16
- }
17
- declare const CheckBox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<CheckboxHandler>>;
18
- export default CheckBox;
@@ -1,15 +0,0 @@
1
- import { animationProps } from "../types/interfaces";
2
- export interface ContextMenuItem {
3
- label: string;
4
- labelColor?: string;
5
- icon?: string;
6
- iconColor?: string;
7
- className?: string;
8
- onSelect: () => void;
9
- }
10
- declare const ContextMenu: import("react").ForwardRefExoticComponent<{
11
- as?: string;
12
- items: ContextMenuItem[];
13
- animate?: animationProps;
14
- } & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
15
- export default ContextMenu;
@@ -1,9 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import With from "./base";
4
- const ContextMenu = forwardRef((props, ref) => {
5
- const { as, items, ...rest } = props;
6
- return _jsx(With, { as: as, className: `context-menu abs flex cols`, ...rest, ref: ref, children: items.map((item, index) => item.label == `-` ? _jsx(With, { as: `context-line` }, `${index}-line`) :
7
- _jsxs(With, { onClick: item.onSelect, as: `button`, className: `context-menu-item flex aic ${item.className || ``}`.trim(), children: [_jsx(With, { as: `div`, className: `ico icon-${item.icon}`.trim(), style: item.iconColor ? { color: item.iconColor } : {} }), _jsx(With, { as: `h1`, className: `flex aic`, style: item.labelColor ? { color: item.labelColor } : {}, children: item.label })] }, `item-${item.label.replace(/\s/g, `-`)}-${index}`)) });
8
- });
9
- export default ContextMenu;
@@ -1,15 +0,0 @@
1
- import { ComponentPropsWithoutRef } from "react";
2
- import { SpinnerProps } from "./spinner";
3
- import { animationProps } from "../types/interfaces";
4
- export interface CoverProps extends ComponentPropsWithoutRef<`div`> {
5
- tag?: string;
6
- message?: string;
7
- spinner?: SpinnerProps;
8
- color?: string;
9
- as?: string;
10
- animate?: animationProps;
11
- when?: boolean;
12
- hideMessage?: boolean;
13
- }
14
- declare const Cover: import("react").ForwardRefExoticComponent<CoverProps & import("react").RefAttributes<HTMLDivElement>>;
15
- export default Cover;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import With from "./base";
4
- import Spinner from "./spinner";
5
- const Cover = forwardRef((props, ref) => {
6
- const { spinner, message, color, as, when, hideMessage, ...rest } = props;
7
- if (`when` in props && props.when == false) {
8
- return null;
9
- }
10
- return (_jsxs(With, { className: `zuz-cover flex aic jcc cols abs fillx nope nous`, ref: ref, style: {
11
- backgroundColor: `var(--cover-bg)`
12
- }, as: as, ...rest, children: [_jsx(Spinner, { ...{
13
- ...spinner
14
- } }), !hideMessage && _jsx(With, { tag: `h1`, className: `label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] }));
15
- // return (
16
- // <With
17
- // className={`zuz-cover flex aic jcc cols abs fill nope nous`}
18
- // ref={ref}
19
- // style={{
20
- // backgroundColor: color ? !color.startsWith(`#`) ? hexToRgba(color, .9) : color : hexToRgba(color || `var(--cover)`, .9)
21
- // }}
22
- // as={as}
23
- // {...rest}
24
- // >
25
- // {<Spinner {...spinner} />}
26
- // {<With tag={`h1`} className={`label`}>{message || `loading`}</With>}
27
- // {/* {message && <With tag={`h1`} className={`label`}>{message}</With>} */}
28
- // </With>
29
- // );
30
- });
31
- export default Cover;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,12 +0,0 @@
1
- import { BaseProps } from "../types/interfaces";
2
- import { dynamicObject } from "../types";
3
- export interface EditorProps {
4
- title: string;
5
- attrs: dynamicObject;
6
- element: string;
7
- }
8
- export interface EditorHandler {
9
- show: () => void;
10
- }
11
- declare const ComponentEditor: import("react").ForwardRefExoticComponent<EditorProps & BaseProps & import("react").RefAttributes<EditorHandler>>;
12
- export default ComponentEditor;
@@ -1,92 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useState } from "react";
3
- import With from "./base";
4
- import Pencil from "../media/edit-ui";
5
- import { TRANSITIONS } from "../types/enums";
6
- import Lexer from "../funs/lexer";
7
- import { copyToClipboard } from "../funs";
8
- import { useMounted } from "../hooks";
9
- const ComponentEditor = forwardRef((props, ref) => {
10
- const [visible, setVisible] = useState(false);
11
- const [code, setCode] = useState(false);
12
- const { title, attrs, element } = props;
13
- const mounted = useMounted(500);
14
- const getVariable = (v) => {
15
- // console.log(element!.current)
16
- // const elm = document.querySelector(element!);
17
- // return getComputedStyle(document.querySelector(element)!).getPropertyValue(`--${v}`).trim()
18
- const a = getComputedStyle(document.querySelector(element)).getPropertyValue(`--${v}`).trim();
19
- const b = getComputedStyle(document.body).getPropertyValue(`--${v}`).trim();
20
- const d = getComputedStyle(document.documentElement).getPropertyValue(`--${v}`).trim();
21
- return a || b || d;
22
- };
23
- const expandHex = (hex) => {
24
- if (hex.length === 4) {
25
- return `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}`;
26
- }
27
- return hex;
28
- };
29
- const rangeSlider = (k, value, min, max, step, unit) => {
30
- return _jsxs(_Fragment, { children: [_jsx(With, { tag: `input`, type: `range`, defaultValue: value, min: min, max: max, step: step, name: `editor-prop-range-${k}`, onChange: (e) => {
31
- // document.body.style.setProperty(`--${k}`,`${e.currentTarget.value}${unit || ``}`);
32
- document.querySelector(element).style.setProperty(`--${k}`, `${e.currentTarget.value}${unit || ``}`);
33
- document.querySelector(`input[name="editor-prop-num-${k}"]`).value = e.currentTarget.value;
34
- } }), _jsx(With, { tag: `input`, type: `number`, name: `editor-prop-num-${k}`, defaultValue: value, min: min, max: max, onChange: (e) => {
35
- document.querySelector(element).style.setProperty(`--${k}`, `${e.currentTarget.value}${unit || ``}`);
36
- // document.body.style.setProperty(`--${k}`,`${e.currentTarget.value}${unit || ``}`);
37
- document.querySelector(`input[name="editor-prop-range-${k}"]`).value = e.currentTarget.value;
38
- } })] });
39
- };
40
- const colorPicker = (k, value) => {
41
- return _jsxs(_Fragment, { children: [_jsx(With, { tag: `input`, type: `color`, defaultValue: expandHex(value.toString()), name: `editor-prop-color-${k}`, onChange: (e) => {
42
- // document.body.style.setProperty(`--${k}`, e.currentTarget.value);
43
- document.querySelector(element).style.setProperty(`--${k}`, e.currentTarget.value);
44
- document.querySelector(`input[name="editor-prop-num-${k}"]`).value = e.currentTarget.value;
45
- } }), _jsx(With, { tag: `input`, name: `editor-prop-num-${k}`, defaultValue: expandHex(value.toString()), onChange: (e) => {
46
- document.querySelector(element).style.setProperty(`--${k}`, `${e.currentTarget.value}`);
47
- // document.body.style.setProperty(`--${k}`,`${e.currentTarget.value}px`);
48
- document.querySelector(`input[name="editor-prop-color-${k}"]`).value = e.currentTarget.value;
49
- } })] });
50
- };
51
- const build = (at) => {
52
- const comps = [];
53
- Object.keys(at)
54
- .forEach((k) => {
55
- if (k.startsWith('@group')) {
56
- comps.push(_jsxs(With, { className: `group flex cols`, children: [_jsx(With, { tag: `h1`, as: `glabel`, children: at[k].label }), _jsx(With, { className: `gprops flex cols`, children: build(at[k].pops) })] }, `egroup-${k}`));
57
- }
58
- else {
59
- const { label, value, min, max, type, step, unit } = Lexer(at[k]);
60
- comps.push(_jsxs(With, { className: `prop flex aic`, children: [_jsxs(With, { className: `pop flex cols`, children: [_jsx(With, { tag: `h1`, as: `label`, children: label.split(`,`).join(` `) }), _jsx(With, { tag: `h1`, as: `l-k`, children: k })] }), _jsxs(With, { className: `pop flex aic`, children: [type == `range` && rangeSlider(k, value == `auto` ? parseFloat(getVariable(k)) : value, min, max, step || 1, unit), type == `color` && colorPicker(k, value == `auto` ? getVariable(k) : value)] })] }, `el-${k}-${label}`));
61
- }
62
- });
63
- return comps;
64
- };
65
- const getCode = (at) => {
66
- const c = [];
67
- Object.keys(at)
68
- .forEach((k) => {
69
- if (k.startsWith('@group')) {
70
- c.push(...getCode(at[k].pops));
71
- }
72
- else {
73
- const { label, value, min, max, type, step, unit } = Lexer(at[k]);
74
- c.push(`--${k}: ${value == `auto` ? type == `range` ? parseFloat(getVariable(k)) : getVariable(k) : value}${unit || ``};`);
75
- }
76
- });
77
- return c; //.join(`\n`)
78
- };
79
- if (!mounted)
80
- return null;
81
- return _jsxs(With, { as: `comp-editor fixed`, children: [_jsx(With, { tag: `button`, as: `pencil`, onClick: (e) => setVisible(!visible), children: !visible ?
82
- _jsx(With, { tag: `img`, src: `data:image/png;base64,${Pencil}` })
83
- : _jsx(With, { tag: `span`, children: "\u00D7" }) }), _jsxs(With, { as: `editor-props fixed`, "aria-hidden": !visible, animate: {
84
- transition: TRANSITIONS.SlideInRight,
85
- when: visible,
86
- duration: 0.1,
87
- }, children: [_jsxs(With, { as: `editor-head flex aic`, children: [_jsxs(With, { tag: `h1`, className: `head-label`, children: [title, " Editor"] }), _jsx(With, { className: `head-action`, children: _jsx(With, { tag: `button`, onClick: (e) => setCode(!code), children: code ? `Edit` : `Get Code` }) })] }), _jsx(With, { as: `editor-body flex cols rel`, children: code ? _jsxs(_Fragment, { children: [_jsx(With, { tag: `textarea`, children: getCode(attrs).join(`\n`) }), _jsx(With, { tag: `button`, className: `copy abs`, onClick: (e) => copyToClipboard(getCode(attrs).join(`\n`)).then(() => {
88
- document.querySelector(`.comp-editor .editor-props .editor-body .copy`).textContent = `Copied`;
89
- setTimeout(() => document.querySelector(`.comp-editor .editor-props .editor-body .copy`).textContent = `Copy`, 3000);
90
- }), children: "Copy" })] }) : build(attrs) })] })] });
91
- });
92
- export default ComponentEditor;
@@ -1,10 +0,0 @@
1
- import { Props } from "../useBase/base.types";
2
- export declare enum GRID {
3
- Default = 0
4
- }
5
- declare const Grid: import("react").ForwardRefExoticComponent<Props<"div"> & {
6
- rows?: number;
7
- cols?: number;
8
- gap?: number;
9
- } & import("react").RefAttributes<HTMLInputElement>>;
10
- export default Grid;
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import Box from "../box";
4
- import useBase from "../useBase";
5
- export var GRID;
6
- (function (GRID) {
7
- GRID[GRID["Default"] = 0] = "Default";
8
- })(GRID || (GRID = {}));
9
- const Grid = forwardRef((props, ref) => {
10
- const { animate, children, rows, cols, gap, ...pops } = props;
11
- const { className, style } = useBase(props);
12
- return _jsx(Box, { style: style, ...{
13
- className: `--grid grid ${className}`.trim()
14
- }, children: children });
15
- });
16
- export default Grid;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { Props } from "./useBase/base.types";
3
- export interface HeadingProps extends Props<"h1" | "h2" | "h3" | "h4" | "h5" | "h6"> {
4
- h?: number | string;
5
- html?: ReactNode | string;
6
- }
7
- declare const Heading: import("react").ForwardRefExoticComponent<HeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
8
- export default Heading;
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createElement, forwardRef } from "react";
3
- import useBase from "./useBase";
4
- const Heading = forwardRef((props, ref) => {
5
- const { h, html, children, ...pops } = props;
6
- const { className, style, rest } = useBase(pops);
7
- const Tag = `h${h || 1}`;
8
- return createElement(Tag, {
9
- ref,
10
- style,
11
- className,
12
- ...rest,
13
- children: html ? _jsx("span", { ...{ dangerouslySetInnerHTML: { __html: html } } }) : children
14
- });
15
- });
16
- export default Heading;
@@ -1,7 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- export interface IconProps extends Props<`div`> {
3
- name: string;
4
- pathCount?: number;
5
- }
6
- declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLDivElement>>;
7
- export default Icon;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- // import With, { Props } from "./base";
4
- import Box from "./box";
5
- import useBase from "./useBase";
6
- import Span from "./span";
7
- const Icon = forwardRef((props, ref) => {
8
- const { name, pathCount, ...pops } = props;
9
- const { className, style, rest } = useBase(pops);
10
- return _jsx(Box, { ...{
11
- className: `${className} icon-${name}`,
12
- style,
13
- ...rest
14
- }, children: Array(pathCount || 0).fill(0).map((p, i) => _jsx(Span, { ...{
15
- className: `path${i + 1}`
16
- } }, `${name}-layer-${i}`)) });
17
- // return <With
18
- // className={`icon-${name}`}
19
- // as={as}
20
- // {...rest}
21
- // ref={ref} />
22
- });
23
- export default Icon;
@@ -1,13 +0,0 @@
1
- import React from "react";
2
- import { animationProps } from "../types/interfaces";
3
- interface ImageProps {
4
- width: string | number;
5
- height: string | number;
6
- as?: string;
7
- animate?: animationProps;
8
- src: string;
9
- alt: string;
10
- crossover?: boolean;
11
- }
12
- declare const Image: React.ForwardRefExoticComponent<ImageProps & Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
- export default Image;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import With from "./base";
4
- const Image = forwardRef((props, ref) => {
5
- const { as, width, height, ...rest } = props;
6
- return _jsx(With, { tag: `img`, as: as, ...rest, ref: ref });
7
- });
8
- export default Image;
@@ -1,6 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- export interface InputProps extends Props<`input`> {
3
- numeric?: boolean;
4
- }
5
- declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
6
- export default Input;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useEffect } from "react";
3
- import useBase from "./useBase";
4
- const Input = forwardRef((props, ref) => {
5
- /**
6
- * @internal
7
- * const _innerRef = useRef<HTMLInputElement>(null)
8
- */
9
- const { numeric, ...pops } = props;
10
- const handleInput = (event) => {
11
- if (numeric) {
12
- event.currentTarget.value = event.currentTarget.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');
13
- }
14
- };
15
- const { className, style, rest } = useBase(pops);
16
- useEffect(() => { }, []);
17
- return _jsx("input", { className: `${className} --input`, style: style, ref: ref, onInput: handleInput, ...rest });
18
- });
19
- export default Input;
@@ -1,6 +0,0 @@
1
- import { Props } from "../useBase/base.types";
2
- declare const OTP: import("react").ForwardRefExoticComponent<Props<"input"> & {
3
- mask?: boolean;
4
- size?: number;
5
- } & import("react").RefAttributes<HTMLInputElement>>;
6
- export default OTP;
@@ -1,3 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- declare const Password: import("react").ForwardRefExoticComponent<Omit<Props<"input">, "type"> & import("react").RefAttributes<HTMLInputElement>>;
3
- export default Password;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useState } from "react";
3
- import Input from "./input";
4
- import Box from "./box";
5
- import Button from "./button";
6
- import useBase from "./useBase";
7
- const Icons = {
8
- on: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", children: [_jsx("path", { fill: "#333", d: "M12 20.5c-4.299 0-8.24-3.023-10.544-8.086a1 1 0 010-.828C3.759 6.523 7.701 3.5 12 3.5s8.24 3.023 10.544 8.086a1.001 1.001 0 010 .828 18.14 18.14 0 01-1.391 2.52 1 1 0 11-1.666-1.106A15.87 15.87 0 0020.529 12C18.543 7.92 15.379 5.5 12 5.5S5.457 7.92 3.471 12c1.986 4.08 5.15 6.5 8.529 6.5a7.964 7.964 0 005.036-1.92 1 1 0 111.265 1.55A9.94 9.94 0 0112 20.5z" }), _jsx("path", { fill: "#333", d: "M12 16a4.004 4.004 0 01-3.929-4.756 1 1 0 011.965.375A2 2 0 1014 12a2.034 2.034 0 00-2.053-1.999 1.04 1.04 0 01-1.043-.947.963.963 0 01.902-1.05L12 8a4 4 0 010 8z" })] }),
9
- off: _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", children: [_jsx("path", { fill: "#333", d: "M12 15c-4.132 0-7.98-1.214-10.294-3.249a1 1 0 111.32-1.502C4.986 11.972 8.34 13 12 13s7.014-1.028 8.974-2.751a1 1 0 111.32 1.502C19.98 13.786 16.132 15 12 15z" }), _jsx("path", { fill: "#333", d: "M12 18a1 1 0 01-1-1v-3a1 1 0 012 0v3a1 1 0 01-1 1zM7.749 17.667a.964.964 0 01-.17-.014 1 1 0 01-.817-1.155l.505-2.935a1 1 0 111.97.339l-.504 2.935a1 1 0 01-.984.83zM3.636 16.306a1.001 1.001 0 01-.942-1.336l.978-2.745a1 1 0 111.884.672l-.978 2.745a1 1 0 01-.942.664zM16.251 17.667a1 1 0 01-.984-.83l-.505-2.935a1 1 0 011.97-.339l.506 2.935a1 1 0 01-.816 1.155.964.964 0 01-.17.014zM20.364 16.306a1 1 0 01-.942-.664l-.978-2.745a1 1 0 111.884-.672l.978 2.745a1.001 1.001 0 01-.942 1.336z" })] })
10
- };
11
- const Password = forwardRef((props, ref) => {
12
- const [visible, setVisible] = useState(false);
13
- const { animate, ...pops } = props;
14
- const { style } = useBase(props);
15
- if (`type` in props) {
16
- delete props[`type`];
17
- }
18
- return _jsxs(Box, { style: style, ...{
19
- className: `--password flex aic rel`
20
- }, children: [_jsx(Input, { ...{
21
- ref,
22
- type: visible ? 'text' : 'password',
23
- ...pops
24
- } }), _jsx(Button, { ...{
25
- tabIndex: -1,
26
- onClick: e => setVisible(prev => !prev),
27
- className: `--toggle flex aic jcc abs`
28
- }, children: visible ? Icons.on : Icons.off })] });
29
- });
30
- export default Password;
@@ -1,11 +0,0 @@
1
- import { BaseProps } from "../types/interfaces";
2
- import { PROGRESS } from "../types/enums";
3
- export interface ProgressBarProps {
4
- progress: number;
5
- type?: PROGRESS;
6
- }
7
- export interface ProgressHandler {
8
- setWidth?: (w: number) => void;
9
- }
10
- declare const ProgressBar: import("react").ForwardRefExoticComponent<ProgressBarProps & BaseProps & import("react").RefAttributes<ProgressHandler>>;
11
- export default ProgressBar;
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useImperativeHandle, useRef } from "react";
3
- import With from "./base";
4
- const ProgressBar = forwardRef((props, ref) => {
5
- const { as } = props;
6
- const bar = useRef(null);
7
- useImperativeHandle(ref, () => ({
8
- setWidth: (progress) => {
9
- bar.current.style.width = `${progress * 100}%`;
10
- }
11
- }), []);
12
- return _jsx(With, { className: `--progress flex rel`, as: as, children: _jsx(With, { ref: bar, className: `--bar rel` }) });
13
- });
14
- export default ProgressBar;
@@ -1,7 +0,0 @@
1
- import { Props } from "../useBase/base.types";
2
- declare const Search: import("react").ForwardRefExoticComponent<Props<"input"> & {
3
- onSubmit?: (value: string) => void;
4
- onChange?: (value: string) => void;
5
- withStyle?: string;
6
- } & import("react").RefAttributes<HTMLInputElement>>;
7
- export default Search;