@zuzjs/ui 0.3.7 → 0.3.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.
package/dist/styles.css CHANGED
@@ -1,460 +1 @@
1
- *, *:before, *:after {
2
- -moz-box-sizing: border-box;
3
- -webkit-box-sizing: border-box;
4
- box-sizing: border-box;
5
- }
6
-
7
- *, html, body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, label, fieldset, input, p, blockquote, th, td {
8
- margin: 0;
9
- padding: 0;
10
- }
11
-
12
- table {
13
- border-collapse: collapse;
14
- border-spacing: 0;
15
- }
16
-
17
- fieldset, img {
18
- border: 0;
19
- }
20
-
21
- address, caption, cite, code, dfn, em, strong, th, var {
22
- font-style: normal;
23
- font-weight: normal;
24
- }
25
-
26
- ol, ul, li {
27
- list-style: none;
28
- }
29
-
30
- caption, th {
31
- text-align: left;
32
- }
33
-
34
- h1, h2, h3, h4, h5, h6 {
35
- font-size: 100%;
36
- font-weight: normal;
37
- }
38
-
39
- div, img, button, input, textarea, select {
40
- outline: none;
41
- }
42
-
43
- strong {
44
- font-weight: bold;
45
- }
46
-
47
- em {
48
- font-style: italic;
49
- }
50
-
51
- a img {
52
- border: none;
53
- }
54
-
55
- button {
56
- cursor: pointer;
57
- }
58
-
59
- .grid {
60
- display: grid;
61
- }
62
-
63
- .fixed {
64
- position: fixed;
65
- }
66
- .fixed.fill {
67
- top: 0px;
68
- left: 0px;
69
- right: 0px;
70
- bottom: 0px;
71
- }
72
-
73
- .rel {
74
- position: relative;
75
- }
76
-
77
- .abs {
78
- position: absolute;
79
- }
80
- .abs.abc {
81
- top: 50%;
82
- left: 50%;
83
- transform: translate(-50%, -50%);
84
- }
85
- .abs.fill {
86
- top: 0px;
87
- left: 0px;
88
- right: 0px;
89
- bottom: 0px;
90
- }
91
-
92
- .sticky {
93
- position: sticky;
94
- }
95
-
96
- .block {
97
- display: block;
98
- }
99
-
100
- .iblock {
101
- display: inline-block;
102
- }
103
-
104
- .tdnh, .tdn {
105
- text-decoration: none;
106
- }
107
-
108
- .tdnh:hover, .tdh:hover {
109
- text-decoration: underline;
110
- }
111
-
112
- .flex {
113
- display: flex;
114
- }
115
- .flex.ass {
116
- align-self: flex-start;
117
- }
118
- .flex.asc {
119
- align-self: center;
120
- }
121
- .flex.ase {
122
- align-self: flex-end;
123
- }
124
- .flex.ais {
125
- align-items: flex-start;
126
- }
127
- .flex.aic {
128
- align-items: center;
129
- }
130
- .flex.aie {
131
- align-items: flex-end;
132
- }
133
- .flex.jcs {
134
- justify-content: flex-start;
135
- }
136
- .flex.jcc {
137
- justify-content: center;
138
- }
139
- .flex.jce {
140
- justify-content: flex-end;
141
- }
142
- .flex.col {
143
- flex-direction: column;
144
- }
145
-
146
- /*
147
- COLORS
148
- It will generate .cfff { color: #fff; } from 'fff'
149
- */
150
- .cfff {
151
- color: #fff;
152
- }
153
-
154
- .c111 {
155
- color: #111;
156
- }
157
-
158
- .c222 {
159
- color: #222;
160
- }
161
-
162
- .c333 {
163
- color: #333;
164
- }
165
-
166
- .c444 {
167
- color: #444;
168
- }
169
-
170
- .c555 {
171
- color: #555;
172
- }
173
-
174
- .c666 {
175
- color: #666;
176
- }
177
-
178
- .c777 {
179
- color: #777;
180
- }
181
-
182
- .c888 {
183
- color: #888;
184
- }
185
-
186
- .c999 {
187
- color: #999;
188
- }
189
-
190
- /*
191
- FONT SIZES
192
- It will generate .s10 { font-size: 12px; } from '12'
193
- */
194
- .s10 {
195
- font-size: 10px;
196
- }
197
-
198
- .s12 {
199
- font-size: 12px;
200
- }
201
-
202
- .s14 {
203
- font-size: 14px;
204
- }
205
-
206
- .s16 {
207
- font-size: 16px;
208
- }
209
-
210
- .s18 {
211
- font-size: 18px;
212
- }
213
-
214
- .s20 {
215
- font-size: 20px;
216
- }
217
-
218
- .s22 {
219
- font-size: 22px;
220
- }
221
-
222
- .s24 {
223
- font-size: 24px;
224
- }
225
-
226
- .s26 {
227
- font-size: 26px;
228
- }
229
-
230
- .s28 {
231
- font-size: 28px;
232
- }
233
-
234
- .s30 {
235
- font-size: 30px;
236
- }
237
-
238
- .s32 {
239
- font-size: 32px;
240
- }
241
-
242
- .s34 {
243
- font-size: 34px;
244
- }
245
-
246
- .s36 {
247
- font-size: 36px;
248
- }
249
-
250
- .s38 {
251
- font-size: 38px;
252
- }
253
-
254
- .s40 {
255
- font-size: 40px;
256
- }
257
-
258
- .s42 {
259
- font-size: 42px;
260
- }
261
-
262
- .s44 {
263
- font-size: 44px;
264
- }
265
-
266
- .s46 {
267
- font-size: 46px;
268
- }
269
-
270
- .s48 {
271
- font-size: 48px;
272
- }
273
-
274
- .s50 {
275
- font-size: 50px;
276
- }
277
-
278
- .s52 {
279
- font-size: 52px;
280
- }
281
-
282
- .s54 {
283
- font-size: 54px;
284
- }
285
-
286
- .s56 {
287
- font-size: 56px;
288
- }
289
-
290
- .s58 {
291
- font-size: 58px;
292
- }
293
-
294
- .s60 {
295
- font-size: 60px;
296
- }
297
-
298
- .s62 {
299
- font-size: 62px;
300
- }
301
-
302
- .s64 {
303
- font-size: 64px;
304
- }
305
-
306
- .s66 {
307
- font-size: 66px;
308
- }
309
-
310
- .s68 {
311
- font-size: 68px;
312
- }
313
-
314
- .s70 {
315
- font-size: 70px;
316
- }
317
-
318
- .s72 {
319
- font-size: 72px;
320
- }
321
-
322
- /*
323
- BoldSize
324
- It will generate .b400 { font-weight: 400; } from '400'
325
- */
326
- .bold {
327
- font-weight: bold;
328
- }
329
-
330
- .b100 {
331
- font-weight: 100;
332
- }
333
-
334
- .b200 {
335
- font-weight: 200;
336
- }
337
-
338
- .b300 {
339
- font-weight: 300;
340
- }
341
-
342
- .b400 {
343
- font-weight: 400;
344
- }
345
-
346
- .b500 {
347
- font-weight: 500;
348
- }
349
-
350
- .b600 {
351
- font-weight: 600;
352
- }
353
-
354
- .b700 {
355
- font-weight: 700;
356
- }
357
-
358
- .b800 {
359
- font-weight: 800;
360
- }
361
-
362
- .b900 {
363
- font-weight: 900;
364
- }
365
-
366
- @keyframes rotate-loop {
367
- from {
368
- -ms-transform: rotate(0deg);
369
- -moz-transform: rotate(0deg);
370
- -webkit-transform: rotate(0deg);
371
- -o-transform: rotate(0deg);
372
- transform: rotate(0deg);
373
- }
374
- to {
375
- -ms-transform: rotate(360deg);
376
- -moz-transform: rotate(360deg);
377
- -webkit-transform: rotate(360deg);
378
- -o-transform: rotate(360deg);
379
- transform: rotate(360deg);
380
- }
381
- }
382
- .zuz-spinner .zuz-loader {
383
- animation: rotate-loop 0.5s linear infinite;
384
- }
385
-
386
- .button {
387
- border: 0px;
388
- }
389
-
390
- .zuz-checkbox {
391
- opacity: 0;
392
- position: absolute;
393
- }
394
- .zuz-checkbox + label {
395
- position: relative;
396
- display: inline-block;
397
- user-select: none;
398
- transition: 0.4s ease;
399
- height: 26px;
400
- width: 44px;
401
- border-radius: 60px;
402
- background: #eee;
403
- }
404
- .zuz-checkbox + label:before {
405
- content: "";
406
- position: absolute;
407
- display: block;
408
- transition: 0.2s cubic-bezier(0.24, 0, 0.5, 1);
409
- height: 26px;
410
- width: 44px;
411
- top: 0;
412
- left: 0;
413
- border-radius: 30px;
414
- }
415
- .zuz-checkbox + label:after {
416
- content: "";
417
- position: absolute;
418
- display: block;
419
- transition: 0.35s cubic-bezier(0.54, 1.6, 0.5, 1);
420
- background: #fff;
421
- height: 22px;
422
- width: 22px;
423
- top: 2px;
424
- left: 2px;
425
- border-radius: 60px;
426
- }
427
- .zuz-checkbox:checked + label:before {
428
- background: green;
429
- transition: width 0.2s cubic-bezier(0, 0, 0, 0.1);
430
- }
431
- .zuz-checkbox:checked + label:after {
432
- left: 20px;
433
- }
434
-
435
- .zuz-contextmenu {
436
- width: 220px;
437
- border-radius: 5px;
438
- padding: 4px;
439
- background: rgba(34, 34, 34, 0.5);
440
- border: 1px rgba(255, 255, 255, 0.25) solid;
441
- box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.45);
442
- backdrop-filter: blur(20px);
443
- }
444
- .zuz-contextmenu button {
445
- border: 0px;
446
- text-align: left;
447
- padding: 4px 6px;
448
- background: rgba(0, 0, 0, 0);
449
- cursor: pointer;
450
- color: #fff;
451
- border-radius: 4px;
452
- }
453
- .zuz-contextmenu button:hover {
454
- background: #5183ff;
455
- }
456
- .zuz-contextmenu .line {
457
- height: 1px;
458
- background: rgba(255, 255, 255, 0.25);
459
- margin: 4px 6px;
460
- }
1
+ :root{--checkbox-checked: rgb(46, 161, 42);--checkbox-unchecked: rgb(203, 203, 203);--checkbox-thumb: #fff;--checkbox-thumb-shadow: #000;--checkbox-thumb-shadow-size: 2px}.abs{position:absolute}.abs.fill{top:0px;left:0px;bottom:0px;right:0px;z-index:9}.rel{position:relative}.zuz-checkbox{height:25px;width:45px;cursor:pointer}.zuz-checkbox input[type=checkbox]{z-index:0;left:10px;top:10px}.zuz-checkbox:before{content:"";position:absolute;width:45px;height:25px;background:var(--checkbox-unchecked);border-radius:50px;z-index:1;transition:all .3s linear 0s}.zuz-checkbox:after{content:"";position:absolute;width:21px;height:21px;background:var(--checkbox-thumb);border-radius:50px;z-index:2;top:2px;left:2px;box-shadow:0px 0px --checkbox-thumb-shadow-size --checkbox-thumb-shadow;transition:all .2s linear 0s}.zuz-checkbox.is-checked:before{box-shadow:inset 0px 0px 0px 15px var(--checkbox-checked)}.zuz-checkbox.is-checked:after{transform:translateX(20px)}.zuz-spinner{animation:spin infinite}@keyframes spin{to{-webkit-transform:rotate(360deg)}}.input-with-error{box-shadow:0px 0px 0px 2px red}
@@ -0,0 +1,10 @@
1
+ export declare enum SPINNER {
2
+ Simple = "SIMPLE",
3
+ Roller = "ROLLER"
4
+ }
5
+ export declare enum FORMVALIDATION {
6
+ Email = "EMAIL",
7
+ Uri = "URI",
8
+ Password = "PASSWORD",
9
+ MatchField = "MATCHFIELD"
10
+ }
@@ -0,0 +1,12 @@
1
+ export var SPINNER;
2
+ (function (SPINNER) {
3
+ SPINNER["Simple"] = "SIMPLE";
4
+ SPINNER["Roller"] = "ROLLER";
5
+ })(SPINNER || (SPINNER = {}));
6
+ export var FORMVALIDATION;
7
+ (function (FORMVALIDATION) {
8
+ FORMVALIDATION["Email"] = "EMAIL";
9
+ FORMVALIDATION["Uri"] = "URI";
10
+ FORMVALIDATION["Password"] = "PASSWORD";
11
+ FORMVALIDATION["MatchField"] = "MATCHFIELD";
12
+ })(FORMVALIDATION || (FORMVALIDATION = {}));
@@ -0,0 +1,23 @@
1
+ export type dynamicObject = {
2
+ [x: string]: any;
3
+ };
4
+ export type stringObject = {
5
+ [x: string]: string;
6
+ };
7
+ declare global {
8
+ interface Object {
9
+ is(v: any): boolean;
10
+ typeof(v: any): boolean;
11
+ equals(v: any): boolean;
12
+ isNull(): boolean;
13
+ isString(): boolean;
14
+ isNumber(): boolean;
15
+ isObject(): boolean;
16
+ isArray(): boolean;
17
+ isEmpty(): boolean;
18
+ isNotEmpty(v: any): boolean;
19
+ isEmail(v: any): boolean;
20
+ isUrl(v: any): boolean;
21
+ }
22
+ }
23
+ export type FormSubmitHandler = (formData: FormData) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import { DetailedHTMLProps, HTMLAttributes } from "react";
2
+ export interface UIProps<T extends HTMLElement> extends DetailedHTMLProps<HTMLAttributes<T>, T> {
3
+ [key: string]: any;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,46 +1,50 @@
1
1
  {
2
- "name": "@zuzjs/ui",
3
- "version": "0.3.7",
4
- "type": "module",
5
- "main": "dist/index.js",
6
- "exports": {
7
- ".": "./dist/ui.js",
8
- "./core": "./dist/index.js",
9
- "./hooks": "./dist/hooks.js",
10
- "./styles": "./dist/styles.css"
11
- },
12
- "scripts": {
13
- "build": "rimraf dist && rollup --config",
14
- "dev": "rimraf dist && rollup --config -w",
15
- "test": "jest"
16
- },
17
- "dependencies": {
18
- "@testing-library/react": "14.0.0",
19
- "@types/jest": "^29.5.0",
20
- "@types/react": "^18.0.31",
21
- "axios": "^1.6.2",
22
- "hashids": "^2.3.0",
23
- "jest": "^29.7.0",
24
- "js-cookie": "^3.0.5",
25
- "nanoid": "^5.0.4",
26
- "prop-types": "^15.8.1",
27
- "react": "18.2.0",
28
- "react-children-utilities": "^2.9.0",
29
- "react-dom": "18.2.0",
30
- "ts-jest": "^29.1.1",
31
- "tslib": "^2.6.2",
32
- "typescript": "^5.3.3"
33
- },
34
- "devDependencies": {
35
- "@rollup/plugin-commonjs": "^24.0.1",
36
- "postcss": "^8.4.21",
37
- "rimraf": "^5.0.5",
38
- "rollup": "^4.8.0",
39
- "rollup-plugin-livereload": "^2.0.5",
40
- "rollup-plugin-scss": "^4.0.0",
41
- "rollup-plugin-typescript2": "^0.36.0",
42
- "rollup-plugin-uglify": "^6.0.4",
43
- "sass": "^1.69.5",
44
- "next": "14.0.4"
45
- }
2
+ "name": "@zuzjs/ui",
3
+ "version": "0.3.8",
4
+ "keywords": [
5
+ "react",
6
+ "zuz",
7
+ "zuz.js",
8
+ "zuz ui",
9
+ "zuzui"
10
+ ],
11
+ "description": "ZuzJS UI Library",
12
+ "author": "Zuz.js Team <support@zuz.com.pk>",
13
+ "license": "MIT",
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "bin": {
17
+ "zuzjs": "dist/bin.js"
18
+ },
19
+ "exports": {
20
+ ".": "./dist/index.js",
21
+ "./styles": "./dist/styles.css"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "scripts": {
27
+ "dev:css": "sass --watch --no-source-map src/scss:dist --style compressed",
28
+ "dev:dist": "tsc -d -w -p tsconfig.json",
29
+ "dev": "npm-run-all -p dev:*"
30
+ },
31
+ "engines": {
32
+ "node": ">=18.17.0"
33
+ },
34
+ "dependencies": {
35
+ "chokidar": "^3.6.0",
36
+ "commander": "^12.1.0",
37
+ "hashids": "^2.3.0",
38
+ "md5": "^2.3.0",
39
+ "nanoid": "^5.0.7",
40
+ "picocolors": "^1.0.1",
41
+ "react": "19.0.0-beta-26f2496093-20240514",
42
+ "react-dom": "19.0.0-beta-26f2496093-20240514",
43
+ "sass": "1.77.8"
44
+ },
45
+ "devDependencies": {
46
+ "node-loader": "^2.0.0",
47
+ "react": "19.0.0-beta-26f2496093-20240514",
48
+ "react-dom": "19.0.0-beta-26f2496093-20240514"
49
+ }
46
50
  }
package/README.md DELETED
@@ -1 +0,0 @@
1
- # zuzjs
package/dist/hooks.js DELETED
@@ -1,89 +0,0 @@
1
- import { createContext, useEffect, useMemo, useReducer, useCallback, useContext } from 'react';
2
- import { jsx } from 'react/jsx-runtime';
3
-
4
- const AppContext = createContext({});
5
-
6
- let isMounted = true;
7
- const STORE_KEY = `__zuzjs`;
8
- const STORE_FORM_KEY = `${STORE_KEY}forms`;
9
- const defaultState = {
10
- [`${STORE_KEY}base`]: {
11
- debug: true,
12
- loading: false,
13
- _tmp: Math.random()
14
- },
15
- [STORE_FORM_KEY]: {
16
- forms: {}
17
- }
18
- };
19
- const rootReducer = (state, action) => (Object.assign(Object.assign({}, state), action.payload));
20
- const AppProvider = ({ children, initialState = {} }) => {
21
- useEffect(() => {
22
- isMounted = true;
23
- return () => {
24
- isMounted = false;
25
- };
26
- }, []);
27
- const rootState = useMemo(() => (Object.assign(Object.assign({}, defaultState), initialState)), [initialState]);
28
- const [state, _dispatch] = useReducer(rootReducer, rootState);
29
- const dispatch = useCallback((args) => {
30
- if (isMounted) {
31
- _dispatch(Object.assign({}, args));
32
- }
33
- }, [_dispatch]);
34
- const providedValue = useMemo(() => (Object.assign(Object.assign({}, state), { dispatch })), [state]);
35
- return jsx(AppContext.Provider, { value: providedValue, children: children });
36
- };
37
-
38
- const createSlice = ({ name, initialState, reducers }) => {
39
- return {
40
- name,
41
- reducer: reducers,
42
- actions: reducers,
43
- state: initialState
44
- };
45
- };
46
-
47
- const useStore = (callback, withFilter = true) => {
48
- let _state = useContext(AppContext);
49
- let state = withFilter ? {} : _state;
50
- if (withFilter) {
51
- const filters = ['defaultState', 'theme', 'dispatch', `${STORE_KEY}base`, `${STORE_KEY}forms`];
52
- Object.keys(_state).map(k => {
53
- if (filters.indexOf(k) == -1) {
54
- state[k] = _state[k];
55
- }
56
- });
57
- }
58
- if ("function" == typeof callback) {
59
- return callback(state);
60
- }
61
- return state;
62
- };
63
-
64
- const useDispatch = (key) => {
65
- const state = useContext(AppContext);
66
- const dispatch = state['dispatch'];
67
- const prepareState = (prevState, nextState) => {
68
- const nextKeys = Object.keys(nextState);
69
- nextKeys.map(k => {
70
- if (prevState[k] !== nextState[k]) {
71
- prevState[k] = nextState[k];
72
- }
73
- });
74
- return Object.assign(Object.assign({}, prevState), nextState);
75
- };
76
- if (key) {
77
- return (payload = {}) => {
78
- dispatch({
79
- action: key,
80
- payload: {
81
- [key]: prepareState(state[key], payload)
82
- }
83
- });
84
- };
85
- }
86
- return dispatch;
87
- };
88
-
89
- export { AppProvider as Provider, createSlice, useDispatch, useStore };