@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,46 +0,0 @@
1
- import { Props } from "../useBase/base.types";
2
- /**
3
- * Individual segment in the `SelectTabs` component.
4
- * @typedef {Object} Segment
5
- * @property {number} index - The index of the segment.
6
- * @property {string} [icon] - The optional icon to display for the segment.
7
- * @property {string} [label] - The optional label to display for the segment.
8
- */
9
- export interface Segment {
10
- tag?: string;
11
- index: number;
12
- icon?: string;
13
- label?: string;
14
- }
15
- /**
16
- * Props for the `SelectTabs` component.
17
- * @typedef {Object} SegmentProps
18
- * @extends {Props<'div'>}
19
- * @property {number} [selected] - The index of the initially selected segment.
20
- * @property {Segment[]} items - Array of segments to display.
21
- */
22
- export interface SegmentProps extends Props<`div`> {
23
- selected?: number;
24
- onSwitch?: (segment: Segment) => void;
25
- items: Segment[];
26
- }
27
- /**
28
- * `SelectTabs` component is a segmented control that allows switching between segments.
29
- *
30
- * @component
31
- * @param {SegmentProps} props - Props for the segmented control component.
32
- * @param {React.Ref<HTMLDivElement>} ref - Ref for the root div element.
33
- * @returns {JSX.Element} The rendered segmented control.
34
- *
35
- * @example
36
- * // Usage example
37
- * const segments = [
38
- * { index: 0, label: "Home", icon: "home_icon" },
39
- * { index: 1, label: "Profile", icon: "profile_icon" },
40
- * { index: 2, label: "Settings", icon: "settings_icon" }
41
- * ];
42
- *
43
- * <SelectTabs selected={1} items={segments} />
44
- */
45
- declare const Segmented: import("react").ForwardRefExoticComponent<SegmentProps & import("react").RefAttributes<HTMLDivElement>>;
46
- export default Segmented;
@@ -1,8 +0,0 @@
1
- import { Segment } from ".";
2
- interface SegmentItemProps {
3
- meta: Segment;
4
- selected: boolean;
5
- onSelect: (index: number, width: number, x: number, segment: Segment) => void;
6
- }
7
- declare const SegmentItem: ({ onSelect, meta, selected }: SegmentItemProps) => import("react/jsx-runtime").JSX.Element;
8
- export default SegmentItem;
@@ -1,15 +0,0 @@
1
- import { Props } from "../useBase/base.types";
2
- import { dynamicObject } from "../../types";
3
- import { FORMVALIDATION } from "../../types/enums";
4
- export interface SelectProps extends Props<"div"> {
5
- name?: string;
6
- required?: FORMVALIDATION;
7
- options: dynamicObject[];
8
- label?: string;
9
- selected?: string | dynamicObject;
10
- search?: boolean;
11
- onChange?: (v: string | dynamicObject) => void;
12
- searchPlaceholder?: string;
13
- }
14
- declare const Select: import("react").ForwardRefExoticComponent<SelectProps & import("react").RefAttributes<HTMLDivElement>>;
15
- export default Select;
@@ -1,79 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
3
- import Box from "../box";
4
- import Button from "../button";
5
- import Heading from "../heading";
6
- import useBase from "../useBase";
7
- import SVGIcons from "../svgicons";
8
- import { uuid } from "../../funs";
9
- import Input from "../input";
10
- const Select = forwardRef((props, ref) => {
11
- const { selected, options, label, name, search: withSearch, searchPlaceholder, onChange, ...pops } = props;
12
- const [value, setValue] = useState(selected || options[0]);
13
- const [choosing, setChoosing] = useState(false);
14
- const [query, setQuery] = useState(null);
15
- const _ref = useRef(null);
16
- const _search = useRef(null);
17
- const _id = useMemo(() => name || uuid(), []);
18
- const { className, style, rest } = useBase(pops);
19
- const updateValue = (o) => {
20
- setValue(o);
21
- onChange && onChange(o);
22
- };
23
- useEffect(() => {
24
- document.body.addEventListener(`click`, (e) => {
25
- setChoosing(false);
26
- });
27
- }, []);
28
- useEffect(() => {
29
- if (choosing) {
30
- _search.current && _search.current.focus();
31
- }
32
- else {
33
- if (_search.current) {
34
- _search.current.value = ``;
35
- }
36
- setQuery(null);
37
- }
38
- }, [choosing]);
39
- return _jsxs(Box, { ...{
40
- className: `--select rel`
41
- }, children: [_jsxs(Button, { "data-value": value ? `string` == typeof value ? value : value.value : value || `-1`, ref: _ref, ...{
42
- className: `--selected flex aic rel ${className}`.trim(),
43
- withLabel: false,
44
- style,
45
- onClick: (e) => setChoosing(true),
46
- ...rest
47
- }, children: [_jsx(Heading, { ...{
48
- className: `--label`,
49
- }, children: value ? `string` == typeof value ? value : value.label : label || `Choose` }), _jsx(Box, { ...{
50
- className: `--svg-arrow rel flex aic jcc`
51
- }, children: choosing ? SVGIcons.ArrowUp : SVGIcons.ArrowDown })] }), _jsxs(Box, { id: _id, ...{
52
- className: `--options-list flex cols abs`,
53
- style: {
54
- pointerEvents: choosing ? `auto` : `none`,
55
- },
56
- animate: {
57
- from: { y: 5, opacity: 0 },
58
- to: { y: 0, opacity: 1 },
59
- when: choosing,
60
- duration: .05
61
- }
62
- }, children: [withSearch && _jsx(Input, { ...{
63
- ref: _search,
64
- onChange: (e) => {
65
- setQuery(e.target.value == `` ? null : e.target.value);
66
- },
67
- className: `--select-search`,
68
- placeholder: searchPlaceholder || `Search...`,
69
- } }), (query == null ? options : options.filter((o) => {
70
- return `string` == typeof o ?
71
- o.toLowerCase().includes(query.toLowerCase())
72
- : o.label.toLowerCase().includes(query.toLowerCase()) || o.value.toLowerCase().includes(query.toLowerCase());
73
- }))
74
- .map((o) => _jsx(Button, { ...{
75
- onClick: (e) => updateValue(o),
76
- className: value && (`string` == typeof o ? o : o.value) == (`string` == typeof value ? value : value.value) ? `selected` : ``,
77
- }, children: `string` == typeof o ? o : o.label }, `option-${(`string` == typeof o ? o : o.label).replace(/\s+/g, `-`)}-${`string` == typeof o ? o : o.value}`))] })] });
78
- });
79
- export default Select;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,229 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
4
- import With from "./base";
5
- import { SHEET, SHEET_ACTION_POSITION, TRANSITION_CURVES, TRANSITIONS } from "../types/enums";
6
- import Cover from "./cover";
7
- import { animationTransition } from "../funs/css";
8
- import ComponentEditor from "./editor";
9
- import { uuid } from "../funs";
10
- let _sheetTimeout = null;
11
- let _sheetWobbleTimeout = null;
12
- const Sheet = forwardRef((props, ref) => {
13
- const { as, transition, curve, speed, editor, type, actionPosition, ...rest } = props;
14
- // const _editor = useComponentEditor()
15
- const sheetID = useMemo(() => uuid(), []);
16
- const [visible, setVisible] = useState(false);
17
- const [title, setTitle] = useState(``);
18
- const [msg, setMsg] = useState(``);
19
- const [action, setAction] = useState(null);
20
- const [_errorType, setErrorType] = useState(type || SHEET.Default);
21
- const [loading, setLoading] = useState(false);
22
- const [render, setRender] = useState(true);
23
- const _render = useRef(null);
24
- const divRef = useRef(null);
25
- const lastTransform = useRef(null);
26
- // const dialogContent = useMemo(() => msg, [msg])
27
- useImperativeHandle(ref, () => ({
28
- setLoading(mode) {
29
- setLoading(mode);
30
- },
31
- showDialog(title, message, action, onShow) {
32
- if (_sheetTimeout) {
33
- clearTimeout(_sheetTimeout);
34
- if (_sheetWobbleTimeout) {
35
- clearTimeout(_sheetWobbleTimeout);
36
- }
37
- divRef.current.classList.remove(`wobble`);
38
- setTimeout(() => divRef.current.classList.add(`wobble`), 50);
39
- _sheetWobbleTimeout = setTimeout(() => {
40
- divRef.current.classList.remove(`wobble`);
41
- _sheetWobbleTimeout = null;
42
- }, 500);
43
- }
44
- setErrorType(SHEET.Dialog);
45
- setMsg(message);
46
- setTitle(title);
47
- if (action)
48
- setAction(action.reduce((ar, b) => {
49
- ar.push({
50
- ...b,
51
- key: b.key || uuid()
52
- });
53
- return ar;
54
- }, []));
55
- setVisible(true);
56
- setTimeout(() => onShow ? onShow() : () => { }, 1000);
57
- },
58
- dialog(title, message, action, onShow) {
59
- if (_sheetTimeout) {
60
- clearTimeout(_sheetTimeout);
61
- if (_sheetWobbleTimeout) {
62
- clearTimeout(_sheetWobbleTimeout);
63
- }
64
- divRef.current.classList.remove(`wobble`);
65
- setTimeout(() => divRef.current.classList.add(`wobble`), 50);
66
- _sheetWobbleTimeout = setTimeout(() => {
67
- divRef.current.classList.remove(`wobble`);
68
- _sheetWobbleTimeout = null;
69
- }, 500);
70
- }
71
- setErrorType(SHEET.Dialog);
72
- setMsg(message);
73
- setTitle(title);
74
- if (action)
75
- setAction(action.reduce((ar, b) => {
76
- ar.push({
77
- ...b,
78
- key: b.key || uuid()
79
- });
80
- return ar;
81
- }, []));
82
- setVisible(true);
83
- setTimeout(() => onShow ? onShow() : () => { }, 1000);
84
- },
85
- error(message, duration) {
86
- this.show(message, duration, SHEET.Error);
87
- },
88
- warn(message, duration) {
89
- this.show(message, duration, SHEET.Warn);
90
- },
91
- success(message, duration) {
92
- this.show(message, duration, SHEET.Success);
93
- },
94
- show(message, duration, type) {
95
- if (_sheetTimeout) {
96
- clearTimeout(_sheetTimeout);
97
- if (_sheetWobbleTimeout) {
98
- clearTimeout(_sheetWobbleTimeout);
99
- }
100
- // if ( lastTransform ) divRef.current!.style.transform = _lastTransform
101
- lastTransform.current = divRef.current.style.transform;
102
- divRef.current.style.transform = ``;
103
- divRef.current.classList.remove(`wobble`);
104
- setTimeout(() => {
105
- divRef.current.classList.add(`wobble`);
106
- divRef.current.style.transform = `${lastTransform.current} scale(.9)`.trim();
107
- }, 50);
108
- _sheetWobbleTimeout = setTimeout(() => {
109
- divRef.current.classList.remove(`wobble`);
110
- divRef.current.style.transform = lastTransform.current || ``;
111
- _sheetWobbleTimeout = null;
112
- }, 500);
113
- }
114
- _sheetTimeout = setTimeout(() => {
115
- setVisible(false);
116
- _sheetTimeout = null;
117
- _sheetWobbleTimeout = null;
118
- }, (duration || 4) * 1000);
119
- setErrorType(type || SHEET.Default);
120
- setMsg(message);
121
- setVisible(true);
122
- },
123
- hide() {
124
- setVisible(false);
125
- }
126
- }));
127
- const buildAnimation = () => {
128
- const base = {
129
- when: visible,
130
- duration: speed || 0.3,
131
- delay: 0.1,
132
- };
133
- if (_errorType == SHEET.Dialog) {
134
- if (transition) {
135
- const { from, to } = animationTransition(transition);
136
- return {
137
- from: { ...from, x: `-50%`, y: `-50%` },
138
- to: { ...to, x: `-50%`, y: `-50%` },
139
- curve: curve || TRANSITION_CURVES.EaseInOut,
140
- ...base
141
- };
142
- }
143
- return {
144
- from: { scale: 0, x: `-50%`, y: `-50%`, opacity: 0 },
145
- to: { scale: 1, x: `-50%`, y: `-50%`, opacity: 1 },
146
- curve: TRANSITION_CURVES.Spring,
147
- ...base
148
- };
149
- }
150
- else {
151
- return {
152
- from: { scale: 0, x: `-50%`, y: `-10vh`, opacity: 0 },
153
- to: { scale: 1, x: `-50%`, y: 0, opacity: 1 },
154
- curve: TRANSITION_CURVES.Spring,
155
- ...base
156
- };
157
- }
158
- };
159
- const sheetProps = useMemo(() => ({
160
- "sheet-radius": `label:Radius type:range value:auto min:0 max:50 unit:px`,
161
- }), []);
162
- const toastProps = useMemo(() => ({
163
- "sheet-padding": `label:Padding type:range value:auto min:0 max:50 unit:px`,
164
- "sheet-font-size": `label:Font,Size type:range value:auto min:12 max:72 unit:px`,
165
- }), []);
166
- const dialogProps = useMemo(() => ({
167
- "sheet-bg": `label:Background type:color value:auto`,
168
- "@group-Head": {
169
- label: "Head",
170
- pops: {
171
- "sheet-title-opacity": `label:Opacity type:range value:auto min:0 max:1 step:0.1`,
172
- "sheet-head-padding": `label:Padding type:range value:auto min:0 max:50 unit:px`,
173
- }
174
- },
175
- "@group-Body": {
176
- label: "Body",
177
- pops: {
178
- "sheet-body-padding": `label:Padding type:range value:auto min:0 max:50 unit:px`,
179
- }
180
- },
181
- "@group-Footer": {
182
- label: "Footer",
183
- pops: {
184
- "sheet-footer": `label:Background type:color value:auto`,
185
- "sheet-footer-padding": `label:Padding type:range value:auto min:0 max:50 unit:px`,
186
- "@group-Action": {
187
- label: "Footer Action",
188
- pops: {
189
- "sheet-action": `label:Background type:color value:auto`,
190
- "sheet-action-color": `label:Text,Color type:color value:auto`,
191
- "sheet-action-hover": `label:Hover,Color type:color value:auto`,
192
- "sheet-action-radius": `label:Radius type:range value:auto min:0 max:50 unit:px`,
193
- }
194
- }
195
- }
196
- },
197
- "@group-Close": {
198
- label: "Close Button",
199
- pops: {
200
- "sheet-closer-font-size": `label:Size type:range value:auto min:8 max:72 step:2 unit:px`,
201
- "sheet-closer-color": `label:Color type:color value:auto`,
202
- "sheet-closer-opacity": `label:Opacity type:range value:auto min:0 max:1 step:0.1`,
203
- "sheet-closer-hover-opacity": `label:Hover,Opacity type:range value:auto min:0 max:1 step:0.1`,
204
- }
205
- }
206
- }), []);
207
- useEffect(() => {
208
- if (_render.current)
209
- clearTimeout(_render.current);
210
- if (!visible) {
211
- _render.current = setTimeout(() => setRender(false), 1000);
212
- }
213
- else {
214
- setRender(true);
215
- }
216
- }, [visible]);
217
- if (_errorType == SHEET.Dialog) {
218
- return _jsxs(_Fragment, { children: [_jsx(With, { "aria-hidden": !visible, className: `zuz-overlay fixed fill`, animate: {
219
- transition: TRANSITIONS.FadeIn,
220
- when: visible,
221
- duration: 0.1,
222
- } }), _jsxs(With, { animate: buildAnimation(), as: as, className: `zuz-sheet toast-${_errorType.toLowerCase()} fixed`.trim(), ...rest, ref: divRef, children: [_jsx(Cover, { ...({ when: loading }) }), _jsxs(With, { className: `sheet-head flex aic rel`, children: [_jsx(With, { className: `sheet-${title ? `title` : `dot`}`, children: title || `` }), _jsx(With, { tag: `button`, onClick: (e) => setVisible(false), className: `sheet-closer abs`, children: "\u00D7" })] }), _jsx(With, { className: `sheet-body flex aic rel ${action ? `` : `--no-action`}`.trim(), children: render ? msg : null }), action && _jsx(With, { className: `sheet-footer flex aic rel ${actionPosition ? actionPosition == SHEET_ACTION_POSITION.Center ? `jcc` : `` : `jce`}`, children: action.map((a, i) => _jsx(With, { onClick: (e) => a.handler ? a.handler() : a.onClick ? a.onClick() : console.log(`onClick Handler missing`), tag: `button`, as: `sheet-action-btn`, children: a.label }, `sheet-${sheetID}-action-${a.key}`)) })] }), props.editor && visible && _jsx(ComponentEditor, { element: `.zuz-sheet`, title: `Sheet`, attrs: {
223
- ...sheetProps,
224
- ...(_errorType == SHEET.Dialog ? dialogProps : toastProps)
225
- } })] });
226
- }
227
- return _jsx(With, { animate: buildAnimation(), as: as, className: `zuz-sheet toast-${_errorType.toLowerCase()} abs`.trim(), ...rest, ref: divRef, children: visible ? msg : null });
228
- });
229
- export default Sheet;
@@ -1,6 +0,0 @@
1
- import { Props } from "./useBase/base.types";
2
- export interface SpanProps extends Props<'div'> {
3
- name?: string;
4
- }
5
- declare const Span: import("react").ForwardRefExoticComponent<SpanProps & import("react").RefAttributes<HTMLSpanElement>>;
6
- export default Span;
@@ -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 Span = forwardRef((props, ref) => {
5
- const { style, ...pops } = props;
6
- const { className, style: _style, rest } = useBase(pops);
7
- return _jsx("span", { ref: ref, className: className, style: {
8
- ..._style,
9
- ...(style || {})
10
- }, ...rest });
11
- });
12
- export default Span;
@@ -1,16 +0,0 @@
1
- import { ComponentPropsWithoutRef } from "react";
2
- import { SPINNER } from "../types/enums";
3
- import { animationProps } from "../types/interfaces";
4
- export interface SpinnerProps extends ComponentPropsWithoutRef<`div`> {
5
- as?: string;
6
- animate?: animationProps;
7
- type?: SPINNER;
8
- size?: number;
9
- width?: number;
10
- color?: string;
11
- background?: string;
12
- foreground?: string;
13
- speed?: number;
14
- }
15
- declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<HTMLDivElement>>;
16
- export default Spinner;
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import With from "./base";
4
- import { SPINNER } from "../types/enums";
5
- import { hexToRgba } from "../funs";
6
- const Spinner = forwardRef((props, ref) => {
7
- const { as, type, width, speed, size, color, background, foreground, ...rest } = props;
8
- const defaultColor = `#000000`;
9
- // console.log(`sp`, props)
10
- const buildSimple = () => {
11
- const c = color && color.startsWith(`var`) ? color : hexToRgba(color || defaultColor);
12
- const bg = color && color.startsWith(`var`) ? color : hexToRgba(color || defaultColor, .3);
13
- const pops = {
14
- width: size || 50,
15
- height: size || 50,
16
- border: `${width || 3}px solid ${bg}`,
17
- borderRadius: `50%`,
18
- borderTopColor: c,
19
- animationDuration: `${speed || .6}s`,
20
- animationTimingFunction: `linear`
21
- };
22
- return pops;
23
- };
24
- const build = () => {
25
- let _ = {};
26
- switch (type || SPINNER.Simple) {
27
- case SPINNER.Simple:
28
- _ = buildSimple();
29
- break;
30
- }
31
- return _;
32
- };
33
- const getChild = () => {
34
- switch (type || SPINNER.Simple) {
35
- case SPINNER.Simple:
36
- break;
37
- }
38
- return null;
39
- };
40
- return _jsx(With, { as: as, ref: ref, tag: `div`, className: `zuz-spinner${type ? `-${type.toLowerCase()}` : ``}`, style: build(), ...rest, children: getChild() });
41
- });
42
- export default Spinner;
@@ -1,64 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
3
- import With from "./base";
4
- import { uuid } from "../funs";
5
- import { useResizeObserver } from "../hooks";
6
- import ComponentEditor from "./editor";
7
- const TabView = forwardRef((props, ref) => {
8
- const { as, tabs: _tabs, speed, prerender, onChange, ...rest } = props;
9
- const tabs = useMemo(() => _tabs.reduce((ts, t) => {
10
- ts.push({
11
- ...t,
12
- key: t.key || uuid()
13
- });
14
- return ts;
15
- }, []), [_tabs]);
16
- const tabview = useRef(null);
17
- const tabViewID = useMemo(() => uuid(), []);
18
- const [activeTab, setActiveTab] = useState(0);
19
- const size = useResizeObserver(tabview);
20
- const render = useMemo(() => prerender == undefined || prerender == true ? true : false, []);
21
- const handleTabClick = (index) => {
22
- setActiveTab(index);
23
- };
24
- useEffect(() => {
25
- // console.log(`TabRenderCount`)
26
- onChange && onChange(tabs[0], 0);
27
- }, []);
28
- // useEffect(() => {
29
- // console.log(tabs)
30
- // }, [tabs])
31
- return _jsxs(_Fragment, { children: [_jsxs(With, { ref: tabview, className: `tabview flex cols`, ...rest, children: [_jsx(With, { className: `tab-head flex aic`, children: tabs.map((tab, index) => _jsx(With, { tag: `button`, className: `tab-label rel ${index === activeTab ? 'active' : ''}`.trim(), onClick: () => {
32
- handleTabClick(index);
33
- tab.onSelect && tab.onSelect(tab, index);
34
- onChange && onChange(tab, index);
35
- }, children: tab.label }, `tab-${tabViewID}-${tab.key}`)) }), _jsx(With, { className: `tab-content rel`, children: _jsx(With, { className: `tabs-track flex aic`, style: { transition: `all ${speed || 0.3}s ease-in-out 0s`, transform: `translate(-${activeTab * size.width}px, 0)` }, children: tabs.map((tab, index) => {
36
- return _jsx(With
37
- // ref={tabBodyRef}
38
- , { className: `tab-body rel`, style: {
39
- width: size.width,
40
- minWidth: size.width,
41
- maxWidth: size.width,
42
- opacity: index === activeTab ? 1 : 0,
43
- transition: 'opacity 0.5s ease',
44
- }, children: (render || activeTab == index) && tab.body }, `tab-body-${tabViewID}-${tab.key}`);
45
- // onClick={() => tab.onSelect(index)}
46
- }) }) })] }), props.editor && _jsx(ComponentEditor, { element: `.tabview`, title: `TabView`, attrs: {
47
- "@group-Head": {
48
- label: "Head",
49
- pops: {
50
- "tab-head": `label:Color type:color value:auto`,
51
- "tab-head-padding": `label:Padding type:range value:auto min:0 max:50 unit:px`,
52
- }
53
- },
54
- "@group-Tabs": {
55
- label: "Tabs",
56
- pops: {
57
- "tab": `label:Tab type:color value:auto`,
58
- "tab-active": `label:Active type:color value:auto`,
59
- "tab-hover": `label:Hover type:color value:auto`,
60
- }
61
- },
62
- } })] });
63
- });
64
- export default TabView;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { animationProps } from '../types/interfaces';
3
- export interface WheelProps {
4
- as?: string;
5
- direction?: `up` | `down`;
6
- value?: number | string;
7
- color?: string;
8
- animate?: animationProps;
9
- }
10
- export interface WheelHandler {
11
- setValue: (v: number | string) => void;
12
- updateValue: (v: number | string) => void;
13
- }
14
- declare const TextWheel: React.ForwardRefExoticComponent<WheelProps & React.RefAttributes<WheelHandler>>;
15
- export default TextWheel;
@@ -1,15 +0,0 @@
1
- import { TreeNode, TreeNodeIcons } from ".";
2
- import { BaseProps } from "../../types/interfaces";
3
- export interface TreeItemProps {
4
- treeTag: string;
5
- meta: TreeNode;
6
- nodes: TreeNode[];
7
- onSelect: (tag: string) => void;
8
- selected?: String;
9
- icons?: TreeNodeIcons;
10
- }
11
- export interface TreeItemHandler {
12
- onSelect?: (v: TreeNode) => void;
13
- }
14
- declare const TreeItem: import("react").ForwardRefExoticComponent<TreeItemProps & BaseProps & import("react").RefAttributes<TreeItemHandler>>;
15
- export default TreeItem;
@@ -1,23 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useEffect, useState } from "react";
3
- import With from "../base";
4
- const TreeItem = forwardRef((props, ref) => {
5
- const { as, meta, nodes, icons, onSelect, treeTag, selected, ...rest } = props;
6
- const { tag, label, under } = meta;
7
- const [isOpen, setIsOpen] = useState(tag == `root`);
8
- const toggle = () => {
9
- localStorage.setItem(`--tn${treeTag}-${tag}`, isOpen ? `0` : `1`);
10
- setIsOpen(!isOpen);
11
- };
12
- useEffect(() => {
13
- if (tag == `root` && !localStorage.getItem(`--tn${treeTag}-${tag}`)) {
14
- localStorage.setItem(`--tn${treeTag}-${tag}`, `1`);
15
- setIsOpen(true);
16
- }
17
- else
18
- setIsOpen(localStorage.getItem(`--tn${treeTag}-${tag}`) == `1`);
19
- }, []);
20
- const _nodes = nodes.filter(x => x.under == tag);
21
- return _jsxs(With, { as: `tree-node tree-node-${tag} flex cols`, children: [_jsxs(With, { as: `--node --node-${tag} flex aic${selected == tag ? ` --selected` : ``}`, children: [_jsx(With, { tag: `button`, onClick: toggle, className: `--node-aro-btn`, children: _jsx(With, { className: `--node-aro-icon icon-${isOpen ? icons?.arrowOpen : icons?.arrowClose}` }) }), _jsxs(With, { tag: `button`, className: `--node-meta flex aic`, onClick: (e) => onSelect(tag), children: [_jsx(With, { className: `--node-icon icon-${isOpen ? icons?.dirOpen : icons?.dirClose}` }), _jsx(With, { tag: `h1`, className: `--node-label`, children: label })] })] }), isOpen && _nodes.length > 0 && _jsx(With, { className: `--sub-node tree-sub-node-${tag} flex cols`, children: _nodes.map(node => _jsx(TreeItem, { treeTag: treeTag, selected: selected, onSelect: onSelect, icons: icons, meta: node, nodes: nodes }, `tree-node-${node.tag}`)) })] });
22
- });
23
- export default TreeItem;