@fuf-stack/pixels 1.2.5 → 1.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/Menu/index.cjs +2 -2
- package/dist/Menu/index.d.cts +2 -2
- package/dist/Menu/index.d.ts +2 -2
- package/dist/Menu/index.js +1 -1
- package/dist/{Menu-CF5f9mfu.d.cts → Menu-DDKcN7N3.d.cts} +1 -1
- package/dist/{Menu-CF5f9mfu.d.ts → Menu-DDKcN7N3.d.ts} +1 -1
- package/dist/Progress/index.cjs +3 -3
- package/dist/Progress/index.js +2 -2
- package/dist/ProgressCircular/index.cjs +3 -3
- package/dist/ProgressCircular/index.js +2 -2
- package/dist/SearchInput/index.cjs +69 -0
- package/dist/SearchInput/index.cjs.map +1 -0
- package/dist/SearchInput/index.d.cts +88 -0
- package/dist/SearchInput/index.d.ts +88 -0
- package/dist/SearchInput/index.js +69 -0
- package/dist/SearchInput/index.js.map +1 -0
- package/dist/{chunk-324TSAWD.js → chunk-3VAWRUPR.js} +65 -17
- package/dist/chunk-3VAWRUPR.js.map +1 -0
- package/dist/{chunk-OLI32URU.cjs → chunk-7ZIK4LWC.cjs} +1 -1
- package/dist/chunk-7ZIK4LWC.cjs.map +1 -0
- package/dist/{chunk-YLJW375Y.cjs → chunk-C43BKEAS.cjs} +57 -9
- package/dist/chunk-C43BKEAS.cjs.map +1 -0
- package/dist/{chunk-TYY3HIYL.js → chunk-EYUII2LV.js} +2 -2
- package/dist/{chunk-2O3IUQR4.js → chunk-FFNMGR72.js} +2 -2
- package/dist/{chunk-IY2NXW6X.cjs → chunk-KM3PZ3GH.cjs} +3 -3
- package/dist/{chunk-IY2NXW6X.cjs.map → chunk-KM3PZ3GH.cjs.map} +1 -1
- package/dist/{chunk-AZ7VMRHX.cjs → chunk-RZGLEDWN.cjs} +3 -3
- package/dist/{chunk-AZ7VMRHX.cjs.map → chunk-RZGLEDWN.cjs.map} +1 -1
- package/dist/{chunk-B3XKBNXD.js → chunk-VTSVKRA7.js} +1 -1
- package/dist/chunk-VTSVKRA7.js.map +1 -0
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/package.json +7 -1
- package/dist/chunk-324TSAWD.js.map +0 -1
- package/dist/chunk-B3XKBNXD.js.map +0 -1
- package/dist/chunk-OLI32URU.cjs.map +0 -1
- package/dist/chunk-YLJW375Y.cjs.map +0 -1
- /package/dist/{chunk-TYY3HIYL.js.map → chunk-EYUII2LV.js.map} +0 -0
- /package/dist/{chunk-2O3IUQR4.js.map → chunk-FFNMGR72.js.map} +0 -0
package/dist/Menu/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkC43BKEAScjs = require('../chunk-C43BKEAS.cjs');
|
|
5
5
|
require('../chunk-AHEA4IJV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.Menu =
|
|
9
|
+
exports.Menu = _chunkC43BKEAScjs.Menu_default; exports.default = _chunkC43BKEAScjs.Menu_default2;
|
|
10
10
|
//# sourceMappingURL=index.cjs.map
|
package/dist/Menu/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Menu } from '../Menu-
|
|
2
|
-
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-
|
|
1
|
+
import { M as Menu } from '../Menu-DDKcN7N3.cjs';
|
|
2
|
+
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-DDKcN7N3.cjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'tailwind-variants';
|
|
5
5
|
import '@fuf-stack/pixel-utils';
|
package/dist/Menu/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Menu } from '../Menu-
|
|
2
|
-
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-
|
|
1
|
+
import { M as Menu } from '../Menu-DDKcN7N3.js';
|
|
2
|
+
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-DDKcN7N3.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'tailwind-variants';
|
|
5
5
|
import '@fuf-stack/pixel-utils';
|
package/dist/Menu/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { DropdownItemProps, DropdownProps } from '@heroui/dropdown';
|
|
|
6
6
|
import { ReactNode, Key } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Menu
|
|
9
|
+
* Menu component based on [HeroUI Dropdown](https://www.heroui.com//docs/components/dropdown)
|
|
10
10
|
*/
|
|
11
11
|
interface MenuItem {
|
|
12
12
|
/** unique identifier */
|
|
@@ -6,7 +6,7 @@ import { DropdownItemProps, DropdownProps } from '@heroui/dropdown';
|
|
|
6
6
|
import { ReactNode, Key } from 'react';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Menu
|
|
9
|
+
* Menu component based on [HeroUI Dropdown](https://www.heroui.com//docs/components/dropdown)
|
|
10
10
|
*/
|
|
11
11
|
interface MenuItem {
|
|
12
12
|
/** unique identifier */
|
package/dist/Progress/index.cjs
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var _chunkKM3PZ3GHcjs = require('../chunk-KM3PZ3GH.cjs');
|
|
6
|
+
require('../chunk-7ZIK4LWC.cjs');
|
|
7
7
|
require('../chunk-AHEA4IJV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.Progress =
|
|
12
|
+
exports.Progress = _chunkKM3PZ3GHcjs.Progress_default; exports.default = _chunkKM3PZ3GHcjs.Progress_default2; exports.progressVariants = _chunkKM3PZ3GHcjs.progressVariants;
|
|
13
13
|
//# sourceMappingURL=index.cjs.map
|
package/dist/Progress/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
Progress_default,
|
|
3
3
|
Progress_default2,
|
|
4
4
|
progressVariants
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-EYUII2LV.js";
|
|
6
|
+
import "../chunk-VTSVKRA7.js";
|
|
7
7
|
import "../chunk-OAIRL2FN.js";
|
|
8
8
|
export {
|
|
9
9
|
Progress_default as Progress,
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
5
|
+
var _chunkRZGLEDWNcjs = require('../chunk-RZGLEDWN.cjs');
|
|
6
|
+
require('../chunk-7ZIK4LWC.cjs');
|
|
7
7
|
require('../chunk-AHEA4IJV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ProgressCircular =
|
|
12
|
+
exports.ProgressCircular = _chunkRZGLEDWNcjs.ProgressCircular_default; exports.default = _chunkRZGLEDWNcjs.ProgressCircular_default2; exports.progressCircularVariants = _chunkRZGLEDWNcjs.progressCircularVariants;
|
|
13
13
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
ProgressCircular_default,
|
|
3
3
|
ProgressCircular_default2,
|
|
4
4
|
progressCircularVariants
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-FFNMGR72.js";
|
|
6
|
+
import "../chunk-VTSVKRA7.js";
|
|
7
7
|
import "../chunk-OAIRL2FN.js";
|
|
8
8
|
export {
|
|
9
9
|
ProgressCircular_default as ProgressCircular,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-AHEA4IJV.cjs');
|
|
2
|
+
|
|
3
|
+
// src/SearchInput/SearchInput.tsx
|
|
4
|
+
var _fa = require('react-icons/fa');
|
|
5
|
+
var _input = require('@heroui/input');
|
|
6
|
+
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
7
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
8
|
+
var inputVariants = _pixelutils.tv.call(void 0, {
|
|
9
|
+
slots: {
|
|
10
|
+
/** wrapper around the whole input */
|
|
11
|
+
base: "",
|
|
12
|
+
/** clear button */
|
|
13
|
+
clearButton: "",
|
|
14
|
+
/** actual input element */
|
|
15
|
+
input: "",
|
|
16
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
17
|
+
inputWrapper: "bg-content1 group-data-[focus=true]:border-focus"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var SearchInput = ({
|
|
21
|
+
className: _className = void 0,
|
|
22
|
+
disabled = false,
|
|
23
|
+
endContent = void 0,
|
|
24
|
+
onChange,
|
|
25
|
+
placeholder = void 0,
|
|
26
|
+
size = void 0,
|
|
27
|
+
startContent = void 0,
|
|
28
|
+
testId = void 0,
|
|
29
|
+
initialValue = void 0
|
|
30
|
+
}) => {
|
|
31
|
+
const variants = inputVariants();
|
|
32
|
+
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, _className, "base");
|
|
33
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
34
|
+
_input.Input,
|
|
35
|
+
{
|
|
36
|
+
isClearable: true,
|
|
37
|
+
"data-testid": testId ? _pixelutils.slugify.call(void 0, testId) : void 0,
|
|
38
|
+
defaultValue: initialValue,
|
|
39
|
+
endContent,
|
|
40
|
+
isDisabled: disabled,
|
|
41
|
+
placeholder,
|
|
42
|
+
radius: "sm",
|
|
43
|
+
size,
|
|
44
|
+
startContent: startContent != null ? startContent : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _fa.FaSearch, { className: "opacity-50" }),
|
|
45
|
+
variant: "bordered",
|
|
46
|
+
classNames: {
|
|
47
|
+
base: classNames.base,
|
|
48
|
+
clearButton: classNames.clearButton,
|
|
49
|
+
input: classNames.input,
|
|
50
|
+
inputWrapper: classNames.inputWrapper
|
|
51
|
+
},
|
|
52
|
+
onChange: (e) => {
|
|
53
|
+
onChange(e.target.value);
|
|
54
|
+
},
|
|
55
|
+
onClear: () => {
|
|
56
|
+
onChange(null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
var SearchInput_default = SearchInput;
|
|
62
|
+
|
|
63
|
+
// src/SearchInput/index.ts
|
|
64
|
+
var SearchInput_default2 = SearchInput_default;
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
exports.SearchInput = SearchInput_default; exports.default = SearchInput_default2;
|
|
69
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/SearchInput/index.cjs","../../src/SearchInput/SearchInput.tsx","../../src/SearchInput/index.ts"],"names":["SearchInput_default"],"mappings":"AAAA,0GAA8B;AAC9B;AACA;ACCA,oCAAyB;AAEzB,sCAAmC;AAEnC,oDAAkD;AAoEd,+CAAA;AAjE7B,IAAM,cAAA,EAAgB,4BAAA;AAAG,EAC9B,KAAA,EAAO;AAAA;AAAA,IAEL,IAAA,EAAM,EAAA;AAAA;AAAA,IAEN,WAAA,EAAa,EAAA;AAAA;AAAA,IAEb,KAAA,EAAO,EAAA;AAAA;AAAA,IAEP,YAAA,EAAc;AAAA,EAChB;AACF,CAAC,CAAA;AA6BD,IAAM,YAAA,EAAc,CAAC;AAAA,EACnB,SAAA,EAAW,WAAA,EAAa,KAAA,CAAA;AAAA,EACxB,SAAA,EAAW,KAAA;AAAA,EACX,WAAA,EAAa,KAAA,CAAA;A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AAA;AAEA,IAAO,oBAAA,EAAQ,WAAA;ADhCf;AACA;AExDA,IAAOA,qBAAAA,EAAQ,mBAAA;AF0Df;AACE;AACA;AACF,kFAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/SearchInput/index.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { FaSearch } from 'react-icons/fa';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\n// input variants\nexport const inputVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface SearchInputProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** optional initial value of the input */\n initialValue?: string;\n /** callback that is fired when the value is changed or cleared */\n onChange: (value: string | null) => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * SearchInput component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst SearchInput = ({\n className: _className = undefined,\n disabled = false,\n endContent = undefined,\n onChange,\n placeholder = undefined,\n size = undefined,\n startContent = undefined,\n testId = undefined,\n initialValue = undefined,\n}: SearchInputProps) => {\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n return (\n <HeroInput\n isClearable\n data-testid={testId ? slugify(testId) : undefined}\n defaultValue={initialValue}\n endContent={endContent}\n isDisabled={disabled}\n placeholder={placeholder}\n radius=\"sm\"\n size={size}\n startContent={startContent ?? <FaSearch className=\"opacity-50\" />}\n variant=\"bordered\"\n classNames={{\n base: classNames.base,\n clearButton: classNames.clearButton,\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n }}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClear={() => {\n onChange(null);\n }}\n />\n );\n};\n\nexport default SearchInput;\n","import SearchInput from './SearchInput';\n\nexport type { SearchInputProps } from './SearchInput';\n\nexport { SearchInput };\n\nexport default SearchInput;\n"]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { TVProps, TVClassName } from '@fuf-stack/pixel-utils';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
declare const inputVariants: tailwind_variants.TVReturnType<{
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
+
base?: tailwind_variants.ClassValue;
|
|
10
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
11
|
+
input?: tailwind_variants.ClassValue;
|
|
12
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
[x: string]: {
|
|
17
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
18
|
+
base?: tailwind_variants.ClassValue;
|
|
19
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
20
|
+
input?: tailwind_variants.ClassValue;
|
|
21
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
} | {}, {
|
|
25
|
+
/** wrapper around the whole input */
|
|
26
|
+
base: string;
|
|
27
|
+
/** clear button */
|
|
28
|
+
clearButton: string;
|
|
29
|
+
/** actual input element */
|
|
30
|
+
input: string;
|
|
31
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
32
|
+
inputWrapper: string;
|
|
33
|
+
}, undefined, {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
36
|
+
base?: tailwind_variants.ClassValue;
|
|
37
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
38
|
+
input?: tailwind_variants.ClassValue;
|
|
39
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
} | {}, {
|
|
43
|
+
/** wrapper around the whole input */
|
|
44
|
+
base: string;
|
|
45
|
+
/** clear button */
|
|
46
|
+
clearButton: string;
|
|
47
|
+
/** actual input element */
|
|
48
|
+
input: string;
|
|
49
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
50
|
+
inputWrapper: string;
|
|
51
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
52
|
+
/** wrapper around the whole input */
|
|
53
|
+
base: string;
|
|
54
|
+
/** clear button */
|
|
55
|
+
clearButton: string;
|
|
56
|
+
/** actual input element */
|
|
57
|
+
input: string;
|
|
58
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
59
|
+
inputWrapper: string;
|
|
60
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
61
|
+
type VariantProps = TVProps<typeof inputVariants>;
|
|
62
|
+
type ClassName = TVClassName<typeof inputVariants>;
|
|
63
|
+
interface SearchInputProps extends VariantProps {
|
|
64
|
+
/** CSS class name */
|
|
65
|
+
className?: ClassName;
|
|
66
|
+
/** input field is disabled */
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/** added content to the end of the input Field. */
|
|
69
|
+
endContent?: ReactNode;
|
|
70
|
+
/** optional initial value of the input */
|
|
71
|
+
initialValue?: string;
|
|
72
|
+
/** callback that is fired when the value is changed or cleared */
|
|
73
|
+
onChange: (value: string | null) => void;
|
|
74
|
+
/** form field placeholder */
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/** size of the input */
|
|
77
|
+
size?: 'sm' | 'md' | 'lg';
|
|
78
|
+
/** content added to the start of the input field */
|
|
79
|
+
startContent?: ReactNode;
|
|
80
|
+
/** HTML data-testid attribute used in e2e tests */
|
|
81
|
+
testId?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* SearchInput component based on [HeroUI Input](https://www.heroui.com//docs/components/input)
|
|
85
|
+
*/
|
|
86
|
+
declare const SearchInput: ({ className: _className, disabled, endContent, onChange, placeholder, size, startContent, testId, initialValue, }: SearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
export { SearchInput, type SearchInputProps, SearchInput as default };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
3
|
+
import { TVProps, TVClassName } from '@fuf-stack/pixel-utils';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
declare const inputVariants: tailwind_variants.TVReturnType<{
|
|
7
|
+
[key: string]: {
|
|
8
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
9
|
+
base?: tailwind_variants.ClassValue;
|
|
10
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
11
|
+
input?: tailwind_variants.ClassValue;
|
|
12
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
[x: string]: {
|
|
17
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
18
|
+
base?: tailwind_variants.ClassValue;
|
|
19
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
20
|
+
input?: tailwind_variants.ClassValue;
|
|
21
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
} | {}, {
|
|
25
|
+
/** wrapper around the whole input */
|
|
26
|
+
base: string;
|
|
27
|
+
/** clear button */
|
|
28
|
+
clearButton: string;
|
|
29
|
+
/** actual input element */
|
|
30
|
+
input: string;
|
|
31
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
32
|
+
inputWrapper: string;
|
|
33
|
+
}, undefined, {
|
|
34
|
+
[key: string]: {
|
|
35
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
36
|
+
base?: tailwind_variants.ClassValue;
|
|
37
|
+
clearButton?: tailwind_variants.ClassValue;
|
|
38
|
+
input?: tailwind_variants.ClassValue;
|
|
39
|
+
inputWrapper?: tailwind_variants.ClassValue;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
} | {}, {
|
|
43
|
+
/** wrapper around the whole input */
|
|
44
|
+
base: string;
|
|
45
|
+
/** clear button */
|
|
46
|
+
clearButton: string;
|
|
47
|
+
/** actual input element */
|
|
48
|
+
input: string;
|
|
49
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
50
|
+
inputWrapper: string;
|
|
51
|
+
}, tailwind_variants.TVReturnType<unknown, {
|
|
52
|
+
/** wrapper around the whole input */
|
|
53
|
+
base: string;
|
|
54
|
+
/** clear button */
|
|
55
|
+
clearButton: string;
|
|
56
|
+
/** actual input element */
|
|
57
|
+
input: string;
|
|
58
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
59
|
+
inputWrapper: string;
|
|
60
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
61
|
+
type VariantProps = TVProps<typeof inputVariants>;
|
|
62
|
+
type ClassName = TVClassName<typeof inputVariants>;
|
|
63
|
+
interface SearchInputProps extends VariantProps {
|
|
64
|
+
/** CSS class name */
|
|
65
|
+
className?: ClassName;
|
|
66
|
+
/** input field is disabled */
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/** added content to the end of the input Field. */
|
|
69
|
+
endContent?: ReactNode;
|
|
70
|
+
/** optional initial value of the input */
|
|
71
|
+
initialValue?: string;
|
|
72
|
+
/** callback that is fired when the value is changed or cleared */
|
|
73
|
+
onChange: (value: string | null) => void;
|
|
74
|
+
/** form field placeholder */
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/** size of the input */
|
|
77
|
+
size?: 'sm' | 'md' | 'lg';
|
|
78
|
+
/** content added to the start of the input field */
|
|
79
|
+
startContent?: ReactNode;
|
|
80
|
+
/** HTML data-testid attribute used in e2e tests */
|
|
81
|
+
testId?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* SearchInput component based on [HeroUI Input](https://www.heroui.com//docs/components/input)
|
|
85
|
+
*/
|
|
86
|
+
declare const SearchInput: ({ className: _className, disabled, endContent, onChange, placeholder, size, startContent, testId, initialValue, }: SearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
export { SearchInput, type SearchInputProps, SearchInput as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "../chunk-OAIRL2FN.js";
|
|
2
|
+
|
|
3
|
+
// src/SearchInput/SearchInput.tsx
|
|
4
|
+
import { FaSearch } from "react-icons/fa";
|
|
5
|
+
import { Input as HeroInput } from "@heroui/input";
|
|
6
|
+
import { slugify, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
var inputVariants = tv({
|
|
9
|
+
slots: {
|
|
10
|
+
/** wrapper around the whole input */
|
|
11
|
+
base: "",
|
|
12
|
+
/** clear button */
|
|
13
|
+
clearButton: "",
|
|
14
|
+
/** actual input element */
|
|
15
|
+
input: "",
|
|
16
|
+
/** inner wrapper (HeroUI inputWrapper slot) */
|
|
17
|
+
inputWrapper: "bg-content1 group-data-[focus=true]:border-focus"
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var SearchInput = ({
|
|
21
|
+
className: _className = void 0,
|
|
22
|
+
disabled = false,
|
|
23
|
+
endContent = void 0,
|
|
24
|
+
onChange,
|
|
25
|
+
placeholder = void 0,
|
|
26
|
+
size = void 0,
|
|
27
|
+
startContent = void 0,
|
|
28
|
+
testId = void 0,
|
|
29
|
+
initialValue = void 0
|
|
30
|
+
}) => {
|
|
31
|
+
const variants = inputVariants();
|
|
32
|
+
const classNames = variantsToClassNames(variants, _className, "base");
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
HeroInput,
|
|
35
|
+
{
|
|
36
|
+
isClearable: true,
|
|
37
|
+
"data-testid": testId ? slugify(testId) : void 0,
|
|
38
|
+
defaultValue: initialValue,
|
|
39
|
+
endContent,
|
|
40
|
+
isDisabled: disabled,
|
|
41
|
+
placeholder,
|
|
42
|
+
radius: "sm",
|
|
43
|
+
size,
|
|
44
|
+
startContent: startContent != null ? startContent : /* @__PURE__ */ jsx(FaSearch, { className: "opacity-50" }),
|
|
45
|
+
variant: "bordered",
|
|
46
|
+
classNames: {
|
|
47
|
+
base: classNames.base,
|
|
48
|
+
clearButton: classNames.clearButton,
|
|
49
|
+
input: classNames.input,
|
|
50
|
+
inputWrapper: classNames.inputWrapper
|
|
51
|
+
},
|
|
52
|
+
onChange: (e) => {
|
|
53
|
+
onChange(e.target.value);
|
|
54
|
+
},
|
|
55
|
+
onClear: () => {
|
|
56
|
+
onChange(null);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
var SearchInput_default = SearchInput;
|
|
62
|
+
|
|
63
|
+
// src/SearchInput/index.ts
|
|
64
|
+
var SearchInput_default2 = SearchInput_default;
|
|
65
|
+
export {
|
|
66
|
+
SearchInput_default as SearchInput,
|
|
67
|
+
SearchInput_default2 as default
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/SearchInput/SearchInput.tsx","../../src/SearchInput/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { FaSearch } from 'react-icons/fa';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\n// input variants\nexport const inputVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface SearchInputProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** optional initial value of the input */\n initialValue?: string;\n /** callback that is fired when the value is changed or cleared */\n onChange: (value: string | null) => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * SearchInput component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst SearchInput = ({\n className: _className = undefined,\n disabled = false,\n endContent = undefined,\n onChange,\n placeholder = undefined,\n size = undefined,\n startContent = undefined,\n testId = undefined,\n initialValue = undefined,\n}: SearchInputProps) => {\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n return (\n <HeroInput\n isClearable\n data-testid={testId ? slugify(testId) : undefined}\n defaultValue={initialValue}\n endContent={endContent}\n isDisabled={disabled}\n placeholder={placeholder}\n radius=\"sm\"\n size={size}\n startContent={startContent ?? <FaSearch className=\"opacity-50\" />}\n variant=\"bordered\"\n classNames={{\n base: classNames.base,\n clearButton: classNames.clearButton,\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n }}\n onChange={(e) => {\n onChange(e.target.value);\n }}\n onClear={() => {\n onChange(null);\n }}\n />\n );\n};\n\nexport default SearchInput;\n","import SearchInput from './SearchInput';\n\nexport type { SearchInputProps } from './SearchInput';\n\nexport { SearchInput };\n\nexport default SearchInput;\n"],"mappings":";;;AAGA,SAAS,gBAAgB;AAEzB,SAAS,SAAS,iBAAiB;AAEnC,SAAS,SAAS,IAAI,4BAA4B;AAoEd;AAjE7B,IAAM,gBAAgB,GAAG;AAAA,EAC9B,OAAO;AAAA;AAAA,IAEL,MAAM;AAAA;AAAA,IAEN,aAAa;AAAA;AAAA,IAEb,OAAO;AAAA;AAAA,IAEP,cAAc;AAAA,EAChB;AACF,CAAC;AA6BD,IAAM,cAAc,CAAC;AAAA,EACnB,WAAW,aAAa;AAAA,EACxB,WAAW;AAAA,EACX,aAAa;AAAA,EACb;AAAA,EACA,cAAc;AAAA,EACd,OAAO;AAAA,EACP,eAAe;AAAA,EACf,SAAS;AAAA,EACT,eAAe;AACjB,MAAwB;AAEtB,QAAM,WAAW,cAAc;AAC/B,QAAM,aAAa,qBAAqB,UAAU,YAAY,MAAM;AAEpE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAW;AAAA,MACX,eAAa,SAAS,QAAQ,MAAM,IAAI;AAAA,MACxC,cAAc;AAAA,MACd;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA,QAAO;AAAA,MACP;AAAA,MACA,cAAc,sCAAgB,oBAAC,YAAS,WAAU,cAAa;AAAA,MAC/D,SAAQ;AAAA,MACR,YAAY;AAAA,QACV,MAAM,WAAW;AAAA,QACjB,aAAa,WAAW;AAAA,QACxB,OAAO,WAAW;AAAA,QAClB,cAAc,WAAW;AAAA,MAC3B;AAAA,MACA,UAAU,CAAC,MAAM;AACf,iBAAS,EAAE,OAAO,KAAK;AAAA,MACzB;AAAA,MACA,SAAS,MAAM;AACb,iBAAS,IAAI;AAAA,MACf;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,sBAAQ;;;ACvFf,IAAOA,uBAAQ;","names":["SearchInput_default"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
__objRest,
|
|
2
3
|
__spreadProps,
|
|
3
4
|
__spreadValues
|
|
4
5
|
} from "./chunk-OAIRL2FN.js";
|
|
5
6
|
|
|
6
7
|
// src/Menu/Menu.tsx
|
|
7
|
-
import { FaEllipsisVertical } from "react-icons/fa6";
|
|
8
8
|
import { Button } from "@heroui/button";
|
|
9
9
|
import {
|
|
10
10
|
Dropdown as HeroDropdown,
|
|
@@ -14,25 +14,71 @@ import {
|
|
|
14
14
|
DropdownTrigger as HeroDropdownTrigger
|
|
15
15
|
} from "@heroui/dropdown";
|
|
16
16
|
import { cn, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// src/Menu/VerticalDotsIcon.tsx
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var VerticalDotsIcon = (_a) => {
|
|
21
|
+
var _b = _a, {
|
|
22
|
+
size = 24,
|
|
23
|
+
width,
|
|
24
|
+
height
|
|
25
|
+
} = _b, props = __objRest(_b, [
|
|
26
|
+
"size",
|
|
27
|
+
"width",
|
|
28
|
+
"height"
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
"svg",
|
|
32
|
+
__spreadProps(__spreadValues({
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
fill: "none",
|
|
35
|
+
focusable: "false",
|
|
36
|
+
height: size != null ? size : height,
|
|
37
|
+
role: "presentation",
|
|
38
|
+
viewBox: "0 0 24 24",
|
|
39
|
+
width: size != null ? size : width
|
|
40
|
+
}, props), {
|
|
41
|
+
children: /* @__PURE__ */ jsx(
|
|
42
|
+
"path",
|
|
43
|
+
{
|
|
44
|
+
d: "M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z",
|
|
45
|
+
fill: "currentColor"
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
var VerticalDotsIcon_default = VerticalDotsIcon;
|
|
52
|
+
|
|
53
|
+
// src/Menu/Menu.tsx
|
|
54
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
18
55
|
var menuVariants = tv({
|
|
19
56
|
slots: {
|
|
20
57
|
item: "",
|
|
21
58
|
trigger: ""
|
|
22
59
|
}
|
|
23
60
|
});
|
|
61
|
+
var isMenuSection = (item) => {
|
|
62
|
+
return "items" in item;
|
|
63
|
+
};
|
|
24
64
|
var getDisabledKeys = (items) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
65
|
+
const flatItems = items.reduce((acc, item) => {
|
|
66
|
+
if (isMenuSection(item)) {
|
|
67
|
+
acc.push(...item.items);
|
|
68
|
+
} else {
|
|
69
|
+
acc.push(item);
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
}, []);
|
|
73
|
+
return flatItems.filter((item) => {
|
|
74
|
+
return item.disabled === true;
|
|
29
75
|
}).map((item) => {
|
|
30
76
|
return item.key;
|
|
31
77
|
});
|
|
32
78
|
};
|
|
33
79
|
var renderMenuItem = (item, itemClassName) => {
|
|
34
80
|
var _a;
|
|
35
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ jsx2(
|
|
36
82
|
HeroDropdownItem,
|
|
37
83
|
{
|
|
38
84
|
className: cn(itemClassName, item.className),
|
|
@@ -58,20 +104,22 @@ var Menu = ({
|
|
|
58
104
|
}) => {
|
|
59
105
|
const variants = menuVariants();
|
|
60
106
|
const className = variantsToClassNames(variants, _className, "trigger");
|
|
61
|
-
let triggerButton = /* @__PURE__ */
|
|
107
|
+
let triggerButton = /* @__PURE__ */ jsx2("button", { className: className.trigger, type: "button", children });
|
|
62
108
|
if (!children) {
|
|
63
|
-
triggerButton = /* @__PURE__ */
|
|
109
|
+
triggerButton = /* @__PURE__ */ jsx2(
|
|
64
110
|
Button,
|
|
65
111
|
__spreadProps(__spreadValues({
|
|
66
|
-
|
|
112
|
+
isIconOnly: true,
|
|
113
|
+
className: cn("outline-divider min-w-0 outline", className.trigger),
|
|
114
|
+
radius: "full",
|
|
67
115
|
size: "sm",
|
|
68
|
-
variant: "
|
|
116
|
+
variant: "light"
|
|
69
117
|
}, triggerButtonProps), {
|
|
70
|
-
children: /* @__PURE__ */
|
|
118
|
+
children: /* @__PURE__ */ jsx2(VerticalDotsIcon_default, {})
|
|
71
119
|
})
|
|
72
120
|
);
|
|
73
121
|
} else if (triggerButtonProps) {
|
|
74
|
-
triggerButton = /* @__PURE__ */
|
|
122
|
+
triggerButton = /* @__PURE__ */ jsx2(Button, __spreadProps(__spreadValues({ className: className.trigger }, triggerButtonProps), { children }));
|
|
75
123
|
}
|
|
76
124
|
return /* @__PURE__ */ jsxs(
|
|
77
125
|
HeroDropdown,
|
|
@@ -80,8 +128,8 @@ var Menu = ({
|
|
|
80
128
|
isDisabled,
|
|
81
129
|
placement,
|
|
82
130
|
children: [
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
/* @__PURE__ */
|
|
131
|
+
/* @__PURE__ */ jsx2(HeroDropdownTrigger, { "data-testid": testId, children: triggerButton }),
|
|
132
|
+
/* @__PURE__ */ jsx2(
|
|
85
133
|
HeroDropdownMenu,
|
|
86
134
|
{
|
|
87
135
|
disabledKeys: getDisabledKeys(items),
|
|
@@ -89,7 +137,7 @@ var Menu = ({
|
|
|
89
137
|
onAction,
|
|
90
138
|
children: (item) => {
|
|
91
139
|
if ("items" in item) {
|
|
92
|
-
return /* @__PURE__ */
|
|
140
|
+
return /* @__PURE__ */ jsx2(
|
|
93
141
|
HeroDropdownSection,
|
|
94
142
|
{
|
|
95
143
|
items: item.items,
|
|
@@ -118,4 +166,4 @@ export {
|
|
|
118
166
|
Menu_default,
|
|
119
167
|
Menu_default2
|
|
120
168
|
};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
169
|
+
//# sourceMappingURL=chunk-3VAWRUPR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Menu/Menu.tsx","../src/Menu/VerticalDotsIcon.tsx","../src/Menu/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ButtonProps } from '@heroui/button';\nimport type {\n DropdownItemProps as HeroDropdownItemProps,\n DropdownProps as HeroDropdownProps,\n DropdownSectionProps as HeroDropdownSectionProps,\n} from '@heroui/dropdown';\nimport type { Key, ReactNode } from 'react';\n\nimport { Button } from '@heroui/button';\nimport {\n Dropdown as HeroDropdown,\n DropdownItem as HeroDropdownItem,\n DropdownMenu as HeroDropdownMenu,\n DropdownSection as HeroDropdownSection,\n DropdownTrigger as HeroDropdownTrigger,\n} from '@heroui/dropdown';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport VerticalDotsIcon from './VerticalDotsIcon';\n\n/**\n * Menu component based on [HeroUI Dropdown](https://www.heroui.com//docs/components/dropdown)\n */\nexport interface MenuItem {\n /** unique identifier */\n key: string;\n /** CSS class name */\n className?: string;\n /** additional description shown under the label */\n description?: string;\n /** disables the menu item */\n disabled?: boolean;\n /** menu item icon */\n icon?: ReactNode;\n /** menu item name */\n label: ReactNode;\n /** click event handler */\n onClick?: HeroDropdownItemProps['onPress'];\n /** e2e test identifier */\n testId?: string;\n}\n\n/**\n * Menu section type\n */\nexport interface MenuSection {\n /** unique identifier */\n key: string;\n /** section label */\n label: ReactNode;\n /** section items (array of MenuItem) */\n items: MenuItem[];\n}\n\n// menu styling variants\nexport const menuVariants = tv({\n slots: {\n item: '',\n trigger: '',\n },\n});\n\ntype VariantProps = TVProps<typeof menuVariants>;\ntype ClassName = TVClassName<typeof menuVariants>;\n\nexport interface MenuProps extends VariantProps {\n /** sets HTML aria-label attribute */\n ariaLabel?: string;\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** menu item structure */\n items: (MenuSection | MenuItem)[];\n /** disable menu trigger */\n isDisabled?: boolean;\n /** placement of the menu */\n placement?: HeroDropdownProps['placement'];\n /** called if item is selected */\n onAction?: (key: Key) => void;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** When defined a Button will be rendered as trigger (with provided props) instead of unstyled html button */\n triggerButtonProps?: Pick<\n ButtonProps,\n | 'aria-label'\n | 'className'\n | 'color'\n | 'disableAnimation'\n | 'disableRipple'\n | 'disabled'\n | 'size'\n | 'variant'\n >;\n}\n\n// type guard for MenuSection\nconst isMenuSection = (item: MenuSection | MenuItem): item is MenuSection => {\n return 'items' in item;\n};\n\n// returns String[] of disabled items/keys\nconst getDisabledKeys = (items: (MenuSection | MenuItem)[]): string[] => {\n const flatItems = items.reduce<MenuItem[]>((acc, item) => {\n if (isMenuSection(item)) {\n acc.push(...item.items);\n } else {\n acc.push(item);\n }\n return acc;\n }, []);\n return flatItems\n .filter((item) => {\n return item.disabled === true;\n })\n .map((item) => {\n return item.key;\n });\n};\n\nconst renderMenuItem = (item: MenuItem, itemClassName?: string) => {\n return (\n <HeroDropdownItem\n key={item.key}\n className={cn(itemClassName, item.className)}\n data-testid={item.testId ?? item.key}\n description={item.description}\n onPress={item.onClick}\n startContent={item.icon}\n >\n {item.label}\n </HeroDropdownItem>\n );\n};\n\n/**\n * Dropdown menu component based on [HeroUI Dropdown](https://www.heroui.com//docs/components/dropdown)\n */\nconst Menu = ({\n ariaLabel = undefined,\n children = null,\n className: _className = undefined,\n isDisabled = false,\n items,\n onAction = undefined,\n placement = undefined,\n testId = undefined,\n triggerButtonProps = undefined,\n}: MenuProps) => {\n // className from slots\n const variants = menuVariants();\n const className = variantsToClassNames(variants, _className, 'trigger');\n\n // determine trigger button variant\n let triggerButton = (\n <button className={className.trigger} type=\"button\">\n {children}\n </button>\n );\n if (!children) {\n // default to ellipsis icon when no children are provided\n triggerButton = (\n <Button\n isIconOnly\n className={cn('outline-divider min-w-0 outline', className.trigger)}\n radius=\"full\"\n size=\"sm\"\n variant=\"light\"\n {...triggerButtonProps}\n >\n <VerticalDotsIcon />\n </Button>\n );\n } else if (triggerButtonProps) {\n // use provided triggerButtonProps with hero button\n triggerButton = (\n <Button className={className.trigger} {...triggerButtonProps}>\n {children}\n </Button>\n );\n }\n\n return (\n <HeroDropdown\n aria-label={ariaLabel}\n isDisabled={isDisabled}\n placement={placement}\n >\n <HeroDropdownTrigger data-testid={testId}>\n {/* NOTE: type and aria properties are injected by HeroDropdownTrigger */}\n {triggerButton}\n </HeroDropdownTrigger>\n <HeroDropdownMenu\n disabledKeys={getDisabledKeys(items)}\n items={items}\n onAction={onAction}\n >\n {(item) => {\n if ('items' in item) {\n return (\n <HeroDropdownSection\n key={item.key}\n items={item.items}\n title={item.label as HeroDropdownSectionProps['title']}\n >\n {(sectionItem) => {\n return renderMenuItem(sectionItem, className.item);\n }}\n </HeroDropdownSection>\n );\n }\n return renderMenuItem(item, className.item);\n }}\n </HeroDropdownMenu>\n </HeroDropdown>\n );\n};\n\nexport default Menu;\n","import type { SVGProps } from 'react';\n\n// Default Icon for Menu button\nconst VerticalDotsIcon = ({\n size = 24,\n width,\n height,\n ...props\n}: SVGProps<SVGSVGElement> & { size?: number }) => {\n return (\n <svg\n aria-hidden=\"true\"\n fill=\"none\"\n focusable=\"false\"\n height={size ?? height}\n role=\"presentation\"\n viewBox=\"0 0 24 24\"\n width={size ?? width}\n {...props}\n >\n <path\n d=\"M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 12c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z\"\n fill=\"currentColor\"\n />\n </svg>\n );\n};\n\nexport default VerticalDotsIcon;\n","import Menu from './Menu';\n\nexport type { MenuProps, MenuItem, MenuSection } from './Menu';\n\nexport { Menu };\n\nexport default Menu;\n"],"mappings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EC,WAAC,SAAS;AACT,kBAAI,WAAW,MAAM;AACnB,uBACE,gBAAAA;AAAA,kBAAC;AAAA;AAAA,oBAEC,OAAO,KAAK;AAAA,oBACZ,OAAO,KAAK;AAAA,oBAEX,WAAC,gBAAgB;AAChB,6BAAO,eAAe,aAAa,UAAU,IAAI;AAAA,oBACnD;AAAA;AAAA,kBANK,KAAK;AAAA,gBAOZ;AAAA,cAEJ;AACA,qBAAO,eAAe,MAAM,UAAU,IAAI;AAAA,YAC5C;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,eAAQ;;;AEtNf,IAAOC,gBAAQ;","names":["jsx","Menu_default"]}
|
|
@@ -80,4 +80,4 @@ var useLocalStorage = (key, initialValue) => {
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
exports.useDebounce = useDebounce; exports.useIsInitialRenderCycle = useIsInitialRenderCycle; exports.useLocalStorage = useLocalStorage;
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-7ZIK4LWC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-7ZIK4LWC.cjs","../src/hooks/useDebounce.ts","../src/hooks/useIsInitialRenderCycle.ts","../src/hooks/useLocalStorage.ts"],"names":["useEffect","useState"],"mappings":"AAAA;ACEA,8BAAoC;AAE7B,IAAM,YAAA,EAAc,CAAQ,KAAA,EAAc,KAAA,EAAA,GAAkB;AAEjE,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,EAAA,EAAI,6BAAA,KAAc,CAAA;AAC1D,EAAA,8BAAA;AAAA,IACE,CAAA,EAAA,GAAM;AAEJ,MAAA,MAAM,QAAA,EAAU,UAAA,CAAW,CAAA,EAAA,GAAM;AAC/B,QAAA,iBAAA,CAAkB,KAAK,CAAA;AAAA,MACzB,CAAA,EAAG,KAAK,CAAA;AAIR,MAAA,OAAO,CAAA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AEF,CAAA,EAAG,CAAC,CAAC,CAAA;AAEL,EAAA,OAAO,CAAC,WAAA,EAAa,QAAQ,CAAA;AAC/B,CAAA;AHNA;AACA;AACE;AACA;AACA;AACF,wIAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-7ZIK4LWC.cjs","sourcesContent":[null,"/* eslint-disable import-x/prefer-default-export */\n\nimport { useEffect, useState } from 'react';\n\nexport const useDebounce = <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","/* eslint-disable import/prefer-default-export */\n\nimport { useEffect, useRef } from 'react';\n\n/**\n * A hook that returns true on initial render and false afterward.\n *\n * @returns {boolean} - True on initial render, false afterward\n */\nexport const useIsInitialRenderCycle = (): boolean => {\n // Use ref to avoid re-renders\n const isInitialRender = useRef(true);\n\n // Update ref after first render\n useEffect(() => {\n // Set to false after component mounts\n isInitialRender.current = false;\n\n // No cleanup needed for this effect\n }, []);\n\n return isInitialRender.current;\n};\n","/* eslint-disable import/prefer-default-export */\n\nimport type { Dispatch, SetStateAction } from 'react';\n\nimport { useEffect, useState } from 'react';\n\nexport const 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"]}
|