@uxf/ui 1.0.0-beta.10 → 1.0.0-beta.13

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 (132) hide show
  1. package/avatar/avatar.d.ts +14 -0
  2. package/avatar/avatar.jsx +10 -0
  3. package/avatar/avatar.stories.d.ts +8 -0
  4. package/avatar/avatar.stories.jsx +29 -0
  5. package/avatar/theme.d.ts +5 -0
  6. package/avatar/theme.js +2 -0
  7. package/button/button.css +75 -0
  8. package/button/button.d.ts +1 -0
  9. package/button/button.jsx +17 -0
  10. package/button/button.stories.jsx +59 -0
  11. package/{stories → button}/button.stories.tsx +1 -1
  12. package/button/button.tsx +36 -0
  13. package/button/index.js +0 -1
  14. package/button/index.ts +2 -0
  15. package/button/theme.d.ts +4 -1
  16. package/button/theme.js +0 -1
  17. package/button/theme.ts +20 -0
  18. package/image-gallery/components/close-button.d.ts +6 -0
  19. package/image-gallery/components/close-button.jsx +13 -0
  20. package/image-gallery/components/close-button.tsx +19 -0
  21. package/image-gallery/components/dot.d.ts +6 -0
  22. package/image-gallery/components/dot.jsx +12 -0
  23. package/image-gallery/components/dot.tsx +17 -0
  24. package/image-gallery/components/gallery.d.ts +11 -0
  25. package/image-gallery/components/gallery.jsx +74 -0
  26. package/image-gallery/components/gallery.tsx +67 -0
  27. package/image-gallery/components/icon-chevron-left.d.ts +3 -0
  28. package/image-gallery/components/icon-chevron-left.jsx +12 -0
  29. package/image-gallery/components/icon-chevron-left.tsx +18 -0
  30. package/image-gallery/components/icon-chevron-right.d.ts +3 -0
  31. package/image-gallery/components/icon-chevron-right.jsx +12 -0
  32. package/image-gallery/components/icon-chevron-right.tsx +18 -0
  33. package/image-gallery/components/icon-close.d.ts +3 -0
  34. package/image-gallery/components/icon-close.jsx +12 -0
  35. package/image-gallery/components/icon-close.tsx +22 -0
  36. package/image-gallery/components/next-button.d.ts +6 -0
  37. package/image-gallery/components/next-button.jsx +13 -0
  38. package/image-gallery/components/next-button.tsx +19 -0
  39. package/image-gallery/components/previous-button.d.ts +6 -0
  40. package/image-gallery/components/previous-button.jsx +13 -0
  41. package/image-gallery/components/previous-button.tsx +19 -0
  42. package/image-gallery/context.d.ts +10 -0
  43. package/image-gallery/context.jsx +12 -0
  44. package/image-gallery/context.tsx +17 -0
  45. package/image-gallery/image-gallery.d.ts +6 -0
  46. package/image-gallery/image-gallery.jsx +58 -0
  47. package/image-gallery/image-gallery.stories.d.ts +13 -0
  48. package/image-gallery/image-gallery.stories.jsx +29 -0
  49. package/image-gallery/image-gallery.stories.tsx +33 -0
  50. package/image-gallery/image-gallery.tsx +59 -0
  51. package/image-gallery/image.d.ts +4 -0
  52. package/image-gallery/image.jsx +12 -0
  53. package/image-gallery/image.tsx +19 -0
  54. package/image-gallery/index.d.ts +3 -0
  55. package/image-gallery/index.js +25 -0
  56. package/image-gallery/index.ts +3 -0
  57. package/image-gallery/types.d.ts +6 -0
  58. package/image-gallery/types.js +2 -0
  59. package/image-gallery/types.ts +6 -0
  60. package/image-gallery/use-image.d.ts +2 -0
  61. package/image-gallery/use-image.js +16 -0
  62. package/image-gallery/use-image.ts +17 -0
  63. package/input/index.d.ts +12 -0
  64. package/input/index.js +19 -0
  65. package/input/index.ts +14 -0
  66. package/input/input-basic.css +18 -0
  67. package/input/input-element.d.ts +8 -0
  68. package/input/input-element.jsx +11 -0
  69. package/input/input-element.tsx +30 -0
  70. package/input/input-left-addon.d.ts +6 -0
  71. package/input/input-left-addon.jsx +10 -0
  72. package/input/input-left-addon.tsx +12 -0
  73. package/input/input-left-element.d.ts +6 -0
  74. package/input/input-left-element.jsx +10 -0
  75. package/input/input-left-element.tsx +11 -0
  76. package/input/input-right-addon.d.ts +6 -0
  77. package/input/input-right-addon.jsx +10 -0
  78. package/input/input-right-addon.tsx +11 -0
  79. package/input/input-right-element.d.ts +6 -0
  80. package/input/input-right-element.jsx +10 -0
  81. package/input/input-right-element.tsx +11 -0
  82. package/input/input.css +75 -0
  83. package/input/input.d.ts +9 -0
  84. package/input/input.jsx +65 -0
  85. package/input/input.stories.d.ts +14 -0
  86. package/input/input.stories.jsx +78 -0
  87. package/input/input.stories.tsx +79 -0
  88. package/input/input.tsx +70 -0
  89. package/input/theme.d.ts +6 -0
  90. package/input/theme.js +2 -0
  91. package/input/theme.ts +7 -0
  92. package/package.json +8 -34
  93. package/text-input/index.d.ts +1 -0
  94. package/{storybook → text-input}/index.js +1 -2
  95. package/text-input/index.ts +1 -0
  96. package/text-input/text-input.css +29 -0
  97. package/text-input/text-input.d.ts +22 -0
  98. package/text-input/text-input.jsx +32 -0
  99. package/text-input/text-input.stories.d.ts +9 -0
  100. package/text-input/text-input.stories.jsx +55 -0
  101. package/text-input/text-input.stories.tsx +72 -0
  102. package/text-input/text-input.tsx +99 -0
  103. package/tsconfig.json +7 -0
  104. package/tsconfig.tsbuildinfo +1 -0
  105. package/types/form-control-props.d.ts +24 -0
  106. package/types/form-control-props.js +2 -0
  107. package/types/form-control-props.ts +35 -0
  108. package/types/index.d.ts +1 -0
  109. package/types/index.js +17 -0
  110. package/types/index.ts +1 -0
  111. package/utils/action.d.ts +2 -0
  112. package/utils/action.js +11 -0
  113. package/utils/action.ts +14 -0
  114. package/utils/component-structure-analyzer.css +28 -0
  115. package/utils/component-structure-analyzer.d.ts +6 -0
  116. package/utils/component-structure-analyzer.jsx +10 -0
  117. package/utils/component-structure-analyzer.tsx +12 -0
  118. package/utils/cx.d.ts +3 -0
  119. package/utils/cx.js +54 -0
  120. package/utils/cx.ts +56 -0
  121. package/utils/forwardRef.d.ts +12 -0
  122. package/utils/forwardRef.js +10 -0
  123. package/utils/forwardRef.ts +30 -0
  124. package/{storybook → utils}/storybook-config.d.ts +3 -6
  125. package/{storybook/storybook-config.js → utils/storybook-config.jsx} +5 -5
  126. package/utils/storybook-config.tsx +42 -0
  127. package/button/button.js +0 -17
  128. package/button/button.stories.js +0 -33
  129. package/storybook/index.d.ts +0 -1
  130. package/tailwindui/button.css +0 -51
  131. package/types.d.ts +0 -3
  132. package/types.js +0 -3
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ function IconClose() {
8
+ return (<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2} className="h-10 w-10 text-white">
9
+ <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12"/>
10
+ </svg>);
11
+ }
12
+ exports.default = IconClose;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+
3
+ function IconClose() {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ fill="none"
8
+ viewBox="0 0 24 24"
9
+ stroke="currentColor"
10
+ strokeWidth={2}
11
+ className="h-10 w-10 text-white"
12
+ >
13
+ <path
14
+ strokeLinecap="round"
15
+ strokeLinejoin="round"
16
+ d="M6 18L18 6M6 6l12 12"
17
+ />
18
+ </svg>
19
+ );
20
+ }
21
+
22
+ export default IconClose;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface NextButtonProps {
3
+ onClick: () => void;
4
+ }
5
+ declare function NextButton(props: NextButtonProps): JSX.Element;
6
+ export default NextButton;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const icon_chevron_right_1 = __importDefault(require("./icon-chevron-right"));
8
+ function NextButton(props) {
9
+ return (<button className="pointer-events-auto rounded-full bg-black bg-opacity-50 p-2" onClick={props.onClick}>
10
+ <icon_chevron_right_1.default />
11
+ </button>);
12
+ }
13
+ exports.default = NextButton;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import IconChevronRight from "./icon-chevron-right";
3
+
4
+ interface NextButtonProps {
5
+ onClick: () => void;
6
+ }
7
+
8
+ function NextButton(props: NextButtonProps) {
9
+ return (
10
+ <button
11
+ className="pointer-events-auto rounded-full bg-black bg-opacity-50 p-2"
12
+ onClick={props.onClick}
13
+ >
14
+ <IconChevronRight />
15
+ </button>
16
+ );
17
+ }
18
+
19
+ export default NextButton;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ interface PreviousButtonProps {
3
+ onClick: () => void;
4
+ }
5
+ declare function PreviousButton(props: PreviousButtonProps): JSX.Element;
6
+ export default PreviousButton;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const icon_chevron_left_1 = __importDefault(require("./icon-chevron-left"));
8
+ function PreviousButton(props) {
9
+ return (<button className="pointer-events-auto rounded-full bg-black bg-opacity-50 p-2" onClick={props.onClick}>
10
+ <icon_chevron_left_1.default />
11
+ </button>);
12
+ }
13
+ exports.default = PreviousButton;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import IconChevronLeft from "./icon-chevron-left";
3
+
4
+ interface PreviousButtonProps {
5
+ onClick: () => void;
6
+ }
7
+
8
+ function PreviousButton(props: PreviousButtonProps) {
9
+ return (
10
+ <button
11
+ className="pointer-events-auto rounded-full bg-black bg-opacity-50 p-2"
12
+ onClick={props.onClick}
13
+ >
14
+ <IconChevronLeft />
15
+ </button>
16
+ );
17
+ }
18
+
19
+ export default PreviousButton;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { ImageGalleryImageProps } from "./types";
3
+ declare type ContextType = {
4
+ registerImage: (props: ImageGalleryImageProps) => void;
5
+ unregisterImage: (props: ImageGalleryImageProps) => void;
6
+ openGallery: (props: ImageGalleryImageProps) => void;
7
+ };
8
+ export declare const ImageGalleryProvider: import("react").Provider<ContextType>;
9
+ export declare const useImageGalleryContext: () => ContextType;
10
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImageGalleryContext = exports.ImageGalleryProvider = void 0;
4
+ const react_1 = require("react");
5
+ const ImageGalleryContext = (0, react_1.createContext)({
6
+ registerImage: () => null,
7
+ unregisterImage: () => null,
8
+ openGallery: () => null,
9
+ });
10
+ exports.ImageGalleryProvider = ImageGalleryContext.Provider;
11
+ const useImageGalleryContext = () => (0, react_1.useContext)(ImageGalleryContext);
12
+ exports.useImageGalleryContext = useImageGalleryContext;
@@ -0,0 +1,17 @@
1
+ import { createContext, useContext } from "react";
2
+ import { ImageGalleryImageProps } from "./types";
3
+
4
+ type ContextType = {
5
+ registerImage: (props: ImageGalleryImageProps) => void;
6
+ unregisterImage: (props: ImageGalleryImageProps) => void;
7
+ openGallery: (props: ImageGalleryImageProps) => void;
8
+ };
9
+
10
+ const ImageGalleryContext = createContext<ContextType>({
11
+ registerImage: () => null,
12
+ unregisterImage: () => null,
13
+ openGallery: () => null,
14
+ });
15
+
16
+ export const ImageGalleryProvider = ImageGalleryContext.Provider;
17
+ export const useImageGalleryContext = () => useContext(ImageGalleryContext);
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ interface ImageGalleryProviderProps {
3
+ children: ReactNode;
4
+ }
5
+ declare function ImageGallery(props: ImageGalleryProviderProps): JSX.Element;
6
+ export default ImageGallery;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const react_1 = __importStar(require("react"));
30
+ const context_1 = require("./context");
31
+ const gallery_1 = __importDefault(require("./components/gallery"));
32
+ function ImageGallery(props) {
33
+ const [images, setImages] = (0, react_1.useState)([]);
34
+ const [imageIndex, setImageIndex] = (0, react_1.useState)(null);
35
+ const registerImage = (image) => setImages((v) => [...v, image]);
36
+ const unregisterImage = (image) => setImages((v) => v.filter((u) => u.src !== image.src));
37
+ const openGallery = (image) => setImageIndex(images.findIndex((i) => i.src === image.src));
38
+ const onPrevious = (0, react_1.useCallback)(() => {
39
+ setImageIndex((v) => (v === null ? null : v - 1));
40
+ }, []);
41
+ const onNext = (0, react_1.useCallback)(() => {
42
+ setImageIndex((v) => (v === null ? null : v + 1));
43
+ }, []);
44
+ // modulo bug https://stackoverflow.com/a/4467559
45
+ const moduloImageIndex = imageIndex === null
46
+ ? null
47
+ : imageIndex < 0
48
+ ? ((imageIndex % images.length) + images.length) % images.length
49
+ : imageIndex % images.length;
50
+ const contextValue = { registerImage, unregisterImage, openGallery };
51
+ return (<>
52
+ <context_1.ImageGalleryProvider value={contextValue}>
53
+ {props.children}
54
+ </context_1.ImageGalleryProvider>
55
+ {typeof moduloImageIndex === "number" && (<gallery_1.default onClose={() => setImageIndex(null)} onNext={onNext} onPrevious={onPrevious} imageIndex={moduloImageIndex} images={images}/>)}
56
+ </>);
57
+ }
58
+ exports.default = ImageGallery;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ import ImageGallery from "./image-gallery";
3
+ declare const _default: {
4
+ title: string;
5
+ component: typeof ImageGallery;
6
+ parameters: {
7
+ actions: {
8
+ argTypesRegex: string;
9
+ };
10
+ };
11
+ };
12
+ export default _default;
13
+ export declare function Default(): JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Default = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const image_gallery_1 = __importDefault(require("./image-gallery"));
9
+ const image_1 = __importDefault(require("./image"));
10
+ exports.default = {
11
+ title: "Lab/ImageGallery",
12
+ component: image_gallery_1.default,
13
+ parameters: { actions: { argTypesRegex: "^on.*" } },
14
+ };
15
+ const images = [
16
+ "https://opentopo.app/hero_image.jpeg",
17
+ "https://opentopo.app/generated/area-18/d/9/d9033d93-ea48-4f66-b0c1-6045c091b326_1024_1024_c.jpg",
18
+ "https://opentopo.app/generated/area-16/f/4/f4a4ca79-ea9e-44d1-a4ec-3c8ccfbcc218_1024_1024_c.jpg",
19
+ "https://opentopo.app/generated/area-1/8/b/8b84e378-1f55-4ce7-b750-b504091cb833_1024_1024_c.jpg",
20
+ "https://opentopo.app/generated/area-2/e/7/e7ec532b-20c2-407e-9305-fa7cfb71f01f_1024_1024_c.jpg",
21
+ ];
22
+ function Default() {
23
+ return (<image_gallery_1.default>
24
+ <div className="flex-direction flex gap-2">
25
+ {images.map((src) => (<image_1.default key={src} src={src} className="h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105"/>))}
26
+ </div>
27
+ </image_gallery_1.default>);
28
+ }
29
+ exports.Default = Default;
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import ImageGallery from "./image-gallery";
3
+ import Image from "./image";
4
+
5
+ export default {
6
+ title: "Lab/ImageGallery",
7
+ component: ImageGallery,
8
+ parameters: { actions: { argTypesRegex: "^on.*" } },
9
+ };
10
+
11
+ const images = [
12
+ "https://opentopo.app/hero_image.jpeg",
13
+ "https://opentopo.app/generated/area-18/d/9/d9033d93-ea48-4f66-b0c1-6045c091b326_1024_1024_c.jpg",
14
+ "https://opentopo.app/generated/area-16/f/4/f4a4ca79-ea9e-44d1-a4ec-3c8ccfbcc218_1024_1024_c.jpg",
15
+ "https://opentopo.app/generated/area-1/8/b/8b84e378-1f55-4ce7-b750-b504091cb833_1024_1024_c.jpg",
16
+ "https://opentopo.app/generated/area-2/e/7/e7ec532b-20c2-407e-9305-fa7cfb71f01f_1024_1024_c.jpg",
17
+ ];
18
+
19
+ export function Default() {
20
+ return (
21
+ <ImageGallery>
22
+ <div className="flex-direction flex gap-2">
23
+ {images.map((src) => (
24
+ <Image
25
+ key={src}
26
+ src={src}
27
+ className="h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105"
28
+ />
29
+ ))}
30
+ </div>
31
+ </ImageGallery>
32
+ );
33
+ }
@@ -0,0 +1,59 @@
1
+ import React, { ReactNode, useCallback, useState } from "react";
2
+ import { ImageGalleryProvider } from "./context";
3
+ import { ImageGalleryImageProps } from "./types";
4
+ import Gallery from "./components/gallery";
5
+
6
+ interface ImageGalleryProviderProps {
7
+ children: ReactNode;
8
+ }
9
+
10
+ function ImageGallery(props: ImageGalleryProviderProps) {
11
+ const [images, setImages] = useState<ImageGalleryImageProps[]>([]);
12
+ const [imageIndex, setImageIndex] = useState<null | number>(null);
13
+
14
+ const registerImage = (image: ImageGalleryImageProps) =>
15
+ setImages((v) => [...v, image]);
16
+
17
+ const unregisterImage = (image: ImageGalleryImageProps) =>
18
+ setImages((v) => v.filter((u) => u.src !== image.src));
19
+
20
+ const openGallery = (image: ImageGalleryImageProps) =>
21
+ setImageIndex(images.findIndex((i) => i.src === image.src));
22
+
23
+ const onPrevious = useCallback(() => {
24
+ setImageIndex((v) => (v === null ? null : v - 1));
25
+ }, []);
26
+
27
+ const onNext = useCallback(() => {
28
+ setImageIndex((v) => (v === null ? null : v + 1));
29
+ }, []);
30
+
31
+ // modulo bug https://stackoverflow.com/a/4467559
32
+ const moduloImageIndex =
33
+ imageIndex === null
34
+ ? null
35
+ : imageIndex < 0
36
+ ? ((imageIndex % images.length) + images.length) % images.length
37
+ : imageIndex % images.length;
38
+
39
+ const contextValue = { registerImage, unregisterImage, openGallery };
40
+
41
+ return (
42
+ <>
43
+ <ImageGalleryProvider value={contextValue}>
44
+ {props.children}
45
+ </ImageGalleryProvider>
46
+ {typeof moduloImageIndex === "number" && (
47
+ <Gallery
48
+ onClose={() => setImageIndex(null)}
49
+ onNext={onNext}
50
+ onPrevious={onPrevious}
51
+ imageIndex={moduloImageIndex}
52
+ images={images}
53
+ />
54
+ )}
55
+ </>
56
+ );
57
+ }
58
+
59
+ export default ImageGallery;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ImageGalleryImageProps } from "@uxf/ui/image-gallery/types";
3
+ declare function Image(props: ImageGalleryImageProps): JSX.Element;
4
+ export default Image;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const use_image_1 = require("./use-image");
8
+ function Image(props) {
9
+ const openGallery = (0, use_image_1.useImage)(props);
10
+ return (<img src={props.src} alt={props.alt} title={props.title} className={props.className} onClick={() => openGallery(props)}/>);
11
+ }
12
+ exports.default = Image;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { useImage } from "./use-image";
3
+ import { ImageGalleryImageProps } from "@uxf/ui/image-gallery/types";
4
+
5
+ function Image(props: ImageGalleryImageProps) {
6
+ const openGallery = useImage(props);
7
+
8
+ return (
9
+ <img
10
+ src={props.src}
11
+ alt={props.alt}
12
+ title={props.title}
13
+ className={props.className}
14
+ onClick={() => openGallery(props)}
15
+ />
16
+ );
17
+ }
18
+
19
+ export default Image;
@@ -0,0 +1,3 @@
1
+ export { default as Image } from "./image";
2
+ export { default as ImageGallery } from "./image-gallery";
3
+ export * from "./use-image";
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.ImageGallery = exports.Image = void 0;
21
+ var image_1 = require("./image");
22
+ Object.defineProperty(exports, "Image", { enumerable: true, get: function () { return __importDefault(image_1).default; } });
23
+ var image_gallery_1 = require("./image-gallery");
24
+ Object.defineProperty(exports, "ImageGallery", { enumerable: true, get: function () { return __importDefault(image_gallery_1).default; } });
25
+ __exportStar(require("./use-image"), exports);
@@ -0,0 +1,3 @@
1
+ export { default as Image } from "./image";
2
+ export { default as ImageGallery } from "./image-gallery";
3
+ export * from "./use-image";
@@ -0,0 +1,6 @@
1
+ export interface ImageGalleryImageProps {
2
+ src: string;
3
+ title?: string;
4
+ alt?: string;
5
+ className?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ export interface ImageGalleryImageProps {
2
+ src: string;
3
+ title?: string;
4
+ alt?: string;
5
+ className?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ import { ImageGalleryImageProps } from "./types";
2
+ export declare function useImage(props: ImageGalleryImageProps): (props: ImageGalleryImageProps) => void;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useImage = void 0;
4
+ const react_1 = require("react");
5
+ const context_1 = require("./context");
6
+ function useImage(props) {
7
+ const { registerImage, unregisterImage, openGallery } = (0, context_1.useImageGalleryContext)();
8
+ (0, react_1.useEffect)(() => {
9
+ registerImage(props);
10
+ return () => {
11
+ unregisterImage(props);
12
+ };
13
+ }, [props]);
14
+ return openGallery;
15
+ }
16
+ exports.useImage = useImage;
@@ -0,0 +1,17 @@
1
+ import { useEffect } from "react";
2
+ import { useImageGalleryContext } from "./context";
3
+ import { ImageGalleryImageProps } from "./types";
4
+
5
+ export function useImage(props: ImageGalleryImageProps) {
6
+ const { registerImage, unregisterImage, openGallery } =
7
+ useImageGalleryContext();
8
+
9
+ useEffect(() => {
10
+ registerImage(props);
11
+ return () => {
12
+ unregisterImage(props);
13
+ };
14
+ }, [props]);
15
+
16
+ return openGallery;
17
+ }
@@ -0,0 +1,12 @@
1
+ import RootInput from "./input";
2
+ import LeftElement from "./input-left-element";
3
+ import RightElement from "./input-right-element";
4
+ import LeftAddon from "./input-left-addon";
5
+ import RightAddon from "./input-right-addon";
6
+ export declare const Input: typeof RootInput & {
7
+ Element: import("react").ForwardRefExoticComponent<import("./input-element").InputElementProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ LeftElement: typeof LeftElement;
9
+ RightElement: typeof RightElement;
10
+ LeftAddon: typeof LeftAddon;
11
+ RightAddon: typeof RightAddon;
12
+ };
package/input/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Input = void 0;
7
+ const input_1 = __importDefault(require("./input"));
8
+ const input_element_1 = __importDefault(require("./input-element"));
9
+ const input_left_element_1 = __importDefault(require("./input-left-element"));
10
+ const input_right_element_1 = __importDefault(require("./input-right-element"));
11
+ const input_left_addon_1 = __importDefault(require("./input-left-addon"));
12
+ const input_right_addon_1 = __importDefault(require("./input-right-addon"));
13
+ exports.Input = Object.assign(input_1.default, {
14
+ Element: input_element_1.default,
15
+ LeftElement: input_left_element_1.default,
16
+ RightElement: input_right_element_1.default,
17
+ LeftAddon: input_left_addon_1.default,
18
+ RightAddon: input_right_addon_1.default,
19
+ });
package/input/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ import RootInput from "./input";
2
+ import Element from "./input-element";
3
+ import LeftElement from "./input-left-element";
4
+ import RightElement from "./input-right-element";
5
+ import LeftAddon from "./input-left-addon";
6
+ import RightAddon from "./input-right-addon";
7
+
8
+ export const Input = Object.assign(RootInput, {
9
+ Element,
10
+ LeftElement,
11
+ RightElement,
12
+ LeftAddon,
13
+ RightAddon,
14
+ });
@@ -0,0 +1,18 @@
1
+ .uxf-input {
2
+ @apply flex flex-row;
3
+ }
4
+
5
+ .uxf-input__wrapper {
6
+ @apply flex w-full flex-row;
7
+ }
8
+
9
+ .uxf-input__element {
10
+ @apply w-full px-2;
11
+ }
12
+
13
+ .uxf-input__left-element,
14
+ .uxf-input__right-element,
15
+ .uxf-input__left-addon,
16
+ .uxf-input__right-addon {
17
+ @apply flex flex-row items-center whitespace-nowrap;
18
+ }
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { FormControlProps } from "@uxf/ui/types/form-control-props";
3
+ export interface InputElementProps extends FormControlProps<string> {
4
+ id?: string;
5
+ placeholder?: string;
6
+ }
7
+ declare const _default: React.ForwardRefExoticComponent<InputElementProps & React.RefAttributes<HTMLInputElement>>;
8
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const forwardRef_1 = require("@uxf/ui/utils/forwardRef");
8
+ function InputElement(props, ref) {
9
+ return (<input id={props.id} ref={ref} className="uxf-input__element" value={props.value} onFocus={props.onFocus} onBlur={props.onBlur} onChange={(event) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, event.target.value, event); }} placeholder={props.placeholder}/>);
10
+ }
11
+ exports.default = (0, forwardRef_1.forwardRef)("InputElement", InputElement);
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { forwardRef } from "@uxf/ui/utils/forwardRef";
3
+ import { FormControlProps } from "@uxf/ui/types/form-control-props";
4
+
5
+ export interface InputElementProps extends FormControlProps<string> {
6
+ id?: string;
7
+ placeholder?: string;
8
+ }
9
+
10
+ type InputTypeRef = HTMLInputElement;
11
+
12
+ function InputElement(
13
+ props: InputElementProps,
14
+ ref: React.ForwardedRef<InputTypeRef>
15
+ ) {
16
+ return (
17
+ <input
18
+ id={props.id}
19
+ ref={ref}
20
+ className="uxf-input__element"
21
+ value={props.value}
22
+ onFocus={props.onFocus}
23
+ onBlur={props.onBlur}
24
+ onChange={(event) => props.onChange?.(event.target.value, event)}
25
+ placeholder={props.placeholder}
26
+ />
27
+ );
28
+ }
29
+
30
+ export default forwardRef("InputElement", InputElement);
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ interface InputLeftAddonProps {
3
+ children: ReactNode;
4
+ }
5
+ declare function InputLeftAddon(props: InputLeftAddonProps): JSX.Element;
6
+ export default InputLeftAddon;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ function InputLeftAddon(props) {
8
+ return <div className="uxf-input__left-addon">{props.children}</div>;
9
+ }
10
+ exports.default = InputLeftAddon;