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

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 (69) hide show
  1. package/button/theme.d.ts +4 -1
  2. package/image-gallery/components/close-button.d.ts +6 -0
  3. package/image-gallery/components/close-button.js +13 -0
  4. package/image-gallery/components/dot.d.ts +6 -0
  5. package/image-gallery/components/dot.js +13 -0
  6. package/image-gallery/components/gallery.d.ts +11 -0
  7. package/image-gallery/components/gallery.js +68 -0
  8. package/image-gallery/components/icon-chevron-left.d.ts +3 -0
  9. package/image-gallery/components/icon-chevron-left.js +12 -0
  10. package/image-gallery/components/icon-chevron-right.d.ts +3 -0
  11. package/image-gallery/components/icon-chevron-right.js +12 -0
  12. package/image-gallery/components/icon-close.d.ts +3 -0
  13. package/image-gallery/components/icon-close.js +12 -0
  14. package/image-gallery/components/next-button.d.ts +6 -0
  15. package/image-gallery/components/next-button.js +13 -0
  16. package/image-gallery/components/previous-button.d.ts +6 -0
  17. package/image-gallery/components/previous-button.js +13 -0
  18. package/image-gallery/context.d.ts +10 -0
  19. package/image-gallery/context.js +13 -0
  20. package/image-gallery/image-gallery.d.ts +6 -0
  21. package/image-gallery/image-gallery.js +87 -0
  22. package/image-gallery/image-gallery.stories.d.ts +13 -0
  23. package/image-gallery/image-gallery.stories.js +27 -0
  24. package/image-gallery/image.d.ts +4 -0
  25. package/image-gallery/image.js +13 -0
  26. package/image-gallery/index.d.ts +3 -0
  27. package/image-gallery/index.js +26 -0
  28. package/image-gallery/types.d.ts +6 -0
  29. package/image-gallery/types.js +3 -0
  30. package/image-gallery/use-image.d.ts +2 -0
  31. package/image-gallery/use-image.js +17 -0
  32. package/input/index.d.ts +6 -0
  33. package/input/index.js +19 -0
  34. package/input/input-group.d.ts +9 -0
  35. package/input/input-group.js +78 -0
  36. package/input/input-left-addon.d.ts +6 -0
  37. package/input/input-left-addon.js +11 -0
  38. package/input/input-left-element.d.ts +6 -0
  39. package/input/input-left-element.js +11 -0
  40. package/input/input-right-addon.d.ts +6 -0
  41. package/input/input-right-addon.js +11 -0
  42. package/input/input-right-element.d.ts +6 -0
  43. package/input/input-right-element.js +11 -0
  44. package/input/input.d.ts +8 -0
  45. package/input/input.js +12 -0
  46. package/input/input.stories.d.ts +9 -0
  47. package/input/input.stories.js +105 -0
  48. package/input/theme.d.ts +6 -0
  49. package/input/theme.js +3 -0
  50. package/package.json +5 -1
  51. package/stories/image-gallery.stories.tsx +33 -0
  52. package/stories/input.stories.tsx +101 -0
  53. package/storybook/action.d.ts +2 -0
  54. package/storybook/action.js +41 -0
  55. package/storybook/storybook-config.d.ts +2 -5
  56. package/storybook/storybook-config.js +3 -2
  57. package/styles/button.css +75 -0
  58. package/styles/component-structure-analyzer.css +28 -0
  59. package/styles/input-basic.css +18 -0
  60. package/styles/input.css +74 -0
  61. package/types/form-control-props.d.ts +24 -0
  62. package/types/form-control-props.js +3 -0
  63. package/utils/component-structure-analyzer.d.ts +6 -0
  64. package/utils/component-structure-analyzer.js +11 -0
  65. package/utils/cx.d.ts +3 -0
  66. package/utils/cx.js +59 -0
  67. package/utils/forwardRef.d.ts +12 -0
  68. package/utils/forwardRef.js +11 -0
  69. package/tailwindui/button.css +0 -51
