@quen-ui/components 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# quen-ui/components
|
|
2
|
+
|
|
3
|
+
A set of UI components for React applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @quen-ui/components @quen-ui/theme
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { Button } from '@quen-ui/components';
|
|
15
|
+
|
|
16
|
+
export function App() {
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<Button view="primary">Сохранить</Button>
|
|
20
|
+
<Button view="secondary">Отмена</Button>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Theme support
|
|
27
|
+
|
|
28
|
+
Components use tokens from @quen-ui/theme. Make sure the theme is enabled in your app:
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { QuenUIProvider, QuenUIDarkTheme } from '@quen-ui/theme';
|
|
32
|
+
import { Button } from '@quen-ui/components';
|
|
33
|
+
|
|
34
|
+
export function App() {
|
|
35
|
+
return (
|
|
36
|
+
<QuenUIProvider theme={QuenUIDarkTheme}>
|
|
37
|
+
<Button variant="primary">Example</Button>
|
|
38
|
+
</QuenUIProvider>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## [Documentation](https://quen-ui.github.io/quen-ui/)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const styles = require("./styles.cjs.js");
|
|
5
|
+
const iconClose = require("../assets/icon-close.svg.cjs.js");
|
|
6
|
+
const Flex = require("../Flex/Flex.cjs.js");
|
|
7
|
+
const Title = require("../typography/Title/Title.cjs.js");
|
|
8
|
+
const Text = require("../typography/Text/Text.cjs.js");
|
|
9
|
+
const Button = require("../Button/Button.cjs.js");
|
|
10
|
+
const Alert = ({
|
|
11
|
+
size = "m",
|
|
12
|
+
title,
|
|
13
|
+
icon,
|
|
14
|
+
description,
|
|
15
|
+
type = "info",
|
|
16
|
+
closable,
|
|
17
|
+
onClose,
|
|
18
|
+
action,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
...props
|
|
22
|
+
}) => {
|
|
23
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
24
|
+
const handleClose = (event) => {
|
|
25
|
+
setIsOpen(false);
|
|
26
|
+
onClose == null ? void 0 : onClose(event);
|
|
27
|
+
};
|
|
28
|
+
if (isOpen) {
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30
|
+
styles.AlertWrapper,
|
|
31
|
+
{
|
|
32
|
+
size,
|
|
33
|
+
type,
|
|
34
|
+
className,
|
|
35
|
+
style,
|
|
36
|
+
role: "alert",
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: "l", children: [
|
|
40
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx(styles.AlertIconWrapper, { type, children: icon }),
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Flex, { direction: "column", className: "quen-ui__alert-content", children: [
|
|
42
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(Title, { type: type !== "info" ? type : void 0, size, children: title }),
|
|
43
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text, { size, children: description }),
|
|
44
|
+
action && /* @__PURE__ */ jsxRuntime.jsx(styles.AlertActionWrapper, { children: action })
|
|
45
|
+
] })
|
|
46
|
+
] }),
|
|
47
|
+
closable && /* @__PURE__ */ jsxRuntime.jsx(Button, { view: "icon", size, onClick: handleClose, children: /* @__PURE__ */ jsxRuntime.jsx(iconClose, { width: 14 }) })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
54
|
+
module.exports = Alert;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { AlertWrapper, AlertIconWrapper, AlertActionWrapper } from "./styles.es.js";
|
|
4
|
+
import SvgIconClose from "../assets/icon-close.svg.es.js";
|
|
5
|
+
import Flex from "../Flex/Flex.es.js";
|
|
6
|
+
import Title from "../typography/Title/Title.es.js";
|
|
7
|
+
import Text from "../typography/Text/Text.es.js";
|
|
8
|
+
import Button from "../Button/Button.es.js";
|
|
9
|
+
const Alert = ({
|
|
10
|
+
size = "m",
|
|
11
|
+
title,
|
|
12
|
+
icon,
|
|
13
|
+
description,
|
|
14
|
+
type = "info",
|
|
15
|
+
closable,
|
|
16
|
+
onClose,
|
|
17
|
+
action,
|
|
18
|
+
className,
|
|
19
|
+
style,
|
|
20
|
+
...props
|
|
21
|
+
}) => {
|
|
22
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
23
|
+
const handleClose = (event) => {
|
|
24
|
+
setIsOpen(false);
|
|
25
|
+
onClose == null ? void 0 : onClose(event);
|
|
26
|
+
};
|
|
27
|
+
if (isOpen) {
|
|
28
|
+
return /* @__PURE__ */ jsxs(
|
|
29
|
+
AlertWrapper,
|
|
30
|
+
{
|
|
31
|
+
size,
|
|
32
|
+
type,
|
|
33
|
+
className,
|
|
34
|
+
style,
|
|
35
|
+
role: "alert",
|
|
36
|
+
...props,
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsxs(Flex, { gap: "l", children: [
|
|
39
|
+
icon && /* @__PURE__ */ jsx(AlertIconWrapper, { type, children: icon }),
|
|
40
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", className: "quen-ui__alert-content", children: [
|
|
41
|
+
title && /* @__PURE__ */ jsx(Title, { type: type !== "info" ? type : void 0, size, children: title }),
|
|
42
|
+
description && /* @__PURE__ */ jsx(Text, { size, children: description }),
|
|
43
|
+
action && /* @__PURE__ */ jsx(AlertActionWrapper, { children: action })
|
|
44
|
+
] })
|
|
45
|
+
] }),
|
|
46
|
+
closable && /* @__PURE__ */ jsx(Button, { view: "icon", size, onClick: handleClose, children: /* @__PURE__ */ jsx(SvgIconClose, { width: 14 }) })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
Alert as default
|
|
55
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const polished = require("polished");
|
|
5
|
+
const getTypeStyles = (theme, type) => {
|
|
6
|
+
switch (type) {
|
|
7
|
+
case "success":
|
|
8
|
+
return styled.css`
|
|
9
|
+
${polished.linearGradient({
|
|
10
|
+
colorStops: [theme.colors.green[1], theme.colors.green[4]],
|
|
11
|
+
toDirection: "to right"
|
|
12
|
+
})};
|
|
13
|
+
`;
|
|
14
|
+
case "danger":
|
|
15
|
+
return styled.css`
|
|
16
|
+
${polished.linearGradient({
|
|
17
|
+
colorStops: [theme.colors.red[1], theme.colors.red[4]],
|
|
18
|
+
toDirection: "to right"
|
|
19
|
+
})};
|
|
20
|
+
`;
|
|
21
|
+
case "warning":
|
|
22
|
+
return styled.css`
|
|
23
|
+
${polished.linearGradient({
|
|
24
|
+
colorStops: [theme.colors.orange[1], theme.colors.orange[4]],
|
|
25
|
+
toDirection: "to right"
|
|
26
|
+
})};
|
|
27
|
+
`;
|
|
28
|
+
case "info":
|
|
29
|
+
default:
|
|
30
|
+
return styled.css`
|
|
31
|
+
background: ${polished.rgba(theme.colors.grayViolet["9"], 0.3)};
|
|
32
|
+
`;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const getColorBackgroundIcon = (theme, type) => {
|
|
36
|
+
switch (type) {
|
|
37
|
+
case "success":
|
|
38
|
+
return theme.colors.green[9];
|
|
39
|
+
case "warning":
|
|
40
|
+
return theme.colors.orange[9];
|
|
41
|
+
case "danger":
|
|
42
|
+
return theme.colors.red[9];
|
|
43
|
+
case "info":
|
|
44
|
+
default:
|
|
45
|
+
return theme.colors.grayViolet[9];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const AlertWrapper = styled.div.withConfig({
|
|
49
|
+
shouldForwardProp: (prop) => !["size", "type"].includes(prop)
|
|
50
|
+
})`
|
|
51
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
52
|
+
padding: ${({ size, theme }) => theme.space[size]};
|
|
53
|
+
display: flex;
|
|
54
|
+
gap: ${({ size, theme }) => theme.space[size]};
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
${({ theme, type }) => getTypeStyles(theme, type)};
|
|
57
|
+
|
|
58
|
+
.quen-ui__alert-content {
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
const AlertIconWrapper = styled.div`
|
|
63
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
64
|
+
background: ${({ theme, type }) => getColorBackgroundIcon(theme, type)};
|
|
65
|
+
width: 32px;
|
|
66
|
+
height: 32px;
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
color: ${({ theme }) => theme.colors.grayViolet[1]};
|
|
71
|
+
min-width: 32px;
|
|
72
|
+
|
|
73
|
+
svg {
|
|
74
|
+
width: 16px;
|
|
75
|
+
height: 16px;
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
const AlertActionWrapper = styled.div`
|
|
79
|
+
margin-top: 0.5rem;
|
|
80
|
+
width: 100%;
|
|
81
|
+
display: flex;
|
|
82
|
+
justify-content: center;
|
|
83
|
+
|
|
84
|
+
button {
|
|
85
|
+
width: 100%;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
exports.AlertActionWrapper = AlertActionWrapper;
|
|
89
|
+
exports.AlertIconWrapper = AlertIconWrapper;
|
|
90
|
+
exports.AlertWrapper = AlertWrapper;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TQuenSize } from '../types/size';
|
|
2
|
+
import { IAlertProps } from './types';
|
|
3
|
+
export declare const AlertWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
+
size: TQuenSize;
|
|
5
|
+
type: IAlertProps["type"];
|
|
6
|
+
}>> & string;
|
|
7
|
+
export declare const AlertIconWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
8
|
+
type: IAlertProps["type"];
|
|
9
|
+
}>> & string;
|
|
10
|
+
export declare const AlertActionWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { rgba, linearGradient } from "polished";
|
|
3
|
+
const getTypeStyles = (theme, type) => {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case "success":
|
|
6
|
+
return css`
|
|
7
|
+
${linearGradient({
|
|
8
|
+
colorStops: [theme.colors.green[1], theme.colors.green[4]],
|
|
9
|
+
toDirection: "to right"
|
|
10
|
+
})};
|
|
11
|
+
`;
|
|
12
|
+
case "danger":
|
|
13
|
+
return css`
|
|
14
|
+
${linearGradient({
|
|
15
|
+
colorStops: [theme.colors.red[1], theme.colors.red[4]],
|
|
16
|
+
toDirection: "to right"
|
|
17
|
+
})};
|
|
18
|
+
`;
|
|
19
|
+
case "warning":
|
|
20
|
+
return css`
|
|
21
|
+
${linearGradient({
|
|
22
|
+
colorStops: [theme.colors.orange[1], theme.colors.orange[4]],
|
|
23
|
+
toDirection: "to right"
|
|
24
|
+
})};
|
|
25
|
+
`;
|
|
26
|
+
case "info":
|
|
27
|
+
default:
|
|
28
|
+
return css`
|
|
29
|
+
background: ${rgba(theme.colors.grayViolet["9"], 0.3)};
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getColorBackgroundIcon = (theme, type) => {
|
|
34
|
+
switch (type) {
|
|
35
|
+
case "success":
|
|
36
|
+
return theme.colors.green[9];
|
|
37
|
+
case "warning":
|
|
38
|
+
return theme.colors.orange[9];
|
|
39
|
+
case "danger":
|
|
40
|
+
return theme.colors.red[9];
|
|
41
|
+
case "info":
|
|
42
|
+
default:
|
|
43
|
+
return theme.colors.grayViolet[9];
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const AlertWrapper = styled.div.withConfig({
|
|
47
|
+
shouldForwardProp: (prop) => !["size", "type"].includes(prop)
|
|
48
|
+
})`
|
|
49
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
50
|
+
padding: ${({ size, theme }) => theme.space[size]};
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: ${({ size, theme }) => theme.space[size]};
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
${({ theme, type }) => getTypeStyles(theme, type)};
|
|
55
|
+
|
|
56
|
+
.quen-ui__alert-content {
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const AlertIconWrapper = styled.div`
|
|
61
|
+
border-radius: ${({ theme }) => theme.control.radius};
|
|
62
|
+
background: ${({ theme, type }) => getColorBackgroundIcon(theme, type)};
|
|
63
|
+
width: 32px;
|
|
64
|
+
height: 32px;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
color: ${({ theme }) => theme.colors.grayViolet[1]};
|
|
69
|
+
min-width: 32px;
|
|
70
|
+
|
|
71
|
+
svg {
|
|
72
|
+
width: 16px;
|
|
73
|
+
height: 16px;
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
const AlertActionWrapper = styled.div`
|
|
77
|
+
margin-top: 0.5rem;
|
|
78
|
+
width: 100%;
|
|
79
|
+
display: flex;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
|
|
82
|
+
button {
|
|
83
|
+
width: 100%;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
export {
|
|
87
|
+
AlertActionWrapper,
|
|
88
|
+
AlertIconWrapper,
|
|
89
|
+
AlertWrapper
|
|
90
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TQuenSize } from '../types/size';
|
|
3
|
+
export interface IAlertProps {
|
|
4
|
+
/** Main heading text (supports JSX) */
|
|
5
|
+
title?: React.ReactNode;
|
|
6
|
+
/** Custom action button/component (placed bottom) */
|
|
7
|
+
action?: React.ReactNode;
|
|
8
|
+
/** Shows close button when true */
|
|
9
|
+
closable?: boolean;
|
|
10
|
+
/** Secondary text content */
|
|
11
|
+
description?: React.ReactNode;
|
|
12
|
+
/** Custom icon component (placed left) */
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
/** Callback when alert is closed */
|
|
15
|
+
onClose?: React.MouseEventHandler;
|
|
16
|
+
/** Color scheme and icon (default: "info") */
|
|
17
|
+
type?: "success" | "warning" | "danger" | "info";
|
|
18
|
+
/** Controls dimensions */
|
|
19
|
+
size?: TQuenSize;
|
|
20
|
+
/** Additional CSS class */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Inline styles */
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const styles = require("./styles.cjs.js");
|
|
5
|
+
const AvatarIcon = require("./AvatarIcon.svg.cjs.js");
|
|
6
|
+
const helpers = require("./helpers.cjs.js");
|
|
7
|
+
const Flex = require("../Flex/Flex.cjs.js");
|
|
8
|
+
const Title = require("../typography/Title/Title.cjs.js");
|
|
9
|
+
const Text = require("../typography/Text/Text.cjs.js");
|
|
10
|
+
const Avatar = ({
|
|
11
|
+
size = "m",
|
|
12
|
+
className,
|
|
13
|
+
style,
|
|
14
|
+
children,
|
|
15
|
+
src,
|
|
16
|
+
alt,
|
|
17
|
+
name,
|
|
18
|
+
label = false,
|
|
19
|
+
allowedInitialsColors,
|
|
20
|
+
description,
|
|
21
|
+
color,
|
|
22
|
+
imageProps,
|
|
23
|
+
status,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
26
|
+
const [error, setError] = React.useState(!src);
|
|
27
|
+
const initials = React.useMemo(() => {
|
|
28
|
+
if (name) {
|
|
29
|
+
return name.split(" ").map((n) => n[0]).join("");
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}, [name]);
|
|
33
|
+
React.useEffect(() => {
|
|
34
|
+
if (!src) {
|
|
35
|
+
setError(true);
|
|
36
|
+
} else {
|
|
37
|
+
setError(false);
|
|
38
|
+
}
|
|
39
|
+
}, [src]);
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(styles.AvatarWrapper, { className, style, size, ...props, children: [
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
styles.AvatarStyled,
|
|
43
|
+
{
|
|
44
|
+
status,
|
|
45
|
+
size,
|
|
46
|
+
color: color || helpers.getInitialsColors(name, allowedInitialsColors),
|
|
47
|
+
children: error ? children || initials || /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon, { className: "quen-ui-avatar__icon" }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
"img",
|
|
49
|
+
{
|
|
50
|
+
className: "quen-ui__avatar__icon",
|
|
51
|
+
src,
|
|
52
|
+
alt,
|
|
53
|
+
onError: () => setError(true),
|
|
54
|
+
...imageProps
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(Flex, { direction: "column", gap: 4, children: [
|
|
60
|
+
name && /* @__PURE__ */ jsxRuntime.jsx(Title, { size: "xs", children: name }),
|
|
61
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: "xs", children: description })
|
|
62
|
+
] })
|
|
63
|
+
] });
|
|
64
|
+
};
|
|
65
|
+
module.exports = Avatar;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IAvatarProps } from './types';
|
|
3
|
+
declare const Avatar: ({ size, className, style, children, src, alt, name, label, allowedInitialsColors, description, color, imageProps, status, ...props }: IAvatarProps) => React.ReactElement;
|
|
4
|
+
export default Avatar;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { AvatarWrapper, AvatarStyled } from "./styles.es.js";
|
|
4
|
+
import SvgAvatarIcon from "./AvatarIcon.svg.es.js";
|
|
5
|
+
import { getInitialsColors } from "./helpers.es.js";
|
|
6
|
+
import Flex from "../Flex/Flex.es.js";
|
|
7
|
+
import Title from "../typography/Title/Title.es.js";
|
|
8
|
+
import Text from "../typography/Text/Text.es.js";
|
|
9
|
+
const Avatar = ({
|
|
10
|
+
size = "m",
|
|
11
|
+
className,
|
|
12
|
+
style,
|
|
13
|
+
children,
|
|
14
|
+
src,
|
|
15
|
+
alt,
|
|
16
|
+
name,
|
|
17
|
+
label = false,
|
|
18
|
+
allowedInitialsColors,
|
|
19
|
+
description,
|
|
20
|
+
color,
|
|
21
|
+
imageProps,
|
|
22
|
+
status,
|
|
23
|
+
...props
|
|
24
|
+
}) => {
|
|
25
|
+
const [error, setError] = useState(!src);
|
|
26
|
+
const initials = useMemo(() => {
|
|
27
|
+
if (name) {
|
|
28
|
+
return name.split(" ").map((n) => n[0]).join("");
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}, [name]);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!src) {
|
|
34
|
+
setError(true);
|
|
35
|
+
} else {
|
|
36
|
+
setError(false);
|
|
37
|
+
}
|
|
38
|
+
}, [src]);
|
|
39
|
+
return /* @__PURE__ */ jsxs(AvatarWrapper, { className, style, size, ...props, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
AvatarStyled,
|
|
42
|
+
{
|
|
43
|
+
status,
|
|
44
|
+
size,
|
|
45
|
+
color: color || getInitialsColors(name, allowedInitialsColors),
|
|
46
|
+
children: error ? children || initials || /* @__PURE__ */ jsx(SvgAvatarIcon, { className: "quen-ui-avatar__icon" }) : /* @__PURE__ */ jsx(
|
|
47
|
+
"img",
|
|
48
|
+
{
|
|
49
|
+
className: "quen-ui__avatar__icon",
|
|
50
|
+
src,
|
|
51
|
+
alt,
|
|
52
|
+
onError: () => setError(true),
|
|
53
|
+
...imageProps
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
label && /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, children: [
|
|
59
|
+
name && /* @__PURE__ */ jsx(Title, { size: "xs", children: name }),
|
|
60
|
+
description && /* @__PURE__ */ jsx(Text, { size: "xs", children: description })
|
|
61
|
+
] })
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
Avatar as default
|
|
66
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const React = require("react");
|
|
3
|
+
function _interopNamespaceDefault(e) {
|
|
4
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
5
|
+
if (e) {
|
|
6
|
+
for (const k in e) {
|
|
7
|
+
if (k !== "default") {
|
|
8
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
9
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: () => e[k]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
n.default = e;
|
|
17
|
+
return Object.freeze(n);
|
|
18
|
+
}
|
|
19
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
20
|
+
const SvgAvatarIcon = (props) => /* @__PURE__ */ React__namespace.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React__namespace.createElement("g", { stroke: "black", strokeWidth: 1, fill: "white" }, /* @__PURE__ */ React__namespace.createElement("circle", { cx: 8, cy: 5, r: 3 }), /* @__PURE__ */ React__namespace.createElement("path", { d: "M3 14c0-2.5 2.2-4.5 5-4.5s5 2 5 4.5", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
21
|
+
module.exports = SvgAvatarIcon;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const SvgAvatarIcon = (props) => /* @__PURE__ */ React.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { stroke: "black", strokeWidth: 1, fill: "white" }, /* @__PURE__ */ React.createElement("circle", { cx: 8, cy: 5, r: 3 }), /* @__PURE__ */ React.createElement("path", { d: "M3 14c0-2.5 2.2-4.5 5-4.5s5 2 5 4.5", strokeLinecap: "round", strokeLinejoin: "round" })));
|
|
3
|
+
export {
|
|
4
|
+
SvgAvatarIcon as default
|
|
5
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const theme = require("@quen-ui/theme");
|
|
4
|
+
const hashCode = (text) => {
|
|
5
|
+
let hash = 0;
|
|
6
|
+
for (let i = 0; i < text.length; i++) {
|
|
7
|
+
const char = text.charCodeAt(i);
|
|
8
|
+
hash = (hash << 5 | hash) + char;
|
|
9
|
+
hash |= 0;
|
|
10
|
+
}
|
|
11
|
+
return hash;
|
|
12
|
+
};
|
|
13
|
+
const getInitialsColors = (name = "QuenUIAvatar", colors = theme.QUENUI_COlORS_PALETTE) => {
|
|
14
|
+
const hash = hashCode(name);
|
|
15
|
+
const index = Math.abs(hash) % colors.length;
|
|
16
|
+
return colors[index];
|
|
17
|
+
};
|
|
18
|
+
exports.getInitialsColors = getInitialsColors;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getInitialsColors: (name?: string, colors?: string[]) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { QUENUI_COlORS_PALETTE } from "@quen-ui/theme";
|
|
2
|
+
const hashCode = (text) => {
|
|
3
|
+
let hash = 0;
|
|
4
|
+
for (let i = 0; i < text.length; i++) {
|
|
5
|
+
const char = text.charCodeAt(i);
|
|
6
|
+
hash = (hash << 5 | hash) + char;
|
|
7
|
+
hash |= 0;
|
|
8
|
+
}
|
|
9
|
+
return hash;
|
|
10
|
+
};
|
|
11
|
+
const getInitialsColors = (name = "QuenUIAvatar", colors = QUENUI_COlORS_PALETTE) => {
|
|
12
|
+
const hash = hashCode(name);
|
|
13
|
+
const index = Math.abs(hash) % colors.length;
|
|
14
|
+
return colors[index];
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
getInitialsColors
|
|
18
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const styled = require("styled-components");
|
|
4
|
+
const polished = require("polished");
|
|
5
|
+
const AvatarWrapper = styled.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
gap: ${({ theme, size }) => theme.space[size ?? "m"]};
|
|
8
|
+
align-items: center;
|
|
9
|
+
`;
|
|
10
|
+
const AvatarStyled = styled.div`
|
|
11
|
+
width: ${({ size, theme }) => theme.control.height[size ?? "m"]};
|
|
12
|
+
height: ${({ size, theme }) => theme.control.height[size ?? "m"]};
|
|
13
|
+
border-radius: ${({ theme }) => polished.math(`${theme.control.radius} * 4`)};
|
|
14
|
+
background: ${({ theme, color }) => color in theme.colors ? theme.colors[color]["3"] : color};
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
|
|
19
|
+
${({ theme, status }) => status && styled.css`
|
|
20
|
+
border: ${polished.math(`${theme.control.borderWidth} * 2`)} solid
|
|
21
|
+
${status === "online" ? theme.colors.green["5"] : theme.colors.grayViolet["5"]};
|
|
22
|
+
`}
|
|
23
|
+
|
|
24
|
+
.quen-ui__avatar__icon {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
border-radius: ${({ theme }) => polished.math(`${theme.control.radius} * 4`)};
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
exports.AvatarStyled = AvatarStyled;
|
|
31
|
+
exports.AvatarWrapper = AvatarWrapper;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IAvatarProps } from './types';
|
|
2
|
+
export declare const AvatarWrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
3
|
+
size: IAvatarProps["size"];
|
|
4
|
+
}>> & string;
|
|
5
|
+
export declare const AvatarStyled: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
|
+
size: IAvatarProps["size"];
|
|
7
|
+
color: string;
|
|
8
|
+
status: IAvatarProps["status"];
|
|
9
|
+
}>> & string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { math } from "polished";
|
|
3
|
+
const AvatarWrapper = styled.div`
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: ${({ theme, size }) => theme.space[size ?? "m"]};
|
|
6
|
+
align-items: center;
|
|
7
|
+
`;
|
|
8
|
+
const AvatarStyled = styled.div`
|
|
9
|
+
width: ${({ size, theme }) => theme.control.height[size ?? "m"]};
|
|
10
|
+
height: ${({ size, theme }) => theme.control.height[size ?? "m"]};
|
|
11
|
+
border-radius: ${({ theme }) => math(`${theme.control.radius} * 4`)};
|
|
12
|
+
background: ${({ theme, color }) => color in theme.colors ? theme.colors[color]["3"] : color};
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
|
|
17
|
+
${({ theme, status }) => status && css`
|
|
18
|
+
border: ${math(`${theme.control.borderWidth} * 2`)} solid
|
|
19
|
+
${status === "online" ? theme.colors.green["5"] : theme.colors.grayViolet["5"]};
|
|
20
|
+
`}
|
|
21
|
+
|
|
22
|
+
.quen-ui__avatar__icon {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
border-radius: ${({ theme }) => math(`${theme.control.radius} * 4`)};
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
export {
|
|
29
|
+
AvatarStyled,
|
|
30
|
+
AvatarWrapper
|
|
31
|
+
};
|