@fuf-stack/pixels 0.2.5 → 0.3.1
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/Button/index.cjs +3 -112
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.d.cts +3 -3
- package/dist/Button/index.d.ts +3 -3
- package/dist/Button/index.js +5 -5
- package/dist/{Button/Button.d.cts → Button-B0H0w1eR.d.cts} +1 -1
- package/dist/{Button/Button.d.ts → Button-B0H0w1eR.d.ts} +1 -1
- package/dist/Card/index.cjs +5 -133
- package/dist/Card/index.cjs.map +1 -1
- package/dist/Card/index.d.cts +3 -3
- package/dist/Card/index.d.ts +3 -3
- package/dist/Card/index.js +4 -5
- package/dist/Card/index.js.map +1 -1
- package/dist/{Card/Card.d.ts → Card-Cl_I4L8G.d.cts} +1 -1
- package/dist/{Card/Card.d.cts → Card-Cl_I4L8G.d.ts} +1 -1
- package/dist/Json/index.cjs +4 -203
- package/dist/Json/index.cjs.map +1 -1
- package/dist/Json/index.d.cts +3 -3
- package/dist/Json/index.d.ts +3 -3
- package/dist/Json/index.js +5 -8
- package/dist/Json/index.js.map +1 -1
- package/dist/{Json/Json.d.cts → Json-ClGDcbcp.d.cts} +1 -1
- package/dist/{Json/Json.d.ts → Json-ClGDcbcp.d.ts} +1 -1
- package/dist/Label/index.cjs +5 -59
- package/dist/Label/index.cjs.map +1 -1
- package/dist/Label/index.d.cts +3 -3
- package/dist/Label/index.d.ts +3 -3
- package/dist/Label/index.js +4 -5
- package/dist/Label/index.js.map +1 -1
- package/dist/{Label/Label.d.cts → Label-DzZDW95M.d.cts} +1 -1
- package/dist/{Label/Label.d.ts → Label-DzZDW95M.d.ts} +1 -1
- package/dist/Menu/index.cjs +5 -105
- package/dist/Menu/index.cjs.map +1 -1
- package/dist/Menu/index.d.cts +3 -3
- package/dist/Menu/index.d.ts +3 -3
- package/dist/Menu/index.js +4 -5
- package/dist/Menu/index.js.map +1 -1
- package/dist/{Menu/Menu.d.cts → Menu-CG5mVVnv.d.cts} +1 -1
- package/dist/{Menu/Menu.d.ts → Menu-CG5mVVnv.d.ts} +1 -1
- package/dist/Modal/index.cjs +5 -81
- package/dist/Modal/index.cjs.map +1 -1
- package/dist/Modal/index.d.cts +3 -3
- package/dist/Modal/index.d.ts +3 -3
- package/dist/Modal/index.js +4 -5
- package/dist/Modal/index.js.map +1 -1
- package/dist/{Modal/Modal.d.cts → Modal-CSxNe0bS.d.cts} +1 -1
- package/dist/{Modal/Modal.d.ts → Modal-CSxNe0bS.d.ts} +1 -1
- package/dist/Popover/index.cjs +5 -73
- package/dist/Popover/index.cjs.map +1 -1
- package/dist/Popover/index.d.cts +3 -3
- package/dist/Popover/index.d.ts +3 -3
- package/dist/Popover/index.js +4 -5
- package/dist/Popover/index.js.map +1 -1
- package/dist/{Popover/Popover.d.cts → Popover-DbTTk7_N.d.cts} +1 -1
- package/dist/{Popover/Popover.d.ts → Popover-DbTTk7_N.d.ts} +1 -1
- package/dist/Tooltip/index.cjs +3 -63
- package/dist/Tooltip/index.cjs.map +1 -1
- package/dist/Tooltip/index.d.cts +2 -2
- package/dist/Tooltip/index.d.ts +2 -2
- package/dist/Tooltip/index.js +2 -5
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/{Tooltip/Tooltip.d.cts → Tooltip-D0yEMBnv.d.cts} +1 -1
- package/dist/{Tooltip/Tooltip.d.ts → Tooltip-D0yEMBnv.d.ts} +1 -1
- package/dist/chunk-2UJJIIMU.js +87 -0
- package/dist/chunk-2UJJIIMU.js.map +1 -0
- package/dist/{chunk-WBAURF6J.js → chunk-7ERBBFDC.js} +38 -5
- package/dist/chunk-7ERBBFDC.js.map +1 -0
- package/dist/chunk-BMKGS5PK.cjs +32 -0
- package/dist/chunk-BMKGS5PK.cjs.map +1 -0
- package/dist/chunk-I76NWOB3.cjs +87 -0
- package/dist/chunk-I76NWOB3.cjs.map +1 -0
- package/dist/{chunk-ONXXZTZY.js → chunk-J47IOXCU.js} +5 -4
- package/dist/chunk-J47IOXCU.js.map +1 -0
- package/dist/chunk-JD3BEOSK.cjs +35 -0
- package/dist/chunk-JD3BEOSK.cjs.map +1 -0
- package/dist/chunk-L5OZDDU7.cjs +84 -0
- package/dist/chunk-L5OZDDU7.cjs.map +1 -0
- package/dist/{chunk-EYUTNORZ.js → chunk-MBQA3LPM.js} +6 -4
- package/dist/chunk-MBQA3LPM.js.map +1 -0
- package/dist/chunk-PI7CBPUS.cjs +127 -0
- package/dist/chunk-PI7CBPUS.cjs.map +1 -0
- package/dist/{chunk-CEUL4NWH.js → chunk-S2WOGSQV.js} +6 -2
- package/dist/chunk-S2WOGSQV.js.map +1 -0
- package/dist/chunk-STEC6TAQ.cjs +60 -0
- package/dist/chunk-STEC6TAQ.cjs.map +1 -0
- package/dist/{chunk-SGAWYTO7.js → chunk-V2C3KFMP.js} +6 -2
- package/dist/chunk-V2C3KFMP.js.map +1 -0
- package/dist/{chunk-XPTSDDXG.js → chunk-VQ5Q33MY.js} +6 -3
- package/dist/chunk-VQ5Q33MY.js.map +1 -0
- package/dist/{chunk-Y35GJHOR.js → chunk-VZW4TVTX.js} +6 -2
- package/dist/chunk-VZW4TVTX.js.map +1 -0
- package/dist/chunk-WTKZJFQV.cjs +111 -0
- package/dist/chunk-WTKZJFQV.cjs.map +1 -0
- package/dist/chunk-YUOFNPJO.cjs +46 -0
- package/dist/chunk-YUOFNPJO.cjs.map +1 -0
- package/dist/index.cjs +102 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/{hooks/useLocalStorage.js → index.js} +56 -6
- package/dist/index.js.map +1 -0
- package/package.json +54 -11
- package/dist/Button/Button.cjs +0 -113
- package/dist/Button/Button.cjs.map +0 -1
- package/dist/Button/Button.js +0 -8
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/subcomponents/LoadingSpinner.cjs +0 -57
- package/dist/Button/subcomponents/LoadingSpinner.cjs.map +0 -1
- package/dist/Button/subcomponents/LoadingSpinner.d.cts +0 -9
- package/dist/Button/subcomponents/LoadingSpinner.d.ts +0 -9
- package/dist/Button/subcomponents/LoadingSpinner.js +0 -7
- package/dist/Button/subcomponents/LoadingSpinner.js.map +0 -1
- package/dist/Card/Card.cjs +0 -137
- package/dist/Card/Card.cjs.map +0 -1
- package/dist/Card/Card.js +0 -9
- package/dist/Card/Card.js.map +0 -1
- package/dist/Json/Json.cjs +0 -204
- package/dist/Json/Json.cjs.map +0 -1
- package/dist/Json/Json.js +0 -10
- package/dist/Json/Json.js.map +0 -1
- package/dist/Label/Label.cjs +0 -58
- package/dist/Label/Label.cjs.map +0 -1
- package/dist/Label/Label.js +0 -7
- package/dist/Label/Label.js.map +0 -1
- package/dist/Menu/Menu.cjs +0 -104
- package/dist/Menu/Menu.cjs.map +0 -1
- package/dist/Menu/Menu.js +0 -7
- package/dist/Menu/Menu.js.map +0 -1
- package/dist/Modal/Modal.cjs +0 -86
- package/dist/Modal/Modal.cjs.map +0 -1
- package/dist/Modal/Modal.js +0 -9
- package/dist/Modal/Modal.js.map +0 -1
- package/dist/Popover/Popover.cjs +0 -72
- package/dist/Popover/Popover.cjs.map +0 -1
- package/dist/Popover/Popover.js +0 -7
- package/dist/Popover/Popover.js.map +0 -1
- package/dist/Tooltip/Tooltip.cjs +0 -68
- package/dist/Tooltip/Tooltip.cjs.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -9
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/chunk-4WCKFSLX.js +0 -11
- package/dist/chunk-4WCKFSLX.js.map +0 -1
- package/dist/chunk-6QVKZ4AT.js +0 -52
- package/dist/chunk-6QVKZ4AT.js.map +0 -1
- package/dist/chunk-CEUL4NWH.js.map +0 -1
- package/dist/chunk-EYUTNORZ.js.map +0 -1
- package/dist/chunk-ONXXZTZY.js.map +0 -1
- package/dist/chunk-SGAWYTO7.js.map +0 -1
- package/dist/chunk-WBAURF6J.js.map +0 -1
- package/dist/chunk-XPTSDDXG.js.map +0 -1
- package/dist/chunk-Y35GJHOR.js.map +0 -1
- package/dist/chunk-ZFEVTQWW.js +0 -37
- package/dist/chunk-ZFEVTQWW.js.map +0 -1
- package/dist/hooks/useDebounce.cjs +0 -43
- package/dist/hooks/useDebounce.cjs.map +0 -1
- package/dist/hooks/useDebounce.d.cts +0 -3
- package/dist/hooks/useDebounce.d.ts +0 -3
- package/dist/hooks/useDebounce.js +0 -22
- package/dist/hooks/useDebounce.js.map +0 -1
- package/dist/hooks/useLocalStorage.cjs +0 -73
- package/dist/hooks/useLocalStorage.cjs.map +0 -1
- package/dist/hooks/useLocalStorage.d.cts +0 -5
- package/dist/hooks/useLocalStorage.d.ts +0 -5
- package/dist/hooks/useLocalStorage.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/Popover/Popover.tsx
|
|
2
|
+
var _popover = require('@nextui-org/popover');
|
|
3
|
+
var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
|
|
4
|
+
var _debug = require('debug'); var _debug2 = _interopRequireDefault(_debug);
|
|
5
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
6
|
+
var debug = _debug2.default.call(void 0, "component:Popover");
|
|
7
|
+
var Popover_default = ({
|
|
8
|
+
children = null,
|
|
9
|
+
className = void 0,
|
|
10
|
+
content,
|
|
11
|
+
contentTestId = void 0,
|
|
12
|
+
placement = "top",
|
|
13
|
+
openControlled = void 0,
|
|
14
|
+
testId = void 0,
|
|
15
|
+
title = void 0
|
|
16
|
+
}) => {
|
|
17
|
+
debug("Popover");
|
|
18
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
19
|
+
_popover.Popover,
|
|
20
|
+
{
|
|
21
|
+
placement,
|
|
22
|
+
radius: "sm",
|
|
23
|
+
showArrow: true,
|
|
24
|
+
...openControlled ? { isOpen: openControlled.open, onOpenChange: openControlled.setOpen } : {},
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _popover.PopoverTrigger, { className: _classnames2.default.call(void 0, className), "data-testid": testId, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { children }) }),
|
|
27
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _popover.PopoverContent, { "data-testid": contentTestId, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "max-h-[80vh] overflow-y-auto", children: [
|
|
28
|
+
title && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
|
|
29
|
+
title,
|
|
30
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "hr", {})
|
|
31
|
+
] }),
|
|
32
|
+
content
|
|
33
|
+
] }) })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// src/Popover/index.ts
|
|
40
|
+
var Popover_default2 = Popover_default;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.Popover_default = Popover_default; exports.Popover_default2 = Popover_default2;
|
|
46
|
+
//# sourceMappingURL=chunk-YUOFNPJO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Popover/Popover.tsx","../src/Popover/index.ts"],"names":["Popover_default"],"mappings":";AAGA,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,OAAO,QAAQ;AACf,OAAO,iBAAiB;AAkDhB,cAKI,YALJ;AAhDR,IAAM,QAAQ,YAAY,mBAAmB;AAwB7C,IAAO,kBAAQ,CAAC;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,MAAoB;AAClB,QAAM,SAAS;AAEf,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAO;AAAA,MACP,WAAS;AAAA,MACR,GAAI,iBACD,EAAE,QAAQ,eAAe,MAAM,cAAc,eAAe,QAAQ,IACpE,CAAC;AAAA,MAEL;AAAA,4BAAC,kBAAe,WAAW,GAAG,SAAS,GAAG,eAAa,QAGrD,8BAAC,YAAQ,UAAS,GACpB;AAAA,QACA,oBAAC,kBAAe,eAAa,eAC3B,+BAAC,SAAI,WAAU,gCACZ;AAAA,mBACC,qBAAC,SACE;AAAA;AAAA,YACD,oBAAC,QAAG;AAAA,aACN;AAAA,UAED;AAAA,WACH,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;;;AChEA,IAAOA,mBAAQ","sourcesContent":["import type { PopoverProps as NextPopoverProps } from '@nextui-org/popover';\nimport type { ReactNode } from 'react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@nextui-org/popover';\nimport cn from 'classnames';\nimport createDebug from 'debug';\n\nconst debug = createDebug('component:Popover');\n\nexport interface PopoverProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** content of the popover */\n content: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n contentTestId?: string;\n /** placement of the popover relative to its trigger reference */\n placement?: NextPopoverProps['placement'];\n /** use as controlled component */\n openControlled?: { open: boolean; setOpen: (open: boolean) => void };\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** popover title */\n title?: ReactNode;\n}\n\n/**\n * Popover component based on [NextUI Card](https://nextui.org/docs/components/popover)\n */\nexport default ({\n children = null,\n className = undefined,\n content,\n contentTestId = undefined,\n placement = 'top',\n openControlled = undefined,\n testId = undefined,\n title = undefined,\n}: PopoverProps) => {\n debug('Popover');\n\n return (\n <Popover\n placement={placement}\n radius=\"sm\"\n showArrow\n {...(openControlled\n ? { isOpen: openControlled.open, onOpenChange: openControlled.setOpen }\n : {})}\n >\n <PopoverTrigger className={cn(className)} data-testid={testId}>\n {/* NOTE: type and aria properties are injected by PopoverTrigger */}\n {/* eslint-disable-next-line react/button-has-type */}\n <button>{children}</button>\n </PopoverTrigger>\n <PopoverContent data-testid={contentTestId}>\n <div className=\"max-h-[80vh] overflow-y-auto\">\n {title && (\n <div>\n {title}\n <hr />\n </div>\n )}\n {content}\n </div>\n </PopoverContent>\n </Popover>\n );\n};\n","import Popover from './Popover';\n\nexport type { PopoverProps } from './Popover';\n\nexport { Popover };\n\nexport default Popover;\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWTKZJFQVcjs = require('./chunk-WTKZJFQV.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkPI7CBPUScjs = require('./chunk-PI7CBPUS.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkI76NWOB3cjs = require('./chunk-I76NWOB3.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkBMKGS5PKcjs = require('./chunk-BMKGS5PK.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkL5OZDDU7cjs = require('./chunk-L5OZDDU7.cjs');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkSTEC6TAQcjs = require('./chunk-STEC6TAQ.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkYUOFNPJOcjs = require('./chunk-YUOFNPJO.cjs');
|
|
22
|
+
require('./chunk-JD3BEOSK.cjs');
|
|
23
|
+
|
|
24
|
+
// src/hooks/useDebounce.ts
|
|
25
|
+
var _react = require('react');
|
|
26
|
+
var useDebounce_default = (value, delay) => {
|
|
27
|
+
const [debouncedValue, setDebouncedValue] = _react.useState.call(void 0, value);
|
|
28
|
+
_react.useEffect.call(void 0,
|
|
29
|
+
() => {
|
|
30
|
+
const handler = setTimeout(() => {
|
|
31
|
+
setDebouncedValue(value);
|
|
32
|
+
}, delay);
|
|
33
|
+
return () => {
|
|
34
|
+
clearTimeout(handler);
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
[value, delay]
|
|
38
|
+
// Only re-call effect if value or delay changes
|
|
39
|
+
);
|
|
40
|
+
return debouncedValue;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/hooks/useLocalStorage.ts
|
|
44
|
+
|
|
45
|
+
var useLocalStorage = (key, initialValue) => {
|
|
46
|
+
const readValue = () => {
|
|
47
|
+
if (typeof window === "undefined") {
|
|
48
|
+
return initialValue;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const item = window.localStorage.getItem(key);
|
|
52
|
+
return item ? JSON.parse(item) : initialValue;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.warn(`Error reading localStorage key \u201C${key}\u201D:`, error);
|
|
55
|
+
return initialValue;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const [storedValue, setStoredValue] = _react.useState.call(void 0, readValue);
|
|
59
|
+
const setValue = (value) => {
|
|
60
|
+
if (typeof window === "undefined") {
|
|
61
|
+
console.warn(
|
|
62
|
+
`Tried setting localStorage key \u201C${key}\u201D even though environment is not a client`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const newValue = value instanceof Function ? value(storedValue) : value;
|
|
67
|
+
window.localStorage.setItem(key, JSON.stringify(newValue));
|
|
68
|
+
setStoredValue(newValue);
|
|
69
|
+
window.dispatchEvent(new Event("local-storage"));
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
_react.useEffect.call(void 0, () => {
|
|
75
|
+
setStoredValue(readValue());
|
|
76
|
+
}, []);
|
|
77
|
+
_react.useEffect.call(void 0, () => {
|
|
78
|
+
const handleStorageChange = () => {
|
|
79
|
+
setStoredValue(readValue());
|
|
80
|
+
};
|
|
81
|
+
window.addEventListener("storage", handleStorageChange);
|
|
82
|
+
window.addEventListener("local-storage", handleStorageChange);
|
|
83
|
+
return () => {
|
|
84
|
+
window.removeEventListener("storage", handleStorageChange);
|
|
85
|
+
window.removeEventListener("local-storage", handleStorageChange);
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
88
|
+
return [storedValue, setValue];
|
|
89
|
+
};
|
|
90
|
+
var useLocalStorage_default = useLocalStorage;
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
exports.Button = _chunkI76NWOB3cjs.Button_default; exports.Card = _chunkWTKZJFQVcjs.Card_default; exports.Json = _chunkPI7CBPUScjs.Json_default; exports.Label = _chunkBMKGS5PKcjs.Label_default; exports.Menu = _chunkL5OZDDU7cjs.Menu_default; exports.Modal = _chunkSTEC6TAQcjs.Modal_default; exports.Popover = _chunkYUOFNPJOcjs.Popover_default; exports.useDebounce = useDebounce_default; exports.useLocalStorage = useLocalStorage_default;
|
|
102
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useDebounce.ts","../src/hooks/useLocalStorage.ts"],"names":["useEffect","useState"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,gBAAgB;AAEpC,IAAO,sBAAQ,CAAQ,OAAc,UAAkB;AAErD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAC1D;AAAA,IACE,MAAM;AAEJ,YAAM,UAAU,WAAW,MAAM;AAC/B,0BAAkB,KAAK;AAAA,MACzB,GAAG,KAAK;AAIR,aAAO,MAAM;AACX,qBAAa,OAAO;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,OAAO,KAAK;AAAA;AAAA,EACf;AACA,SAAO;AACT;;;ACnBA,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;AAEpC,IAAM,kBAAkB,CACtB,KACA,iBACqC;AAGrC,QAAM,YAAY,MAAM;AAEtB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AACF,YAAM,OAAO,OAAO,aAAa,QAAQ,GAAG;AAC5C,aAAO,OAAO,KAAK,MAAM,IAAI,IAAI;AAAA,IACnC,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAC9D,aAAO;AAAA,IACT;AAAA,EACF;AAIA,QAAM,CAAC,aAAa,cAAc,IAAIA,UAAY,SAAS;AAI3D,QAAM,WAAwC,CAAC,UAAU;AAEvD,QAAI,OAAO,WAAW,aAAa;AACjC,cAAQ;AAAA,QACN,wCAAmC,GAAG;AAAA,MACxC;AAAA,IACF;AAEA,QAAI;AAEF,YAAM,WAAW,iBAAiB,WAAW,MAAM,WAAW,IAAI;AAGlE,aAAO,aAAa,QAAQ,KAAK,KAAK,UAAU,QAAQ,CAAC;AAGzD,qBAAe,QAAQ;AAGvB,aAAO,cAAc,IAAI,MAAM,eAAe,CAAC;AAAA,IACjD,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAAA,IAChE;AAAA,EACF;AAEA,EAAAD,WAAU,MAAM;AACd,mBAAe,UAAU,CAAC;AAAA,EAE5B,GAAG,CAAC,CAAC;AAEL,EAAAA,WAAU,MAAM;AACd,UAAM,sBAAsB,MAAM;AAChC,qBAAe,UAAU,CAAC;AAAA,IAC5B;AAGA,WAAO,iBAAiB,WAAW,mBAAmB;AAGtD,WAAO,iBAAiB,iBAAiB,mBAAmB;AAE5D,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,mBAAmB;AACzD,aAAO,oBAAoB,iBAAiB,mBAAmB;AAAA,IACjE;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,aAAa,QAAQ;AAC/B;AAEA,IAAO,0BAAQ","sourcesContent":["import { useEffect, useState } from 'react';\n\nexport default <Value>(value: Value, delay: number) => {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = useState(value);\n useEffect(\n () => {\n // Update debounced value after delay\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n // Cancel the timeout if value changes (also on delay change or unmount)\n // This is how we prevent debounced value from updating if value is changed ...\n // .. within the delay period. Timeout gets cleared and restarted.\n return () => {\n clearTimeout(handler);\n };\n },\n [value, delay], // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n};\n","import type { Dispatch, SetStateAction } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nconst useLocalStorage = <T>(\n key: string,\n initialValue: T | (() => T),\n): [T, Dispatch<SetStateAction<T>>] => {\n // Get from local storage then\n // parse stored json or return initialValue\n const readValue = () => {\n // Prevent build error \"window is undefined\" but keep keep working\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n console.warn(`Error reading localStorage key “${key}”:`, error);\n return initialValue;\n }\n };\n\n // State to store our value\n // Pass initial state function to useState so logic is only executed once\n const [storedValue, setStoredValue] = useState<T>(readValue);\n\n // Return a wrapped version of useState's setter function that ...\n // ... persists the new value to localStorage.\n const setValue: Dispatch<SetStateAction<T>> = (value) => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window === 'undefined') {\n console.warn(\n `Tried setting localStorage key “${key}” even though environment is not a client`,\n );\n }\n\n try {\n // Allow value to be a function so we have the same API as useState\n const newValue = value instanceof Function ? value(storedValue) : value;\n\n // Save to local storage\n window.localStorage.setItem(key, JSON.stringify(newValue));\n\n // Save state\n setStoredValue(newValue);\n\n // We dispatch a custom event so every useLocalStorage hook are notified\n window.dispatchEvent(new Event('local-storage'));\n } catch (error) {\n console.warn(`Error setting localStorage key “${key}”:`, error);\n }\n };\n\n useEffect(() => {\n setStoredValue(readValue());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const handleStorageChange = () => {\n setStoredValue(readValue());\n };\n\n // this only works for other documents, not the current one\n window.addEventListener('storage', handleStorageChange);\n\n // this is a custom event, triggered in writeValueToLocalStorage\n window.addEventListener('local-storage', handleStorageChange);\n\n return () => {\n window.removeEventListener('storage', handleStorageChange);\n window.removeEventListener('local-storage', handleStorageChange);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return [storedValue, setValue];\n};\n\nexport default useLocalStorage;\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export { B as Button, a as ButtonProps } from './Button-B0H0w1eR.cjs';
|
|
3
|
+
export { C as Card, a as CardProps } from './Card-Cl_I4L8G.cjs';
|
|
4
|
+
export { J as Json, a as JsonProps } from './Json-ClGDcbcp.cjs';
|
|
5
|
+
export { L as Label, a as LabelProps } from './Label-DzZDW95M.cjs';
|
|
6
|
+
export { M as Menu, b as MenuItem, a as MenuProps, c as MenuSection } from './Menu-CG5mVVnv.cjs';
|
|
7
|
+
export { M as Modal, a as ModalProps } from './Modal-CSxNe0bS.cjs';
|
|
8
|
+
export { _ as Popover, P as PopoverProps } from './Popover-DbTTk7_N.cjs';
|
|
9
|
+
export { a as TooltipProps } from './Tooltip-D0yEMBnv.cjs';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '@nextui-org/button';
|
|
12
|
+
import 'tailwind-variants/dist/config.js';
|
|
13
|
+
import 'tailwind-variants';
|
|
14
|
+
import '@nextui-org/chip';
|
|
15
|
+
import '@nextui-org/popover';
|
|
16
|
+
|
|
17
|
+
declare const _default: <Value>(value: Value, delay: number) => Value;
|
|
18
|
+
|
|
19
|
+
declare const useLocalStorage: <T>(key: string, initialValue: T | (() => T)) => [T, Dispatch<SetStateAction<T>>];
|
|
20
|
+
|
|
21
|
+
export { _default as useDebounce, useLocalStorage };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export { B as Button, a as ButtonProps } from './Button-B0H0w1eR.js';
|
|
3
|
+
export { C as Card, a as CardProps } from './Card-Cl_I4L8G.js';
|
|
4
|
+
export { J as Json, a as JsonProps } from './Json-ClGDcbcp.js';
|
|
5
|
+
export { L as Label, a as LabelProps } from './Label-DzZDW95M.js';
|
|
6
|
+
export { M as Menu, b as MenuItem, a as MenuProps, c as MenuSection } from './Menu-CG5mVVnv.js';
|
|
7
|
+
export { M as Modal, a as ModalProps } from './Modal-CSxNe0bS.js';
|
|
8
|
+
export { _ as Popover, P as PopoverProps } from './Popover-DbTTk7_N.js';
|
|
9
|
+
export { a as TooltipProps } from './Tooltip-D0yEMBnv.js';
|
|
10
|
+
import 'react/jsx-runtime';
|
|
11
|
+
import '@nextui-org/button';
|
|
12
|
+
import 'tailwind-variants/dist/config.js';
|
|
13
|
+
import 'tailwind-variants';
|
|
14
|
+
import '@nextui-org/chip';
|
|
15
|
+
import '@nextui-org/popover';
|
|
16
|
+
|
|
17
|
+
declare const _default: <Value>(value: Value, delay: number) => Value;
|
|
18
|
+
|
|
19
|
+
declare const useLocalStorage: <T>(key: string, initialValue: T | (() => T)) => [T, Dispatch<SetStateAction<T>>];
|
|
20
|
+
|
|
21
|
+
export { _default as useDebounce, useLocalStorage };
|
|
@@ -1,5 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
Card_default
|
|
3
|
+
} from "./chunk-VQ5Q33MY.js";
|
|
4
|
+
import {
|
|
5
|
+
Json_default
|
|
6
|
+
} from "./chunk-7ERBBFDC.js";
|
|
7
|
+
import {
|
|
8
|
+
Button_default
|
|
9
|
+
} from "./chunk-2UJJIIMU.js";
|
|
10
|
+
import {
|
|
11
|
+
Label_default
|
|
12
|
+
} from "./chunk-S2WOGSQV.js";
|
|
13
|
+
import {
|
|
14
|
+
Menu_default
|
|
15
|
+
} from "./chunk-VZW4TVTX.js";
|
|
16
|
+
import {
|
|
17
|
+
Modal_default
|
|
18
|
+
} from "./chunk-MBQA3LPM.js";
|
|
19
|
+
import {
|
|
20
|
+
Popover_default
|
|
21
|
+
} from "./chunk-V2C3KFMP.js";
|
|
22
|
+
import "./chunk-J47IOXCU.js";
|
|
23
|
+
|
|
24
|
+
// src/hooks/useDebounce.ts
|
|
2
25
|
import { useEffect, useState } from "react";
|
|
26
|
+
var useDebounce_default = (value, delay) => {
|
|
27
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
28
|
+
useEffect(
|
|
29
|
+
() => {
|
|
30
|
+
const handler = setTimeout(() => {
|
|
31
|
+
setDebouncedValue(value);
|
|
32
|
+
}, delay);
|
|
33
|
+
return () => {
|
|
34
|
+
clearTimeout(handler);
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
[value, delay]
|
|
38
|
+
// Only re-call effect if value or delay changes
|
|
39
|
+
);
|
|
40
|
+
return debouncedValue;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/hooks/useLocalStorage.ts
|
|
44
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
3
45
|
var useLocalStorage = (key, initialValue) => {
|
|
4
46
|
const readValue = () => {
|
|
5
47
|
if (typeof window === "undefined") {
|
|
@@ -13,7 +55,7 @@ var useLocalStorage = (key, initialValue) => {
|
|
|
13
55
|
return initialValue;
|
|
14
56
|
}
|
|
15
57
|
};
|
|
16
|
-
const [storedValue, setStoredValue] =
|
|
58
|
+
const [storedValue, setStoredValue] = useState2(readValue);
|
|
17
59
|
const setValue = (value) => {
|
|
18
60
|
if (typeof window === "undefined") {
|
|
19
61
|
console.warn(
|
|
@@ -29,10 +71,10 @@ var useLocalStorage = (key, initialValue) => {
|
|
|
29
71
|
console.warn(`Error setting localStorage key \u201C${key}\u201D:`, error);
|
|
30
72
|
}
|
|
31
73
|
};
|
|
32
|
-
|
|
74
|
+
useEffect2(() => {
|
|
33
75
|
setStoredValue(readValue());
|
|
34
76
|
}, []);
|
|
35
|
-
|
|
77
|
+
useEffect2(() => {
|
|
36
78
|
const handleStorageChange = () => {
|
|
37
79
|
setStoredValue(readValue());
|
|
38
80
|
};
|
|
@@ -47,6 +89,14 @@ var useLocalStorage = (key, initialValue) => {
|
|
|
47
89
|
};
|
|
48
90
|
var useLocalStorage_default = useLocalStorage;
|
|
49
91
|
export {
|
|
50
|
-
|
|
92
|
+
Button_default as Button,
|
|
93
|
+
Card_default as Card,
|
|
94
|
+
Json_default as Json,
|
|
95
|
+
Label_default as Label,
|
|
96
|
+
Menu_default as Menu,
|
|
97
|
+
Modal_default as Modal,
|
|
98
|
+
Popover_default as Popover,
|
|
99
|
+
useDebounce_default as useDebounce,
|
|
100
|
+
useLocalStorage_default as useLocalStorage
|
|
51
101
|
};
|
|
52
|
-
//# sourceMappingURL=
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useDebounce.ts","../src/hooks/useLocalStorage.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nexport default <Value>(value: Value, delay: number) => {\n // State and setters for debounced value\n const [debouncedValue, setDebouncedValue] = useState(value);\n useEffect(\n () => {\n // Update debounced value after delay\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n // Cancel the timeout if value changes (also on delay change or unmount)\n // This is how we prevent debounced value from updating if value is changed ...\n // .. within the delay period. Timeout gets cleared and restarted.\n return () => {\n clearTimeout(handler);\n };\n },\n [value, delay], // Only re-call effect if value or delay changes\n );\n return debouncedValue;\n};\n","import type { Dispatch, SetStateAction } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nconst useLocalStorage = <T>(\n key: string,\n initialValue: T | (() => T),\n): [T, Dispatch<SetStateAction<T>>] => {\n // Get from local storage then\n // parse stored json or return initialValue\n const readValue = () => {\n // Prevent build error \"window is undefined\" but keep keep working\n if (typeof window === 'undefined') {\n return initialValue;\n }\n\n try {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n } catch (error) {\n console.warn(`Error reading localStorage key “${key}”:`, error);\n return initialValue;\n }\n };\n\n // State to store our value\n // Pass initial state function to useState so logic is only executed once\n const [storedValue, setStoredValue] = useState<T>(readValue);\n\n // Return a wrapped version of useState's setter function that ...\n // ... persists the new value to localStorage.\n const setValue: Dispatch<SetStateAction<T>> = (value) => {\n // Prevent build error \"window is undefined\" but keeps working\n if (typeof window === 'undefined') {\n console.warn(\n `Tried setting localStorage key “${key}” even though environment is not a client`,\n );\n }\n\n try {\n // Allow value to be a function so we have the same API as useState\n const newValue = value instanceof Function ? value(storedValue) : value;\n\n // Save to local storage\n window.localStorage.setItem(key, JSON.stringify(newValue));\n\n // Save state\n setStoredValue(newValue);\n\n // We dispatch a custom event so every useLocalStorage hook are notified\n window.dispatchEvent(new Event('local-storage'));\n } catch (error) {\n console.warn(`Error setting localStorage key “${key}”:`, error);\n }\n };\n\n useEffect(() => {\n setStoredValue(readValue());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n const handleStorageChange = () => {\n setStoredValue(readValue());\n };\n\n // this only works for other documents, not the current one\n window.addEventListener('storage', handleStorageChange);\n\n // this is a custom event, triggered in writeValueToLocalStorage\n window.addEventListener('local-storage', handleStorageChange);\n\n return () => {\n window.removeEventListener('storage', handleStorageChange);\n window.removeEventListener('local-storage', handleStorageChange);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return [storedValue, setValue];\n};\n\nexport default useLocalStorage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAW,gBAAgB;AAEpC,IAAO,sBAAQ,CAAQ,OAAc,UAAkB;AAErD,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAC1D;AAAA,IACE,MAAM;AAEJ,YAAM,UAAU,WAAW,MAAM;AAC/B,0BAAkB,KAAK;AAAA,MACzB,GAAG,KAAK;AAIR,aAAO,MAAM;AACX,qBAAa,OAAO;AAAA,MACtB;AAAA,IACF;AAAA,IACA,CAAC,OAAO,KAAK;AAAA;AAAA,EACf;AACA,SAAO;AACT;;;ACnBA,SAAS,aAAAA,YAAW,YAAAC,iBAAgB;AAEpC,IAAM,kBAAkB,CACtB,KACA,iBACqC;AAGrC,QAAM,YAAY,MAAM;AAEtB,QAAI,OAAO,WAAW,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,QAAI;AACF,YAAM,OAAO,OAAO,aAAa,QAAQ,GAAG;AAC5C,aAAO,OAAO,KAAK,MAAM,IAAI,IAAI;AAAA,IACnC,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAC9D,aAAO;AAAA,IACT;AAAA,EACF;AAIA,QAAM,CAAC,aAAa,cAAc,IAAIA,UAAY,SAAS;AAI3D,QAAM,WAAwC,CAAC,UAAU;AAEvD,QAAI,OAAO,WAAW,aAAa;AACjC,cAAQ;AAAA,QACN,wCAAmC,GAAG;AAAA,MACxC;AAAA,IACF;AAEA,QAAI;AAEF,YAAM,WAAW,iBAAiB,WAAW,MAAM,WAAW,IAAI;AAGlE,aAAO,aAAa,QAAQ,KAAK,KAAK,UAAU,QAAQ,CAAC;AAGzD,qBAAe,QAAQ;AAGvB,aAAO,cAAc,IAAI,MAAM,eAAe,CAAC;AAAA,IACjD,SAAS,OAAO;AACd,cAAQ,KAAK,wCAAmC,GAAG,WAAM,KAAK;AAAA,IAChE;AAAA,EACF;AAEA,EAAAD,WAAU,MAAM;AACd,mBAAe,UAAU,CAAC;AAAA,EAE5B,GAAG,CAAC,CAAC;AAEL,EAAAA,WAAU,MAAM;AACd,UAAM,sBAAsB,MAAM;AAChC,qBAAe,UAAU,CAAC;AAAA,IAC5B;AAGA,WAAO,iBAAiB,WAAW,mBAAmB;AAGtD,WAAO,iBAAiB,iBAAiB,mBAAmB;AAE5D,WAAO,MAAM;AACX,aAAO,oBAAoB,WAAW,mBAAmB;AACzD,aAAO,oBAAoB,iBAAiB,mBAAmB;AAAA,IACjE;AAAA,EAEF,GAAG,CAAC,CAAC;AAEL,SAAO,CAAC,aAAa,QAAQ;AAC/B;AAEA,IAAO,0BAAQ;","names":["useEffect","useState"]}
|
package/package.json
CHANGED
|
@@ -2,16 +2,57 @@
|
|
|
2
2
|
"name": "@fuf-stack/pixels",
|
|
3
3
|
"description": "fuf react component library",
|
|
4
4
|
"author": "Hannes Tiede",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.cjs",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
7
11
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./Button": {
|
|
18
|
+
"import": "./dist/Button/index.js",
|
|
19
|
+
"require": "./dist/Button/index.cjs",
|
|
20
|
+
"types": "./dist/Button/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./Card": {
|
|
23
|
+
"import": "./dist/Card/index.js",
|
|
24
|
+
"require": "./dist/Card/index.cjs",
|
|
25
|
+
"types": "./dist/Card/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./Json": {
|
|
28
|
+
"import": "./dist/Json/index.js",
|
|
29
|
+
"require": "./dist/Json/index.cjs",
|
|
30
|
+
"types": "./dist/Json/index.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./Label": {
|
|
33
|
+
"import": "./dist/Label/index.js",
|
|
34
|
+
"require": "./dist/Label/index.cjs",
|
|
35
|
+
"types": "./dist/Label/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./Menu": {
|
|
38
|
+
"import": "./dist/Menu/index.js",
|
|
39
|
+
"require": "./dist/Menu/index.cjs",
|
|
40
|
+
"types": "./dist/Menu/index.d.ts"
|
|
41
|
+
},
|
|
42
|
+
"./Modal": {
|
|
43
|
+
"import": "./dist/Modal/index.js",
|
|
44
|
+
"require": "./dist/Modal/index.cjs",
|
|
45
|
+
"types": "./dist/Modal/index.d.ts"
|
|
46
|
+
},
|
|
47
|
+
"./Popover": {
|
|
48
|
+
"import": "./dist/Popover/index.js",
|
|
49
|
+
"require": "./dist/Popover/index.cjs",
|
|
50
|
+
"types": "./dist/Popover/index.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"./Tooltip": {
|
|
53
|
+
"import": "./dist/Tooltip/index.js",
|
|
54
|
+
"require": "./dist/Tooltip/index.cjs",
|
|
55
|
+
"types": "./dist/Tooltip/index.d.ts"
|
|
15
56
|
}
|
|
16
57
|
},
|
|
17
58
|
"files": [
|
|
@@ -57,11 +98,13 @@
|
|
|
57
98
|
"@types/debug": "4.1.12",
|
|
58
99
|
"@types/react": "18.2.69",
|
|
59
100
|
"@types/react-dom": "18.2.22",
|
|
60
|
-
"storybook-config": "0.0.1",
|
|
61
|
-
"tailwind-config": "0.0.1"
|
|
101
|
+
"@repo/storybook-config": "0.0.1",
|
|
102
|
+
"@repo/tailwind-config": "0.0.1",
|
|
103
|
+
"@repo/tsup-config": "0.0.1",
|
|
104
|
+
"@repo/vite-config": "0.0.1"
|
|
62
105
|
},
|
|
63
106
|
"scripts": {
|
|
64
|
-
"build": "
|
|
107
|
+
"build": "tsup --config node_modules/@repo/tsup-config/config.ts",
|
|
65
108
|
"test": "vitest ./src"
|
|
66
109
|
}
|
|
67
110
|
}
|
package/dist/Button/Button.cjs
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/Button/Button.tsx
|
|
31
|
-
var Button_exports = {};
|
|
32
|
-
__export(Button_exports, {
|
|
33
|
-
default: () => Button_default
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(Button_exports);
|
|
36
|
-
var import_button = require("@nextui-org/button");
|
|
37
|
-
var import_classnames = __toESM(require("classnames"), 1);
|
|
38
|
-
|
|
39
|
-
// src/Button/subcomponents/LoadingSpinner.tsx
|
|
40
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
-
var LoadingSpinner_default = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
42
|
-
"svg",
|
|
43
|
-
{
|
|
44
|
-
className: "animate-spin h-5 w-5 text-current",
|
|
45
|
-
fill: "none",
|
|
46
|
-
viewBox: "0 0 24 24",
|
|
47
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
-
"circle",
|
|
51
|
-
{
|
|
52
|
-
className: "opacity-25",
|
|
53
|
-
cx: "12",
|
|
54
|
-
cy: "12",
|
|
55
|
-
r: "10",
|
|
56
|
-
stroke: "currentColor",
|
|
57
|
-
strokeWidth: "4"
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
-
"path",
|
|
62
|
-
{
|
|
63
|
-
className: "opacity-75",
|
|
64
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
65
|
-
fill: "currentColor"
|
|
66
|
-
}
|
|
67
|
-
)
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
// src/Button/Button.tsx
|
|
73
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
74
|
-
var Button = ({
|
|
75
|
-
ariaLabel = void 0,
|
|
76
|
-
children = void 0,
|
|
77
|
-
className = void 0,
|
|
78
|
-
color = "default",
|
|
79
|
-
disabled = false,
|
|
80
|
-
icon = void 0,
|
|
81
|
-
loading = false,
|
|
82
|
-
onClick = void 0,
|
|
83
|
-
size = void 0,
|
|
84
|
-
testId = void 0,
|
|
85
|
-
type = void 0,
|
|
86
|
-
variant = "solid",
|
|
87
|
-
...passthrouhProps
|
|
88
|
-
}) => {
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
90
|
-
import_button.Button,
|
|
91
|
-
{
|
|
92
|
-
"aria-label": ariaLabel,
|
|
93
|
-
className: (0, import_classnames.default)(className),
|
|
94
|
-
color,
|
|
95
|
-
"data-testid": testId,
|
|
96
|
-
isDisabled: disabled,
|
|
97
|
-
isIconOnly: !!(icon && !children),
|
|
98
|
-
isLoading: loading,
|
|
99
|
-
onPress: onClick,
|
|
100
|
-
size,
|
|
101
|
-
spinner: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LoadingSpinner_default, {}),
|
|
102
|
-
type,
|
|
103
|
-
variant,
|
|
104
|
-
...passthrouhProps,
|
|
105
|
-
children: [
|
|
106
|
-
icon,
|
|
107
|
-
children
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
var Button_default = Button;
|
|
113
|
-
//# sourceMappingURL=Button.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Button/Button.tsx","../../src/Button/subcomponents/LoadingSpinner.tsx"],"sourcesContent":["import type { ButtonProps as NextButtonProps } from '@nextui-org/button';\nimport type { ReactNode } from 'react';\n\nimport { Button as NextButton } from '@nextui-org/button';\nimport cn from 'classnames';\n\nimport LoadingSpinner from './subcomponents/LoadingSpinner';\n\nexport interface ButtonProps {\n /** sets HTML aria-label attribute */\n ariaLabel?: string;\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** next ui button color */\n color?: NextButtonProps['color'];\n /** disables function of the button. */\n disabled?: boolean;\n /** If set loading animation is shown */\n loading?: boolean;\n /** optional icon */\n icon?: ReactNode;\n /** on click event */\n onClick?: NextButtonProps['onPress'];\n /** 3 size options */\n size?: NextButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** sets the button type. */\n type?: 'button' | 'submit' | 'reset' | undefined;\n /** next ui button variants */\n variant?: NextButtonProps['variant'];\n}\n\n/**\n * Button component based on [NextUI Button](https://nextui.org/docs/components/button)\n */\nconst Button = ({\n ariaLabel = undefined,\n children = undefined,\n className = undefined,\n color = 'default',\n disabled = false,\n icon = undefined,\n loading = false,\n onClick = undefined,\n size = undefined,\n testId = undefined,\n type = undefined,\n variant = 'solid',\n ...passthrouhProps\n}: ButtonProps) => {\n return (\n <NextButton\n aria-label={ariaLabel}\n className={cn(className)}\n color={color}\n data-testid={testId}\n isDisabled={disabled}\n isIconOnly={!!(icon && !children)}\n isLoading={loading}\n onPress={onClick}\n size={size}\n spinner={<LoadingSpinner />}\n type={type}\n variant={variant}\n {...passthrouhProps}\n >\n {icon}\n {children}\n </NextButton>\n );\n};\n\nexport default Button;\n","/**\n * svg loading spinner for button\n * @see https://nextui.org/docs/components/button#loading\n * */\nexport default () => (\n <svg\n className=\"animate-spin h-5 w-5 text-current\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,wBAAe;;;ACCb;AADF,IAAO,yBAAQ,MACb;AAAA,EAAC;AAAA;AAAA,IACC,WAAU;AAAA,IACV,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,OAAM;AAAA,IAEN;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACd;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,GAAE;AAAA,UACF,MAAK;AAAA;AAAA,MACP;AAAA;AAAA;AACF;;;AD8BE,IAAAA,sBAAA;AAhBJ,IAAM,SAAS,CAAC;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,OAAO;AAAA,EACP,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,EACV,GAAG;AACL,MAAmB;AACjB,SACE;AAAA,IAAC,cAAAC;AAAA,IAAA;AAAA,MACC,cAAY;AAAA,MACZ,eAAW,kBAAAC,SAAG,SAAS;AAAA,MACvB;AAAA,MACA,eAAa;AAAA,MACb,YAAY;AAAA,MACZ,YAAY,CAAC,EAAE,QAAQ,CAAC;AAAA,MACxB,WAAW;AAAA,MACX,SAAS;AAAA,MACT;AAAA,MACA,SAAS,6CAAC,0BAAe;AAAA,MACzB;AAAA,MACA;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,QACA;AAAA;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,iBAAQ;","names":["import_jsx_runtime","NextButton","cn"]}
|
package/dist/Button/Button.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/Button/subcomponents/LoadingSpinner.tsx
|
|
21
|
-
var LoadingSpinner_exports = {};
|
|
22
|
-
__export(LoadingSpinner_exports, {
|
|
23
|
-
default: () => LoadingSpinner_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(LoadingSpinner_exports);
|
|
26
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
var LoadingSpinner_default = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
28
|
-
"svg",
|
|
29
|
-
{
|
|
30
|
-
className: "animate-spin h-5 w-5 text-current",
|
|
31
|
-
fill: "none",
|
|
32
|
-
viewBox: "0 0 24 24",
|
|
33
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
34
|
-
children: [
|
|
35
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
36
|
-
"circle",
|
|
37
|
-
{
|
|
38
|
-
className: "opacity-25",
|
|
39
|
-
cx: "12",
|
|
40
|
-
cy: "12",
|
|
41
|
-
r: "10",
|
|
42
|
-
stroke: "currentColor",
|
|
43
|
-
strokeWidth: "4"
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
-
"path",
|
|
48
|
-
{
|
|
49
|
-
className: "opacity-75",
|
|
50
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z",
|
|
51
|
-
fill: "currentColor"
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
//# sourceMappingURL=LoadingSpinner.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/Button/subcomponents/LoadingSpinner.tsx"],"sourcesContent":["/**\n * svg loading spinner for button\n * @see https://nextui.org/docs/components/button#loading\n * */\nexport default () => (\n <svg\n className=\"animate-spin h-5 w-5 text-current\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <circle\n className=\"opacity-25\"\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n />\n <path\n className=\"opacity-75\"\n d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z\"\n fill=\"currentColor\"\n />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKE;AADF,IAAO,yBAAQ,MACb;AAAA,EAAC;AAAA;AAAA,IACC,WAAU;AAAA,IACV,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,OAAM;AAAA,IAEN;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACd;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,GAAE;AAAA,UACF,MAAK;AAAA;AAAA,MACP;AAAA;AAAA;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|