@@ -0,0 +1,75 @@
1
+ .button {
2
+ @apply inline-flex items-center rounded font-medium shadow-md shadow-sm focus:outline-none focus:ring-2 focus:ring-offset-2;
3
+
4
+ &.button--disabled {
5
+ @apply pointer-events-none opacity-40;
6
+ }
7
+
8
+ &.button--size-xs {
9
+ @apply px-2.5 py-1.5 text-xs;
10
+ }
11
+
12
+ &.button--size-sm {
13
+ @apply px-3 py-2 text-sm leading-4;
14
+ }
15
+
16
+ &.button--size-default {
17
+ @apply px-4 py-2 text-sm;
18
+ }
19
+
20
+ &.button--size-lg {
21
+ @apply px-4 py-2 text-base;
22
+ }
23
+
24
+ &.button--size-xl {
25
+ @apply border px-6 py-3 text-base;
26
+ }
27
+
28
+ &.button--variant-outlined {
29
+ @apply border bg-white;
30
+
31
+ &.button--color-default {
32
+ @apply border-primary-500 text-primary-700 hover:bg-primary-50 focus:ring-primary-500;
33
+ }
34
+
35
+ &.button--color-white {
36
+ @apply border-gray-300 text-gray-700 hover:bg-gray-50 focus:ring-gray-500;
37
+ }
38
+
39
+ &.button--color-success {
40
+ @apply border-success-500 text-success-700 hover:bg-success-50 focus:ring-success-500;
41
+ }
42
+
43
+ &.button--color-warning {
44
+ @apply border-warning-500 text-warning-700 hover:bg-warning-50 focus:ring-warning-500;
45
+ }
46
+
47
+ &.button--color-error {
48
+ @apply border-error-500 text-error-700 hover:bg-error-50 focus:ring-error-500;
49
+ }
50
+ }
51
+
52
+ &.button--variant-default {
53
+ @apply border-transparent text-white;
54
+
55
+ &.button--color-default {
56
+ @apply bg-primary-500 hover:bg-primary-600 focus:ring-primary-400;
57
+ }
58
+
59
+ &.button--color-white {
60
+ @apply bg-gray-50 text-gray-700 shadow-none hover:bg-gray-100 focus:ring-gray-500;
61
+ }
62
+
63
+ &.button--color-success {
64
+ @apply bg-success-500 hover:bg-success-600 focus:ring-success-400;
65
+ }
66
+
67
+ &.button--color-warning {
68
+ @apply bg-warning-500 hover:bg-warning-600 focus:ring-warning-400;
69
+ }
70
+
71
+ &.button--color-error {
72
+ @apply bg-error-500 hover:bg-error-600 focus:ring-error-400;
73
+ }
74
+ }
75
+ }
@@ -0,0 +1,28 @@
1
+ .uxf-component-structure-analyzer {
2
+ padding-bottom: 32px;
3
+
4
+ * {
5
+ padding: 32px !important;
6
+ border: 2px solid black !important;
7
+ position: relative !important;
8
+ color: lightgray !important;
9
+ background-color: white !important;
10
+ border-radius: initial !important;
11
+ margin: 4px !important;
12
+ font-family: monospace;
13
+ font-size: 12px;
14
+ min-width: 200px;
15
+ height: auto !important;
16
+
17
+ &::before {
18
+ position: absolute;
19
+ left: 4px;
20
+ top: 2px;
21
+ content: attr(class);
22
+ font-size: 12px;
23
+ line-height: 14px;
24
+ color: black;
25
+ font-weight: 500;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ .uxf-input-group {
2
+ @apply flex flex-row;
3
+
4
+ .uxf-input-wrapper {
5
+ @apply flex w-full flex-row;
6
+ }
7
+
8
+ .uxf-input {
9
+ @apply w-full px-2;
10
+ }
11
+
12
+ .uxf-input-left-element,
13
+ .uxf-input-right-element,
14
+ .uxf-input-left-addon,
15
+ .uxf-input-right-addon {
16
+ @apply flex flex-row items-center whitespace-nowrap;
17
+ }
18
+ }
@@ -0,0 +1,74 @@
1
+ .uxf-input-group {
2
+ @apply rounded-md text-sm shadow-sm;
3
+
4
+ .uxf-input-wrapper {
5
+ @apply h-10 rounded-md border border-gray-300;
6
+ }
7
+
8
+ .uxf-input {
9
+ @apply bg-transparent outline-none;
10
+ }
11
+
12
+ .uxf-input-left-element,
13
+ .uxf-input-right-element {
14
+ @apply text-gray-400;
15
+ }
16
+
17
+ .uxf-input-left-element {
18
+ @apply pl-2;
19
+ }
20
+ .uxf-input-right-element {
21
+ @apply pr-2;
22
+ }
23
+
24
+ .uxf-input-left-addon,
25
+ .uxf-input-right-addon {
26
+ @apply border border-gray-300 bg-gray-50 px-2 text-gray-500;
27
+ }
28
+
29
+ .uxf-input-left-addon {
30
+ @apply rounded-l-md border-r-0;
31
+ }
32
+
33
+ .uxf-input-right-addon {
34
+ @apply rounded-r-md border-l-0;
35
+ }
36
+
37
+ &--has-right-addon {
38
+ .uxf-input-wrapper {
39
+ @apply rounded-r-none;
40
+ }
41
+ }
42
+
43
+ &--has-left-addon {
44
+ .uxf-input-wrapper {
45
+ @apply rounded-l-none;
46
+ }
47
+ }
48
+
49
+ &--focused {
50
+ .uxf-input-wrapper {
51
+ @apply border-primary-500 ring-1 ring-inset ring-primary-500 ring-offset-0;
52
+ }
53
+ }
54
+
55
+ &--invalid {
56
+ &.uxf-input-group--focused {
57
+ .uxf-input-wrapper {
58
+ @apply ring-1 ring-inset ring-error-500 ring-offset-0;
59
+ }
60
+ }
61
+ .uxf-input-wrapper {
62
+ @apply border-error-500 placeholder-error-300;
63
+
64
+ .uxf-input-left-element,
65
+ .uxf-input-right-element {
66
+ @apply text-error-500;
67
+ }
68
+
69
+ .uxf-input {
70
+ @apply text-error-900 placeholder-error-300;
71
+ }
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,24 @@
1
+ import { ChangeEvent, FocusEventHandler } from "react";
2
+ export interface FormControlProps<ValueType, ElementType = HTMLInputElement, RestParams extends unknown[] = []> {
3
+ value: ValueType;
4
+ onChange?: (value: ValueType, event?: ChangeEvent<ElementType>, ...args: RestParams) => void;
5
+ onBlur?: FocusEventHandler<ElementType>;
6
+ onFocus?: FocusEventHandler<ElementType>;
7
+ name?: string;
8
+ /**
9
+ * @about
10
+ * The input element will be disabled.
11
+ */
12
+ isDisabled?: boolean;
13
+ /**
14
+ * @about
15
+ * It prevents the user from changing the value of the field (not from interacting with the field).
16
+ */
17
+ isReadOnly?: boolean;
18
+ isInvalid?: boolean;
19
+ isRequired?: boolean;
20
+ }
21
+ export declare type OptionType<ValueType = string, LabelType = string> = {
22
+ value: ValueType;
23
+ label: LabelType;
24
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9ybS1jb250cm9sLXByb3BzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL2Zvcm0tY29udHJvbC1wcm9wcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ interface ComponentStructureAnalyzerProps {
3
+ children: ReactNode;
4
+ }
5
+ declare function ComponentStructureAnalyzer(props: ComponentStructureAnalyzerProps): JSX.Element;
6
+ export default ComponentStructureAnalyzer;
@@ -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
+ var react_1 = __importDefault(require("react"));
7
+ function ComponentStructureAnalyzer(props) {
8
+ return (react_1.default.createElement("div", { className: "uxf-component-structure-analyzer" }, props.children));
9
+ }
10
+ exports.default = ComponentStructureAnalyzer;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LXN0cnVjdHVyZS1hbmFseXplci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9jb21wb25lbnQtc3RydWN0dXJlLWFuYWx5emVyLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLGdEQUF5QztBQUt6QyxTQUFTLDBCQUEwQixDQUFDLEtBQXNDO0lBQ3hFLE9BQU8sQ0FDTCx1Q0FBSyxTQUFTLEVBQUMsa0NBQWtDLElBQUUsS0FBSyxDQUFDLFFBQVEsQ0FBTyxDQUN6RSxDQUFDO0FBQ0osQ0FBQztBQUVELGtCQUFlLDBCQUEwQixDQUFDIn0=
package/utils/cx.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare type ClassArray = ClassValue[];
2
+ export declare type ClassValue = ClassArray | Record<string, any> | string | number | null | boolean | undefined;
3
+ export declare function cx(...classes: ClassValue[]): string;
package/utils/cx.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cx = void 0;
4
+ function toVal(mix) {
5
+ var k;
6
+ var y;
7
+ var str = "";
8
+ if (typeof mix === "string" || typeof mix === "number") {
9
+ str += mix;
10
+ }
11
+ else if (typeof mix === "object") {
12
+ if (Array.isArray(mix)) {
13
+ for (k = 0; k < mix.length; k++) {
14
+ if (mix[k]) {
15
+ if ((y = toVal(mix[k]))) {
16
+ if (str) {
17
+ str += " ";
18
+ }
19
+ str += y;
20
+ }
21
+ }
22
+ }
23
+ }
24
+ else {
25
+ for (k in mix) {
26
+ if (mix === null || mix === void 0 ? void 0 : mix[k]) {
27
+ if (str) {
28
+ str += " ";
29
+ }
30
+ str += k;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ return str;
36
+ }
37
+ function cx() {
38
+ var classes = [];
39
+ for (var _i = 0; _i < arguments.length; _i++) {
40
+ classes[_i] = arguments[_i];
41
+ }
42
+ var i = 0;
43
+ var tmp;
44
+ var x;
45
+ var str = "";
46
+ while (i < classes.length) {
47
+ if ((tmp = classes[i++])) {
48
+ if ((x = toVal(tmp))) {
49
+ if (str) {
50
+ str += " ";
51
+ }
52
+ str += x;
53
+ }
54
+ }
55
+ }
56
+ return str;
57
+ }
58
+ exports.cx = cx;
59
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbHMvY3gudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EsU0FBUyxLQUFLLENBQUMsR0FBZTtJQUMxQixJQUFJLENBQUMsQ0FBQztJQUNOLElBQUksQ0FBQyxDQUFDO0lBQ04sSUFBSSxHQUFHLEdBQUcsRUFBRSxDQUFDO0lBRWIsSUFBSSxPQUFPLEdBQUcsS0FBSyxRQUFRLElBQUksT0FBTyxHQUFHLEtBQUssUUFBUSxFQUFFO1FBQ3BELEdBQUcsSUFBSSxHQUFHLENBQUM7S0FDZDtTQUFNLElBQUksT0FBTyxHQUFHLEtBQUssUUFBUSxFQUFFO1FBQ2hDLElBQUksS0FBSyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsRUFBRTtZQUNwQixLQUFLLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLEdBQUcsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVB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EdBQUcsRUFBRTtvQkFDTCxHQUFHLElBQUksR0FBRyxDQUFDO2lCQUNkO2dCQUNELEdBQUcsSUFBSSxDQUFDLENBQUM7YUFDWjtTQUNKO0tBQ0o7SUFFRCxPQUFPLEdBQUcsQ0FBQztBQUNmLENBQUM7QUFsQkQsZ0JBa0JDIn0=
@@ -0,0 +1,12 @@
1
+ import { ForwardedRef, ForwardRefExoticComponent, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
2
+ export declare type ForwardRefRenderFunction<T, P> = {
3
+ (props: P, ref: ForwardedRef<T>): ReactElement | null;
4
+ displayName?: string;
5
+ /** defaultProps are not supported on render functions */
6
+ defaultProps?: never;
7
+ /** propTypes are not supported on render functions */
8
+ propTypes?: never;
9
+ /** used by Chakra */
10
+ id?: string;
11
+ };
12
+ export declare const forwardRef: <T, P>(name: string, render: ForwardRefRenderFunction<T, P>) => ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.forwardRef = void 0;
4
+ var react_1 = require("react");
5
+ var forwardRef = function (name, render) {
6
+ var Component = (0, react_1.forwardRef)(render);
7
+ Component.displayName = name;
8
+ return Component;
9
+ };
10
+ exports.forwardRef = forwardRef;
11
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9yd2FyZFJlZi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9mb3J3YXJkUmVmLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLCtCQU9lO0FBZVIsSUFBTSxVQUFVLEdBQUcsVUFDeEIsSUFBWSxFQUNaLE1BQXNDO0lBRXRDLElBQU0sU0FBUyxHQUFHLElBQUEsa0JBQWUsRUFBQyxNQUFNLENBQUMsQ0FBQztJQUMxQyxTQUFTLENBQUMsV0FBVyxHQUFHLElBQUksQ0FBQztJQUM3QixPQUFPLFNBQVMsQ0FBQztBQUNuQixDQUFDLENBQUM7QUFQVyxRQUFBLFVBQVUsY0FPckIifQ==
@@ -1,51 +0,0 @@
1
- .button {
2
- @apply inline-flex shadow-sm items-center shadow-sm font-medium rounded focus:outline-none focus:ring-2 focus:ring-offset-2;
3
-
4
- &.button--disabled {
5
- @apply pointer-events-none opacity-40;
6
- }
7
-
8
- &.button--size-xs {
9
- @apply px-2.5 py-1.5 text-xs;
10
- }
11
-
12
- &.button--size-sm {
13
- @apply px-3 py-2 text-sm leading-4;
14
- }
15
-
16
- &.button--size-default {
17
- @apply px-4 py-2 text-sm;
18
- }
19
-
20
- &.button--size-lg {
21
- @apply px-4 py-2 text-base;
22
- }
23
-
24
- &.button--size-xl {
25
- @apply px-6 py-3 border text-base;
26
- }
27
-
28
- &.button--variant-outlined {
29
- @apply border bg-white;
30
-
31
- &.button--color-default {
32
- @apply border-primary-300 text-primary-700 hover:bg-primary-50 focus:ring-primary-500;
33
- }
34
-
35
- &.button--color-secondary {
36
- @apply border-secondary-300 text-secondary-700 hover:bg-secondary-50 focus:ring-secondary-500;
37
- }
38
- }
39
-
40
- &.button--variant-default {
41
- @apply border-transparent text-white;
42
-
43
- &.button--color-default {
44
- @apply bg-primary-500 hover:bg-primary-600 focus:ring-primary-400;
45
- }
46
-
47
- &.button--color-secondary {
48
- @apply bg-secondary-500 hover:bg-secondary-600 focus:ring-secondary-400;
49
- }
50
- }
51
- }