@zuzjs/ui 0.3.7 → 0.3.9

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 (45) hide show
  1. package/dist/bin.d.ts +2 -0
  2. package/dist/bin.js +107 -0
  3. package/dist/comps/base.d.ts +10 -0
  4. package/dist/comps/base.js +12 -0
  5. package/dist/comps/box.d.ts +4 -0
  6. package/dist/comps/box.js +15 -0
  7. package/dist/comps/button.d.ts +4 -0
  8. package/dist/comps/button.js +19 -0
  9. package/dist/comps/checkbox.d.ts +4 -0
  10. package/dist/comps/checkbox.js +28 -0
  11. package/dist/comps/cover.d.ts +11 -0
  12. package/dist/comps/cover.js +36 -0
  13. package/dist/comps/form.d.ts +18 -0
  14. package/dist/comps/form.js +287 -0
  15. package/dist/comps/heading.d.ts +7 -0
  16. package/dist/comps/heading.js +21 -0
  17. package/dist/comps/icon.d.ts +5 -0
  18. package/dist/comps/icon.js +18 -0
  19. package/dist/comps/input.d.ts +6 -0
  20. package/dist/comps/input.js +23 -0
  21. package/dist/comps/sheet.d.ts +13 -0
  22. package/dist/comps/sheet.js +102 -0
  23. package/dist/comps/spinner.d.ts +14 -0
  24. package/dist/comps/spinner.js +42 -0
  25. package/dist/funs/colors.d.ts +7 -0
  26. package/dist/funs/colors.js +9 -0
  27. package/dist/funs/css.d.ts +269 -0
  28. package/dist/funs/css.js +413 -0
  29. package/dist/funs/index.d.ts +20 -0
  30. package/dist/funs/index.js +125 -0
  31. package/dist/funs/stylesheet.d.ts +242 -0
  32. package/dist/funs/stylesheet.js +249 -0
  33. package/dist/index.d.ts +11 -0
  34. package/dist/index.js +11 -0
  35. package/dist/styles.css +1 -460
  36. package/dist/types/enums.d.ts +19 -0
  37. package/dist/types/enums.js +23 -0
  38. package/dist/types/index.d.ts +24 -0
  39. package/dist/types/index.js +1 -0
  40. package/dist/types/interfaces.d.ts +4 -0
  41. package/dist/types/interfaces.js +1 -0
  42. package/package.json +50 -44
  43. package/README.md +0 -1
  44. package/dist/hooks.js +0 -89
  45. package/dist/ui.js +0 -688
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+ import { SHEET } from "../types/enums";
3
+ export interface SheetProps {
4
+ as?: string;
5
+ title?: string;
6
+ message?: string | ReactNode;
7
+ }
8
+ export interface SheetHandler {
9
+ show: (message: string, duration?: number, type?: SHEET) => void;
10
+ hide: () => void;
11
+ }
12
+ declare const Sheet: import("react").ForwardRefExoticComponent<SheetProps & import("react").RefAttributes<SheetHandler>>;
13
+ export default Sheet;
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
4
+ import With from "./base";
5
+ import { SHEET } from "../types/enums";
6
+ let _sheetTimeout = null;
7
+ let _sheetWobbleTimeout = null;
8
+ const Sheet = forwardRef((props, ref) => {
9
+ const { as, ...rest } = props;
10
+ const [visible, setVisible] = useState(false);
11
+ const [msg, setMsg] = useState(``);
12
+ const [_errorType, setErrorType] = useState(SHEET.Default);
13
+ const divRef = useRef(null);
14
+ useImperativeHandle(ref, () => ({
15
+ show(message, duration, type) {
16
+ if (_sheetTimeout) {
17
+ clearTimeout(_sheetTimeout);
18
+ if (_sheetWobbleTimeout) {
19
+ clearTimeout(_sheetWobbleTimeout);
20
+ }
21
+ divRef.current.classList.remove(`wobble`);
22
+ setTimeout(() => divRef.current.classList.add(`wobble`), 50);
23
+ _sheetWobbleTimeout = setTimeout(() => {
24
+ divRef.current.classList.remove(`wobble`);
25
+ _sheetWobbleTimeout = null;
26
+ }, 500);
27
+ }
28
+ _sheetTimeout = setTimeout(() => {
29
+ setVisible(false);
30
+ _sheetTimeout = null;
31
+ _sheetWobbleTimeout = null;
32
+ }, (duration || 4) * 1000);
33
+ setErrorType(type || SHEET.Default);
34
+ setMsg(message);
35
+ setVisible(true);
36
+ },
37
+ hide() {
38
+ setVisible(false);
39
+ }
40
+ }));
41
+ useEffect(() => {
42
+ }, []);
43
+ return _jsx(With, { as: as, className: `zuz-sheet toast-${_errorType.toLowerCase()} zuz-toast${visible ? ` is-visible` : ``} fixed`.trim(), ...rest, ref: divRef, children: msg == `` ? `Lorem ipsum dolor sit amet, consectetur adipiscing...` : msg });
44
+ });
45
+ // import { forwardRef, ReactNode, Ref, useEffect, useImperativeHandle, useRef, useState } from "react";
46
+ // import { css, cleanProps } from "../funs";
47
+ // import { UIProps } from "../types/interfaces";
48
+ // import { SHEET } from "../types/enums";
49
+ // export interface SheetProps extends UIProps<HTMLDivElement> {
50
+ // title?: string,
51
+ // message?: string | ReactNode
52
+ // }
53
+ // export interface SheetHandler {
54
+ // show: ( message : string, duration?: number, type?: SHEET ) => void,
55
+ // hide: () => void
56
+ // }
57
+ // let _sheetTimeout: NodeJS.Timeout | null = null
58
+ // let _sheetWobbleTimeout: NodeJS.Timeout | null = null
59
+ // const Sheet = forwardRef<SheetHandler, SheetProps>(( props : SheetProps, ref ) => {
60
+ // const { as, title } = props
61
+ // const { cx } = css.Build(as)
62
+ // const [ visible, setVisible ] = useState(false)
63
+ // const [ msg, setMsg ] = useState(``)
64
+ // const [ _errorType, setErrorType ] = useState(SHEET.Default)
65
+ // const divRef = useRef<HTMLDivElement>(null);
66
+ // useImperativeHandle(ref, () => ({
67
+ // show( message: string, duration?: number, type?: SHEET ){
68
+ // if ( _sheetTimeout ){
69
+ // clearTimeout(_sheetTimeout);
70
+ // if ( _sheetWobbleTimeout ){
71
+ // clearTimeout(_sheetWobbleTimeout);
72
+ // }
73
+ // divRef.current!.classList.remove(`wobble`)
74
+ // setTimeout(() => divRef.current!.classList.add(`wobble`), 50)
75
+ // _sheetWobbleTimeout = setTimeout(() => {
76
+ // divRef.current!.classList.remove(`wobble`)
77
+ // _sheetWobbleTimeout = null
78
+ // }, 500)
79
+ // }
80
+ // _sheetTimeout = setTimeout(() => {
81
+ // setVisible(false)
82
+ // _sheetTimeout = null
83
+ // _sheetWobbleTimeout = null
84
+ // }, (duration || 4) * 1000)
85
+ // setErrorType(type || SHEET.Default)
86
+ // setMsg(message);
87
+ // setVisible(true);
88
+ // },
89
+ // hide(){
90
+ // setVisible(false)
91
+ // }
92
+ // }))
93
+ // useEffect(() => {
94
+ // }, [])
95
+ // return <div
96
+ // ref={divRef}
97
+ // className={[`zuz-sheet toast-${_errorType.toLowerCase()} zuz-toast${visible ? ` is-visible` : ``} fixed`, ...cx].join(` `).trim()}
98
+ // {...(cleanProps(props) as UIProps<HTMLDivElement>)}>
99
+ // {msg == `` ? `Lorem ipsum dolor sit amet, consectetur adipiscing...` : msg}
100
+ // </div>
101
+ // })
102
+ export default Sheet;
@@ -0,0 +1,14 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ import { SPINNER } from "../types/enums";
3
+ export interface SpinnerProps extends ComponentPropsWithoutRef<`div`> {
4
+ as?: string;
5
+ type?: SPINNER;
6
+ size?: number;
7
+ width?: number;
8
+ color?: string;
9
+ background?: string;
10
+ foreground?: string;
11
+ speed?: number;
12
+ }
13
+ declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export default Spinner;
@@ -0,0 +1,42 @@
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 = hexToRgba(color || defaultColor);
12
+ const bg = 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;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export declare const colorNames: string[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * An array of color names.
3
+ *
4
+ * @remarks
5
+ * This array contains a list of color names that can be used in CSS or other color-related operations.
6
+ */
7
+ export const colorNames = [
8
+ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen'
9
+ ];
@@ -0,0 +1,269 @@
1
+ import { dynamicObject } from "../types/index.js";
2
+ declare class CSS {
3
+ unit: any;
4
+ PROPS: {
5
+ [x: string]: any;
6
+ alignContent: string;
7
+ alignItems: string;
8
+ alignSelf: string;
9
+ animation: string;
10
+ animationDelay: string;
11
+ animationDirection: string;
12
+ animationDuration: string;
13
+ animationFillMode: string;
14
+ animationIterationCount: string;
15
+ animationName: string;
16
+ animationPlayState: string;
17
+ animationTimingFunction: string;
18
+ background: string;
19
+ backgroundColor: string;
20
+ backgroundImage: string;
21
+ backgroundOrigin: string;
22
+ backgroundPosition: string;
23
+ backgroundRepeat: string;
24
+ backgroundSize: string;
25
+ backfaceVisibility: string;
26
+ backgroundAttachment: string;
27
+ backgroundBlendMode: string;
28
+ backgroundClip: string;
29
+ border: string;
30
+ borderBottom: string;
31
+ borderBottomColor: string;
32
+ borderBottomStyle: string;
33
+ borderBottomWidth: string;
34
+ borderCollapse: string;
35
+ borderColor: string;
36
+ borderImage: string;
37
+ borderImageOutset: string;
38
+ borderImageRepeat: string;
39
+ borderImageSlice: string;
40
+ borderImageSource: string;
41
+ borderImageWidth: string;
42
+ borderLeft: string;
43
+ borderLeftColor: string;
44
+ borderLeftStyle: string;
45
+ borderLeftWidth: string;
46
+ borderRight: string;
47
+ borderRightColor: string;
48
+ borderRightStyle: string;
49
+ borderRightWidth: string;
50
+ borderSpacing: string;
51
+ borderStyle: string;
52
+ borderTop: string;
53
+ borderTopColor: string;
54
+ borderTopStyle: string;
55
+ borderTopWidth: string;
56
+ borderWidth: string;
57
+ borderRadius: string;
58
+ borderTopLeftRadius: string;
59
+ borderTopRightRadius: string;
60
+ borderBottomLeftRadius: string;
61
+ borderBottomRightRadius: string;
62
+ bottom: string;
63
+ boxDecorationBreak: string;
64
+ boxShadow: string;
65
+ boxSizing: string;
66
+ captionSide: string;
67
+ caretColor: string;
68
+ "@charset": string;
69
+ clear: string;
70
+ clip: string;
71
+ clipPath: string;
72
+ color: string;
73
+ columnCount: string;
74
+ columnFill: string;
75
+ columnGap: string;
76
+ colGap: string;
77
+ columnRule: string;
78
+ columnRuleColor: string;
79
+ columnRuleStyle: string;
80
+ columnRuleWidth: string;
81
+ columnSpan: string;
82
+ columnWidth: string;
83
+ columns: string;
84
+ content: string;
85
+ counterIncrement: string;
86
+ counterReset: string;
87
+ cursor: string;
88
+ pointer: string;
89
+ direction: string;
90
+ display: string;
91
+ emptyCells: string;
92
+ filter: string;
93
+ flex: string;
94
+ flexBasis: string;
95
+ flexDirection: string;
96
+ flexFlow: string;
97
+ flexGrow: string;
98
+ flexShrink: string;
99
+ flexWrap: string;
100
+ float: string;
101
+ font: string;
102
+ fontFamily: string;
103
+ fontKerning: string;
104
+ fontSize: string;
105
+ fontSizeAdjust: string;
106
+ fontStretch: string;
107
+ fontStyle: string;
108
+ fontVariant: string;
109
+ bold: string;
110
+ fontWeight: string;
111
+ gap: string;
112
+ grid: string;
113
+ gridArea: string;
114
+ gridAutoColumns: string;
115
+ gridAutoFlow: string;
116
+ gridAutoRows: string;
117
+ gridColumn: string;
118
+ gridColumnEnd: string;
119
+ gridColumnGap: string;
120
+ gridColumnStart: string;
121
+ gridGap: string;
122
+ gridRow: string;
123
+ gridRowEnd: string;
124
+ gridRowGap: string;
125
+ gridRowStart: string;
126
+ gridTemplate: string;
127
+ gridTemplateAreas: string;
128
+ gridTemplateColumns: string;
129
+ gridTemplateRows: string;
130
+ hangingPunctuation: string;
131
+ hyphens: string;
132
+ isolation: string;
133
+ justifyContent: string;
134
+ left: string;
135
+ letterSpacing: string;
136
+ lineHeight: string;
137
+ listStyle: string;
138
+ listStyleImage: string;
139
+ listStylePosition: string;
140
+ listStyleType: string;
141
+ aspectRatio: string;
142
+ margin: string;
143
+ marginBottom: string;
144
+ marginLeft: string;
145
+ marginRight: string;
146
+ marginTop: string;
147
+ height: string;
148
+ minHeight: string;
149
+ maxHeight: string;
150
+ width: string;
151
+ minWidth: string;
152
+ maxWidth: string;
153
+ mixBlendMode: string;
154
+ objectFit: string;
155
+ objectPosition: string;
156
+ opacity: string;
157
+ order: string;
158
+ outline: string;
159
+ outlineColor: string;
160
+ outlineOffset: string;
161
+ outlineStyle: string;
162
+ outlineWidth: string;
163
+ overflow: string;
164
+ overflowX: string;
165
+ overflowY: string;
166
+ padding: string;
167
+ paddingBottom: string;
168
+ paddingLeft: string;
169
+ paddingRight: string;
170
+ paddingTop: string;
171
+ pageBreakAfter: string;
172
+ pageBreakBefore: string;
173
+ pageBreakInside: string;
174
+ perspective: string;
175
+ perspectiveOrigin: string;
176
+ pointerEvents: string;
177
+ position: string;
178
+ quotes: string;
179
+ resize: string;
180
+ right: string;
181
+ scrollBehavior: string;
182
+ tabSize: string;
183
+ tableLayout: string;
184
+ align: string;
185
+ textAlign: string;
186
+ textAlignLast: string;
187
+ textDecoration: string;
188
+ textDecorationColor: string;
189
+ textDecorationLine: string;
190
+ textDecorationStyle: string;
191
+ textIndent: string;
192
+ textJustify: string;
193
+ textOverflow: string;
194
+ textShadow: string;
195
+ textTransform: string;
196
+ top: string;
197
+ transform: string;
198
+ "transform(2D)": string;
199
+ "transformOrigin(twoValue syntax)": string;
200
+ transformStyle: string;
201
+ transition: string;
202
+ transitionDelay: string;
203
+ transitionDuration: string;
204
+ transitionProperty: string;
205
+ transitionTimingFunction: string;
206
+ unicodeBidi: string;
207
+ userSelect: string;
208
+ verticalAlign: string;
209
+ visibility: string;
210
+ whiteSpace: string;
211
+ wordBreak: string;
212
+ wordSpacing: string;
213
+ textWrap: string;
214
+ wordWrap: string;
215
+ writingMode: string;
216
+ zIndex: string;
217
+ backdropFilter: string;
218
+ };
219
+ DIRECT: {
220
+ [x: string]: any;
221
+ fill: string;
222
+ abc: string;
223
+ };
224
+ IGNORE: string[];
225
+ chars: string;
226
+ hashids: any;
227
+ cx: string[];
228
+ cache: {
229
+ [x: string]: any;
230
+ };
231
+ pseudoRegExp: RegExp;
232
+ pseudoList: string[];
233
+ baseRegex: RegExp;
234
+ pseudoCounter: {
235
+ [key: string]: number;
236
+ };
237
+ pseudoPattern: string;
238
+ pseudoReg: RegExp;
239
+ propCounter: dynamicObject;
240
+ keysWithoutCommaToSpace: string[];
241
+ rgbaRegex: RegExp;
242
+ constructor(options?: {
243
+ [x: string]: any;
244
+ } | undefined);
245
+ getStyleSheet(cache: {
246
+ [key: string]: any;
247
+ }, indentLevel?: number, pseudo?: boolean): string;
248
+ makeColor(): void;
249
+ makeUnit(k: string, v: any): any;
250
+ makeValue(k: string, v: any): string;
251
+ makeID(k: string, v: string, _out: string): string;
252
+ makeIDFromObject(key: string, obj: {
253
+ [key: string]: any;
254
+ }): string;
255
+ parseRawLine(line: string): {
256
+ [key: string]: {};
257
+ };
258
+ makeCSS(line: string): void;
259
+ cleanPseudo(cache: {
260
+ [key: string]: any;
261
+ }): {
262
+ [key: string]: any;
263
+ };
264
+ Build(css: string | string[][]): {
265
+ cx: string[];
266
+ sheet: string;
267
+ };
268
+ }
269
+ export default CSS;