@a-type/ui 2.0.11 → 2.1.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.
Files changed (64) hide show
  1. package/dist/cjs/colors.stories.d.ts +20 -1
  2. package/dist/cjs/colors.stories.js +30 -5
  3. package/dist/cjs/colors.stories.js.map +1 -1
  4. package/dist/cjs/components/chip/Chip.js +3 -3
  5. package/dist/cjs/components/chip/Chip.js.map +1 -1
  6. package/dist/cjs/components/emojiPicker/EmojiPicker.d.ts +28 -0
  7. package/dist/cjs/components/emojiPicker/EmojiPicker.js +79 -0
  8. package/dist/cjs/components/emojiPicker/EmojiPicker.js.map +1 -0
  9. package/dist/cjs/components/emojiPicker/EmojiPicker.stories.d.ts +25 -0
  10. package/dist/cjs/components/emojiPicker/EmojiPicker.stories.js +21 -0
  11. package/dist/cjs/components/emojiPicker/EmojiPicker.stories.js.map +1 -0
  12. package/dist/cjs/components/icon/generated/IconSpritesheet.js +1 -1
  13. package/dist/cjs/components/icon/generated/IconSpritesheet.js.map +1 -1
  14. package/dist/cjs/components/icon/generated/iconNames.d.ts +1 -1
  15. package/dist/cjs/components/icon/generated/iconNames.js +1 -0
  16. package/dist/cjs/components/icon/generated/iconNames.js.map +1 -1
  17. package/dist/cjs/components/index.d.ts +1 -0
  18. package/dist/cjs/components/index.js +1 -0
  19. package/dist/cjs/components/index.js.map +1 -1
  20. package/dist/cjs/hooks/useStorage.d.ts +2 -0
  21. package/dist/cjs/hooks/useStorage.js +80 -0
  22. package/dist/cjs/hooks/useStorage.js.map +1 -0
  23. package/dist/cjs/hooks/withProps.d.ts +5 -0
  24. package/dist/cjs/hooks/withProps.js +7 -1
  25. package/dist/cjs/hooks/withProps.js.map +1 -1
  26. package/dist/cjs/uno/colors.js +1 -1
  27. package/dist/css/main.css +34 -34
  28. package/dist/esm/colors.stories.d.ts +20 -1
  29. package/dist/esm/colors.stories.js +30 -5
  30. package/dist/esm/colors.stories.js.map +1 -1
  31. package/dist/esm/components/chip/Chip.js +3 -3
  32. package/dist/esm/components/chip/Chip.js.map +1 -1
  33. package/dist/esm/components/emojiPicker/EmojiPicker.d.ts +28 -0
  34. package/dist/esm/components/emojiPicker/EmojiPicker.js +68 -0
  35. package/dist/esm/components/emojiPicker/EmojiPicker.js.map +1 -0
  36. package/dist/esm/components/emojiPicker/EmojiPicker.stories.d.ts +25 -0
  37. package/dist/esm/components/emojiPicker/EmojiPicker.stories.js +18 -0
  38. package/dist/esm/components/emojiPicker/EmojiPicker.stories.js.map +1 -0
  39. package/dist/esm/components/icon/generated/IconSpritesheet.js +1 -1
  40. package/dist/esm/components/icon/generated/IconSpritesheet.js.map +1 -1
  41. package/dist/esm/components/icon/generated/iconNames.d.ts +1 -1
  42. package/dist/esm/components/icon/generated/iconNames.js +1 -0
  43. package/dist/esm/components/icon/generated/iconNames.js.map +1 -1
  44. package/dist/esm/components/index.d.ts +1 -0
  45. package/dist/esm/components/index.js +1 -0
  46. package/dist/esm/components/index.js.map +1 -1
  47. package/dist/esm/hooks/useStorage.d.ts +2 -0
  48. package/dist/esm/hooks/useStorage.js +77 -0
  49. package/dist/esm/hooks/useStorage.js.map +1 -0
  50. package/dist/esm/hooks/withProps.d.ts +5 -0
  51. package/dist/esm/hooks/withProps.js +5 -0
  52. package/dist/esm/hooks/withProps.js.map +1 -1
  53. package/dist/esm/uno/colors.js +1 -1
  54. package/package.json +4 -2
  55. package/src/colors.stories.tsx +30 -4
  56. package/src/components/chip/Chip.tsx +3 -3
  57. package/src/components/emojiPicker/EmojiPicker.stories.tsx +21 -0
  58. package/src/components/emojiPicker/EmojiPicker.tsx +170 -0
  59. package/src/components/icon/generated/IconSpritesheet.tsx +16 -0
  60. package/src/components/icon/generated/iconNames.ts +1 -0
  61. package/src/components/index.ts +1 -0
  62. package/src/hooks/useStorage.ts +107 -0
  63. package/src/hooks/withProps.tsx +12 -0
  64. 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
