@a-type/ui 2.0.10 → 2.1.0
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/cjs/colors.stories.d.ts +20 -1
- package/dist/cjs/colors.stories.js +30 -5
- package/dist/cjs/colors.stories.js.map +1 -1
- package/dist/cjs/components/emojiPicker/EmojiPicker.d.ts +28 -0
- package/dist/cjs/components/emojiPicker/EmojiPicker.js +79 -0
- package/dist/cjs/components/emojiPicker/EmojiPicker.js.map +1 -0
- package/dist/cjs/components/emojiPicker/EmojiPicker.stories.d.ts +25 -0
- package/dist/cjs/components/emojiPicker/EmojiPicker.stories.js +21 -0
- package/dist/cjs/components/emojiPicker/EmojiPicker.stories.js.map +1 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/relativeTime/RelativeTime.d.ts +10 -1
- package/dist/cjs/components/relativeTime/RelativeTime.js +17 -9
- package/dist/cjs/components/relativeTime/RelativeTime.js.map +1 -1
- package/dist/cjs/components/relativeTime/RelativeTime.stories.d.ts +19 -0
- package/dist/cjs/components/relativeTime/RelativeTime.stories.js +20 -0
- package/dist/cjs/components/relativeTime/RelativeTime.stories.js.map +1 -0
- package/dist/cjs/hooks/useStorage.d.ts +2 -0
- package/dist/cjs/hooks/useStorage.js +80 -0
- package/dist/cjs/hooks/useStorage.js.map +1 -0
- package/dist/cjs/hooks/withProps.d.ts +5 -0
- package/dist/cjs/hooks/withProps.js +7 -1
- package/dist/cjs/hooks/withProps.js.map +1 -1
- package/dist/cjs/uno/colors.js +1 -1
- package/dist/css/main.css +34 -34
- package/dist/esm/colors.stories.d.ts +20 -1
- package/dist/esm/colors.stories.js +30 -5
- package/dist/esm/colors.stories.js.map +1 -1
- package/dist/esm/components/emojiPicker/EmojiPicker.d.ts +28 -0
- package/dist/esm/components/emojiPicker/EmojiPicker.js +68 -0
- package/dist/esm/components/emojiPicker/EmojiPicker.js.map +1 -0
- package/dist/esm/components/emojiPicker/EmojiPicker.stories.d.ts +25 -0
- package/dist/esm/components/emojiPicker/EmojiPicker.stories.js +18 -0
- package/dist/esm/components/emojiPicker/EmojiPicker.stories.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/relativeTime/RelativeTime.d.ts +10 -1
- package/dist/esm/components/relativeTime/RelativeTime.js +17 -9
- package/dist/esm/components/relativeTime/RelativeTime.js.map +1 -1
- package/dist/esm/components/relativeTime/RelativeTime.stories.d.ts +19 -0
- package/dist/esm/components/relativeTime/RelativeTime.stories.js +17 -0
- package/dist/esm/components/relativeTime/RelativeTime.stories.js.map +1 -0
- package/dist/esm/hooks/useStorage.d.ts +2 -0
- package/dist/esm/hooks/useStorage.js +77 -0
- package/dist/esm/hooks/useStorage.js.map +1 -0
- package/dist/esm/hooks/withProps.d.ts +5 -0
- package/dist/esm/hooks/withProps.js +5 -0
- package/dist/esm/hooks/withProps.js.map +1 -1
- package/dist/esm/uno/colors.js +1 -1
- package/package.json +4 -2
- package/src/colors.stories.tsx +30 -4
- package/src/components/emojiPicker/EmojiPicker.stories.tsx +21 -0
- package/src/components/emojiPicker/EmojiPicker.tsx +170 -0
- package/src/components/index.ts +1 -0
- package/src/components/relativeTime/RelativeTime.stories.tsx +21 -0
- package/src/components/relativeTime/RelativeTime.tsx +32 -9
- package/src/hooks/useStorage.ts +107 -0
- package/src/hooks/withProps.tsx +12 -0
- package/src/uno/colors.ts +1 -1
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
argTypes: {
|
|
4
|
+
argTypes: {
|
|
5
|
+
customHue: {
|
|
6
|
+
control: {
|
|
7
|
+
type: "range";
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
customRotate: {
|
|
13
|
+
control: {
|
|
14
|
+
type: "range";
|
|
15
|
+
min: number;
|
|
16
|
+
max: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
args: {
|
|
21
|
+
customHue: number;
|
|
22
|
+
customRotate: number;
|
|
23
|
+
};
|
|
5
24
|
parameters: {
|
|
6
25
|
controls: {
|
|
7
26
|
expanded: boolean;
|
|
@@ -6,15 +6,40 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
const index_js_1 = require("./components/index.js");
|
|
7
7
|
const meta = {
|
|
8
8
|
title: 'colors',
|
|
9
|
-
argTypes: {
|
|
9
|
+
argTypes: {
|
|
10
|
+
customHue: {
|
|
11
|
+
control: {
|
|
12
|
+
type: 'range',
|
|
13
|
+
min: 0,
|
|
14
|
+
max: 360,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
customRotate: {
|
|
18
|
+
control: {
|
|
19
|
+
type: 'range',
|
|
20
|
+
min: -180,
|
|
21
|
+
max: 180,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
customHue: 0,
|
|
27
|
+
customRotate: 0,
|
|
28
|
+
},
|
|
10
29
|
parameters: {
|
|
11
30
|
controls: { expanded: true },
|
|
12
31
|
},
|
|
13
32
|
};
|
|
14
33
|
exports.default = meta;
|
|
15
34
|
exports.Default = {
|
|
16
|
-
render() {
|
|
17
|
-
|
|
35
|
+
render(args) {
|
|
36
|
+
const style = args.customHue
|
|
37
|
+
? {
|
|
38
|
+
'--dyn-primary-source': args.customHue,
|
|
39
|
+
'--dyn-primary-hue-rotate': args.customRotate,
|
|
40
|
+
}
|
|
41
|
+
: {};
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(index_js_1.Box, { d: "col", children: [(0, jsx_runtime_1.jsx)(Range, { className: "theme-lemon" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme-leek" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme-tomato" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme-eggplant" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme-blueberry" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme-salt" }), (0, jsx_runtime_1.jsx)(Range, { className: "theme", style: style })] }));
|
|
18
43
|
},
|
|
19
44
|
};
|
|
20
45
|
function Swatch({ className }) {
|
|
@@ -23,7 +48,7 @@ function Swatch({ className }) {
|
|
|
23
48
|
height: '100px',
|
|
24
49
|
} }));
|
|
25
50
|
}
|
|
26
|
-
function Range({ className }) {
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)(index_js_1.Box, { className: className, children: [(0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-wash" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-light" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-dark" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-ink" })] }));
|
|
51
|
+
function Range({ className, style }) {
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(index_js_1.Box, { className: className, style: style, children: [(0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-wash" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-light" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-dark" }), (0, jsx_runtime_1.jsx)(Swatch, { className: "bg-primary-ink" })] }));
|
|
28
53
|
}
|
|
29
54
|
//# sourceMappingURL=colors.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.stories.js","sourceRoot":"","sources":["../../src/colors.stories.tsx"],"names":[],"mappings":";;;;AACA,oDAA4C;AAE5C,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,QAAQ;IACf,QAAQ,EA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AE,KAAK,GAAI,IACpC,CACN,CAAC;IACH,CAAC;CACD,CAAC;AAEF,SAAS,MAAM,CAAC,EAAE,SAAS,EAA0B;IACpD,OAAO,CACN,gCACC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE;YACN,KAAK,EAAE,OAAO;YACd,MAAM,EAAE,OAAO;SACf,GACA,CACF,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,KAAK,EAAuC;IACvE,OAAO,CACN,wBAAC,cAAG,IAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,aACtC,uBAAC,MAAM,IAAC,SAAS,EAAC,iBAAiB,GAAG,EACtC,uBAAC,MAAM,IAAC,SAAS,EAAC,kBAAkB,GAAG,EACvC,uBAAC,MAAM,IAAC,SAAS,EAAC,YAAY,GAAG,EACjC,uBAAC,MAAM,IAAC,SAAS,EAAC,iBAAiB,GAAG,EACtC,uBAAC,MAAM,IAAC,SAAS,EAAC,gBAAgB,GAAG,IAChC,CACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EmojiPickerListCategoryHeaderProps, EmojiPickerListEmojiProps, EmojiPickerListProps, EmojiPickerRootProps, EmojiPickerViewportProps, useSkinTone } from 'frimousse';
|
|
2
|
+
import { BoxProps } from '../box/Box.js';
|
|
3
|
+
export declare const EmojiPickerRoot: import("react").FunctionComponent<Omit<EmojiPickerRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const EmojiPickerSearch: import("react").FunctionComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export declare const EmojiPickerViewport: ({ className, ...props }: EmojiPickerViewportProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
6
|
+
export declare const EmojiPickerLoading: import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
|
|
7
|
+
export declare const EmojiPickerEmpty: import("react").FunctionComponent<import("frimousse").EmojiPickerEmptyProps>;
|
|
8
|
+
export declare const EmojiPickerCategoryHeader: (props: EmojiPickerListCategoryHeaderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
9
|
+
export declare const EmojiPickerRow: import("react").FunctionComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
10
|
+
export declare const EmojiPickerEmoji: import("react").FunctionComponent<EmojiPickerListEmojiProps>;
|
|
11
|
+
export declare const EmojiPickerList: ({ className, components, }: EmojiPickerListProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
12
|
+
export declare const useEmojiSkinTone: () => readonly [import("frimousse").SkinTone | undefined, (value: import("frimousse").SkinTone | ((current: import("frimousse").SkinTone | undefined) => import("frimousse").SkinTone | undefined) | undefined) => void];
|
|
13
|
+
export type SkinTone = ReturnType<typeof useSkinTone>[0];
|
|
14
|
+
export declare const EmojiPickerSkinToneSelector: (props: BoxProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
15
|
+
export interface EmojiPickerProps extends Omit<EmojiPickerRootProps, 'emoji' | 'onEmojiSelect'> {
|
|
16
|
+
onValueChange: (value: string, label: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const EmojiPicker: (({ onValueChange, ...props }: EmojiPickerProps) => import("react/jsx-runtime.js").JSX.Element) & {
|
|
19
|
+
Root: import("react").FunctionComponent<Omit<EmojiPickerRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
Search: import("react").FunctionComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
|
+
Viewport: ({ className, ...props }: EmojiPickerViewportProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
22
|
+
List: ({ className, components, }: EmojiPickerListProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
23
|
+
Loading: import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
|
|
24
|
+
Empty: import("react").FunctionComponent<import("frimousse").EmojiPickerEmptyProps>;
|
|
25
|
+
CategoryHeader: (props: EmojiPickerListCategoryHeaderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
26
|
+
Row: import("react").FunctionComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
27
|
+
Emoji: import("react").FunctionComponent<EmojiPickerListEmojiProps>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
"use strict";
|
|
3
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10
|
+
t[p[i]] = s[p[i]];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.EmojiPicker = exports.EmojiPickerSkinToneSelector = exports.useEmojiSkinTone = exports.EmojiPickerList = exports.EmojiPickerEmoji = exports.EmojiPickerRow = exports.EmojiPickerCategoryHeader = exports.EmojiPickerEmpty = exports.EmojiPickerLoading = exports.EmojiPickerViewport = exports.EmojiPickerSearch = exports.EmojiPickerRoot = void 0;
|
|
19
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
20
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
21
|
+
const frimousse_1 = require("frimousse");
|
|
22
|
+
const hooks_js_1 = require("../../hooks.js");
|
|
23
|
+
const useStorage_js_1 = require("../../hooks/useStorage.js");
|
|
24
|
+
const Box_js_1 = require("../box/Box.js");
|
|
25
|
+
const Button_js_1 = require("../button/Button.js");
|
|
26
|
+
const Input_js_1 = require("../input/Input.js");
|
|
27
|
+
const Spinner_js_1 = require("../spinner/Spinner.js");
|
|
28
|
+
exports.EmojiPickerRoot = (0, hooks_js_1.withClassName)(frimousse_1.EmojiPicker.Root, 'layer-components:isolate layer-components:flex layer-components:flex-col layer-components:w-fit layer-components:h-368px layer-components:bg-white layer-components:gap-sm');
|
|
29
|
+
exports.EmojiPickerSearch = (0, hooks_js_1.withClassName)(frimousse_1.EmojiPicker.Search, 'layer-components:z-10', Input_js_1.inputClassName);
|
|
30
|
+
const EmojiPickerViewport = (_a) => {
|
|
31
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(Box_js_1.Box, { border: true, className: "flex-1 min-h-0 overflow-hidden", children: (0, jsx_runtime_1.jsx)(frimousse_1.EmojiPicker.Viewport, Object.assign({ className: "layer-components:relative layer-components:outline-hidden" }, props)) }));
|
|
33
|
+
};
|
|
34
|
+
exports.EmojiPickerViewport = EmojiPickerViewport;
|
|
35
|
+
exports.EmojiPickerLoading = (0, hooks_js_1.withClassName)((0, hooks_js_1.withProps)(frimousse_1.EmojiPicker.Loading, {
|
|
36
|
+
children: (0, jsx_runtime_1.jsx)(Spinner_js_1.Spinner, {}),
|
|
37
|
+
}), 'layer-compoennts:absolute layer-compoennts:inset-0 layer-compoennts:flex layer-compoennts:items-center layer-compoennts:justify-center layer-compoennts:bg-inherit');
|
|
38
|
+
exports.EmojiPickerEmpty = (0, hooks_js_1.withClassName)((0, hooks_js_1.withProps)(frimousse_1.EmojiPicker.Empty, {
|
|
39
|
+
children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "No emoji found" }),
|
|
40
|
+
}), 'layer-components:absolute layer-components:inset-0 layer-components:flex layer-components:items-center layer-components:justify-center layer-components:bg-inherit layer-components:color-gray-dark layer-components:text-xs');
|
|
41
|
+
const EmojiPickerCategoryHeader = (props) => ((0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('layer-components:bg-inherit layer-components:px-md layer-components:py-sm layer-components:text-xs layer-components:font-semibold layer-components:text-gray-dark layer-components:sticky layer-components:top-0', props.className), children: props.category.label }));
|
|
42
|
+
exports.EmojiPickerCategoryHeader = EmojiPickerCategoryHeader;
|
|
43
|
+
exports.EmojiPickerRow = (0, hooks_js_1.withClassName)('div', 'layer-components:scroll-my-xs layer-components:px-xs');
|
|
44
|
+
exports.EmojiPickerEmoji = (0, hooks_js_1.withClassName)((p) => ((0, jsx_runtime_1.jsx)(Button_js_1.Button, Object.assign({}, p, { color: "ghost", toggled: p.emoji.isActive, toggleMode: "color", size: "icon-small", "aria-label": p.emoji.label, className: "text-lg p-xs", children: p.emoji.emoji }))), '');
|
|
45
|
+
const defaultListComponents = {
|
|
46
|
+
CategoryHeader: exports.EmojiPickerCategoryHeader,
|
|
47
|
+
Row: exports.EmojiPickerRow,
|
|
48
|
+
Emoji: exports.EmojiPickerEmoji,
|
|
49
|
+
};
|
|
50
|
+
const EmojiPickerList = ({ className, components, }) => {
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)(frimousse_1.EmojiPicker.List, { className: (0, clsx_1.default)('layer-components:select-none layer-components:pb-md', className), components: components
|
|
52
|
+
? Object.assign(Object.assign({}, defaultListComponents), components) : defaultListComponents }));
|
|
53
|
+
};
|
|
54
|
+
exports.EmojiPickerList = EmojiPickerList;
|
|
55
|
+
const useEmojiSkinTone = () => (0, useStorage_js_1.useLocalStorage)('emoji-skin-tone', undefined, false);
|
|
56
|
+
exports.useEmojiSkinTone = useEmojiSkinTone;
|
|
57
|
+
const EmojiPickerSkinToneSelector = (props) => {
|
|
58
|
+
const [_, __, options] = (0, frimousse_1.useSkinTone)();
|
|
59
|
+
const [skinTone, setSkinTone] = (0, exports.useEmojiSkinTone)();
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(Box_js_1.Box, Object.assign({ d: "row", gap: true, border: true }, props, { children: options.map((option) => ((0, jsx_runtime_1.jsx)(Button_js_1.Button, { color: "ghost", toggled: option.skinTone === skinTone, toggleMode: "color", size: "icon-small", "aria-label": `Skin tone ${option}`, className: "text-md p-xs", onClick: () => setSkinTone(option.skinTone), children: option.emoji }, option.skinTone))) })));
|
|
61
|
+
};
|
|
62
|
+
exports.EmojiPickerSkinToneSelector = EmojiPickerSkinToneSelector;
|
|
63
|
+
const EmojiPickerPrefab = (_a) => {
|
|
64
|
+
var { onValueChange } = _a, props = __rest(_a, ["onValueChange"]);
|
|
65
|
+
const [skinTone] = (0, exports.useEmojiSkinTone)();
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(exports.EmojiPickerRoot, Object.assign({}, props, { onEmojiSelect: (emoji) => onValueChange(emoji.emoji, emoji.label), skinTone: skinTone, children: [(0, jsx_runtime_1.jsx)(exports.EmojiPickerSearch, {}), (0, jsx_runtime_1.jsxs)(exports.EmojiPickerViewport, { children: [(0, jsx_runtime_1.jsx)(exports.EmojiPickerList, {}), (0, jsx_runtime_1.jsx)(exports.EmojiPickerLoading, {}), (0, jsx_runtime_1.jsx)(exports.EmojiPickerEmpty, {})] }), (0, jsx_runtime_1.jsx)(exports.EmojiPickerSkinToneSelector, { className: "mr-auto" })] })));
|
|
67
|
+
};
|
|
68
|
+
exports.EmojiPicker = Object.assign(EmojiPickerPrefab, {
|
|
69
|
+
Root: exports.EmojiPickerRoot,
|
|
70
|
+
Search: exports.EmojiPickerSearch,
|
|
71
|
+
Viewport: exports.EmojiPickerViewport,
|
|
72
|
+
List: exports.EmojiPickerList,
|
|
73
|
+
Loading: exports.EmojiPickerLoading,
|
|
74
|
+
Empty: exports.EmojiPickerEmpty,
|
|
75
|
+
CategoryHeader: exports.EmojiPickerCategoryHeader,
|
|
76
|
+
Row: exports.EmojiPickerRow,
|
|
77
|
+
Emoji: exports.EmojiPickerEmoji,
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=EmojiPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPicker.js","sourceRoot":"","sources":["../../../../src/components/emojiPicker/EmojiPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,yCAQmB;AACnB,6CAA0D;AAC1D,6DAA4D;AAC5D,0CAA8C;AAC9C,mDAA6C;AAC7C,gDAAmD;AACnD,sDAAgD;AAEnC,QAAA,eAAe,GAAG,IAAA,wBAAa,EAC3C,uBAAI,CAAC,IAAI,EACT,wEAAwE,CACxE,CAAC;AACW,QAAA,iBAAiB,GAAG,IAAA,wBAAa,EAC7C,uBAAI,CAAC,MAAM,EACX,yBAAyB,EACzB,yBAAc,CACd,CAAC;AACK,MAAM,mBAAmB,GAAG,CAAC,EAGT,EAAE,EAAE;QAHK,EACnC,SAAS,OAEiB,EADvB,KAAK,cAF2B,aAGnC,CADQ;IACuB,OAAA,CAC/B,uBAAC,YAAG,IAAC,MAAM,QAAC,SAAS,EAAC,gCAAgC,YACrD,uBAAC,uBAAI,CAAC,QAAQ,kBACb,SAAS,EAAC,4CAA4C,IAClD,KAAK,EACR,GACG,CACN,CAAA;CAAA,CAAC;AAVW,QAAA,mBAAmB,uBAU9B;AACW,QAAA,kBAAkB,GAAG,IAAA,wBAAa,EAC9C,IAAA,oBAAS,EAAC,uBAAI,CAAC,OAAO,EAAE;IACvB,QAAQ,EAAE,uBAAC,oBAAO,KAAG;CACrB,CAAC,EACF,iFAAiF,CACjF,CAAC;AACW,QAAA,gBAAgB,GAAG,IAAA,wBAAa,EAC5C,IAAA,oBAAS,EAAC,uBAAI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,EACrB,wBAAC,2BAAmB,eACnB,uBAAC,uBAAe,KAAG,EACnB,uBAAC,0BAAkB,KAAG,EACtB,uBAAC,wBAAgB,KAAG,IACC,EACtB,uBAAC,mCAA2B,IAAC,SAAS,EAAC,SAAS,GAAG,KAClC,CAClB,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAC3D,IAAI,EAAE,uBAAe;IACrB,MAAM,EAAE,yBAAiB;IACzB,QAAQ,EAAE,2BAAmB;IAC7B,IAAI,EAAE,uBAAe;IACrB,OAAO,EAAE,0BAAkB;IAC3B,KAAK,EAAE,wBAAgB;IACvB,cAAc,EAAE,iCAAyB;IACzC,GAAG,EAAE,sBAAc;IACnB,KAAK,EAAE,wBAAgB;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { EmojiPicker } from './EmojiPicker.js';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: (({ onValueChange, ...props }: import("./EmojiPicker.js").EmojiPickerProps) => import("react/jsx-runtime.js").JSX.Element) & {
|
|
6
|
+
Root: import("react").FunctionComponent<Omit<import("frimousse").EmojiPickerRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
Search: import("react").FunctionComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
|
+
Viewport: ({ className, ...props }: import("frimousse").EmojiPickerViewportProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
9
|
+
List: ({ className, components, }: import("frimousse").EmojiPickerListProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
10
|
+
Loading: import("react").FunctionComponent<import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement>>;
|
|
11
|
+
Empty: import("react").FunctionComponent<import("frimousse").EmojiPickerEmptyProps>;
|
|
12
|
+
CategoryHeader: (props: import("frimousse").EmojiPickerListCategoryHeaderProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
13
|
+
Row: import("react").FunctionComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
14
|
+
Emoji: import("react").FunctionComponent<import("frimousse").EmojiPickerListEmojiProps>;
|
|
15
|
+
};
|
|
16
|
+
argTypes: {};
|
|
17
|
+
parameters: {
|
|
18
|
+
controls: {
|
|
19
|
+
expanded: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
type Story = StoryObj<typeof EmojiPicker>;
|
|
25
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Default = void 0;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const EmojiPicker_js_1 = require("./EmojiPicker.js");
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'EmojiPicker',
|
|
9
|
+
component: EmojiPicker_js_1.EmojiPicker,
|
|
10
|
+
argTypes: {},
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: { expanded: true },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
exports.default = meta;
|
|
16
|
+
exports.Default = {
|
|
17
|
+
render(args) {
|
|
18
|
+
return (0, jsx_runtime_1.jsx)(EmojiPicker_js_1.EmojiPicker, Object.assign({}, args));
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=EmojiPicker.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmojiPicker.stories.js","sourceRoot":"","sources":["../../../../src/components/emojiPicker/EmojiPicker.stories.tsx"],"names":[],"mappings":";;;;AACA,qDAA+C;AAE/C,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,4BAAW;IACtB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CACkC,CAAC;AAErC,kBAAe,IAAI,CAAC;AAIP,QAAA,OAAO,GAAU;IAC7B,MAAM,CAAC,IAAI;QACV,OAAO,uBAAC,4BAAW,oBAAK,IAAI,EAAI,CAAC;IAClC,CAAC;CACD,CAAC"}
|
|
@@ -15,6 +15,7 @@ export * from './dialog/index.js';
|
|
|
15
15
|
export * from './divider/index.js';
|
|
16
16
|
export * from './dropdownMenu/index.js';
|
|
17
17
|
export * from './editableText/EditableText.js';
|
|
18
|
+
export * from './emojiPicker/EmojiPicker.js';
|
|
18
19
|
export * from './errorBoundary/index.js';
|
|
19
20
|
export * from './forms/index.js';
|
|
20
21
|
export * from './horizontalList/HorizontalList.js';
|
|
@@ -35,6 +35,7 @@ __exportStar(require("./dialog/index.js"), exports);
|
|
|
35
35
|
__exportStar(require("./divider/index.js"), exports);
|
|
36
36
|
__exportStar(require("./dropdownMenu/index.js"), exports);
|
|
37
37
|
__exportStar(require("./editableText/EditableText.js"), exports);
|
|
38
|
+
__exportStar(require("./emojiPicker/EmojiPicker.js"), exports);
|
|
38
39
|
__exportStar(require("./errorBoundary/index.js"), exports);
|
|
39
40
|
__exportStar(require("./forms/index.js"), exports);
|
|
40
41
|
__exportStar(require("./horizontalList/HorizontalList.js"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAuE;AAA9D,kGAAA,IAAI,OAAA;AAAE,uGAAA,SAAS,OAAA;AACxB,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,sDAAoC;AACpC,kDAAgC;AAChC,yDAAuC;AACvC,yDAAuC;AACvC,+DAA6C;AAC7C,wDAAsC;AACtC,oDAAkC;AAClC,qDAAmC;AACnC,0DAAwC;AACxC,iEAA+C;AAC/C,2DAAyC;AACzC,mDAAiC;AACjC,qEAAmD;AACnD,kDAAgC;AAChC,2DAAyC;AACzC,+EAA6D;AAC7D,mDAAiC;AACjC,qDAAmC;AACnC,iEAA+C;AAC/C,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC;AAClC,kDAAgC;AAChC,2DAAyC;AACzC,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,wDAAsC;AACtC,6DAA2C;AAC3C,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,+DAA6C;AAC7C,qDAAmC;AACnC,wDAAsC;AACtC,qEAAmD;AACnD,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mDAAuE;AAA9D,kGAAA,IAAI,OAAA;AAAE,uGAAA,SAAS,OAAA;AACxB,qDAAmC;AACnC,oDAAkC;AAClC,+CAA6B;AAC7B,oDAAkC;AAClC,oDAAkC;AAClC,kDAAgC;AAChC,sDAAoC;AACpC,kDAAgC;AAChC,yDAAuC;AACvC,yDAAuC;AACvC,+DAA6C;AAC7C,wDAAsC;AACtC,oDAAkC;AAClC,qDAAmC;AACnC,0DAAwC;AACxC,iEAA+C;AAC/C,+DAA6C;AAC7C,2DAAyC;AACzC,mDAAiC;AACjC,qEAAmD;AACnD,kDAAgC;AAChC,2DAAyC;AACzC,+EAA6D;AAC7D,mDAAiC;AACjC,qDAAmC;AACnC,iEAA+C;AAC/C,uDAAqC;AACrC,uDAAqC;AACrC,oDAAkC;AAClC,kDAAgC;AAChC,2DAAyC;AACzC,uDAAqC;AACrC,kDAAgC;AAChC,qDAAmC;AACnC,yDAAuC;AACvC,yDAAuC;AACvC,0DAAwC;AACxC,wDAAsC;AACtC,6DAA2C;AAC3C,oDAAkC;AAClC,2DAAyC;AACzC,oDAAkC;AAClC,qDAAmC;AACnC,oDAAkC;AAClC,iDAA+B;AAC/B,sDAAoC;AACpC,qDAAmC;AACnC,+DAA6C;AAC7C,qDAAmC;AACnC,wDAAsC;AACtC,qEAAmD;AACnD,uDAAqC"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
export interface RelativeTimeProps {
|
|
2
2
|
value: number;
|
|
3
3
|
abbreviate?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Makes it count down seconds for a future date value as it approaches.
|
|
6
|
+
* Does not affect past dates.
|
|
7
|
+
*/
|
|
8
|
+
countdownSeconds?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Remove "from now" or "ago" from the output.
|
|
11
|
+
*/
|
|
12
|
+
disableRelativeText?: boolean;
|
|
4
13
|
}
|
|
5
|
-
export declare function RelativeTime({ value, abbreviate }: RelativeTimeProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function RelativeTime({ value, abbreviate, countdownSeconds, disableRelativeText, }: RelativeTimeProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,31 +5,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.RelativeTime = RelativeTime;
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const utils_1 = require("@a-type/utils");
|
|
8
|
+
const differenceInMinutes_1 = require("date-fns/differenceInMinutes");
|
|
8
9
|
const formatDistanceToNowStrict_1 = require("date-fns/formatDistanceToNowStrict");
|
|
9
10
|
const react_1 = require("react");
|
|
10
|
-
function formatDistanceToNow(date) {
|
|
11
|
+
function formatDistanceToNow(date, relativeText = true) {
|
|
11
12
|
const now = Date.now();
|
|
12
13
|
if (Math.abs(date.getTime() - now) < 1000) {
|
|
13
14
|
return 'just now';
|
|
14
15
|
}
|
|
15
16
|
return ((0, formatDistanceToNowStrict_1.formatDistanceToNowStrict)(date) +
|
|
16
|
-
(date.getTime() < now ? ' ago' : ' from now'));
|
|
17
|
+
(relativeText ? (date.getTime() < now ? ' ago' : ' from now') : ''));
|
|
17
18
|
}
|
|
18
|
-
function RelativeTime({ value, abbreviate }) {
|
|
19
|
+
function RelativeTime({ value, abbreviate, countdownSeconds, disableRelativeText, }) {
|
|
19
20
|
const asDate = (0, react_1.useMemo)(() => new Date(value), [value]);
|
|
20
21
|
const [time, setTime] = (0, react_1.useState)(() => abbreviate
|
|
21
|
-
? (0, utils_1.shortenTimeUnits)(formatDistanceToNow(asDate))
|
|
22
|
-
: formatDistanceToNow(asDate));
|
|
22
|
+
? (0, utils_1.shortenTimeUnits)(formatDistanceToNow(asDate, !disableRelativeText))
|
|
23
|
+
: formatDistanceToNow(asDate, !disableRelativeText));
|
|
24
|
+
// increase update rate if the date is less than 1 minute away and in the future
|
|
25
|
+
// (past is ok to just leave ~1 minute)
|
|
26
|
+
const updateRate = countdownSeconds &&
|
|
27
|
+
asDate.getTime() > Date.now() &&
|
|
28
|
+
Math.abs((0, differenceInMinutes_1.differenceInMinutes)(asDate, new Date())) < 1
|
|
29
|
+
? 1000
|
|
30
|
+
: 60 * 1000;
|
|
23
31
|
(0, react_1.useEffect)(() => {
|
|
24
32
|
const update = () => {
|
|
25
33
|
setTime(abbreviate
|
|
26
|
-
? (0, utils_1.shortenTimeUnits)(formatDistanceToNow(asDate))
|
|
27
|
-
: formatDistanceToNow(asDate));
|
|
34
|
+
? (0, utils_1.shortenTimeUnits)(formatDistanceToNow(asDate, !disableRelativeText))
|
|
35
|
+
: formatDistanceToNow(asDate, !disableRelativeText));
|
|
28
36
|
};
|
|
29
|
-
const interval = setInterval(update,
|
|
37
|
+
const interval = setInterval(update, updateRate);
|
|
30
38
|
update();
|
|
31
39
|
return () => clearInterval(interval);
|
|
32
|
-
}, [asDate, abbreviate]);
|
|
40
|
+
}, [asDate, abbreviate, updateRate, disableRelativeText]);
|
|
33
41
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: time });
|
|
34
42
|
}
|
|
35
43
|
//# sourceMappingURL=RelativeTime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelativeTime.js","sourceRoot":"","sources":["../../../../src/components/relativeTime/RelativeTime.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"RelativeTime.js","sourceRoot":"","sources":["../../../../src/components/relativeTime/RelativeTime.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;AAgCb,oCAmCC;;AAjED,yCAAiD;AACjD,sEAAmE;AACnE,kFAA+E;AAC/E,iCAAqD;AAgBrD,SAAS,mBAAmB,CAAC,IAAU,EAAE,YAAY,GAAG,IAAI;IAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC;QAC3C,OAAO,UAAU,CAAC;IACnB,CAAC;IACD,OAAO,CACN,IAAA,qDAAyB,EAAC,IAAI,CAAC;QAC/B,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CACnE,CAAC;AACH,CAAC;AAED,SAAgB,YAAY,CAAC,EAC5B,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,mBAAmB,GACA;IACnB,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,K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elativeTime.js';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof RelativeTime;
|
|
6
|
+
argTypes: {};
|
|
7
|
+
args: {
|
|
8
|
+
value: number;
|
|
9
|
+
abbreviate: false;
|
|
10
|
+
};
|
|
11
|
+
parameters: {
|
|
12
|
+
controls: {
|
|
13
|
+
expanded: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof RelativeTime>;
|
|
19
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Default = void 0;
|
|
5
|
+
const RelativeTime_js_1 = require("./RelativeTime.js");
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'RelativeTime',
|
|
8
|
+
component: RelativeTime_js_1.RelativeTime,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
args: {
|
|
11
|
+
value: Date.now() + 60 * 1000 * 2,
|
|
12
|
+
abbreviate: false,
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
controls: { expanded: true },
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
exports.default = meta;
|
|
19
|
+
exports.Default = {};
|
|
20
|
+
//# sourceMappingURL=RelativeTime.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelativeTime.stories.js","sourceRoot":"","sources":["../../../../src/components/relativeTime/RelativeTime.stories.tsx"],"names":[],"mappings":";;;AACA,uDAAiD;AAEjD,MAAM,IAAI,GAAG;IACZ,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,8BAAY;IACvB,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE;QACL,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,CAAC;QACjC,UAAU,EAAE,KAAK;KACjB;IACD,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;KAC5B;CACmC,CAAC;AAEtC,kBAAe,IAAI,CAAC;AAIP,QAAA,OAAO,GAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const useLocalStorage: <T>(key: string, initialValue: T, writeInitialValue?: boolean) => readonly [T, (value: T | ((current: T) => T)) => void];
|
|
2
|
+
export declare const useSessionStorage: <T>(key: string, initialValue: T, writeInitialValue?: boolean) => readonly [T, (value: T | ((current: T) => T)) => void];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// @unocss-include
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.useSessionStorage = exports.useLocalStorage = void 0;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const valtio_1 = require("valtio");
|
|
7
|
+
function makeUseStorage(storage, cache, name = storage.constructor.name) {
|
|
8
|
+
return function useStorage(key, initialValue, writeInitialValue = false) {
|
|
9
|
+
var _a;
|
|
10
|
+
// using useMemo to execute synchronous code in render just once.
|
|
11
|
+
// this hook comes before useLocalStorageCache because we want to load
|
|
12
|
+
// values into the cache before accessing them.
|
|
13
|
+
(0, react_1.useMemo)(() => {
|
|
14
|
+
if (typeof window === 'undefined')
|
|
15
|
+
return;
|
|
16
|
+
try {
|
|
17
|
+
const stored = storage.getItem(key);
|
|
18
|
+
if (stored) {
|
|
19
|
+
cache[key] = JSON.parse(stored);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.error(`Error loading use-${name} value for ${key}: ${err}`);
|
|
24
|
+
storage.removeItem(key);
|
|
25
|
+
}
|
|
26
|
+
}, [key]);
|
|
27
|
+
const snapshot = (0, valtio_1.useSnapshot)(cache);
|
|
28
|
+
const storedValue = ((_a = snapshot[key]) !== null && _a !== void 0 ? _a : initialValue);
|
|
29
|
+
const hasValue = snapshot[key] !== undefined;
|
|
30
|
+
(0, react_1.useEffect)(() => {
|
|
31
|
+
if (!hasValue && writeInitialValue) {
|
|
32
|
+
storage.setItem(key, JSON.stringify(initialValue));
|
|
33
|
+
}
|
|
34
|
+
}, [hasValue, initialValue, writeInitialValue, key]);
|
|
35
|
+
// Return a wrapped version of useState's setter function that
|
|
36
|
+
// persists the new value to localStorage. It's throttled to prevent
|
|
37
|
+
// frequent writes to localStorage, which can be costly.
|
|
38
|
+
const setValue = (0, react_1.useMemo)(() => throttle((value) => {
|
|
39
|
+
if (typeof window === 'undefined')
|
|
40
|
+
return;
|
|
41
|
+
try {
|
|
42
|
+
// Allow value to be a function so we have same API as useState
|
|
43
|
+
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
44
|
+
// Save to local storage
|
|
45
|
+
storage.setItem(key, JSON.stringify(valueToStore));
|
|
46
|
+
// sync it to other instances of the hook via the global cache
|
|
47
|
+
cache[key] = valueToStore;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error(`Error setting use-${name} value for ${key}: ${value}: ${error}`);
|
|
51
|
+
throw new Error('Error setting value');
|
|
52
|
+
}
|
|
53
|
+
}, 300, { trailing: true, leading: true }), [key, storedValue]);
|
|
54
|
+
return [storedValue, setValue];
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exports.useLocalStorage = makeUseStorage(localStorage, (0, valtio_1.proxy)({}), 'LocalStorage');
|
|
58
|
+
exports.useSessionStorage = makeUseStorage(sessionStorage, (0, valtio_1.proxy)({}), 'SessionStorage');
|
|
59
|
+
function throttle(func, wait, options) {
|
|
60
|
+
let previous = 0;
|
|
61
|
+
return function (...args) {
|
|
62
|
+
const now = Date.now();
|
|
63
|
+
if (!previous && (options === null || options === void 0 ? void 0 : options.leading) === false)
|
|
64
|
+
previous = now;
|
|
65
|
+
const remaining = wait - (now - previous);
|
|
66
|
+
if (remaining <= 0) {
|
|
67
|
+
if ((options === null || options === void 0 ? void 0 : options.trailing) === false)
|
|
68
|
+
previous = now;
|
|
69
|
+
return func(...args);
|
|
70
|
+
}
|
|
71
|
+
if ((options === null || options === void 0 ? void 0 : options.trailing) === false) {
|
|
72
|
+
return func(...args);
|
|
73
|
+
}
|
|
74
|
+
return setTimeout(() => {
|
|
75
|
+
previous = (options === null || options === void 0 ? void 0 : options.leading) === false ? 0 : Date.now();
|
|
76
|
+
func(...args);
|
|
77
|
+
}, remaining);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=useStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStorage.js","sourceRoot":"","sources":["../../../src/hooks/useStorage.ts"],"names":[],"mappings":";;;AAAA,iCAA2C;AAC3C,mCAA4C;AAE5C,SAAS,cAAc,CACtB,OAAgB,EAChB,KAA0B,EAC1B,OAAe,OAAO,CAAC,WAAW,CAAC,IAAI;IAEvC,OAAO,SAAS,UAAU,CACzB,GAAW,EACX,YAAe,EACf,iBAAiB,GAAG,KAAK;;QAEzB,iEAAiE;QACjE,sEAAsE;QACtE,+CAA+C;QAC/C,IAAA,eAAO,EAAC,GAAG,EAAE;YACZ,IAAI,OAAO,MAAM,KAAK,WAAW;gBAAE,OAAO;YAE1C,IAAI,CAAC;gBACJ,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,MAAM,EAAE,CAAC;oBACZ,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACjC,CAAC;YACF,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,qBAAqB,IAAI,cAAc,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC;gBACpE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACzB,CAAC;QACF,CAAC,EAAE,CAAC,GAAG,C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AAP,OAAO,uBAAP,OAAO,CAAE,OAAO,MAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACvD,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACf,CAAC,EAAE,SAAS,CAAC,CAAC;IACf,CAAC,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const withProps: <T extends {}>(Component: React.ComponentType<T>, extras: Partial<T>) => (props: T) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
type OptionalKeys<T> = {
|
|
4
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
5
|
+
}[keyof T];
|
|
6
|
+
export declare const withoutProps: <T extends {}, P extends OptionalKeys<T>>(Component: React.ComponentType<T>, remove: P[]) => (props: Omit<T, P>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @unocss-include
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.withProps = void 0;
|
|
4
|
+
exports.withoutProps = exports.withProps = void 0;
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const withProps = (Component, extras) => {
|
|
7
7
|
return (props) => {
|
|
@@ -9,4 +9,10 @@ const withProps = (Component, extras) => {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
exports.withProps = withProps;
|
|
12
|
+
const withoutProps = (Component, remove) => {
|
|
13
|
+
return (props) => {
|
|
14
|
+
return (0, jsx_runtime_1.jsx)(Component, Object.assign({}, props));
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
exports.withoutProps = withoutProps;
|
|
12
18
|
//# sourceMappingURL=withProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withProps.js","sourceRoot":"","sources":["../../../src/hooks/withProps.tsx"],"names":[],"mappings":";;;;AAEO,MAAM,SAAS,GAAG,CACxB,SAAiC,EACjC,MAAkB,EACjB,EAAE;IACH,OAAO,CAAC,KAAQ,EAAE,EAAE;QACnB,OAAO,uBAAC,SAAS,oBAAK,KAAK,EAAM,MAAM,EAAI,CAAC;IAC7C,CAAC,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
|
|
1
|
+
{"version":3,"file":"withProps.js","sourceRoot":"","sources":["../../../src/hooks/withProps.tsx"],"names":[],"mappings":";;;;AAEO,MAAM,SAAS,GAAG,CACxB,SAAiC,EACjC,MAAkB,EACjB,EAAE;IACH,OAAO,CAAC,KAAQ,EAAE,EAAE;QACnB,OAAO,uBAAC,SAAS,oBAAK,KAAK,EAAM,MAAM,EAAI,CAAC;IAC7C,CAAC,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB;AAKK,MAAM,YAAY,GAAG,CAC3B,SAAiC,EACjC,MAAW,EACV,EAAE;IACH,OAAO,CAAC,KAAiB,EAAE,EAAE;QAC5B,OAAO,uBAAC,SAAS,oBAAM,KAAa,EAAI,CAAC;IAC1C,CAAC,CAAC;AACH,CAAC,CAAC;AAPW,QAAA,YAAY,gBAOvB"}
|
package/dist/cjs/uno/colors.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.colorConstants = `
|
|
|
11
11
|
`;
|
|
12
12
|
const dynamicThemeComputedColors = (name) => `
|
|
13
13
|
--color-${name}: oklch(calc(90% - 35% * var(--dyn-source-mode-adjust, 0) - (var(--dyn-mode-sign, 1) * var(--dyn-${name}-base-dim, 0%))) calc(var(--dyn-${name}-sat-mult,1) * (35% - 2% * var(--dyn-source-mode-adjust, 0))) var(--dyn-${name}-source, 0));
|
|
14
|
-
--color-${name}-wash: oklch(from var(--color-${name}) calc(min(0.999,max(0.15, l + 0.15 * var(--dyn-mode-mult, 1)))) calc(var(--dyn-${name}-sat-mult) * (c * var(--dyn-saturation-x-wash, 1) - 0.
|
|
14
|
+
--color-${name}-wash: oklch(from var(--color-${name}) calc(min(0.999,max(0.15, l + 0.15 * var(--dyn-mode-mult, 1)))) calc(var(--dyn-${name}-sat-mult) * (c * var(--dyn-saturation-x-wash, 1) - 0.06)) calc(h - 5 * var(--dyn-${name}-hue-rotate, 0) * var(--dyn-${name}-hue-rotate-mult, 1)));
|
|
15
15
|
--color-${name}-light: oklch(from var(--color-${name}) calc(l + 0.08 * var(--dyn-mode-mult, 1)) calc(var(--dyn-${name}-sat-mult) * (c * var(--dyn-saturation-x-light, 1) - 0.03)) calc(h - 0.5 * var(--dyn-${name}-hue-rotate, 0) * var(--dyn-${name}-hue-rotate-mult, 1)));
|
|
16
16
|
--color-${name}-dark: oklch(from var(--color-${name}) calc(l - 0.26 * var(--dyn-mode-mult, 1)) calc(var(--dyn-${name}-sat-mult) * (c * var(--dyn-saturation-x-dark, 1) + 0.01)) calc(h + 0.2 * var(--dyn-${name}-hue-rotate, 0) * var(--dyn-${name}-hue-rotate-mult, 1)));
|
|
17
17
|
--color-${name}-ink: oklch(from var(--color-${name}) calc(l - 0.45 * var(--dyn-mode-mult, 1)) calc(var(--dyn-${name}-sat-mult) * (c * var(--dyn-saturation-x-ink, 1) + 0.01)) calc(h + 1 * var(--dyn-${name}-hue-rotate, 0) * var(--dyn-${name}-hue-rotate-mult, 1)));
|