@uxf/ui 1.0.0-beta.8 → 1.0.0-beta.81
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/_private-utils/get-provider-config.d.ts +2 -0
- package/_private-utils/get-provider-config.js +8 -0
- package/avatar/avatar.d.ts +5 -0
- package/avatar/avatar.js +14 -0
- package/avatar/avatar.stories.d.ts +7 -0
- package/avatar/avatar.stories.js +21 -0
- package/avatar/index.d.ts +1 -0
- package/avatar/index.js +5 -0
- package/avatar-file-input/avatar-file-input.d.ts +32 -0
- package/avatar-file-input/avatar-file-input.js +69 -0
- package/avatar-file-input/avatar-file-input.stories.d.ts +7 -0
- package/avatar-file-input/avatar-file-input.stories.js +30 -0
- package/avatar-file-input/index.d.ts +1 -0
- package/{storybook → avatar-file-input}/index.js +1 -2
- package/badge/badge.d.ts +7 -0
- package/badge/badge.js +15 -0
- package/badge/badge.stories.d.ts +7 -0
- package/badge/badge.stories.js +39 -0
- package/badge/index.d.ts +1 -0
- package/badge/index.js +5 -0
- package/badge/theme.d.ts +5 -0
- package/badge/theme.js +2 -0
- package/button/button.d.ts +13 -13
- package/button/button.js +16 -12
- package/button/button.stories.d.ts +14 -0
- package/button/button.stories.js +68 -0
- package/button/index.d.ts +1 -2
- package/button/index.js +1 -8
- package/button/theme.d.ts +5 -2
- package/button/theme.js +0 -1
- package/checkbox/checkbox.d.ts +9 -0
- package/checkbox/checkbox.js +24 -0
- package/checkbox/checkbox.stories.d.ts +7 -0
- package/checkbox/checkbox.stories.js +57 -0
- package/checkbox/index.d.ts +1 -0
- package/checkbox/index.js +17 -0
- package/checkbox-button/checkbox-button.d.ts +8 -0
- package/checkbox-button/checkbox-button.js +21 -0
- package/checkbox-button/checkbox-button.stories.d.ts +7 -0
- package/checkbox-button/checkbox-button.stories.js +57 -0
- package/checkbox-button/index.d.ts +1 -0
- package/checkbox-button/index.js +17 -0
- package/checkbox-input/checkbox-input.d.ts +2 -0
- package/checkbox-input/checkbox-input.js +12 -0
- package/checkbox-input/checkbox-input.stories.d.ts +7 -0
- package/checkbox-input/checkbox-input.stories.js +17 -0
- package/checkbox-input/index.d.ts +1 -0
- package/checkbox-input/index.js +17 -0
- package/chip/chip.d.ts +7 -0
- package/chip/chip.js +14 -0
- package/chip/chip.stories.d.ts +7 -0
- package/chip/chip.stories.js +22 -0
- package/chip/index.d.ts +1 -0
- package/chip/index.js +5 -0
- package/chip/theme.d.ts +5 -0
- package/chip/theme.js +2 -0
- package/color-radio-group/color-radio-group.d.ts +18 -0
- package/color-radio-group/color-radio-group.js +47 -0
- package/color-radio-group/color-radio-group.stories.d.ts +7 -0
- package/color-radio-group/color-radio-group.stories.js +79 -0
- package/color-radio-group/color-radio.d.ts +8 -0
- package/color-radio-group/color-radio.js +22 -0
- package/color-radio-group/index.d.ts +1 -0
- package/color-radio-group/index.js +17 -0
- package/combobox/combobox.d.ts +25 -0
- package/combobox/combobox.js +63 -0
- package/combobox/combobox.stories.d.ts +9 -0
- package/combobox/combobox.stories.js +67 -0
- package/combobox/index.d.ts +1 -0
- package/combobox/index.js +17 -0
- package/config/icons-config.d.ts +2 -0
- package/config/icons-config.js +5 -0
- package/config/icons.d.ts +77 -0
- package/config/icons.js +20 -0
- package/content/content-schema.d.ts +3 -0
- package/content/content-schema.js +2 -0
- package/content/types.d.ts +27 -0
- package/content/types.js +2 -0
- package/context/context.d.ts +12 -0
- package/context/context.js +5 -0
- package/context/index.d.ts +3 -0
- package/context/index.js +19 -0
- package/context/provider.d.ts +8 -0
- package/context/provider.js +10 -0
- package/context/use-component-context.d.ts +3 -0
- package/context/use-component-context.js +13 -0
- package/css/avatar-file-input.css +7 -0
- package/css/avatar.css +15 -0
- package/css/badge.css +23 -0
- package/css/button.css +200 -0
- package/css/button.old.css +231 -0
- package/css/checkbox-button.css +98 -0
- package/css/checkbox-input.css +3 -0
- package/css/checkbox.css +102 -0
- package/css/chip.css +37 -0
- package/css/color-radio-group.css +21 -0
- package/css/color-radio.css +21 -0
- package/css/combobox.css +102 -0
- package/css/component-structure-analyzer.css +31 -0
- package/css/date-picker-input.css +133 -0
- package/css/date-picker.css +90 -0
- package/css/dropdown.css +24 -0
- package/css/error-message.css +3 -0
- package/css/flash-messages.css +20 -0
- package/css/form-control.css +7 -0
- package/css/icon.css +7 -0
- package/css/input-basic.css +18 -0
- package/css/input.css +193 -0
- package/css/label.css +15 -0
- package/css/layout.css +47 -0
- package/css/list-item.css +29 -0
- package/css/pagination.css +27 -0
- package/css/radio-group.css +160 -0
- package/css/radio.css +89 -0
- package/css/raster-image.css +15 -0
- package/css/select.css +66 -0
- package/css/tabs.css +131 -0
- package/css/text-link.css +12 -0
- package/css/textarea.css +118 -0
- package/css/time-picker-input.css +133 -0
- package/css/time-picker.css +27 -0
- package/css/toggle.css +80 -0
- package/date-picker-input/date-picker-day.d.ts +8 -0
- package/date-picker-input/date-picker-day.js +63 -0
- package/date-picker-input/date-picker-decade.d.ts +6 -0
- package/date-picker-input/date-picker-decade.js +68 -0
- package/date-picker-input/date-picker-input.d.ts +21 -0
- package/date-picker-input/date-picker-input.js +60 -0
- package/date-picker-input/date-picker-input.stories.d.ts +7 -0
- package/date-picker-input/date-picker-input.stories.js +45 -0
- package/date-picker-input/date-picker-month.d.ts +7 -0
- package/date-picker-input/date-picker-month.js +63 -0
- package/date-picker-input/date-picker-provider.d.ts +8 -0
- package/date-picker-input/date-picker-provider.js +26 -0
- package/date-picker-input/date-picker-year.d.ts +7 -0
- package/date-picker-input/date-picker-year.js +72 -0
- package/date-picker-input/date-picker.d.ts +3 -0
- package/date-picker-input/date-picker.js +53 -0
- package/date-picker-input/index.d.ts +3 -0
- package/date-picker-input/index.js +19 -0
- package/date-picker-input/types.d.ts +5 -0
- package/date-picker-input/types.js +2 -0
- package/dropdown/dropdown.d.ts +11 -0
- package/dropdown/dropdown.js +27 -0
- package/dropdown/dropdown.stories.d.ts +10 -0
- package/dropdown/dropdown.stories.js +30 -0
- package/dropdown/index.d.ts +1 -0
- package/dropdown/index.js +17 -0
- package/error-message/error-message.d.ts +7 -0
- package/error-message/error-message.js +11 -0
- package/error-message/error-message.stories.d.ts +8 -0
- package/error-message/error-message.stories.js +17 -0
- package/error-message/index.d.ts +1 -0
- package/error-message/index.js +17 -0
- package/flash-messages/flash-message.d.ts +16 -0
- package/flash-messages/flash-message.js +46 -0
- package/flash-messages/flash-messages-service.d.ts +5 -0
- package/flash-messages/flash-messages-service.js +15 -0
- package/flash-messages/flash-messages.d.ts +8 -0
- package/flash-messages/flash-messages.js +55 -0
- package/flash-messages/flash-messages.stories.d.ts +7 -0
- package/flash-messages/flash-messages.stories.js +31 -0
- package/flash-messages/theme.d.ts +4 -0
- package/flash-messages/theme.js +2 -0
- package/form-control/form-control.d.ts +13 -0
- package/form-control/form-control.js +19 -0
- package/form-control/form-control.stories.d.ts +12 -0
- package/form-control/form-control.stories.js +25 -0
- package/form-control/index.d.ts +1 -0
- package/form-control/index.js +17 -0
- package/hooks/use-dropdown.d.ts +2 -0
- package/hooks/use-dropdown.js +28 -0
- package/hooks/use-input-submit.d.ts +4 -0
- package/hooks/use-input-submit.js +40 -0
- package/icon/icon.d.ts +17 -0
- package/icon/icon.js +38 -0
- package/icon/icon.stories.d.ts +18 -0
- package/icon/icon.stories.js +53 -0
- package/icon/index.d.ts +1 -0
- package/icon/index.js +17 -0
- package/icon/theme.d.ts +2 -0
- package/icon/theme.js +2 -0
- package/icon/types.d.ts +2 -0
- package/icon/types.js +2 -0
- package/image-gallery/components/close-button.d.ts +6 -0
- package/image-gallery/components/close-button.js +12 -0
- package/image-gallery/components/dot.d.ts +6 -0
- package/image-gallery/components/dot.js +12 -0
- package/image-gallery/components/gallery.d.ts +11 -0
- package/image-gallery/components/gallery.js +71 -0
- package/image-gallery/components/next-button.d.ts +6 -0
- package/image-gallery/components/next-button.js +12 -0
- package/image-gallery/components/previous-button.d.ts +6 -0
- package/image-gallery/components/previous-button.js +12 -0
- package/image-gallery/context.d.ts +10 -0
- package/image-gallery/context.js +12 -0
- package/image-gallery/image-gallery.d.ts +6 -0
- package/image-gallery/image-gallery.js +55 -0
- package/image-gallery/image-gallery.stories.d.ts +13 -0
- package/image-gallery/image-gallery.stories.js +26 -0
- package/image-gallery/image.d.ts +4 -0
- package/image-gallery/image.js +14 -0
- package/image-gallery/index.d.ts +4 -0
- package/image-gallery/index.js +26 -0
- package/image-gallery/types.d.ts +7 -0
- package/image-gallery/types.js +2 -0
- package/image-gallery/use-image.d.ts +2 -0
- package/image-gallery/use-image.js +16 -0
- package/input/index.d.ts +12 -0
- package/input/index.js +16 -0
- package/input/input-element.d.ts +21 -0
- package/input/input-element.js +11 -0
- package/input/input-left-addon.d.ts +9 -0
- package/input/input-left-addon.js +12 -0
- package/input/input-left-element.d.ts +9 -0
- package/input/input-left-element.js +12 -0
- package/input/input-right-addon.d.ts +8 -0
- package/input/input-right-addon.js +12 -0
- package/input/input-right-element.d.ts +9 -0
- package/input/input-right-element.js +12 -0
- package/input/input.d.ts +8 -0
- package/input/input.js +65 -0
- package/input/input.stories.d.ts +14 -0
- package/input/input.stories.js +83 -0
- package/input/theme.d.ts +7 -0
- package/input/theme.js +2 -0
- package/label/index.d.ts +1 -0
- package/label/index.js +17 -0
- package/label/label.d.ts +12 -0
- package/label/label.js +14 -0
- package/label/label.stories.d.ts +7 -0
- package/label/label.stories.js +17 -0
- package/layout/index.d.ts +1 -0
- package/layout/index.js +17 -0
- package/layout/layout.d.ts +9 -0
- package/layout/layout.js +60 -0
- package/layout/layout.stories.d.ts +8 -0
- package/layout/layout.stories.js +21 -0
- package/layout/uxf-logo.d.ts +6 -0
- package/layout/uxf-logo.js +13 -0
- package/list-item/index.d.ts +1 -0
- package/list-item/index.js +5 -0
- package/list-item/list-item.d.ts +8 -0
- package/list-item/list-item.js +24 -0
- package/list-item/list-item.stories.d.ts +7 -0
- package/list-item/list-item.stories.js +32 -0
- package/package.json +17 -36
- package/pagination/pagination.d.ts +7 -0
- package/pagination/pagination.js +49 -0
- package/pagination/pagination.stories.d.ts +7 -0
- package/pagination/pagination.stories.js +47 -0
- package/radio/index.d.ts +1 -0
- package/radio/index.js +17 -0
- package/radio/radio.d.ts +6 -0
- package/radio/radio.js +15 -0
- package/radio/radio.stories.d.ts +7 -0
- package/radio/radio.stories.js +42 -0
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.js +17 -0
- package/radio-group/radio-group.d.ts +22 -0
- package/radio-group/radio-group.js +48 -0
- package/radio-group/radio-group.stories.d.ts +7 -0
- package/radio-group/radio-group.stories.js +57 -0
- package/radio-group/theme.d.ts +5 -0
- package/radio-group/theme.js +2 -0
- package/raster-image/index.d.ts +1 -0
- package/raster-image/index.js +17 -0
- package/raster-image/raster-image.d.ts +16 -0
- package/raster-image/raster-image.js +21 -0
- package/raster-image/raster-image.stories.d.ts +7 -0
- package/raster-image/raster-image.stories.js +17 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +17 -0
- package/select/select.d.ts +25 -0
- package/select/select.js +60 -0
- package/select/select.stories.d.ts +9 -0
- package/select/select.stories.js +72 -0
- package/tabs/index.d.ts +1 -0
- package/tabs/index.js +5 -0
- package/tabs/tabs.d.ts +19 -0
- package/tabs/tabs.js +68 -0
- package/tabs/tabs.stories.d.ts +11 -0
- package/tabs/tabs.stories.js +48 -0
- package/text-input/index.d.ts +1 -0
- package/text-input/index.js +17 -0
- package/text-input/text-input.d.ts +31 -0
- package/text-input/text-input.js +57 -0
- package/text-input/text-input.stories.d.ts +8 -0
- package/text-input/text-input.stories.js +56 -0
- package/text-link/index.d.ts +1 -0
- package/text-link/index.js +5 -0
- package/text-link/text-link.d.ts +5 -0
- package/text-link/text-link.js +19 -0
- package/text-link/text-link.stories.d.ts +7 -0
- package/text-link/text-link.stories.js +24 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +17 -0
- package/textarea/textarea.d.ts +18 -0
- package/textarea/textarea.js +81 -0
- package/textarea/textarea.stories.d.ts +7 -0
- package/textarea/textarea.stories.js +44 -0
- package/time-picker-input/index.d.ts +2 -0
- package/time-picker-input/index.js +18 -0
- package/time-picker-input/time-picker-hour.d.ts +5 -0
- package/time-picker-input/time-picker-hour.js +47 -0
- package/time-picker-input/time-picker-hours.d.ts +2 -0
- package/time-picker-input/time-picker-hours.js +14 -0
- package/time-picker-input/time-picker-input.d.ts +22 -0
- package/time-picker-input/time-picker-input.js +64 -0
- package/time-picker-input/time-picker-input.stories.d.ts +7 -0
- package/time-picker-input/time-picker-input.stories.js +45 -0
- package/time-picker-input/time-picker-minute.d.ts +5 -0
- package/time-picker-input/time-picker-minute.js +47 -0
- package/time-picker-input/time-picker-minutes.d.ts +2 -0
- package/time-picker-input/time-picker-minutes.js +14 -0
- package/time-picker-input/time-picker.d.ts +8 -0
- package/time-picker-input/time-picker.js +69 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/index.js +17 -0
- package/toggle/theme.d.ts +4 -0
- package/toggle/theme.js +2 -0
- package/toggle/toggle.d.ts +12 -0
- package/toggle/toggle.js +19 -0
- package/toggle/toggle.stories.d.ts +7 -0
- package/toggle/toggle.stories.js +52 -0
- package/types/form-control-props.d.ts +24 -0
- package/types/form-control-props.js +2 -0
- package/types/index.d.ts +1 -0
- package/types/index.js +17 -0
- package/utils/action.d.ts +2 -0
- package/utils/action.js +11 -0
- package/utils/component-structure-analyzer.d.ts +6 -0
- package/utils/component-structure-analyzer.js +10 -0
- package/utils/icons-config.js +73 -0
- package/utils/image.d.ts +9 -0
- package/utils/image.js +30 -0
- package/utils/is-light-background.d.ts +2 -0
- package/utils/is-light-background.js +11 -0
- package/utils/localized-dayjs.d.ts +2 -0
- package/utils/localized-dayjs.js +34 -0
- package/utils/storybook-config.d.ts +19 -0
- package/{storybook → utils}/storybook-config.js +7 -6
- package/utils/tailwind-config.js +163 -0
- package/stories/button.stories.tsx +0 -73
- package/storybook/index.d.ts +0 -1
- package/storybook/storybook-config.d.ts +0 -21
- package/tailwindui/button.css +0 -51
- package/types.d.ts +0 -3
- package/types.js +0 -3
|
@@ -0,0 +1,72 @@
|
|
|
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.DatePickerYear = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const use_year_1 = require("@uxf/datepicker/hooks/use-year");
|
|
29
|
+
const date_picker_context_1 = require("@uxf/datepicker/contexts/date-picker-context");
|
|
30
|
+
const button_1 = require("../button");
|
|
31
|
+
const icon_1 = require("../icon");
|
|
32
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
34
|
+
const localized_dayjs_1 = require("../utils/localized-dayjs");
|
|
35
|
+
exports.DatePickerYear = (0, react_1.memo)((props) => {
|
|
36
|
+
const { canGoToNextYear, canGoToPrevYear, goToNextYear, goToPrevYear, canGoToMonth, activeMonths } = (0, react_1.useContext)(date_picker_context_1.DatePickerContext);
|
|
37
|
+
const currentMonth = activeMonths[0].month;
|
|
38
|
+
const currentYear = activeMonths[0].year;
|
|
39
|
+
const { months, yearLabel } = (0, use_year_1.useYear)({
|
|
40
|
+
year: currentYear,
|
|
41
|
+
yearLabelFormat: (date) => (0, localized_dayjs_1.localizedDayjs)(date).format("YYYY"),
|
|
42
|
+
monthLabelFormat: (date) => (0, localized_dayjs_1.localizedDayjs)(date).format("MMMM"),
|
|
43
|
+
});
|
|
44
|
+
const handleGoToNextYear = (0, react_1.useCallback)(() => {
|
|
45
|
+
if (canGoToNextYear) {
|
|
46
|
+
goToNextYear(1);
|
|
47
|
+
}
|
|
48
|
+
}, [canGoToNextYear, goToNextYear]);
|
|
49
|
+
const handleGoToPrevYear = (0, react_1.useCallback)(() => {
|
|
50
|
+
if (canGoToPrevYear) {
|
|
51
|
+
goToPrevYear(1);
|
|
52
|
+
}
|
|
53
|
+
}, [canGoToPrevYear, goToPrevYear]);
|
|
54
|
+
const handleYearClick = (0, react_1.useCallback)(() => {
|
|
55
|
+
props.onYearSelect();
|
|
56
|
+
}, [props]);
|
|
57
|
+
const handleMonthClick = (0, react_1.useCallback)((date) => () => {
|
|
58
|
+
if (canGoToMonth(date)) {
|
|
59
|
+
props.onMonthSelect(date);
|
|
60
|
+
}
|
|
61
|
+
}, [canGoToMonth, props]);
|
|
62
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
|
+
react_1.default.createElement("div", { className: "uxf-date-picker__year-select" },
|
|
64
|
+
react_1.default.createElement(button_1.Button, { disabled: !canGoToPrevYear, isIconButton: true, onClick: canGoToPrevYear ? handleGoToPrevYear : undefined, title: "P\u0159edchoz\u00ED rok", variant: "text" },
|
|
65
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronLeft", size: 16 })),
|
|
66
|
+
react_1.default.createElement(button_1.Button, { variant: "text", onClick: handleYearClick }, yearLabel),
|
|
67
|
+
react_1.default.createElement(button_1.Button, { disabled: !canGoToNextYear, isIconButton: true, onClick: canGoToNextYear ? handleGoToNextYear : undefined, title: "Dal\u0161\u00ED rok", variant: "text" },
|
|
68
|
+
react_1.default.createElement(icon_1.Icon, { name: "chevronRight", size: 16 }))),
|
|
69
|
+
react_1.default.createElement("div", { className: "uxf-date-picker__year-calendar" }, months.map((month, index) => (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-date-picker__cell uxf-date-picker__cell__month", !canGoToMonth(month.date) && classes_1.CLASSES.IS_DISABLED, (0, localized_dayjs_1.localizedDayjs)(month.date).month() === currentMonth &&
|
|
70
|
+
"uxf-date-picker__cell__month--current"), key: month.monthLabel + index, onClick: handleMonthClick(month.date) }, month.monthLabel))))));
|
|
71
|
+
});
|
|
72
|
+
exports.DatePickerYear.displayName = "DatePickerYear";
|
|
@@ -0,0 +1,53 @@
|
|
|
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.DatePicker = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const date_picker_year_1 = require("./date-picker-year");
|
|
29
|
+
const date_picker_decade_1 = require("./date-picker-decade");
|
|
30
|
+
const date_picker_context_1 = require("@uxf/datepicker/contexts/date-picker-context");
|
|
31
|
+
const date_picker_month_1 = require("./date-picker-month");
|
|
32
|
+
const DatePicker = (props) => {
|
|
33
|
+
const { goToDate, activeMonths } = (0, react_1.useContext)(date_picker_context_1.DatePickerContext);
|
|
34
|
+
const [viewMode, setViewMode] = (0, react_1.useState)("month");
|
|
35
|
+
const onYearSelect = (0, react_1.useCallback)(() => setViewMode("decade"), [setViewMode]);
|
|
36
|
+
const onMonthSelect = (0, react_1.useCallback)((date) => {
|
|
37
|
+
goToDate(date);
|
|
38
|
+
setViewMode("month");
|
|
39
|
+
}, [goToDate, setViewMode]);
|
|
40
|
+
const onDecadeYearSelect = (0, react_1.useCallback)((date) => {
|
|
41
|
+
goToDate(date);
|
|
42
|
+
setViewMode("year");
|
|
43
|
+
}, [goToDate, setViewMode]);
|
|
44
|
+
const datePickerComponents = (0, react_1.useMemo)(() => ({
|
|
45
|
+
month: activeMonths.map((month) => (react_1.default.createElement(date_picker_month_1.DatePickerMonth, { key: `${month.year}-${month.month}`, setViewMode: setViewMode }))),
|
|
46
|
+
year: react_1.default.createElement(date_picker_year_1.DatePickerYear, { onMonthSelect: (date) => onMonthSelect(date), onYearSelect: onYearSelect }),
|
|
47
|
+
decade: react_1.default.createElement(date_picker_decade_1.DatePickerDecade, { onYearSelect: (date) => onDecadeYearSelect(date) }),
|
|
48
|
+
}), [onMonthSelect, onYearSelect, onDecadeYearSelect, setViewMode, activeMonths]);
|
|
49
|
+
return (react_1.default.createElement("div", { className: "uxf-date-picker" },
|
|
50
|
+
props.children,
|
|
51
|
+
datePickerComponents[viewMode]));
|
|
52
|
+
};
|
|
53
|
+
exports.DatePicker = DatePicker;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./date-picker"), exports);
|
|
18
|
+
__exportStar(require("./date-picker-input"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core/hooks/useAnchorProps";
|
|
2
|
+
import React, { AnchorHTMLAttributes, HTMLAttributes } from "react";
|
|
3
|
+
export interface ItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type">, UseAnchorProps {
|
|
4
|
+
}
|
|
5
|
+
declare type ItemsProps = HTMLAttributes<HTMLDivElement>;
|
|
6
|
+
export declare type ItemsTypeProps = HTMLDivElement;
|
|
7
|
+
export declare const Dropdown: {
|
|
8
|
+
Item: React.ForwardRefExoticComponent<ItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
9
|
+
Items: React.ForwardRefExoticComponent<ItemsProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
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.Dropdown = void 0;
|
|
7
|
+
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const Item = (0, forwardRef_1.forwardRef)("Item.", (props, ref) => {
|
|
12
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
13
|
+
const { children, className, ...restProps } = props;
|
|
14
|
+
const anchorProps = (0, useAnchorProps_1.useAnchorProps)({
|
|
15
|
+
className: `uxf-dropdown__item ${className || ""}`,
|
|
16
|
+
role: "menuitem",
|
|
17
|
+
...restProps,
|
|
18
|
+
});
|
|
19
|
+
return (react_1.default.createElement("a", { ref: ref, ...anchorProps }, children));
|
|
20
|
+
});
|
|
21
|
+
const Items = (0, forwardRef_1.forwardRef)("Items", (props, ref) => {
|
|
22
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-dropdown__items", props.className), ref: ref, role: props.role }, props.children));
|
|
23
|
+
});
|
|
24
|
+
exports.Dropdown = {
|
|
25
|
+
Item,
|
|
26
|
+
Items,
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: {
|
|
5
|
+
Item: React.ForwardRefExoticComponent<import("./dropdown").ItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
6
|
+
Items: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
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 = require("@headlessui/react");
|
|
8
|
+
const react_2 = __importDefault(require("react"));
|
|
9
|
+
const index_1 = require("./index");
|
|
10
|
+
const button_1 = require("../button");
|
|
11
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
12
|
+
exports.default = {
|
|
13
|
+
title: "UI/Dropdown",
|
|
14
|
+
component: index_1.Dropdown,
|
|
15
|
+
};
|
|
16
|
+
const testDropdownItems = [
|
|
17
|
+
{ id: 1, title: "Test 1" },
|
|
18
|
+
{ id: 2, title: "Test 2" },
|
|
19
|
+
{ id: 3, title: "Test 3" },
|
|
20
|
+
];
|
|
21
|
+
function Default() {
|
|
22
|
+
const storyDropdown = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
23
|
+
react_2.default.createElement(react_1.Menu, { as: "div", className: "relative" },
|
|
24
|
+
react_2.default.createElement(react_1.Menu.Button, { as: button_1.Button, title: "Test" }, "Click me"),
|
|
25
|
+
react_2.default.createElement(react_1.Menu.Items, { as: index_1.Dropdown.Items }, testDropdownItems.map((item) => (react_2.default.createElement(react_1.Menu.Item, { key: item.id }, ({ active }) => (react_2.default.createElement(index_1.Dropdown.Item, { className: `first-letter:uppercase ${active ? classes_1.CLASSES.IS_ACTIVE : ""}` }, item.title)))))))));
|
|
26
|
+
return (react_2.default.createElement("div", { className: "flex" },
|
|
27
|
+
react_2.default.createElement("div", { className: "light grow gap-4 p-4" }, storyDropdown),
|
|
28
|
+
react_2.default.createElement("div", { className: "dark grow gap-4 bg-gray-900 p-4 text-gray-200" }, storyDropdown)));
|
|
29
|
+
}
|
|
30
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dropdown";
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dropdown"), exports);
|
|
@@ -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
|
+
exports.ErrorMessage = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
function ErrorMessage(props) {
|
|
9
|
+
return (react_1.default.createElement("p", { id: props.id, className: "uxf-error-message" }, props.children));
|
|
10
|
+
}
|
|
11
|
+
exports.ErrorMessage = ErrorMessage;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 index_1 = require("./index");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "UI/ErrorMessage",
|
|
11
|
+
component: index_1.ErrorMessage,
|
|
12
|
+
};
|
|
13
|
+
function Default() {
|
|
14
|
+
return (react_1.default.createElement("div", { className: "space-y-2" },
|
|
15
|
+
react_1.default.createElement(index_1.ErrorMessage, null, "This field is required.")));
|
|
16
|
+
}
|
|
17
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./error-message";
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./error-message"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC, MouseEventHandler, ReactNode } from "react";
|
|
2
|
+
import { FlashMessageVariants } from "@uxf/ui/flash-messages/theme";
|
|
3
|
+
export declare type FlashMessageVariant = keyof FlashMessageVariants;
|
|
4
|
+
export interface Notification {
|
|
5
|
+
autoDismiss?: boolean;
|
|
6
|
+
message: ReactNode;
|
|
7
|
+
dismissTimeout?: number;
|
|
8
|
+
id?: number;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
variant?: FlashMessageVariant;
|
|
11
|
+
}
|
|
12
|
+
export interface FlashMessageProps {
|
|
13
|
+
notification: Notification;
|
|
14
|
+
onClose: MouseEventHandler<HTMLDivElement>;
|
|
15
|
+
}
|
|
16
|
+
export declare const FlashMessage: FC<FlashMessageProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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.FlashMessage = void 0;
|
|
27
|
+
const useClickableProps_1 = require("@uxf/core/hooks/useClickableProps");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
30
|
+
const FlashMessage = ({ notification, onClose }) => {
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
const { autoDismiss = true, dismissTimeout = 5000 } = notification;
|
|
33
|
+
let timer;
|
|
34
|
+
if (autoDismiss) {
|
|
35
|
+
timer = window.setTimeout(onClose, dismissTimeout);
|
|
36
|
+
}
|
|
37
|
+
return () => clearTimeout(timer);
|
|
38
|
+
}, [onClose, notification]);
|
|
39
|
+
const clickableProps = (0, useClickableProps_1.useClickableProps)({
|
|
40
|
+
className: `uxf-flash-message uxf-flash-message--${notification.variant || "success"}`,
|
|
41
|
+
onClick: onClose,
|
|
42
|
+
role: "listitem alert",
|
|
43
|
+
});
|
|
44
|
+
return react_1.default.createElement("div", { ...clickableProps }, notification.message);
|
|
45
|
+
};
|
|
46
|
+
exports.FlashMessage = FlashMessage;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Notification } from "@uxf/ui/flash-messages/flash-message";
|
|
3
|
+
import { FlashMessagesRef } from "@uxf/ui/flash-messages/flash-messages";
|
|
4
|
+
export declare function getFlashMessagesRef(): import("react").RefObject<FlashMessagesRef>;
|
|
5
|
+
export declare function flashMessage(notification: Notification): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flashMessage = exports.getFlashMessagesRef = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const flashMessagesRef = (0, react_1.createRef)();
|
|
6
|
+
function getFlashMessagesRef() {
|
|
7
|
+
return flashMessagesRef;
|
|
8
|
+
}
|
|
9
|
+
exports.getFlashMessagesRef = getFlashMessagesRef;
|
|
10
|
+
function flashMessage(notification) {
|
|
11
|
+
if (flashMessagesRef.current) {
|
|
12
|
+
flashMessagesRef.current.open(notification);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.flashMessage = flashMessage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Notification } from "./flash-message";
|
|
3
|
+
export interface FlashMessagesRef {
|
|
4
|
+
close: (notification: Notification) => void;
|
|
5
|
+
closeAll: () => void;
|
|
6
|
+
open: (notification: Notification) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const FlashMessages: React.ForwardRefExoticComponent<React.RefAttributes<FlashMessagesRef>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
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.FlashMessages = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const flash_message_1 = require("./flash-message");
|
|
29
|
+
exports.FlashMessages = (0, react_1.forwardRef)((props, ref) => {
|
|
30
|
+
const [notifications, setNotifications] = (0, react_1.useState)([]);
|
|
31
|
+
const open = (0, react_1.useCallback)((notification) => setNotifications((prev) => [
|
|
32
|
+
...prev,
|
|
33
|
+
{
|
|
34
|
+
...notification,
|
|
35
|
+
variant: notification.variant || "success",
|
|
36
|
+
id: notification.id || Math.round(Math.random() * 1000),
|
|
37
|
+
},
|
|
38
|
+
]), []);
|
|
39
|
+
const close = (0, react_1.useCallback)((notification) => setNotifications((prev) => prev.filter((n) => n !== notification)), []);
|
|
40
|
+
const closeAll = (0, react_1.useCallback)(() => setNotifications([]), []);
|
|
41
|
+
const innerRef = (0, react_1.useRef)({
|
|
42
|
+
close,
|
|
43
|
+
closeAll,
|
|
44
|
+
open,
|
|
45
|
+
});
|
|
46
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
47
|
+
close: innerRef.current.close,
|
|
48
|
+
closeAll: innerRef.current.closeAll,
|
|
49
|
+
open: innerRef.current.open,
|
|
50
|
+
}), []);
|
|
51
|
+
const onClose = (0, react_1.useCallback)((notification) => () => setNotifications((prev) => prev.filter((n) => n !== notification)), []);
|
|
52
|
+
return notifications.length > 0 ? (react_1.default.createElement("div", { className: "uxf-flash-messages" },
|
|
53
|
+
react_1.default.createElement("div", { className: "uxf-flash-messages__list-wrapper", role: "list" }, notifications.map((notification) => (react_1.default.createElement(flash_message_1.FlashMessage, { key: `${notification.id}`, notification: notification, onClose: onClose(notification) })))))) : null;
|
|
54
|
+
});
|
|
55
|
+
exports.FlashMessages.displayName = "FlashMessages";
|
|
@@ -0,0 +1,31 @@
|
|
|
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 flash_messages_1 = require("./flash-messages");
|
|
9
|
+
const flash_messages_service_1 = require("./flash-messages-service");
|
|
10
|
+
const button_1 = require("@uxf/ui/button");
|
|
11
|
+
const icon_1 = require("@uxf/ui/icon");
|
|
12
|
+
exports.default = {
|
|
13
|
+
title: "UI/FlashMessages",
|
|
14
|
+
component: flash_messages_1.FlashMessages,
|
|
15
|
+
};
|
|
16
|
+
function Default() {
|
|
17
|
+
return (react_1.default.createElement("div", { className: "light flex space-x-4" },
|
|
18
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
19
|
+
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
20
|
+
react_1.default.createElement(icon_1.Icon, { name: "check", size: 24 }),
|
|
21
|
+
react_1.default.createElement("span", null, "Everything is alright."))),
|
|
22
|
+
}) }, "Click to fire Flash message"),
|
|
23
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
24
|
+
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
25
|
+
react_1.default.createElement(icon_1.Icon, { name: "cross", size: 24 }),
|
|
26
|
+
react_1.default.createElement("span", null, "Seems like an error occurred :)"))),
|
|
27
|
+
autoDismiss: false,
|
|
28
|
+
variant: "error",
|
|
29
|
+
}) }, "AutoDismiss: false Flash message, variant error")));
|
|
30
|
+
}
|
|
31
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface FormControlProps {
|
|
3
|
+
children?: ReactElement;
|
|
4
|
+
className?: string;
|
|
5
|
+
errorId?: string;
|
|
6
|
+
form?: string;
|
|
7
|
+
helperText?: ReactNode;
|
|
8
|
+
hiddenLabel?: boolean;
|
|
9
|
+
inputId: string;
|
|
10
|
+
isRequired?: boolean;
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -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.FormControl = void 0;
|
|
7
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
|
+
const forwardRef_1 = require("@uxf/core/utils/forwardRef");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const label_1 = require("../label");
|
|
12
|
+
// TODO - tohle asi ještě nějak předělám (ten interface je trochu nelogickej)
|
|
13
|
+
exports.FormControl = (0, forwardRef_1.forwardRef)("FormControl", (props, ref) => {
|
|
14
|
+
const helperTextClassName = (0, cx_1.cx)("uxf-helper-text", props.errorId && classes_1.CLASSES.IS_INVALID);
|
|
15
|
+
return (react_1.default.createElement("div", { className: props.className, ref: ref },
|
|
16
|
+
react_1.default.createElement(label_1.Label, { isHidden: props.hiddenLabel, isRequired: props.isRequired, htmlFor: props.inputId, form: props.form }, props.label),
|
|
17
|
+
props.children,
|
|
18
|
+
props.helperText && (react_1.default.createElement("div", { className: helperTextClassName, id: props.errorId }, props.helperText))));
|
|
19
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./form-control").FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
parameters: {
|
|
6
|
+
actions: {
|
|
7
|
+
argTypesRegex: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
12
|
+
export declare function Default(): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
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 form_control_1 = require("./form-control");
|
|
9
|
+
exports.default = {
|
|
10
|
+
title: "UI/FormControl",
|
|
11
|
+
component: form_control_1.FormControl,
|
|
12
|
+
parameters: { actions: { argTypesRegex: "^on.*" } },
|
|
13
|
+
};
|
|
14
|
+
function Default() {
|
|
15
|
+
return (react_1.default.createElement("div", { className: "space-y-4" },
|
|
16
|
+
react_1.default.createElement(form_control_1.FormControl, { inputId: "default", helperText: "helper text", label: "Default" },
|
|
17
|
+
react_1.default.createElement("div", null, "Default")),
|
|
18
|
+
react_1.default.createElement(form_control_1.FormControl, { inputId: "default", helperText: "helper text", label: "Default", isRequired: true },
|
|
19
|
+
react_1.default.createElement("div", null, "Is required")),
|
|
20
|
+
react_1.default.createElement(form_control_1.FormControl, { inputId: "error", helperText: "helper text", label: "Default", errorId: "error--error", isRequired: true },
|
|
21
|
+
react_1.default.createElement("div", null, "Is invalid")),
|
|
22
|
+
react_1.default.createElement(form_control_1.FormControl, { inputId: "error", helperText: "helper text", label: "Default", errorId: "error--error", hiddenLabel: true },
|
|
23
|
+
react_1.default.createElement("div", null, "hidden label"))));
|
|
24
|
+
}
|
|
25
|
+
exports.Default = Default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./form-control";
|