@quen-ui/components 0.0.14
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/README.md +43 -0
- package/dist/Alert/Alert.cjs.js +54 -0
- package/dist/Alert/Alert.d.ts +4 -0
- package/dist/Alert/Alert.es.js +55 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/styles.cjs.js +90 -0
- package/dist/Alert/styles.d.ts +10 -0
- package/dist/Alert/styles.es.js +90 -0
- package/dist/Alert/types.d.ts +25 -0
- package/dist/Avatar/Avatar.cjs.js +65 -0
- package/dist/Avatar/Avatar.d.ts +4 -0
- package/dist/Avatar/Avatar.es.js +66 -0
- package/dist/Avatar/AvatarIcon.svg.cjs.js +21 -0
- package/dist/Avatar/AvatarIcon.svg.es.js +5 -0
- package/dist/Avatar/helpers.cjs.js +18 -0
- package/dist/Avatar/helpers.d.ts +1 -0
- package/dist/Avatar/helpers.es.js +18 -0
- package/dist/Avatar/index.d.ts +2 -0
- package/dist/Avatar/styles.cjs.js +31 -0
- package/dist/Avatar/styles.d.ts +9 -0
- package/dist/Avatar/styles.es.js +31 -0
- package/dist/Avatar/types.d.ts +31 -0
- package/dist/Badge/Badge.cjs.js +53 -0
- package/dist/Badge/Badge.d.ts +4 -0
- package/dist/Badge/Badge.es.js +54 -0
- package/dist/Badge/index.d.ts +3 -0
- package/dist/Badge/styles.cjs.js +70 -0
- package/dist/Badge/styles.d.ts +7 -0
- package/dist/Badge/styles.es.js +70 -0
- package/dist/Badge/types.cjs.js +10 -0
- package/dist/Badge/types.d.ts +22 -0
- package/dist/Badge/types.es.js +10 -0
- package/dist/Breadcrumbs/BreadcrumbItem.cjs.js +42 -0
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts +4 -0
- package/dist/Breadcrumbs/BreadcrumbItem.es.js +43 -0
- package/dist/Breadcrumbs/Breadcrumbs.cjs.js +48 -0
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/dist/Breadcrumbs/Breadcrumbs.es.js +49 -0
- package/dist/Breadcrumbs/helpers.cjs.js +18 -0
- package/dist/Breadcrumbs/helpers.d.ts +16 -0
- package/dist/Breadcrumbs/helpers.es.js +18 -0
- package/dist/Breadcrumbs/index.d.ts +2 -0
- package/dist/Breadcrumbs/styles.cjs.js +50 -0
- package/dist/Breadcrumbs/styles.d.ts +4 -0
- package/dist/Breadcrumbs/styles.es.js +50 -0
- package/dist/Breadcrumbs/types.d.ts +56 -0
- package/dist/Button/Button.cjs.js +66 -0
- package/dist/Button/Button.d.ts +4 -0
- package/dist/Button/Button.es.js +67 -0
- package/dist/Button/index.d.ts +2 -0
- package/dist/Button/styles.cjs.js +177 -0
- package/dist/Button/styles.d.ts +7 -0
- package/dist/Button/styles.es.js +177 -0
- package/dist/Button/types.d.ts +38 -0
- package/dist/Card/Card.cjs.js +38 -0
- package/dist/Card/Card.d.ts +3 -0
- package/dist/Card/Card.es.js +39 -0
- package/dist/Card/index.d.ts +2 -0
- package/dist/Card/styles.cjs.js +55 -0
- package/dist/Card/styles.d.ts +11 -0
- package/dist/Card/styles.es.js +55 -0
- package/dist/Card/types.d.ts +26 -0
- package/dist/Checkbox/Checkbox.cjs.js +39 -0
- package/dist/Checkbox/Checkbox.d.ts +4 -0
- package/dist/Checkbox/Checkbox.es.js +40 -0
- package/dist/Checkbox/CheckboxGroup.cjs.js +82 -0
- package/dist/Checkbox/CheckboxGroup.d.ts +4 -0
- package/dist/Checkbox/CheckboxGroup.es.js +83 -0
- package/dist/Checkbox/helpers.cjs.js +14 -0
- package/dist/Checkbox/helpers.d.ts +18 -0
- package/dist/Checkbox/helpers.es.js +14 -0
- package/dist/Checkbox/index.cjs.js +7 -0
- package/dist/Checkbox/index.d.ts +8 -0
- package/dist/Checkbox/index.es.js +7 -0
- package/dist/Checkbox/styles.cjs.js +147 -0
- package/dist/Checkbox/styles.d.ts +13 -0
- package/dist/Checkbox/styles.es.js +147 -0
- package/dist/Checkbox/types.d.ts +67 -0
- package/dist/Divider/Divider.cjs.js +27 -0
- package/dist/Divider/Divider.d.ts +4 -0
- package/dist/Divider/Divider.es.js +28 -0
- package/dist/Divider/index.d.ts +2 -0
- package/dist/Divider/styles.cjs.js +121 -0
- package/dist/Divider/styles.d.ts +3 -0
- package/dist/Divider/styles.es.js +121 -0
- package/dist/Divider/types.d.ts +17 -0
- package/dist/Drawer/Drawer.cjs.js +67 -0
- package/dist/Drawer/Drawer.d.ts +4 -0
- package/dist/Drawer/Drawer.es.js +68 -0
- package/dist/Drawer/index.d.ts +2 -0
- package/dist/Drawer/styles.cjs.js +85 -0
- package/dist/Drawer/styles.d.ts +18 -0
- package/dist/Drawer/styles.es.js +85 -0
- package/dist/Drawer/types.d.ts +24 -0
- package/dist/Dropdown/Dropdown.cjs.js +65 -0
- package/dist/Dropdown/Dropdown.d.ts +4 -0
- package/dist/Dropdown/Dropdown.es.js +66 -0
- package/dist/Dropdown/DropdownItem.cjs.js +32 -0
- package/dist/Dropdown/DropdownItem.d.ts +4 -0
- package/dist/Dropdown/DropdownItem.es.js +33 -0
- package/dist/Dropdown/DropdownList.cjs.js +85 -0
- package/dist/Dropdown/DropdownList.d.ts +6 -0
- package/dist/Dropdown/DropdownList.es.js +86 -0
- package/dist/Dropdown/DropdownPortal.cjs.js +41 -0
- package/dist/Dropdown/DropdownPortal.d.ts +4 -0
- package/dist/Dropdown/DropdownPortal.es.js +42 -0
- package/dist/Dropdown/helpers.cjs.js +112 -0
- package/dist/Dropdown/helpers.d.ts +35 -0
- package/dist/Dropdown/helpers.es.js +112 -0
- package/dist/Dropdown/index.d.ts +2 -0
- package/dist/Dropdown/styles.cjs.js +150 -0
- package/dist/Dropdown/styles.d.ts +33 -0
- package/dist/Dropdown/styles.es.js +150 -0
- package/dist/Dropdown/types.d.ts +81 -0
- package/dist/Flex/Flex.cjs.js +10 -0
- package/dist/Flex/Flex.d.ts +4 -0
- package/dist/Flex/Flex.es.js +11 -0
- package/dist/Flex/index.d.ts +2 -0
- package/dist/Flex/styles.cjs.js +32 -0
- package/dist/Flex/styles.d.ts +2 -0
- package/dist/Flex/styles.es.js +32 -0
- package/dist/Flex/types.d.ts +23 -0
- package/dist/Image/Image.cjs.js +79 -0
- package/dist/Image/Image.d.ts +4 -0
- package/dist/Image/Image.es.js +80 -0
- package/dist/Image/index.d.ts +2 -0
- package/dist/Image/styles.cjs.js +87 -0
- package/dist/Image/styles.d.ts +13 -0
- package/dist/Image/styles.es.js +87 -0
- package/dist/Image/types.d.ts +20 -0
- package/dist/InputNumber/InputNumber.cjs.js +145 -0
- package/dist/InputNumber/InputNumber.d.ts +4 -0
- package/dist/InputNumber/InputNumber.es.js +146 -0
- package/dist/InputNumber/index.d.ts +2 -0
- package/dist/InputNumber/styles.cjs.js +136 -0
- package/dist/InputNumber/styles.d.ts +21 -0
- package/dist/InputNumber/styles.es.js +136 -0
- package/dist/InputNumber/types.d.ts +61 -0
- package/dist/Layout/Content.cjs.js +7 -0
- package/dist/Layout/Content.d.ts +4 -0
- package/dist/Layout/Content.es.js +8 -0
- package/dist/Layout/Footer.cjs.js +7 -0
- package/dist/Layout/Footer.d.ts +4 -0
- package/dist/Layout/Footer.es.js +8 -0
- package/dist/Layout/Header.cjs.js +47 -0
- package/dist/Layout/Header.d.ts +4 -0
- package/dist/Layout/Header.es.js +48 -0
- package/dist/Layout/Layout.cjs.js +49 -0
- package/dist/Layout/Layout.d.ts +5 -0
- package/dist/Layout/Layout.es.js +49 -0
- package/dist/Layout/Sidebar.cjs.js +57 -0
- package/dist/Layout/Sidebar.d.ts +4 -0
- package/dist/Layout/Sidebar.es.js +58 -0
- package/dist/Layout/index.cjs.js +13 -0
- package/dist/Layout/index.d.ts +14 -0
- package/dist/Layout/index.es.js +13 -0
- package/dist/Layout/styles.cjs.js +150 -0
- package/dist/Layout/styles.d.ts +32 -0
- package/dist/Layout/styles.es.js +150 -0
- package/dist/Layout/types.d.ts +75 -0
- package/dist/Loader/Loader.cjs.js +34 -0
- package/dist/Loader/Loader.d.ts +4 -0
- package/dist/Loader/Loader.es.js +35 -0
- package/dist/Loader/index.d.ts +2 -0
- package/dist/Loader/loaders/Bars.cjs.js +12 -0
- package/dist/Loader/loaders/Bars.d.ts +6 -0
- package/dist/Loader/loaders/Bars.es.js +13 -0
- package/dist/Loader/loaders/Dots.cjs.js +12 -0
- package/dist/Loader/loaders/Dots.d.ts +6 -0
- package/dist/Loader/loaders/Dots.es.js +13 -0
- package/dist/Loader/loaders/Oval.cjs.js +8 -0
- package/dist/Loader/loaders/Oval.d.ts +6 -0
- package/dist/Loader/loaders/Oval.es.js +9 -0
- package/dist/Loader/styles.cjs.js +95 -0
- package/dist/Loader/styles.d.ts +9 -0
- package/dist/Loader/styles.es.js +95 -0
- package/dist/Loader/types.d.ts +11 -0
- package/dist/Modal/Modal.cjs.js +67 -0
- package/dist/Modal/Modal.d.ts +4 -0
- package/dist/Modal/Modal.es.js +68 -0
- package/dist/Modal/index.d.ts +2 -0
- package/dist/Modal/styles.cjs.js +52 -0
- package/dist/Modal/styles.d.ts +14 -0
- package/dist/Modal/styles.es.js +52 -0
- package/dist/Modal/types.d.ts +31 -0
- package/dist/Notification/Notification.cjs.js +73 -0
- package/dist/Notification/Notification.d.ts +4 -0
- package/dist/Notification/Notification.es.js +74 -0
- package/dist/Notification/NotificationInstance.cjs.js +244 -0
- package/dist/Notification/NotificationInstance.d.ts +8 -0
- package/dist/Notification/NotificationInstance.es.js +244 -0
- package/dist/Notification/NotificationsStore.cjs.js +30 -0
- package/dist/Notification/NotificationsStore.d.ts +13 -0
- package/dist/Notification/NotificationsStore.es.js +31 -0
- package/dist/Notification/index.d.ts +3 -0
- package/dist/Notification/styles.cjs.js +90 -0
- package/dist/Notification/styles.d.ts +8 -0
- package/dist/Notification/styles.es.js +90 -0
- package/dist/Notification/types.cjs.js +9 -0
- package/dist/Notification/types.d.ts +41 -0
- package/dist/Notification/types.es.js +9 -0
- package/dist/Progress/Progress.cjs.js +43 -0
- package/dist/Progress/Progress.d.ts +4 -0
- package/dist/Progress/Progress.es.js +44 -0
- package/dist/Progress/index.d.ts +2 -0
- package/dist/Progress/styles.cjs.js +82 -0
- package/dist/Progress/styles.d.ts +13 -0
- package/dist/Progress/styles.es.js +82 -0
- package/dist/Progress/types.d.ts +20 -0
- package/dist/RadioButton/RadioButton.cjs.js +45 -0
- package/dist/RadioButton/RadioButton.d.ts +4 -0
- package/dist/RadioButton/RadioButton.es.js +46 -0
- package/dist/RadioButton/RadioButtonGroup.cjs.js +68 -0
- package/dist/RadioButton/RadioButtonGroup.d.ts +4 -0
- package/dist/RadioButton/RadioButtonGroup.es.js +69 -0
- package/dist/RadioButton/helpers.cjs.js +14 -0
- package/dist/RadioButton/helpers.d.ts +18 -0
- package/dist/RadioButton/helpers.es.js +14 -0
- package/dist/RadioButton/index.cjs.js +7 -0
- package/dist/RadioButton/index.d.ts +8 -0
- package/dist/RadioButton/index.es.js +7 -0
- package/dist/RadioButton/styles.cjs.js +84 -0
- package/dist/RadioButton/styles.d.ts +12 -0
- package/dist/RadioButton/styles.es.js +84 -0
- package/dist/RadioButton/types.d.ts +65 -0
- package/dist/Select/Select.cjs.js +114 -0
- package/dist/Select/Select.d.ts +4 -0
- package/dist/Select/Select.es.js +115 -0
- package/dist/Select/helpers.cjs.js +16 -0
- package/dist/Select/helpers.d.ts +138 -0
- package/dist/Select/helpers.es.js +16 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/styles.cjs.js +415 -0
- package/dist/Select/styles.d.ts +9 -0
- package/dist/Select/styles.es.js +415 -0
- package/dist/Select/types.d.ts +116 -0
- package/dist/Select/useSelect.cjs.js +72 -0
- package/dist/Select/useSelect.d.ts +150 -0
- package/dist/Select/useSelect.es.js +72 -0
- package/dist/Switch/Switch.cjs.js +53 -0
- package/dist/Switch/Switch.d.ts +4 -0
- package/dist/Switch/Switch.es.js +54 -0
- package/dist/Switch/index.d.ts +2 -0
- package/dist/Switch/styles.cjs.js +78 -0
- package/dist/Switch/styles.d.ts +7 -0
- package/dist/Switch/styles.es.js +78 -0
- package/dist/Switch/types.d.ts +25 -0
- package/dist/Tabs/Tab.cjs.js +42 -0
- package/dist/Tabs/Tab.d.ts +4 -0
- package/dist/Tabs/Tab.es.js +43 -0
- package/dist/Tabs/TabPanel.cjs.js +14 -0
- package/dist/Tabs/TabPanel.d.ts +4 -0
- package/dist/Tabs/TabPanel.es.js +15 -0
- package/dist/Tabs/Tabs.cjs.js +21 -0
- package/dist/Tabs/Tabs.d.ts +5 -0
- package/dist/Tabs/Tabs.es.js +21 -0
- package/dist/Tabs/TabsList.cjs.js +12 -0
- package/dist/Tabs/TabsList.d.ts +4 -0
- package/dist/Tabs/TabsList.es.js +13 -0
- package/dist/Tabs/index.cjs.js +10 -0
- package/dist/Tabs/index.d.ts +12 -0
- package/dist/Tabs/index.es.js +11 -0
- package/dist/Tabs/styles.cjs.js +74 -0
- package/dist/Tabs/styles.d.ts +9 -0
- package/dist/Tabs/styles.es.js +74 -0
- package/dist/Tabs/types.d.ts +51 -0
- package/dist/Tag/Tag.cjs.js +39 -0
- package/dist/Tag/Tag.d.ts +4 -0
- package/dist/Tag/Tag.es.js +40 -0
- package/dist/Tag/index.d.ts +2 -0
- package/dist/Tag/styles.cjs.js +51 -0
- package/dist/Tag/styles.d.ts +6 -0
- package/dist/Tag/styles.es.js +51 -0
- package/dist/Tag/types.d.ts +18 -0
- package/dist/TextField/TextField.cjs.js +100 -0
- package/dist/TextField/TextField.d.ts +4 -0
- package/dist/TextField/TextField.es.js +101 -0
- package/dist/TextField/index.d.ts +2 -0
- package/dist/TextField/styles.cjs.js +65 -0
- package/dist/TextField/styles.d.ts +9 -0
- package/dist/TextField/styles.es.js +65 -0
- package/dist/TextField/types.d.ts +41 -0
- package/dist/Textarea/Textarea.cjs.js +103 -0
- package/dist/Textarea/Textarea.d.ts +4 -0
- package/dist/Textarea/Textarea.es.js +104 -0
- package/dist/Textarea/index.d.ts +2 -0
- package/dist/Textarea/styles.cjs.js +80 -0
- package/dist/Textarea/styles.d.ts +9 -0
- package/dist/Textarea/styles.es.js +80 -0
- package/dist/Textarea/types.d.ts +47 -0
- package/dist/Tooltip/Tooltip.cjs.js +69 -0
- package/dist/Tooltip/Tooltip.d.ts +4 -0
- package/dist/Tooltip/Tooltip.es.js +70 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/styles.cjs.js +232 -0
- package/dist/Tooltip/styles.d.ts +13 -0
- package/dist/Tooltip/styles.es.js +232 -0
- package/dist/Tooltip/types.d.ts +22 -0
- package/dist/assets/icon-arrow-bottom.svg.cjs.js +21 -0
- package/dist/assets/icon-arrow-bottom.svg.es.js +5 -0
- package/dist/assets/icon-close.svg.cjs.js +21 -0
- package/dist/assets/icon-close.svg.es.js +5 -0
- package/dist/assets/icon-error.svg.cjs.js +21 -0
- package/dist/assets/icon-error.svg.es.js +5 -0
- package/dist/assets/icon-info.svg.cjs.js +21 -0
- package/dist/assets/icon-info.svg.es.js +5 -0
- package/dist/assets/icon-lines.svg.cjs.js +21 -0
- package/dist/assets/icon-lines.svg.es.js +5 -0
- package/dist/assets/icon-success.svg.cjs.js +21 -0
- package/dist/assets/icon-success.svg.es.js +5 -0
- package/dist/assets/icon-warning.svg.cjs.js +21 -0
- package/dist/assets/icon-warning.svg.es.js +5 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.cjs.js +63 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.es.js +63 -0
- package/dist/types/propsWithAttributes.d.ts +2 -0
- package/dist/types/size.d.ts +2 -0
- package/dist/typography/Text/Text.cjs.js +31 -0
- package/dist/typography/Text/Text.d.ts +4 -0
- package/dist/typography/Text/Text.es.js +32 -0
- package/dist/typography/Text/__stories__/Text.stories.d.ts +9 -0
- package/dist/typography/Text/index.d.ts +2 -0
- package/dist/typography/Text/styles.cjs.js +69 -0
- package/dist/typography/Text/styles.d.ts +2 -0
- package/dist/typography/Text/styles.es.js +69 -0
- package/dist/typography/Text/types.d.ts +22 -0
- package/dist/typography/Title/Title.cjs.js +26 -0
- package/dist/typography/Title/Title.d.ts +4 -0
- package/dist/typography/Title/Title.es.js +27 -0
- package/dist/typography/Title/__stories__/Title.stories.d.ts +9 -0
- package/dist/typography/Title/index.d.ts +2 -0
- package/dist/typography/Title/styles.cjs.js +75 -0
- package/dist/typography/Title/styles.d.ts +2 -0
- package/dist/typography/Title/styles.es.js +75 -0
- package/dist/typography/Title/types.d.ts +22 -0
- package/package.json +71 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { default as React, RefObject } from 'react';
|
|
2
|
+
import { TransitionStatus } from 'react-transition-state';
|
|
3
|
+
import { TQuenSize } from '../types/size';
|
|
4
|
+
export declare const direction: readonly ["bottomLeft", "bottomRight", "topLeft", "topRight", "bottom", "top", "left", "right"];
|
|
5
|
+
export type TDropdownSortGroup = (a: string | number, b: string | number) => number;
|
|
6
|
+
export type TDropdownDirection = (typeof direction)[number];
|
|
7
|
+
export type TDropdownOnClick<Item> = (item: Item, event: React.MouseEvent) => void;
|
|
8
|
+
export interface IDropdownDefaultItem {
|
|
9
|
+
key?: string | number;
|
|
10
|
+
label: React.ReactNode;
|
|
11
|
+
leftContent?: React.ReactNode;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
onClick?: TDropdownOnClick<IDropdownDefaultItem>;
|
|
14
|
+
groupId?: string | number;
|
|
15
|
+
}
|
|
16
|
+
export interface IDropdownMappersItem<ITEM> {
|
|
17
|
+
/** Label renderer */
|
|
18
|
+
getItemLabel?: TDropdownGetItemLabel<ITEM>;
|
|
19
|
+
/** Unique key extractor */
|
|
20
|
+
getItemKey?: TDropdownGetItemKey<ITEM>;
|
|
21
|
+
/** Disable state checker */
|
|
22
|
+
getItemDisabled?: TDropdownGetItemDisabled<ITEM>;
|
|
23
|
+
getItemLeftContent?: TDropdownGetItemLeftContent<ITEM>;
|
|
24
|
+
/** Group identifier */
|
|
25
|
+
getItemGroupId?: TDropdownGetItemGroupId<ITEM>;
|
|
26
|
+
getItemOnClick?: TDropdownGetItemOnClick<ITEM>;
|
|
27
|
+
}
|
|
28
|
+
export interface IDropdownProps<ITEM = IDropdownDefaultItem> extends IDropdownMappersItem<ITEM> {
|
|
29
|
+
/** Opening direction */
|
|
30
|
+
direction?: TDropdownDirection;
|
|
31
|
+
/** Array of dropdown items */
|
|
32
|
+
items?: ITEM[];
|
|
33
|
+
/** Item selection handler */
|
|
34
|
+
onItemClick?: TDropdownOnClick<ITEM>;
|
|
35
|
+
/** Click outside handler */
|
|
36
|
+
onClickOutside?: () => void;
|
|
37
|
+
/** Additional CSS class */
|
|
38
|
+
className?: string;
|
|
39
|
+
/** Group sorting function */
|
|
40
|
+
sortGroup?: TDropdownSortGroup;
|
|
41
|
+
/** Custom close handler */
|
|
42
|
+
onClickClose?: () => void;
|
|
43
|
+
/** Custom width */
|
|
44
|
+
width?: string;
|
|
45
|
+
/** Custom height */
|
|
46
|
+
height?: string;
|
|
47
|
+
/** Controls visibility */
|
|
48
|
+
open?: boolean;
|
|
49
|
+
/** */
|
|
50
|
+
content?: React.ReactElement;
|
|
51
|
+
/** Disable close on outside click */
|
|
52
|
+
notCloseOutside?: boolean;
|
|
53
|
+
/** Disable entire dropdown */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** Size variant */
|
|
56
|
+
size?: TQuenSize;
|
|
57
|
+
/** Reference to anchor element */
|
|
58
|
+
anchorRef: RefObject<HTMLElement | null>;
|
|
59
|
+
}
|
|
60
|
+
export type TDropdownListProps<Item> = Omit<IDropdownProps<Item>, "children" | "height"> & {
|
|
61
|
+
top?: number;
|
|
62
|
+
left?: number;
|
|
63
|
+
};
|
|
64
|
+
export type TDropdownPortalProps<Item> = Omit<TDropdownListProps<Item>, "children" | "ref"> & {
|
|
65
|
+
direction: TDropdownDirection;
|
|
66
|
+
anchorRect: DOMRect;
|
|
67
|
+
height?: string;
|
|
68
|
+
anchorRef: React.RefObject<HTMLElement | null>;
|
|
69
|
+
transitionStatus: TransitionStatus;
|
|
70
|
+
};
|
|
71
|
+
export type TDropdownGetItemLabel<Item> = (item: Item) => React.ReactNode;
|
|
72
|
+
export type TDropdownGetItemKey<Item> = (item: Item) => string | number | undefined;
|
|
73
|
+
export type TDropdownGetItemDisabled<Item> = (item: Item) => boolean | undefined;
|
|
74
|
+
export type TDropdownGetItemLeftContent<Item> = (item: Item) => React.ReactNode | undefined;
|
|
75
|
+
export type TDropdownGetItemGroupId<Item> = (item: Item) => string | number | undefined;
|
|
76
|
+
export type TDropdownGetItemOnClick<Item> = (item: Item) => TDropdownOnClick<Item> | undefined;
|
|
77
|
+
export type TDropdownItemProps<ITEM> = Omit<IDropdownMappersItem<ITEM>, "getItemKey" | "getItemGroupId"> & Required<Pick<IDropdownMappersItem<ITEM>, "getItemLabel">> & {
|
|
78
|
+
item: ITEM;
|
|
79
|
+
onItemClick?: TDropdownOnClick<ITEM>;
|
|
80
|
+
size: TQuenSize;
|
|
81
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const styles = require("./styles.cjs.js");
|
|
5
|
+
const Flex = React.forwardRef(
|
|
6
|
+
({ children, ...props }, ref) => {
|
|
7
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles.FlexWrapper, { ref, ...props, children });
|
|
8
|
+
}
|
|
9
|
+
);
|
|
10
|
+
module.exports = Flex;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { FlexWrapper } from "./styles.es.js";
|
|
4
|
+
const Flex = forwardRef(
|
|
5
|
+
({ children, ...props }, ref) => {
|
|
6
|
+
return /* @__PURE__ */ jsx(FlexWrapper, { ref, ...props, children });
|
|
7
|
+
}
|
|
8
|
+
);
|
|
9
|
+
export {
|
|
10
|
+
Flex as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const getGap = (theme, gap) => {
|
|
5
|
+
if (typeof gap === "number") {
|
|
6
|
+
return `${gap}px`;
|
|
7
|
+
} else if (gap) {
|
|
8
|
+
return theme.space[gap];
|
|
9
|
+
}
|
|
10
|
+
return void 0;
|
|
11
|
+
};
|
|
12
|
+
const FlexWrapper = styled.div.withConfig({
|
|
13
|
+
shouldForwardProp: (prop) => ![
|
|
14
|
+
"direction",
|
|
15
|
+
"gap",
|
|
16
|
+
"align",
|
|
17
|
+
"columnGap",
|
|
18
|
+
"rowGap",
|
|
19
|
+
"justify",
|
|
20
|
+
"wrap"
|
|
21
|
+
].includes(prop)
|
|
22
|
+
}).attrs({ className: "quen-ui__flex" })`
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: ${({ direction }) => direction || "row"};
|
|
25
|
+
gap: ${({ gap, theme }) => getGap(theme, gap)};
|
|
26
|
+
align-items: ${({ align }) => align};
|
|
27
|
+
column-gap: ${({ columnGap, theme }) => getGap(theme, columnGap)};
|
|
28
|
+
row-gap: ${({ rowGap, theme }) => getGap(theme, rowGap)};
|
|
29
|
+
justify-content: ${({ justify }) => justify};
|
|
30
|
+
flex-wrap: ${({ wrap }) => wrap};
|
|
31
|
+
`;
|
|
32
|
+
exports.FlexWrapper = FlexWrapper;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IFlexProps } from './types';
|
|
2
|
+
export declare const FlexWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('styled-components').FastOmit<import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>>, never>, Omit<IFlexProps, "children">>> & string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
const getGap = (theme, gap) => {
|
|
3
|
+
if (typeof gap === "number") {
|
|
4
|
+
return `${gap}px`;
|
|
5
|
+
} else if (gap) {
|
|
6
|
+
return theme.space[gap];
|
|
7
|
+
}
|
|
8
|
+
return void 0;
|
|
9
|
+
};
|
|
10
|
+
const FlexWrapper = styled.div.withConfig({
|
|
11
|
+
shouldForwardProp: (prop) => ![
|
|
12
|
+
"direction",
|
|
13
|
+
"gap",
|
|
14
|
+
"align",
|
|
15
|
+
"columnGap",
|
|
16
|
+
"rowGap",
|
|
17
|
+
"justify",
|
|
18
|
+
"wrap"
|
|
19
|
+
].includes(prop)
|
|
20
|
+
}).attrs({ className: "quen-ui__flex" })`
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: ${({ direction }) => direction || "row"};
|
|
23
|
+
gap: ${({ gap, theme }) => getGap(theme, gap)};
|
|
24
|
+
align-items: ${({ align }) => align};
|
|
25
|
+
column-gap: ${({ columnGap, theme }) => getGap(theme, columnGap)};
|
|
26
|
+
row-gap: ${({ rowGap, theme }) => getGap(theme, rowGap)};
|
|
27
|
+
justify-content: ${({ justify }) => justify};
|
|
28
|
+
flex-wrap: ${({ wrap }) => wrap};
|
|
29
|
+
`;
|
|
30
|
+
export {
|
|
31
|
+
FlexWrapper
|
|
32
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IQuenUITheme } from '../../../theme/src';
|
|
3
|
+
export interface IFlexProps {
|
|
4
|
+
/** Additional style */
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
/** Custom CSS class */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Content */
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/** Spacing between all children (CSS gap) */
|
|
11
|
+
gap?: keyof IQuenUITheme["space"] | number;
|
|
12
|
+
/** Cross-axis alignment (align-items) */
|
|
13
|
+
align?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
14
|
+
/** Horizontal spacing between columns */
|
|
15
|
+
columnGap?: keyof IQuenUITheme["space"] | number;
|
|
16
|
+
/** Vertical spacing between rows */
|
|
17
|
+
rowGap?: keyof IQuenUITheme["space"] | number;
|
|
18
|
+
/** Main axis direction */
|
|
19
|
+
direction?: "row" | "column" | "row-reverse" | "column-reverse";
|
|
20
|
+
/** Main-axis alignment (justify-content) */
|
|
21
|
+
justify?: "start" | "center" | "end" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
22
|
+
wrap?: "wrap" | "wrap-reverse" | "no-wrap";
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const iconClose = require("../assets/icon-close.svg.cjs.js");
|
|
5
|
+
const styles = require("./styles.cjs.js");
|
|
6
|
+
const Text = require("../typography/Text/Text.cjs.js");
|
|
7
|
+
const Loader = require("../Loader/Loader.cjs.js");
|
|
8
|
+
const Image = ({
|
|
9
|
+
src,
|
|
10
|
+
fallback,
|
|
11
|
+
onError,
|
|
12
|
+
alt,
|
|
13
|
+
height,
|
|
14
|
+
width,
|
|
15
|
+
placeholder,
|
|
16
|
+
preview = false,
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
const [isFullScreen, setIsFullScreen] = React.useState(false);
|
|
20
|
+
const [isLoading, setIsLoading] = React.useState(true);
|
|
21
|
+
const [error, setError] = React.useState(!src);
|
|
22
|
+
React.useEffect(() => setError(!src), [src]);
|
|
23
|
+
const handleImageError = (e) => {
|
|
24
|
+
setError(true);
|
|
25
|
+
if (onError) {
|
|
26
|
+
onError(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const handleClick = () => {
|
|
30
|
+
if (preview && !error && src) {
|
|
31
|
+
setIsFullScreen(true);
|
|
32
|
+
setIsLoading(true);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleCloseFullscreen = () => {
|
|
36
|
+
setIsFullScreen(false);
|
|
37
|
+
};
|
|
38
|
+
const imageSrc = error && fallback ? fallback : src;
|
|
39
|
+
const showPlaceholder = (!imageSrc || error) && placeholder;
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
styles.ImageContainer,
|
|
43
|
+
{
|
|
44
|
+
height,
|
|
45
|
+
preview: preview && !error && !!src,
|
|
46
|
+
width,
|
|
47
|
+
onClick: handleClick,
|
|
48
|
+
...props,
|
|
49
|
+
children: showPlaceholder ? /* @__PURE__ */ jsxRuntime.jsx(styles.ImagePlaceholderWrapper, { children: placeholder }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
51
|
+
styles.ImageStyled,
|
|
52
|
+
{
|
|
53
|
+
src: imageSrc,
|
|
54
|
+
alt,
|
|
55
|
+
onError: handleImageError,
|
|
56
|
+
onLoad: () => setIsLoading(false)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx(styles.ImageLoaderWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(Loader, { view: "oval" }) }),
|
|
60
|
+
preview && !error && src && /* @__PURE__ */ jsxRuntime.jsx(styles.ImagePreviewOverlay, { children: /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "m", color: "unset", children: "Preview" }) })
|
|
61
|
+
] })
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
isFullScreen && /* @__PURE__ */ jsxRuntime.jsxs(styles.ImageFullscreenOverlay, { onClick: handleCloseFullscreen, children: [
|
|
65
|
+
/* @__PURE__ */ jsxRuntime.jsx(styles.CloseButtonStyled, { view: "icon", onClick: handleCloseFullscreen, children: /* @__PURE__ */ jsxRuntime.jsx(iconClose, {}) }),
|
|
66
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
styles.ImageFullscreenStyled,
|
|
68
|
+
{
|
|
69
|
+
src,
|
|
70
|
+
alt,
|
|
71
|
+
onClick: (e) => e.stopPropagation(),
|
|
72
|
+
onLoad: () => setIsLoading(false)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx(styles.ImageLoaderWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(Loader, { view: "oval" }) })
|
|
76
|
+
] })
|
|
77
|
+
] });
|
|
78
|
+
};
|
|
79
|
+
module.exports = Image;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import SvgIconClose from "../assets/icon-close.svg.es.js";
|
|
4
|
+
import { ImageContainer, ImagePlaceholderWrapper, ImageStyled, ImageLoaderWrapper, ImagePreviewOverlay, ImageFullscreenOverlay, CloseButtonStyled, ImageFullscreenStyled } from "./styles.es.js";
|
|
5
|
+
import Text from "../typography/Text/Text.es.js";
|
|
6
|
+
import Loader from "../Loader/Loader.es.js";
|
|
7
|
+
const Image = ({
|
|
8
|
+
src,
|
|
9
|
+
fallback,
|
|
10
|
+
onError,
|
|
11
|
+
alt,
|
|
12
|
+
height,
|
|
13
|
+
width,
|
|
14
|
+
placeholder,
|
|
15
|
+
preview = false,
|
|
16
|
+
...props
|
|
17
|
+
}) => {
|
|
18
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
19
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
20
|
+
const [error, setError] = useState(!src);
|
|
21
|
+
useEffect(() => setError(!src), [src]);
|
|
22
|
+
const handleImageError = (e) => {
|
|
23
|
+
setError(true);
|
|
24
|
+
if (onError) {
|
|
25
|
+
onError(e);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const handleClick = () => {
|
|
29
|
+
if (preview && !error && src) {
|
|
30
|
+
setIsFullScreen(true);
|
|
31
|
+
setIsLoading(true);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const handleCloseFullscreen = () => {
|
|
35
|
+
setIsFullScreen(false);
|
|
36
|
+
};
|
|
37
|
+
const imageSrc = error && fallback ? fallback : src;
|
|
38
|
+
const showPlaceholder = (!imageSrc || error) && placeholder;
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
ImageContainer,
|
|
42
|
+
{
|
|
43
|
+
height,
|
|
44
|
+
preview: preview && !error && !!src,
|
|
45
|
+
width,
|
|
46
|
+
onClick: handleClick,
|
|
47
|
+
...props,
|
|
48
|
+
children: showPlaceholder ? /* @__PURE__ */ jsx(ImagePlaceholderWrapper, { children: placeholder }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
ImageStyled,
|
|
51
|
+
{
|
|
52
|
+
src: imageSrc,
|
|
53
|
+
alt,
|
|
54
|
+
onError: handleImageError,
|
|
55
|
+
onLoad: () => setIsLoading(false)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
isLoading && /* @__PURE__ */ jsx(ImageLoaderWrapper, { children: /* @__PURE__ */ jsx(Loader, { view: "oval" }) }),
|
|
59
|
+
preview && !error && src && /* @__PURE__ */ jsx(ImagePreviewOverlay, { children: /* @__PURE__ */ jsx(Text, { size: "m", color: "unset", children: "Preview" }) })
|
|
60
|
+
] })
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
isFullScreen && /* @__PURE__ */ jsxs(ImageFullscreenOverlay, { onClick: handleCloseFullscreen, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(CloseButtonStyled, { view: "icon", onClick: handleCloseFullscreen, children: /* @__PURE__ */ jsx(SvgIconClose, {}) }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
ImageFullscreenStyled,
|
|
67
|
+
{
|
|
68
|
+
src,
|
|
69
|
+
alt,
|
|
70
|
+
onClick: (e) => e.stopPropagation(),
|
|
71
|
+
onLoad: () => setIsLoading(false)
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
isLoading && /* @__PURE__ */ jsx(ImageLoaderWrapper, { children: /* @__PURE__ */ jsx(Loader, { view: "oval" }) })
|
|
75
|
+
] })
|
|
76
|
+
] });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
Image as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const polished = require("polished");
|
|
5
|
+
const Button = require("../Button/Button.cjs.js");
|
|
6
|
+
const ImageContainer = styled.div`
|
|
7
|
+
position: relative;
|
|
8
|
+
width: ${({ width }) => typeof width === "number" ? `${width}px` : width || "auto"};
|
|
9
|
+
height: ${({ height }) => typeof height === "number" ? `${height}px` : height || "auto"};
|
|
10
|
+
display: inline-block;
|
|
11
|
+
cursor: ${({ preview }) => preview ? "pointer" : "default"};
|
|
12
|
+
`;
|
|
13
|
+
const ImageStyled = styled.img`
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
object-fit: cover;
|
|
17
|
+
display: block;
|
|
18
|
+
`;
|
|
19
|
+
const ImagePlaceholderWrapper = styled.div`
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
background-color: #f0f0f0;
|
|
26
|
+
`;
|
|
27
|
+
const ImagePreviewOverlay = styled.div`
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 0;
|
|
30
|
+
left: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
bottom: 0;
|
|
33
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
color: white;
|
|
38
|
+
font-size: 1.2rem;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transition: opacity 0.3s ease;
|
|
41
|
+
|
|
42
|
+
${ImageContainer}:hover & {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
const ImageFullscreenOverlay = styled.div`
|
|
47
|
+
position: fixed;
|
|
48
|
+
top: 0;
|
|
49
|
+
left: 0;
|
|
50
|
+
right: 0;
|
|
51
|
+
bottom: 0;
|
|
52
|
+
background-color: ${({ theme }) => polished.rgba(theme.colors.gray["2"], 0.5)};
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
z-index: 1000;
|
|
57
|
+
`;
|
|
58
|
+
const ImageFullscreenStyled = styled.img`
|
|
59
|
+
max-width: 90%;
|
|
60
|
+
max-height: 90%;
|
|
61
|
+
object-fit: contain;
|
|
62
|
+
`;
|
|
63
|
+
const CloseButtonStyled = styled(Button)`
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 20px;
|
|
66
|
+
right: 20px;
|
|
67
|
+
z-index: 1001;
|
|
68
|
+
`;
|
|
69
|
+
const ImageLoaderWrapper = styled.div`
|
|
70
|
+
position: absolute;
|
|
71
|
+
top: 0;
|
|
72
|
+
left: 0;
|
|
73
|
+
right: 0;
|
|
74
|
+
bottom: 0;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
transition: opacity 0.3s ease;
|
|
79
|
+
`;
|
|
80
|
+
exports.CloseButtonStyled = CloseButtonStyled;
|
|
81
|
+
exports.ImageContainer = ImageContainer;
|
|
82
|
+
exports.ImageFullscreenOverlay = ImageFullscreenOverlay;
|
|
83
|
+
exports.ImageFullscreenStyled = ImageFullscreenStyled;
|
|
84
|
+
exports.ImageLoaderWrapper = ImageLoaderWrapper;
|
|
85
|
+
exports.ImagePlaceholderWrapper = ImagePlaceholderWrapper;
|
|
86
|
+
exports.ImagePreviewOverlay = ImagePreviewOverlay;
|
|
87
|
+
exports.ImageStyled = ImageStyled;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IImageProps } from './types';
|
|
2
|
+
export declare const ImageContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
width: IImageProps["width"];
|
|
4
|
+
height: IImageProps["height"];
|
|
5
|
+
preview: IImageProps["preview"];
|
|
6
|
+
}>> & string;
|
|
7
|
+
export declare const ImageStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
|
|
8
|
+
export declare const ImagePlaceholderWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
+
export declare const ImagePreviewOverlay: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
|
+
export declare const ImageFullscreenOverlay: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const ImageFullscreenStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, never>> & string;
|
|
12
|
+
export declare const CloseButtonStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('..').IButtonProps, never>> & string & Omit<import('react').FC<import('..').IButtonProps>, keyof import('react').Component<any, {}, any>>;
|
|
13
|
+
export declare const ImageLoaderWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { rgba } from "polished";
|
|
3
|
+
import Button from "../Button/Button.es.js";
|
|
4
|
+
const ImageContainer = styled.div`
|
|
5
|
+
position: relative;
|
|
6
|
+
width: ${({ width }) => typeof width === "number" ? `${width}px` : width || "auto"};
|
|
7
|
+
height: ${({ height }) => typeof height === "number" ? `${height}px` : height || "auto"};
|
|
8
|
+
display: inline-block;
|
|
9
|
+
cursor: ${({ preview }) => preview ? "pointer" : "default"};
|
|
10
|
+
`;
|
|
11
|
+
const ImageStyled = styled.img`
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
object-fit: cover;
|
|
15
|
+
display: block;
|
|
16
|
+
`;
|
|
17
|
+
const ImagePlaceholderWrapper = styled.div`
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
background-color: #f0f0f0;
|
|
24
|
+
`;
|
|
25
|
+
const ImagePreviewOverlay = styled.div`
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0;
|
|
28
|
+
left: 0;
|
|
29
|
+
right: 0;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
color: white;
|
|
36
|
+
font-size: 1.2rem;
|
|
37
|
+
opacity: 0;
|
|
38
|
+
transition: opacity 0.3s ease;
|
|
39
|
+
|
|
40
|
+
${ImageContainer}:hover & {
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const ImageFullscreenOverlay = styled.div`
|
|
45
|
+
position: fixed;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
right: 0;
|
|
49
|
+
bottom: 0;
|
|
50
|
+
background-color: ${({ theme }) => rgba(theme.colors.gray["2"], 0.5)};
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
z-index: 1000;
|
|
55
|
+
`;
|
|
56
|
+
const ImageFullscreenStyled = styled.img`
|
|
57
|
+
max-width: 90%;
|
|
58
|
+
max-height: 90%;
|
|
59
|
+
object-fit: contain;
|
|
60
|
+
`;
|
|
61
|
+
const CloseButtonStyled = styled(Button)`
|
|
62
|
+
position: absolute;
|
|
63
|
+
top: 20px;
|
|
64
|
+
right: 20px;
|
|
65
|
+
z-index: 1001;
|
|
66
|
+
`;
|
|
67
|
+
const ImageLoaderWrapper = styled.div`
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
bottom: 0;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
transition: opacity 0.3s ease;
|
|
77
|
+
`;
|
|
78
|
+
export {
|
|
79
|
+
CloseButtonStyled,
|
|
80
|
+
ImageContainer,
|
|
81
|
+
ImageFullscreenOverlay,
|
|
82
|
+
ImageFullscreenStyled,
|
|
83
|
+
ImageLoaderWrapper,
|
|
84
|
+
ImagePlaceholderWrapper,
|
|
85
|
+
ImagePreviewOverlay,
|
|
86
|
+
ImageStyled
|
|
87
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface IImageProps {
|
|
3
|
+
/** Alternative text for accessibility */
|
|
4
|
+
alt?: string;
|
|
5
|
+
/** Fallback image URL when main fails to load */
|
|
6
|
+
fallback?: string;
|
|
7
|
+
/** Image height */
|
|
8
|
+
height?: number | string;
|
|
9
|
+
/** Custom placeholder while loading */
|
|
10
|
+
placeholder?: React.ReactNode;
|
|
11
|
+
/** Enables lightbox preview on click */
|
|
12
|
+
preview?: boolean;
|
|
13
|
+
/** Image source URL */
|
|
14
|
+
src?: string;
|
|
15
|
+
/** Image width */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** Error handler for failed loads */
|
|
18
|
+
onError?: (event: React.SyntheticEvent) => void;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|