- 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" })] }));
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,EAAE,EAAE;IACZ,UAAU,EAAE;QACX,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;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F,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"}
@@ -22,9 +22,9 @@ const clsx_1 = __importDefault(require("clsx"));
22
22
  function Chip(_a) {
23
23
  var { className, color = 'neutral', asChild, ref } = _a, rest = __rest(_a, ["className", "color", "asChild", "ref"]);
24
24
  const Component = asChild ? react_slot_1.Slot : 'div';
25
- return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ ref: ref, className: (0, clsx_1.default)('inline-flex flex-row gap-1 items-center whitespace-nowrap border-light border-solid border rounded-lg px-2 py-1 text-black', {
26
- 'bg-primary-wash': color === 'primary',
27
- 'bg-accent-wash': color === 'accent',
25
+ return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ ref: ref, className: (0, clsx_1.default)('layer-components:inline-flex layer-components:flex-row layer-components:gap-1 layer-components:items-center layer-components:whitespace-nowrap layer-components:border-light layer-components:border-solid layer-components:border layer-components:rounded-lg layer-components:px-2 layer-components:py-1 layer-components:text-black', {
26
+ 'layer-variants:bg-primary-wash': color === 'primary',
27
+ 'layer-variants:bg-accent-wash': color === 'accent',
28
28
  }, className) }, rest)));
29
29
  }
30
30
  //# sourceMappingURL=Chip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../../src/components/chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAUA,oBAsBC;;AAhCD,qDAA4C;AAC5C,gDAA8B;AAS9B,SAAgB,IAAI,CAAC,EAMT;QANS,EACpB,SAAS,EACT,KAAK,GAAG,SAAS,EACjB,OAAO,EACP,GAAG,OAEQ,EADR,IAAI,cALa,wCAMpB,CADO;IAEP,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,uBAAC,SAAS,kBACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAU,EACpB,4HAA4H,EAC5H;YACC,iBAAiB,EAAE,KAAK,KAAK,SAAS;YACtC,gBAAgB,EAAE,KAAK,KAAK,QAAQ;SACpC,EACD,SAAS,CACT,IACG,IAAI,EACP,CACF,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../../src/components/chip/Chip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAUA,oBAsBC;;AAhCD,qDAA4C;AAC5C,gDAA8B;AAS9B,SAAgB,IAAI,CAAC,EAMT;QANS,EACpB,SAAS,EACT,KAAK,GAAG,SAAS,EACjB,OAAO,EACP,GAAG,OAEQ,EADR,IAAI,cALa,wCAMpB,CADO;IAEP,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzC,OAAO,CACN,uBAAC,SAAS,kBACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAU,EACpB,+IAA+I,EAC/I;YACC,gCAAgC,EAAE,KAAK,KAAK,SAAS;YACrD,+BAA+B,EAAE,KAAK,KAAK,QAAQ;SACnD,EACD,SAAS,CACT,IACG,IAAI,EACP,CACF,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":";;;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,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"}