@uxf/ui 10.0.0-beta.9 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_file-input-base/file-input-base.js +15 -1
- package/_file-input-base/index.d.ts +1 -1
- package/_input-with-popover/input-with-popover.d.ts +4 -3
- package/_input-with-popover/input-with-popover.js +26 -26
- package/_select-base/_select-base.d.ts +3 -2
- package/_select-base/_select-base.js +6 -5
- package/_select-base/index.d.ts +1 -1
- package/alert-bubble/alert-bubble.d.ts +8 -0
- package/alert-bubble/alert-bubble.js +22 -0
- package/alert-bubble/alert-bubble.spec.d.ts +1 -0
- package/alert-bubble/alert-bubble.spec.js +9 -0
- package/alert-bubble/alert-bubble.stories.d.ts +7 -0
- package/alert-bubble/alert-bubble.stories.js +50 -0
- package/alert-bubble/index.d.ts +3 -0
- package/alert-bubble/index.js +5 -0
- package/alert-bubble/theme.d.ts +16 -0
- package/alert-bubble/theme.js +2 -0
- package/avatar/README.md +8 -0
- package/avatar/avatar.stories.js +1 -1
- package/avatar/index.d.ts +1 -1
- package/avatar-file-input/README.md +1 -0
- package/avatar-file-input/avatar-file-input.d.ts +3 -0
- package/avatar-file-input/avatar-file-input.js +12 -6
- package/avatar-file-input/avatar-file-input.stories.js +5 -5
- package/avatar-file-input/index.d.ts +1 -1
- package/avatar-file-input/theme.d.ts +5 -0
- package/avatar-file-input/theme.js +2 -0
- package/badge/README.md +1 -0
- package/badge/badge.d.ts +1 -1
- package/badge/badge.stories.js +1 -1
- package/badge/index.d.ts +1 -1
- package/button/README.md +68 -0
- package/button/button.stories.js +0 -1
- package/button/index.d.ts +1 -1
- package/button/theme.d.ts +1 -0
- package/button-group/README.md +1 -0
- package/button-group/button-group.js +1 -1
- package/button-group/button-group.stories.js +1 -1
- package/button-group/index.d.ts +1 -1
- package/button-list/README.md +1 -0
- package/button-list/button-list.d.ts +1 -1
- package/button-list/button-list.js +22 -22
- package/button-list/index.d.ts +1 -1
- package/calendar/README.md +1 -0
- package/calendar/calendar-day-cell.d.ts +4 -1
- package/calendar/calendar-day-cell.js +18 -18
- package/{date-picker/date-picker-navigation.d.ts → calendar/calendar-navigation.d.ts} +2 -3
- package/{date-picker/date-picker-navigation.js → calendar/calendar-navigation.js} +6 -6
- package/calendar/calendar-provider.js +2 -2
- package/calendar/calendar.d.ts +5 -0
- package/calendar/calendar.js +6 -9
- package/calendar/calendar.stories.js +1 -1
- package/calendar/index.d.ts +4 -1
- package/calendar/index.js +5 -15
- package/checkbox/README.md +1 -0
- package/checkbox/checkbox.stories.js +1 -1
- package/checkbox/index.d.ts +1 -1
- package/checkbox-button/README.md +1 -0
- package/checkbox-button/checkbox-button.js +2 -2
- package/checkbox-button/checkbox-button.stories.js +1 -1
- package/checkbox-button/index.d.ts +1 -1
- package/checkbox-input/README.md +1 -0
- package/checkbox-input/checkbox-input.d.ts +1 -1
- package/checkbox-input/checkbox-input.stories.js +1 -1
- package/checkbox-input/index.d.ts +1 -1
- package/chip/README.md +1 -0
- package/chip/chip.d.ts +1 -1
- package/chip/chip.js +5 -3
- package/chip/chip.stories.js +37 -31
- package/chip/index.d.ts +2 -2
- package/color-radio/README.md +8 -0
- package/color-radio/color-radio.js +1 -1
- package/color-radio/index.d.ts +1 -1
- package/color-radio-group/README.md +9 -0
- package/color-radio-group/color-radio-group.js +3 -3
- package/color-radio-group/color-radio-group.stories.js +1 -1
- package/color-radio-group/index.d.ts +1 -1
- package/combobox/README.md +12 -0
- package/combobox/combobox.d.ts +1 -1
- package/combobox/combobox.js +1 -1
- package/combobox/combobox.stories.d.ts +2 -1
- package/combobox/combobox.stories.js +7 -3
- package/combobox/index.d.ts +1 -1
- package/config/icons-config.d.ts +1 -1
- package/config/icons-config.js +1 -1
- package/config/icons.d.ts +13 -3
- package/config/icons.js +3 -1
- package/content/types.d.ts +1 -1
- package/context/provider.js +1 -1
- package/create-component-preview-page/create-component-preview-page.d.ts +8 -0
- package/create-component-preview-page/create-component-preview-page.js +40 -0
- package/create-component-preview-page/index.d.ts +2 -0
- package/create-component-preview-page/index.js +18 -0
- package/create-component-preview-page/ui-components.d.ts +237 -0
- package/create-component-preview-page/ui-components.js +263 -0
- package/create-component-preview-page/ui-readmes.d.ts +2 -0
- package/create-component-preview-page/ui-readmes.js +102 -0
- package/css/alert-bubble.css +100 -0
- package/css/avatar-file-input.css +54 -20
- package/css/avatar.css +4 -4
- package/css/badge.css +5 -5
- package/css/button-group.css +1 -1
- package/css/button-list.css +2 -2
- package/css/button.css +78 -32
- package/css/calendar.css +115 -51
- package/css/checkbox-button.css +10 -10
- package/css/checkbox.css +9 -9
- package/css/chip.css +5 -3
- package/css/color-radio-group.css +1 -1
- package/css/color-radio.css +3 -3
- package/css/component-structure-analyzer.css +12 -12
- package/css/date-picker.css +10 -3
- package/css/date-range-picker.css +21 -0
- package/css/datetime-picker.css +2 -2
- package/css/dialog.css +55 -0
- package/css/dropdown.css +11 -3
- package/css/dropzone.css +6 -6
- package/css/error-message.css +1 -1
- package/css/file-input.css +2 -2
- package/css/flash-messages.css +133 -9
- package/css/icon.css +1 -1
- package/css/image-gallery.css +8 -8
- package/css/input-with-popover.css +1 -1
- package/css/input.css +10 -10
- package/css/layout.css +4 -4
- package/css/list-item.css +2 -2
- package/css/message.css +92 -0
- package/css/modal.css +10 -54
- package/css/multi-combobox.css +12 -12
- package/css/pagination.css +14 -14
- package/css/paper.css +1 -1
- package/css/radio-group.css +3 -3
- package/css/radio.css +7 -7
- package/css/raster-image.css +1 -1
- package/css/select-base.css +1 -1
- package/css/tabs.css +16 -16
- package/css/text-link.css +4 -4
- package/css/textarea.css +68 -76
- package/css/time-picker.css +12 -16
- package/css/toggle.css +3 -3
- package/css/tooltip.css +2 -2
- package/date-picker/README.md +9 -0
- package/date-picker/date-picker-content.d.ts +5 -2
- package/date-picker/date-picker-content.js +4 -3
- package/date-picker/date-picker-decade.js +10 -10
- package/date-picker/date-picker-month.js +6 -6
- package/date-picker/date-picker-year.js +2 -2
- package/date-picker/date-picker.d.ts +4 -1
- package/date-picker/date-picker.js +4 -2
- package/date-picker/date-picker.stories.js +2 -1
- package/date-picker/index.d.ts +1 -1
- package/date-picker-input/README.md +11 -0
- package/date-picker-input/date-picker-input.d.ts +2 -0
- package/date-picker-input/date-picker-input.js +5 -3
- package/date-picker-input/date-picker-input.stories.js +1 -1
- package/date-picker-input/index.d.ts +1 -1
- package/date-picker-input/index.js +3 -3
- package/date-range-picker/README.md +1 -0
- package/date-range-picker/date-range-picker-content.d.ts +5 -0
- package/date-range-picker/date-range-picker-content.js +56 -0
- package/date-range-picker/date-range-picker-decade.d.ts +6 -0
- package/date-range-picker/date-range-picker-decade.js +72 -0
- package/date-range-picker/date-range-picker-month.d.ts +8 -0
- package/date-range-picker/date-range-picker-month.js +69 -0
- package/date-range-picker/date-range-picker-year.d.ts +7 -0
- package/date-range-picker/date-range-picker-year.js +80 -0
- package/date-range-picker/date-range-picker.d.ts +11 -0
- package/date-range-picker/date-range-picker.js +51 -0
- package/date-range-picker/date-range-picker.spec.d.ts +1 -0
- package/date-range-picker/date-range-picker.spec.js +9 -0
- package/date-range-picker/date-range-picker.stories.d.ts +7 -0
- package/date-range-picker/date-range-picker.stories.js +43 -0
- package/date-range-picker/index.d.ts +3 -0
- package/date-range-picker/index.js +5 -0
- package/date-range-picker/types.d.ts +5 -0
- package/date-range-picker/types.js +2 -0
- package/date-range-picker-input/README.md +1 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +17 -0
- package/date-range-picker-input/date-range-picker-input.js +62 -0
- package/date-range-picker-input/date-range-picker-input.spec.d.ts +1 -0
- package/date-range-picker-input/date-range-picker-input.spec.js +9 -0
- package/date-range-picker-input/date-range-picker-input.stories.d.ts +10 -0
- package/date-range-picker-input/date-range-picker-input.stories.js +53 -0
- package/date-range-picker-input/index.d.ts +2 -0
- package/date-range-picker-input/index.js +5 -0
- package/datetime-picker/README.md +13 -0
- package/datetime-picker/datetime-picker.d.ts +3 -1
- package/datetime-picker/datetime-picker.js +5 -5
- package/datetime-picker/index.d.ts +1 -1
- package/datetime-picker/index.js +2 -2
- package/datetime-picker-input/README.md +1 -0
- package/datetime-picker-input/datetime-picker-input.d.ts +2 -0
- package/datetime-picker-input/datetime-picker-input.js +5 -3
- package/datetime-picker-input/datetime-picker-input.stories.js +1 -1
- package/datetime-picker-input/index.d.ts +1 -1
- package/datetime-picker-input/index.js +2 -2
- package/dialog/dialog.d.ts +11 -0
- package/{modal/modal-dialog.js → dialog/dialog.js} +9 -10
- package/dialog/dialog.spec.d.ts +1 -0
- package/dialog/dialog.spec.js +9 -0
- package/dialog/dialog.stories.d.ts +7 -0
- package/dialog/dialog.stories.js +47 -0
- package/dialog/index.d.ts +2 -0
- package/dialog/index.js +5 -0
- package/dialog/theme.d.ts +4 -0
- package/dialog/theme.js +2 -0
- package/dropdown/README.md +1 -0
- package/dropdown/dropdown.stories.js +2 -2
- package/dropdown/index.d.ts +1 -1
- package/dropzone/README.md +8 -0
- package/dropzone/dropzone-input.js +10 -6
- package/dropzone/dropzone-list.js +2 -16
- package/dropzone/dropzone.stories.js +7 -7
- package/error-message/README.md +7 -0
- package/error-message/error-message.stories.js +1 -1
- package/file-input/README.md +11 -0
- package/file-input/file-input.d.ts +3 -0
- package/file-input/file-input.js +10 -22
- package/file-input/file-input.stories.js +5 -5
- package/file-input/index.d.ts +1 -1
- package/flash-messages/README.md +23 -0
- package/flash-messages/flash-message.d.ts +1 -1
- package/flash-messages/flash-message.js +1 -1
- package/flash-messages/flash-messages.js +52 -18
- package/flash-messages/flash-messages.stories.js +12 -0
- package/flash-messages/index.d.ts +2 -2
- package/flash-messages/index.js +4 -4
- package/form-component/README.md +7 -0
- package/form-component/index.d.ts +1 -1
- package/hooks/use-dropdown.d.ts +16 -8
- package/icon/README.md +11 -0
- package/icon/icon.stories.js +1 -1
- package/icon/index.d.ts +1 -1
- package/image-gallery/components/close-button.d.ts +2 -1
- package/image-gallery/components/close-button.js +2 -3
- package/image-gallery/components/gallery.d.ts +4 -1
- package/image-gallery/components/gallery.js +6 -5
- package/image-gallery/components/next-button.d.ts +7 -0
- package/image-gallery/components/next-button.js +14 -0
- package/image-gallery/components/prev-button.d.ts +7 -0
- package/image-gallery/components/prev-button.js +14 -0
- package/image-gallery/image-gallery.d.ts +4 -1
- package/image-gallery/image-gallery.js +2 -2
- package/image-gallery/image-gallery.stories.js +5 -1
- package/image-gallery/image.d.ts +1 -1
- package/image-gallery/image.js +1 -1
- package/image-gallery/use-image.js +1 -1
- package/input/README.md +8 -0
- package/input/input-element.d.ts +1 -0
- package/input/input-element.js +1 -1
- package/input/input.d.ts +2 -2
- package/input/input.js +3 -3
- package/input/input.stories.js +3 -3
- package/label/README.md +7 -0
- package/label/index.d.ts +1 -1
- package/label/label.stories.js +1 -1
- package/layout/index.d.ts +1 -1
- package/layout/layout.js +28 -28
- package/list-item/README.md +7 -0
- package/list-item/index.d.ts +1 -1
- package/list-item/list-item.stories.js +1 -1
- package/loader/README.md +7 -0
- package/loader/index.d.ts +1 -1
- package/message/README.md +1 -0
- package/message/index.d.ts +3 -0
- package/message/index.js +7 -0
- package/message/message-content.d.ts +17 -0
- package/message/message-content.js +41 -0
- package/message/message-service.d.ts +13 -0
- package/message/message-service.js +29 -0
- package/message/message.d.ts +20 -0
- package/message/message.js +47 -0
- package/message/message.spec.d.ts +1 -0
- package/message/message.spec.js +9 -0
- package/message/message.stories.d.ts +7 -0
- package/message/message.stories.js +82 -0
- package/message/theme.d.ts +12 -0
- package/message/theme.js +2 -0
- package/modal/README.md +24 -0
- package/modal/index.d.ts +3 -2
- package/modal/index.js +3 -3
- package/modal/modal.d.ts +6 -4
- package/modal/modal.js +9 -9
- package/modal/modal.stories.js +12 -0
- package/modal/theme.d.ts +7 -0
- package/multi-combobox/README.md +10 -0
- package/multi-combobox/_multi-combobox-base.js +28 -22
- package/multi-combobox/multi-combobox.js +1 -1
- package/multi-combobox/multi-combobox.stories.js +7 -4
- package/multi-combobox/types.d.ts +5 -1
- package/multi-select/README.md +11 -0
- package/multi-select/_multi-select-base.js +21 -21
- package/multi-select/index.d.ts +1 -1
- package/multi-select/multi-select.js +1 -1
- package/multi-select/multi-select.stories.js +6 -3
- package/multi-select/types.d.ts +1 -1
- package/package.json +17 -12
- package/pagination/README.md +31 -0
- package/pagination/index.d.ts +1 -1
- package/pagination/pagination.d.ts +1 -1
- package/pagination/pagination.js +2 -2
- package/pagination/pagination.stories.d.ts +0 -3
- package/pagination/pagination.stories.js +14 -30
- package/paper/README.md +7 -0
- package/paper/index.d.ts +1 -1
- package/paper/paper.stories.js +1 -1
- package/radio/README.md +7 -0
- package/radio/index.d.ts +1 -1
- package/radio/radio.stories.js +1 -1
- package/radio-group/README.md +8 -0
- package/radio-group/index.d.ts +2 -2
- package/radio-group/radio-group.d.ts +3 -3
- package/radio-group/radio-group.js +2 -2
- package/radio-group/radio-group.stories.js +5 -5
- package/raster-image/README.md +7 -0
- package/raster-image/index.d.ts +1 -1
- package/raster-image/raster-image.js +1 -1
- package/scripts/generate-tw-tokens.js +40 -32
- package/select/README.md +11 -0
- package/select/index.d.ts +1 -1
- package/select/select.d.ts +1 -4
- package/select/select.js +2 -2
- package/select/select.stories.d.ts +2 -1
- package/select/select.stories.js +9 -3
- package/tabs/README.md +7 -0
- package/tabs/index.d.ts +1 -1
- package/text-input/README.md +10 -0
- package/text-input/index.d.ts +1 -1
- package/text-input/text-input.d.ts +1 -0
- package/text-input/text-input.js +2 -2
- package/text-link/README.md +19 -0
- package/text-link/index.d.ts +1 -1
- package/text-link/text-link.d.ts +1 -1
- package/textarea/README.md +9 -0
- package/textarea/index.d.ts +1 -1
- package/textarea/textarea.js +5 -5
- package/textarea/textarea.stories.js +1 -1
- package/time-picker/README.md +8 -0
- package/time-picker/index.d.ts +1 -1
- package/time-picker/time-picker-hour.js +6 -6
- package/time-picker/time-picker-hours.js +2 -2
- package/time-picker/time-picker-input.stories.js +2 -1
- package/time-picker/time-picker-minute.js +6 -6
- package/time-picker/time-picker-minutes.js +2 -2
- package/time-picker/time-picker.d.ts +2 -1
- package/time-picker/time-picker.js +7 -6
- package/time-picker-input/README.md +9 -0
- package/time-picker-input/index.d.ts +1 -1
- package/time-picker-input/index.js +3 -3
- package/time-picker-input/time-picker-input.js +6 -4
- package/time-picker-input/time-picker-input.stories.js +1 -1
- package/toggle/README.md +7 -0
- package/toggle/index.d.ts +1 -1
- package/toggle/toggle.js +8 -8
- package/toggle/toggle.stories.js +1 -1
- package/tooltip/README.md +7 -0
- package/tooltip/index.d.ts +2 -2
- package/tooltip/tooltip.js +27 -25
- package/tooltip/tooltip.stories.js +1 -1
- package/tooltip/use-tooltip.d.ts +19 -11
- package/tooltip/use-tooltip.js +15 -15
- package/tw-tokens/tw-colors.d.ts +283 -282
- package/tw-tokens/tw-colors.js +283 -282
- package/tw-tokens/tw-line-height.d.ts +8 -8
- package/tw-tokens/tw-line-height.js +8 -8
- package/tw-tokens/tw-spacing.d.ts +34 -34
- package/tw-tokens/tw-spacing.js +34 -34
- package/tw-tokens/tw-z-index.d.ts +7 -7
- package/tw-tokens/tw-z-index.js +7 -7
- package/types/index.d.ts +1 -1
- package/types/index.js +1 -1
- package/typography/README.md +7 -0
- package/utils/action.d.ts +2 -1
- package/utils/action.js +2 -2
- package/utils/files/get-file-icon.d.ts +2 -0
- package/utils/files/get-file-icon.js +19 -0
- package/utils/icons-config.js +13 -3
- package/utils/mocks/{uploadFIle.mock.js → upload-file.mock.js} +1 -1
- package/utils/snap-test.js +1 -1
- package/utils/storybook-config.d.ts +12 -2
- package/utils/storybook-config.js +9 -1
- package/utils/tailwind-config.js +10 -1
- package/image-gallery/components/arrow-button.d.ts +0 -7
- package/image-gallery/components/arrow-button.js +0 -14
- package/modal/modal-dialog.d.ts +0 -11
- /package/utils/mocks/{uploadFIle.mock.d.ts → upload-file.mock.d.ts} +0 -0
|
@@ -26,7 +26,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports._FileInputBase = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
exports._FileInputBase = (0, react_1.forwardRef)((props, ref) => {
|
|
29
|
-
const onChange = (e) =>
|
|
29
|
+
const onChange = async (e) => {
|
|
30
|
+
var _a;
|
|
31
|
+
if (e.target.files) {
|
|
32
|
+
try {
|
|
33
|
+
const response = await props.onUploadFile(e.target.files[0]);
|
|
34
|
+
await props.onChange(response, e);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
(_a = props.onUploadError) === null || _a === void 0 ? void 0 : _a.call(props, err);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
props.onChange(null, e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
30
44
|
return (react_1.default.createElement("input", { accept: props.accept, "aria-invalid": props.isInvalid, "aria-describedby": props["aria-describedby"], className: props.className, disabled: props.isDisabled, form: props.form, id: props.id, name: props.name, onBlur: props.onBlur, onChange: onChange, onFocus: props.onFocus, readOnly: props.isReadOnly, ref: ref, required: props.isRequired, tabIndex: props.isDisabled ? -1 : undefined, type: "file" }));
|
|
31
45
|
});
|
|
32
46
|
exports._FileInputBase.displayName = "UxfUiFileInputBase";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Clearable, FormControlProps } from "../types";
|
|
2
|
-
import { InputProps } from "../input";
|
|
3
|
-
import React, { MutableRefObject, ReactElement, ReactNode } from "react";
|
|
4
1
|
import { Placement, Strategy } from "@floating-ui/react";
|
|
2
|
+
import React, { MutableRefObject, ReactElement, ReactNode } from "react";
|
|
3
|
+
import { InputProps } from "../input";
|
|
4
|
+
import { Clearable, FormControlProps } from "../types";
|
|
5
5
|
export interface InputWithPopoverProps<ValueType = string> extends FormControlProps<ValueType>, Pick<InputProps, "size" | "variant">, Clearable {
|
|
6
|
+
autoFocus?: boolean;
|
|
6
7
|
className?: string;
|
|
7
8
|
children: (args: {
|
|
8
9
|
close: (focusableElement?: HTMLElement | MutableRefObject<HTMLElement | null>) => void;
|
|
@@ -24,15 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports._InputWithPopover = void 0;
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
|
-
const cx_1 = require("@uxf/core/utils/cx");
|
|
27
|
+
const react_1 = require("@floating-ui/react");
|
|
28
|
+
const react_2 = require("@headlessui/react");
|
|
31
29
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
-
const
|
|
30
|
+
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
33
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
32
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
|
+
const react_3 = __importStar(require("react"));
|
|
34
34
|
const form_component_1 = require("../form-component");
|
|
35
|
-
const
|
|
35
|
+
const input_1 = require("../input");
|
|
36
36
|
function useErrorProps(error, id, isInvalid) {
|
|
37
37
|
const errorId = isInvalid ? `${id}--error-message` : undefined;
|
|
38
38
|
return {
|
|
@@ -42,20 +42,20 @@ function useErrorProps(error, id, isInvalid) {
|
|
|
42
42
|
ariaInvalid: !!error,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
exports._InputWithPopover = (0,
|
|
45
|
+
exports._InputWithPopover = (0, react_3.forwardRef)((props, ref) => {
|
|
46
46
|
var _a, _b, _c;
|
|
47
|
-
const generatedId = (0,
|
|
47
|
+
const generatedId = (0, react_3.useId)();
|
|
48
48
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
49
|
-
const innerRef = (0,
|
|
49
|
+
const innerRef = (0, react_3.useRef)(null);
|
|
50
50
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
51
51
|
const error = useErrorProps(props.error, id, props.isInvalid);
|
|
52
52
|
const rootClassName = (0, cx_1.cx)("uxf-input-with-popover", ((_b = props.isFocused) !== null && _b !== void 0 ? _b : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
|
53
|
-
const floatingPopover = (0,
|
|
53
|
+
const floatingPopover = (0, react_1.useFloating)({
|
|
54
54
|
placement: (_c = props.popoverPlacement) !== null && _c !== void 0 ? _c : "bottom",
|
|
55
55
|
middleware: [
|
|
56
|
-
(0,
|
|
57
|
-
(0,
|
|
58
|
-
(0,
|
|
56
|
+
(0, react_1.flip)(),
|
|
57
|
+
(0, react_1.shift)(),
|
|
58
|
+
(0, react_1.size)({
|
|
59
59
|
apply({ availableHeight, availableWidth, elements }) {
|
|
60
60
|
Object.assign(elements.floating.style, {
|
|
61
61
|
maxHeight: Math.max(50, availableHeight) + "px",
|
|
@@ -65,25 +65,25 @@ exports._InputWithPopover = (0, react_1.forwardRef)((props, ref) => {
|
|
|
65
65
|
}),
|
|
66
66
|
],
|
|
67
67
|
strategy: props.popoverStrategy,
|
|
68
|
-
whileElementsMounted: (reference, floating, update) => (0,
|
|
68
|
+
whileElementsMounted: (reference, floating, update) => (0, react_1.autoUpdate)(reference, floating, update, {
|
|
69
69
|
elementResize: typeof ResizeObserver !== "undefined",
|
|
70
70
|
}),
|
|
71
71
|
});
|
|
72
72
|
const isInteractive = !props.isDisabled && !props.isReadOnly;
|
|
73
73
|
const showRemoveButton = !!(props.value && isInteractive && props.isClearable);
|
|
74
|
-
return (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
props.leftAddon &&
|
|
78
|
-
props.leftElement &&
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
showRemoveButton &&
|
|
82
|
-
|
|
74
|
+
return (react_3.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: error.errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
75
|
+
react_3.default.createElement(react_2.Popover, { as: react_3.Fragment }, (renderProps) => (react_3.default.createElement(react_3.default.Fragment, null,
|
|
76
|
+
react_3.default.createElement(input_1.Input, { inputFocus: input, size: props.size, variant: props.variant, wrapperRef: floatingPopover.refs.setReference },
|
|
77
|
+
props.leftAddon && react_3.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
78
|
+
props.leftElement && react_3.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
79
|
+
react_3.default.createElement(input_1.Input.Element, { "aria-describedby": error.ariaDescribedby, "aria-errormessage": error.ariaErrormessage, "aria-invalid": error.ariaInvalid, "aria-live": "polite", autoComplete: "off", autoFocus: props.autoFocus, form: props.form, id: id, isDisabled: props.isDisabled, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onChange: props.onChange, placeholder: props.placeholder, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), type: "text", value: props.value }),
|
|
80
|
+
react_3.default.createElement(input_1.Input.RightElement, null,
|
|
81
|
+
showRemoveButton && react_3.default.createElement(input_1.Input.RemoveButton, { onChange: () => props.onChange("") }),
|
|
82
|
+
react_3.default.createElement(react_2.Popover.Button, { className: "uxf-input-with-popover__trigger-element" }, props.triggerElement),
|
|
83
83
|
props.rightElement),
|
|
84
|
-
props.rightAddon &&
|
|
85
|
-
isInteractive && renderProps.open && (
|
|
86
|
-
|
|
84
|
+
props.rightAddon && react_3.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
|
|
85
|
+
isInteractive && renderProps.open && (react_3.default.createElement(react_1.FloatingPortal, null,
|
|
86
|
+
react_3.default.createElement(react_2.Popover.Panel, { className: (0, cx_1.cx)("uxf-input-with-popover__panel", floatingPopover.placement === "bottom" &&
|
|
87
87
|
"uxf-input-with-popover__panel--bottom", floatingPopover.placement === "top" && "uxf-input-with-popover__panel--top"), ref: floatingPopover.refs.setFloating, static: true, style: floatingPopover.floatingStyles }, props.children))))))));
|
|
88
88
|
});
|
|
89
89
|
exports._InputWithPopover.displayName = "UxfUiInputWithPopover";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Placement, Strategy } from "@floating-ui/react";
|
|
2
2
|
import type { Combobox as HUICombobox, Listbox as HUIListbox } from "@headlessui/react";
|
|
3
3
|
import { IconsSet } from "@uxf/ui/icon/theme";
|
|
4
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
4
5
|
import { Clearable, FormControlProps } from "@uxf/ui/types";
|
|
5
6
|
import React, { ReactElement, ReactNode, Ref } from "react";
|
|
6
|
-
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type SelectBaseValueId = number | string;
|
|
8
8
|
export type SelectBaseValue<ValueId = SelectBaseValueId> = {
|
|
9
9
|
id: ValueId;
|
|
@@ -17,6 +17,7 @@ export interface SelectBaseProps<Value, Option> extends FormControlProps<Value |
|
|
|
17
17
|
children: ReactElement;
|
|
18
18
|
className?: string;
|
|
19
19
|
customInputElementDisplayName: string;
|
|
20
|
+
dropdownMatchesInputWidth?: boolean;
|
|
20
21
|
dropdownPlacement?: Placement;
|
|
21
22
|
dropdownStrategy?: Strategy;
|
|
22
23
|
emptyMessage: string;
|
|
@@ -28,7 +29,7 @@ export interface SelectBaseProps<Value, Option> extends FormControlProps<Value |
|
|
|
28
29
|
label: ReactNode;
|
|
29
30
|
options?: Option[];
|
|
30
31
|
placeholder?: string;
|
|
31
|
-
renderOption?: (option: Option) => ReactNode;
|
|
32
|
+
renderOption?: (option: Option, isSelected: boolean) => ReactNode;
|
|
32
33
|
size?: keyof InputGroupSizes;
|
|
33
34
|
variant?: keyof InputGroupVariants;
|
|
34
35
|
leftAddon?: ReactNode;
|
|
@@ -54,23 +54,24 @@ const Options = (props) => {
|
|
|
54
54
|
var _a, _b;
|
|
55
55
|
const HUIComponent = props.HUIComponent;
|
|
56
56
|
return (react_2.default.createElement(HUIComponent.Options, { className: (0, cx_1.cx)("uxf-dropdown", `uxf-dropdown--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-dropdown--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, props.placement === "bottom" && "uxf-dropdown--bottom", props.placement === "top" && "uxf-dropdown--top"), ref: props.forwardRef, static: true, style: props.style }, props.options && props.options.length > 0 ? (props.options.map((option) => {
|
|
57
|
-
var _a
|
|
57
|
+
var _a;
|
|
58
58
|
const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
|
|
59
|
-
|
|
59
|
+
const _option = option;
|
|
60
|
+
return (react_2.default.createElement(HUIComponent.Option, { disabled: _option.disabled, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: optionKey !== null && optionKey !== void 0 ? optionKey : _option.id, value: option }, (optionState) => { var _a, _b; return (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option, optionState.selected)) !== null && _b !== void 0 ? _b : option.label; }));
|
|
60
61
|
})) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, props.emptyMessage))));
|
|
61
62
|
};
|
|
62
63
|
Options.displayName = "UxfUiSelectBaseOptions";
|
|
63
64
|
const _SelectBase = (props) => {
|
|
64
|
-
var _a, _b;
|
|
65
|
+
var _a, _b, _c;
|
|
65
66
|
const generatedId = (0, react_2.useId)();
|
|
66
67
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
67
68
|
const innerRef = (0, react_2.useRef)(null);
|
|
68
69
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
69
70
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
70
|
-
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", true, props.dropdownStrategy);
|
|
71
|
+
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", (_c = props.dropdownMatchesInputWidth) !== null && _c !== void 0 ? _c : true, props.dropdownStrategy);
|
|
71
72
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, props.forwardRef, dropdown.refs.setReference), [dropdown.refs.setReference, props.forwardRef]);
|
|
72
73
|
const HUIComponent = props.HUIComponent;
|
|
73
|
-
return (react_2.default.createElement(HUIComponent, { as: "div", className: (0, cx_1.cx)("uxf-form-component uxf-select-base", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, onChange: props.onChange, value: props.value }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
74
|
+
return (react_2.default.createElement(HUIComponent, { as: "div", by: "id", className: (0, cx_1.cx)("uxf-form-component uxf-select-base", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), "data-testid": id, disabled: props.isDisabled || props.isReadOnly, onChange: props.onChange, value: props.value }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
74
75
|
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
|
75
76
|
react_2.default.createElement(HUIComponent.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label)),
|
|
76
77
|
react_2.default.createElement("div", { className: "uxf-form-component__input" },
|
package/_select-base/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { AlertBubbleColor, AlertBubbleSize } from "./theme";
|
|
3
|
+
export interface AlertBubbleProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
color?: AlertBubbleColor;
|
|
6
|
+
size?: AlertBubbleSize;
|
|
7
|
+
}
|
|
8
|
+
export declare const AlertBubble: FC<AlertBubbleProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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.AlertBubble = void 0;
|
|
7
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const icon_1 = require("../icon");
|
|
10
|
+
const ICON = {
|
|
11
|
+
default: "triangle-exclamation",
|
|
12
|
+
error: "xmark",
|
|
13
|
+
warning: "triangle-exclamation",
|
|
14
|
+
success: "check",
|
|
15
|
+
};
|
|
16
|
+
const AlertBubble = (props) => {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-alert-bubble", `uxf-alert-bubble--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "default"}`, `uxf-alert-bubble--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, props.className) },
|
|
19
|
+
react_1.default.createElement(icon_1.Icon, { className: "uxf-alert-bubble__icon", name: ICON[(_c = props.color) !== null && _c !== void 0 ? _c : "default"] })));
|
|
20
|
+
};
|
|
21
|
+
exports.AlertBubble = AlertBubble;
|
|
22
|
+
exports.AlertBubble.displayName = "UxfUiAlertBubble";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
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 snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const alert_bubble_stories_1 = require("./alert-bubble.stories");
|
|
9
|
+
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(alert_bubble_stories_1.Default, null));
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Default = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const storybook_config_1 = require("../utils/storybook-config");
|
|
29
|
+
const alert_bubble_1 = require("./alert-bubble");
|
|
30
|
+
exports.default = {
|
|
31
|
+
title: "UI/AlertBubble",
|
|
32
|
+
component: alert_bubble_1.AlertBubble,
|
|
33
|
+
};
|
|
34
|
+
function Default() {
|
|
35
|
+
const config = (0, storybook_config_1.useStorybookConfig)("AlertBubble");
|
|
36
|
+
const storyAlertBubbles = config.colors.map((color) => (react_1.default.createElement(react_1.Fragment, { key: color }, config.sizes.map((size) => (react_1.default.createElement("div", { key: `${size}${color}`, className: "space-y-2 pb-4" },
|
|
37
|
+
react_1.default.createElement("div", { className: "text-sm dark:text-gray-100" },
|
|
38
|
+
"Color: ",
|
|
39
|
+
react_1.default.createElement("span", { className: "font-semibold" }, color),
|
|
40
|
+
", Size:",
|
|
41
|
+
" ",
|
|
42
|
+
react_1.default.createElement("span", { className: "font-semibold" }, size)),
|
|
43
|
+
react_1.default.createElement("div", { className: "flex flex-row items-start gap-2" },
|
|
44
|
+
react_1.default.createElement(alert_bubble_1.AlertBubble, { color: color, size: size })),
|
|
45
|
+
react_1.default.createElement("hr", null)))))));
|
|
46
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
47
|
+
react_1.default.createElement("div", { className: "light space-y-2 p-20" }, storyAlertBubbles),
|
|
48
|
+
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20" }, storyAlertBubbles)));
|
|
49
|
+
}
|
|
50
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlertBubble = void 0;
|
|
4
|
+
var alert_bubble_1 = require("./alert-bubble");
|
|
5
|
+
Object.defineProperty(exports, "AlertBubble", { enumerable: true, get: function () { return alert_bubble_1.AlertBubble; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface AlertBubbleColors {
|
|
2
|
+
default: true;
|
|
3
|
+
success: true;
|
|
4
|
+
error: true;
|
|
5
|
+
warning: true;
|
|
6
|
+
}
|
|
7
|
+
export type AlertBubbleColor = keyof AlertBubbleColors;
|
|
8
|
+
export interface AlertBubbleSizes {
|
|
9
|
+
xs: true;
|
|
10
|
+
sm: true;
|
|
11
|
+
default: true;
|
|
12
|
+
lg: true;
|
|
13
|
+
xl: true;
|
|
14
|
+
"2xl": true;
|
|
15
|
+
}
|
|
16
|
+
export type AlertBubbleSize = keyof AlertBubbleSizes;
|
package/avatar/README.md
ADDED
package/avatar/avatar.stories.js
CHANGED
|
@@ -12,7 +12,7 @@ exports.default = {
|
|
|
12
12
|
};
|
|
13
13
|
function Default() {
|
|
14
14
|
const testAvatars = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
-
react_1.default.createElement(avatar_1.Avatar, { src: "https://
|
|
15
|
+
react_1.default.createElement(avatar_1.Avatar, { src: "https://images.pexels.com/photos/14934612/pexels-photo-14934612.jpeg?auto=compress&cs=tinysrgb&w=100&h=100&dpr=1" }),
|
|
16
16
|
react_1.default.createElement(avatar_1.Avatar, null)));
|
|
17
17
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
18
18
|
react_1.default.createElement("div", { className: "light flex items-center space-x-4 rounded bg-white p-8" }, testAvatars),
|
package/avatar/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# AvatarFileInput
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { FileInputBaseProps } from "../_file-input-base";
|
|
3
|
+
import { AvatarFileInputVariant } from "./theme";
|
|
3
4
|
export interface AvatarFileInputProps extends FileInputBaseProps {
|
|
4
5
|
helperText?: ReactNode;
|
|
5
6
|
label?: ReactNode;
|
|
7
|
+
changeFileLabel?: ReactNode;
|
|
8
|
+
variant?: AvatarFileInputVariant;
|
|
6
9
|
}
|
|
7
10
|
export declare const AvatarFileInput: React.ForwardRefExoticComponent<AvatarFileInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -27,21 +27,27 @@ exports.AvatarFileInput = void 0;
|
|
|
27
27
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
28
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
|
-
const
|
|
30
|
+
const file_1 = require("@uxf/core/utils/file");
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
32
|
const _file_input_base_1 = require("../_file-input-base");
|
|
33
|
+
const avatar_1 = require("../avatar");
|
|
33
34
|
const icon_1 = require("../icon");
|
|
34
|
-
exports.AvatarFileInput = (0,
|
|
35
|
+
exports.AvatarFileInput = (0, react_1.forwardRef)((props, ref) => {
|
|
36
|
+
var _a, _b;
|
|
35
37
|
const generatedId = (0, react_1.useId)();
|
|
36
38
|
const id = props.id || generatedId;
|
|
37
39
|
const innerRef = (0, react_1.useRef)(null);
|
|
38
40
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
39
41
|
const errorId = props.isInvalid && props.id ? `${props.id}--errormessage` : undefined;
|
|
40
42
|
const stateClassNames = (0, cx_1.cx)(input.focused && classes_1.CLASSES.IS_FOCUSED, (props.isDisabled || props.isReadOnly) && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const label = props.value && props.changeFileLabel ? props.changeFileLabel : props.label;
|
|
44
|
+
return (react_1.default.createElement("div", { className: `uxf-avatar-file-input uxf-avatar-file-input--variant-${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"} ${(_b = props.className) !== null && _b !== void 0 ? _b : ""}` },
|
|
45
|
+
react_1.default.createElement("div", { className: "uxf-avatar-file-input__label-wrapper" },
|
|
46
|
+
props.value ? (react_1.default.createElement(avatar_1.Avatar, { className: (0, cx_1.cx)("uxf-avatar-file-input__image", stateClassNames), src: (0, file_1.getFileUrl)(props.value) })) : (react_1.default.createElement("label", { className: (0, cx_1.cx)("uxf-avatar-file-input__label", stateClassNames), htmlFor: id, tabIndex: 0 },
|
|
47
|
+
react_1.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-avatar-file-input__label-icon", stateClassNames), name: "cloud", size: 28 }))),
|
|
48
|
+
(props.label && typeof props.label === "string") ||
|
|
49
|
+
(props.value && props.changeFileLabel && typeof props.changeFileLabel === "string") ? (react_1.default.createElement("label", { className: (0, cx_1.cx)("uxf-avatar-file-input__label-text", stateClassNames), htmlFor: id, tabIndex: 0 }, label)) : (label)),
|
|
45
50
|
react_1.default.createElement(_file_input_base_1._FileInputBase, { accept: props.accept, "aria-describedby": errorId, "aria-invalid": props.isInvalid, className: "uxf-avatar-file-input__input", form: props.form, id: id, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onBlur: input.onBlur, onChange: props.onChange, onFocus: input.onFocus, onUploadError: props.onUploadError, onUploadFile: props.onUploadFile, ref: ref, value: props.value }),
|
|
46
51
|
props.helperText && (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", errorId && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))));
|
|
47
52
|
});
|
|
53
|
+
exports.AvatarFileInput.displayName = "UxfUiAvatarFileInput";
|
|
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Default = void 0;
|
|
27
|
-
const
|
|
27
|
+
const upload_file_mock_1 = require("@uxf/ui/utils/mocks/upload-file.mock");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
|
-
const index_1 = require("./index");
|
|
30
29
|
const action_1 = require("../utils/action");
|
|
30
|
+
const index_1 = require("./index");
|
|
31
31
|
exports.default = {
|
|
32
32
|
title: "UI/AvatarFileInput",
|
|
33
33
|
component: index_1.AvatarFileInput,
|
|
@@ -46,9 +46,9 @@ function Default() {
|
|
|
46
46
|
console.log("Upload error", err);
|
|
47
47
|
};
|
|
48
48
|
const storyAvatarFileInputs = (react_1.default.createElement("div", { className: "space-y-8" },
|
|
49
|
-
react_1.default.createElement(index_1.AvatarFileInput, { onChange: onChange, onUploadError: onUploadError, onUploadFile:
|
|
50
|
-
react_1.default.createElement(index_1.AvatarFileInput, { isDisabled: true, onChange: onChange, onUploadError: onUploadError, onUploadFile:
|
|
51
|
-
react_1.default.createElement(index_1.AvatarFileInput, { id: "afi", isInvalid: true, label: "Vyberte Avatar", onChange: onChange, onUploadError: onUploadError, onUploadFile:
|
|
49
|
+
react_1.default.createElement(index_1.AvatarFileInput, { label: "Nahrajte fotku", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, variant: "square" }),
|
|
50
|
+
react_1.default.createElement(index_1.AvatarFileInput, { isDisabled: true, onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, variant: "square" }),
|
|
51
|
+
react_1.default.createElement(index_1.AvatarFileInput, { id: "afi", isInvalid: true, label: "Vyberte Avatar", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value })));
|
|
52
52
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
53
53
|
react_1.default.createElement("div", { className: "light space-y-2 p-20" }, storyAvatarFileInputs),
|
|
54
54
|
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20" }, storyAvatarFileInputs)));
|
package/badge/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Badge
|
package/badge/badge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from "react";
|
|
2
1
|
import { BadgeSizes } from "@uxf/ui/badge/theme";
|
|
2
|
+
import React, { HTMLAttributes } from "react";
|
|
3
3
|
export type BadgeSize = keyof BadgeSizes;
|
|
4
4
|
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
size?: BadgeSize;
|
package/badge/badge.stories.js
CHANGED
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const badge_1 = require("./badge");
|
|
9
8
|
const icon_1 = require("../icon");
|
|
9
|
+
const badge_1 = require("./badge");
|
|
10
10
|
exports.default = {
|
|
11
11
|
title: "UI/Badge",
|
|
12
12
|
component: badge_1.Badge,
|
package/badge/index.d.ts
CHANGED
package/button/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
### Props configuration
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
// button.d.ts
|
|
7
|
+
|
|
8
|
+
declare module "@uxf/ui/icon/theme" {
|
|
9
|
+
export interface ButtonVariants {
|
|
10
|
+
default: true;
|
|
11
|
+
outlined: true;
|
|
12
|
+
text: true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ButtonSizes {
|
|
16
|
+
xs: true;
|
|
17
|
+
sm: true;
|
|
18
|
+
default: true;
|
|
19
|
+
lg: true;
|
|
20
|
+
xl: true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ButtonColors {
|
|
24
|
+
default: true;
|
|
25
|
+
white: true;
|
|
26
|
+
success: true;
|
|
27
|
+
warning: true;
|
|
28
|
+
error: true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Css
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
// button.css
|
|
37
|
+
|
|
38
|
+
.uxf-button {
|
|
39
|
+
|
|
40
|
+
&__text {
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.is-disabled {
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.is-loading {
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--full-width {
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&--icon-button {
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&--size-{{ size }} {
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&--variant-{{ variant }} {
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
package/button/button.stories.js
CHANGED
|
@@ -28,7 +28,6 @@ const button_1 = require("@uxf/ui/button");
|
|
|
28
28
|
const icon_1 = require("@uxf/ui/icon");
|
|
29
29
|
const storybook_config_1 = require("@uxf/ui/utils/storybook-config");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
|
-
// import Docs from "./button.docs.mdx";
|
|
32
31
|
exports.default = {
|
|
33
32
|
title: "UI/Button",
|
|
34
33
|
component: button_1.Button,
|
package/button/index.d.ts
CHANGED
package/button/theme.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# ButtonGroup
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ButtonGroup = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
7
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const ButtonGroup = (props) => {
|
|
10
10
|
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-button-group", props.className), style: props.style }, props.children));
|
|
11
11
|
};
|
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const index_1 = require("./index");
|
|
9
8
|
const button_1 = require("../button");
|
|
10
9
|
const icon_1 = require("../icon");
|
|
11
10
|
const tooltip_1 = require("../tooltip");
|
|
11
|
+
const index_1 = require("./index");
|
|
12
12
|
exports.default = {
|
|
13
13
|
title: "UI/ButtonGroup",
|
|
14
14
|
component: index_1.ButtonGroup,
|
package/button-group/index.d.ts
CHANGED