@qoretechnologies/reqore 0.30.6 → 0.30.7
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/LICENSE +1 -1
- package/README.md +2 -44
- package/__tests__/collection.test.tsx +1 -1
- package/__tests__/{control_group.text.tsx → control_group.test.tsx} +4 -2
- package/__tests__/modal.test.tsx +74 -2
- package/__tests__/panel.test.tsx +96 -24
- package/__tests__/popover.test.tsx +24 -2
- package/__tests__/tabs.test.tsx +75 -0
- package/dist/components/Button/index.d.ts +7 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +30 -20
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +6 -3
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collection/index.d.ts +7 -2
- package/dist/components/Collection/index.d.ts.map +1 -1
- package/dist/components/Collection/index.js +57 -53
- package/dist/components/Collection/index.js.map +1 -1
- package/dist/components/Collection/item.d.ts +5 -5
- package/dist/components/Collection/item.d.ts.map +1 -1
- package/dist/components/Collection/item.js +15 -4
- package/dist/components/Collection/item.js.map +1 -1
- package/dist/components/Columns/column.d.ts.map +1 -1
- package/dist/components/Columns/column.js +1 -1
- package/dist/components/Columns/column.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +21 -4
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +250 -55
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Drawer/index.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +27 -16
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -0
- package/dist/components/Dropdown/index.d.ts.map +1 -1
- package/dist/components/Dropdown/index.js +2 -2
- package/dist/components/Dropdown/index.js.map +1 -1
- package/dist/components/Dropdown/list.d.ts +3 -3
- package/dist/components/Dropdown/list.d.ts.map +1 -1
- package/dist/components/Effect/index.d.ts +10 -10
- package/dist/components/Effect/index.d.ts.map +1 -1
- package/dist/components/Effect/index.js +7 -6
- package/dist/components/Effect/index.js.map +1 -1
- package/dist/components/Icon/index.d.ts +5 -6
- package/dist/components/Icon/index.d.ts.map +1 -1
- package/dist/components/Icon/index.js +14 -7
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +10 -4
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InternalPopover/index.d.ts.map +1 -1
- package/dist/components/InternalPopover/index.js +12 -10
- package/dist/components/InternalPopover/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Message/index.d.ts +2 -0
- package/dist/components/Message/index.d.ts.map +1 -1
- package/dist/components/Message/index.js +2 -2
- package/dist/components/Message/index.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +2 -2
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.js +10 -10
- package/dist/components/MultiSelect/index.js.map +1 -1
- package/dist/components/Notifications/index.d.ts +1 -1
- package/dist/components/Notifications/index.d.ts.map +1 -1
- package/dist/components/Notifications/notification.d.ts +1 -1
- package/dist/components/Notifications/notification.d.ts.map +1 -1
- package/dist/components/Panel/index.d.ts +13 -6
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +78 -44
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -2
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +2 -2
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Spacer/index.d.ts +2 -0
- package/dist/components/Spacer/index.d.ts.map +1 -1
- package/dist/components/Spacer/index.js +29 -7
- package/dist/components/Spacer/index.js.map +1 -1
- package/dist/components/Table/header.js +2 -2
- package/dist/components/Table/header.js.map +1 -1
- package/dist/components/Table/headerCell.js +2 -2
- package/dist/components/Table/headerCell.js.map +1 -1
- package/dist/components/Table/helpers.d.ts +3 -2
- package/dist/components/Table/helpers.d.ts.map +1 -1
- package/dist/components/Table/helpers.js +6 -3
- package/dist/components/Table/helpers.js.map +1 -1
- package/dist/components/Table/index.d.ts +4 -3
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Table/row.d.ts +0 -5
- package/dist/components/Table/row.d.ts.map +1 -1
- package/dist/components/Table/row.js +3 -7
- package/dist/components/Table/row.js.map +1 -1
- package/dist/components/Tabs/content.d.ts +3 -1
- package/dist/components/Tabs/content.d.ts.map +1 -1
- package/dist/components/Tabs/content.js +8 -3
- package/dist/components/Tabs/content.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -1
- package/dist/components/Tabs/index.d.ts.map +1 -1
- package/dist/components/Tabs/index.js +12 -4
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts +1 -0
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +7 -7
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +7 -6
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/group.d.ts +2 -2
- package/dist/components/Tag/group.d.ts.map +1 -1
- package/dist/components/Tag/group.js +7 -8
- package/dist/components/Tag/group.js.map +1 -1
- package/dist/components/Tag/index.d.ts +6 -2
- package/dist/components/Tag/index.d.ts.map +1 -1
- package/dist/components/Tag/index.js +24 -12
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Tree/index.js +1 -1
- package/dist/components/Tree/index.js.map +1 -1
- package/dist/constants/animations.js +1 -1
- package/dist/constants/sizes.d.ts +2 -2
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +10 -10
- package/dist/constants/sizes.js.map +1 -1
- package/dist/constants/theme.d.ts +1 -1
- package/dist/constants/theme.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.d.ts.map +1 -1
- package/dist/containers/PopoverProvider.js +10 -8
- package/dist/containers/PopoverProvider.js.map +1 -1
- package/dist/containers/ReqoreProvider.d.ts.map +1 -1
- package/dist/containers/ReqoreProvider.js +4 -2
- package/dist/containers/ReqoreProvider.js.map +1 -1
- package/dist/containers/UIProvider.d.ts +7 -0
- package/dist/containers/UIProvider.d.ts.map +1 -1
- package/dist/containers/UIProvider.js.map +1 -1
- package/dist/context/ReqoreContext.d.ts +2 -0
- package/dist/context/ReqoreContext.d.ts.map +1 -1
- package/dist/context/ReqoreContext.js.map +1 -1
- package/dist/helpers/colors.d.ts +1 -1
- package/dist/helpers/colors.d.ts.map +1 -1
- package/dist/helpers/colors.js +6 -2
- package/dist/helpers/colors.js.map +1 -1
- package/dist/helpers/utils.d.ts +3 -0
- package/dist/helpers/utils.d.ts.map +1 -1
- package/dist/helpers/utils.js +17 -2
- package/dist/helpers/utils.js.map +1 -1
- package/dist/hooks/useLatestZIndex.js +2 -2
- package/dist/hooks/useLatestZIndex.js.map +1 -1
- package/dist/hooks/usePopover.d.ts +1 -0
- package/dist/hooks/usePopover.d.ts.map +1 -1
- package/dist/hooks/usePopover.js +8 -6
- package/dist/hooks/usePopover.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.d.ts.map +1 -1
- package/dist/styles.js +6 -5
- package/dist/styles.js.map +1 -1
- package/dist/types/global.d.ts +27 -1
- package/dist/types/global.d.ts.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/dist/types/icons.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +79 -34
- package/src/components/Checkbox/index.tsx +3 -2
- package/src/components/Collection/index.tsx +93 -60
- package/src/components/Collection/item.tsx +29 -9
- package/src/components/Columns/column.tsx +1 -0
- package/src/components/ControlGroup/index.tsx +449 -104
- package/src/components/Drawer/index.tsx +28 -27
- package/src/components/Dropdown/index.tsx +3 -1
- package/src/components/Effect/index.tsx +22 -14
- package/src/components/Icon/index.tsx +81 -62
- package/src/components/Input/index.tsx +8 -3
- package/src/components/InternalPopover/index.tsx +131 -126
- package/src/components/Menu/index.tsx +7 -1
- package/src/components/Message/index.tsx +9 -1
- package/src/components/MultiSelect/index.tsx +180 -188
- package/src/components/Panel/index.tsx +227 -100
- package/src/components/Popover/index.tsx +1 -3
- package/src/components/Spacer/index.tsx +63 -14
- package/src/components/Table/header.tsx +2 -2
- package/src/components/Table/headerCell.tsx +2 -2
- package/src/components/Table/helpers.ts +12 -6
- package/src/components/Table/index.tsx +1 -0
- package/src/components/Table/row.tsx +2 -7
- package/src/components/Tabs/content.tsx +11 -3
- package/src/components/Tabs/index.tsx +14 -3
- package/src/components/Tabs/item.tsx +28 -5
- package/src/components/Tabs/list.tsx +7 -3
- package/src/components/Tag/group.tsx +6 -12
- package/src/components/Tag/index.tsx +69 -35
- package/src/components/Tree/index.tsx +1 -1
- package/src/constants/animations.ts +1 -1
- package/src/constants/sizes.ts +10 -10
- package/src/containers/PopoverProvider.tsx +11 -8
- package/src/containers/ReqoreProvider.tsx +40 -35
- package/src/containers/UIProvider.tsx +7 -0
- package/src/context/ReqoreContext.tsx +2 -0
- package/src/helpers/colors.ts +8 -2
- package/src/helpers/utils.ts +18 -0
- package/src/hooks/useLatestZIndex.ts +2 -2
- package/src/hooks/usePopover.tsx +9 -6
- package/src/mock/collectionData.tsx +33 -2
- package/src/stories/Button/Button.stories.tsx +72 -7
- package/src/stories/Checkbox/Checkbox.stories.tsx +6 -3
- package/src/stories/Collection/Collection.stories.tsx +18 -2
- package/src/stories/ControlGroup/ControlGroup.stories.tsx +282 -33
- package/src/stories/Drawer/Drawer.stories.tsx +70 -3
- package/src/stories/Dropdown/Dropdown.stories.tsx +13 -3
- package/src/stories/Icon/Icon.stories.tsx +1 -0
- package/src/stories/Input/Input.stories.tsx +5 -3
- package/src/stories/Menu/Menu.stories.tsx +2 -0
- package/src/stories/Message/Message.stories.tsx +7 -0
- package/src/stories/Panel/Panel.stories.tsx +147 -13
- package/src/stories/Popover/Popover.stories.tsx +88 -82
- package/src/stories/Tabs/Tabs.stories.tsx +33 -15
- package/src/stories/Tag/Tag.stories.tsx +23 -3
- package/src/stories/TextArea/TextArea.stories.tsx +3 -3
- package/src/styles.ts +6 -0
- package/src/types/global.ts +28 -0
- package/tests.json +1 -1
- package/CODE_OF_CONDUCT.md +0 -105
- package/CONTRIBUTING.MD +0 -78
- package/SECURITY.md +0 -5
- package/public/logo-dark.png +0 -0
- package/public/logo.png +0 -0
- package/public/q-symbol.png +0 -0
- package/public/qoreLogo-dark.png +0 -0
- package/public/qoreLogo.png +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2020 Qore Technologies, s.r.o.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
<br><br><br>
|
|
3
|
-
<img src="./public/logo.png" alt="Unstated Logo" width="500">
|
|
4
|
-
<br><br><br>
|
|
5
|
-
</div>
|
|
1
|
+
# reqore
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Reqore is a UI library based on React which can be used with any React project to provide customized UI experience.
|
|
10
|
-
|
|
11
|
-
- Reqore is a comprehensive library of UI components that features our implementation of Qore Technologies design system
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
|
|
16
|
-
Latest stable Node.js is required.
|
|
17
|
-
|
|
18
|
-
Install the library using
|
|
19
|
-
|
|
20
|
-
```console
|
|
21
|
-
$ yarn add @qoretechnologies/reqore
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Features
|
|
25
|
-
|
|
26
|
-
## Community
|
|
27
|
-
|
|
28
|
-
- [GitHub Organization](https://github.com/qoretechnologies) for Official open-source projects
|
|
29
|
-
- [Discord](https://discord.gg/T7vgS6nh) for support, discussion, news and latest release updates
|
|
30
|
-
|
|
31
|
-
## Examples
|
|
32
|
-
|
|
33
|
-
## Contributing
|
|
34
|
-
|
|
35
|
-
The Qorus-Toolkit project welcomes all constructive contributions. Contributions can be of many forms including bug fixes, enhancements, fixes to documentation, additional tests and more!
|
|
36
|
-
|
|
37
|
-
See the [Contributing Guide](CONTRIBUTING.MD) for more technical details on contributing.
|
|
38
|
-
|
|
39
|
-
### Security Issues
|
|
40
|
-
|
|
41
|
-
If you discover a security vulnerability in Qorus-Toolkit, please see [Security Policies and Procedures](SECURITY.md).
|
|
42
|
-
|
|
43
|
-
## License
|
|
44
|
-
|
|
45
|
-
[MIT](LICENSE)
|
|
3
|
+
ReQore is a UI library for Qorus connected apps.
|
|
@@ -13,7 +13,7 @@ test('Renders basic <Collection /> properly', () => {
|
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
expect(document.querySelectorAll('.reqore-collection').length).toBe(1);
|
|
16
|
-
expect(document.querySelectorAll('.reqore-collection-item').length).toBe(
|
|
16
|
+
expect(document.querySelectorAll('.reqore-collection-item').length).toBe(9);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('<Collection /> items can be filtered', () => {
|
|
@@ -9,16 +9,18 @@ import {
|
|
|
9
9
|
ReqoreUIProvider,
|
|
10
10
|
} from '../src';
|
|
11
11
|
|
|
12
|
-
test('Renders <
|
|
12
|
+
test('Renders <ControlGroup /> properly', () => {
|
|
13
13
|
render(
|
|
14
14
|
<ReqoreUIProvider>
|
|
15
15
|
<ReqoreLayoutContent>
|
|
16
16
|
<ReqoreContent>
|
|
17
|
-
<ReqoreControlGroup
|
|
17
|
+
<ReqoreControlGroup>
|
|
18
18
|
<ReqoreInput minimal />
|
|
19
19
|
<ReqoreButton>Hello</ReqoreButton>
|
|
20
20
|
<ReqoreInput disabled />
|
|
21
21
|
<ReqoreInput size='big' />
|
|
22
|
+
<ReqoreButton>Hello</ReqoreButton>
|
|
23
|
+
<ReqoreButton>Hello</ReqoreButton>
|
|
22
24
|
</ReqoreControlGroup>
|
|
23
25
|
</ReqoreContent>
|
|
24
26
|
</ReqoreLayoutContent>
|
package/__tests__/modal.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { act, fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
-
import React, { useContext } from 'react';
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
3
|
import {
|
|
4
4
|
ReqoreButton,
|
|
5
5
|
ReqoreContent,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ReqoreLayoutContent,
|
|
8
8
|
ReqoreModal,
|
|
9
9
|
ReqoreUIProvider,
|
|
10
|
+
useReqore,
|
|
10
11
|
} from '../src';
|
|
11
12
|
|
|
12
13
|
test('Renders basic <Modal /> properly', () => {
|
|
@@ -94,13 +95,52 @@ const ConfirmButton = ({ confirmFn, cancelFn }) => {
|
|
|
94
95
|
);
|
|
95
96
|
};
|
|
96
97
|
|
|
98
|
+
const ConfirmButtonFromModal = ({ confirmFn, cancelFn }) => {
|
|
99
|
+
const { confirmAction } = useReqore();
|
|
100
|
+
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<>
|
|
104
|
+
<ReqoreButton
|
|
105
|
+
id='dialog'
|
|
106
|
+
onClick={() => {
|
|
107
|
+
setIsDialogOpen(true);
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
110
|
+
Open Dialog
|
|
111
|
+
</ReqoreButton>
|
|
112
|
+
{isDialogOpen && (
|
|
113
|
+
<ReqoreModal
|
|
114
|
+
isOpen
|
|
115
|
+
id='confirm'
|
|
116
|
+
actions={[
|
|
117
|
+
{
|
|
118
|
+
label: 'Open Confirm',
|
|
119
|
+
id: 'open-confirm',
|
|
120
|
+
onClick: () => {
|
|
121
|
+
confirmAction({
|
|
122
|
+
description: 'Do you really wanna do this?',
|
|
123
|
+
onConfirm: () => confirmFn(),
|
|
124
|
+
onCancel: () => cancelFn(),
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
]}
|
|
129
|
+
>
|
|
130
|
+
Modal
|
|
131
|
+
</ReqoreModal>
|
|
132
|
+
)}
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
97
137
|
test('Renders confirmation <Modal /> ', () => {
|
|
98
138
|
const confirmFn = jest.fn();
|
|
99
139
|
const cancelFn = jest.fn();
|
|
100
140
|
|
|
101
141
|
act(() => {
|
|
102
142
|
render(
|
|
103
|
-
<ReqoreUIProvider>
|
|
143
|
+
<ReqoreUIProvider options={{ animations: { dialogs: false } }}>
|
|
104
144
|
<ReqoreLayoutContent>
|
|
105
145
|
<ReqoreContent>
|
|
106
146
|
<ConfirmButton confirmFn={confirmFn} cancelFn={cancelFn} />
|
|
@@ -130,3 +170,35 @@ test('Renders confirmation <Modal /> ', () => {
|
|
|
130
170
|
|
|
131
171
|
expect(cancelFn).toHaveBeenCalledTimes(2);
|
|
132
172
|
});
|
|
173
|
+
|
|
174
|
+
test('Always renders confirmation <Modal /> properly above a normal modal', () => {
|
|
175
|
+
const confirmFn = jest.fn();
|
|
176
|
+
const cancelFn = jest.fn();
|
|
177
|
+
|
|
178
|
+
act(() => {
|
|
179
|
+
render(
|
|
180
|
+
<ReqoreUIProvider options={{ animations: { dialogs: false } }}>
|
|
181
|
+
<ReqoreLayoutContent>
|
|
182
|
+
<ReqoreContent>
|
|
183
|
+
<ConfirmButtonFromModal confirmFn={confirmFn} cancelFn={cancelFn} />
|
|
184
|
+
</ReqoreContent>
|
|
185
|
+
</ReqoreLayoutContent>
|
|
186
|
+
</ReqoreUIProvider>
|
|
187
|
+
);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
fireEvent.click(document.getElementById('dialog')!);
|
|
191
|
+
expect(document.querySelectorAll('.reqore-modal').length).toBe(1);
|
|
192
|
+
|
|
193
|
+
fireEvent.click(screen.getAllByText('Open Confirm')[0]);
|
|
194
|
+
expect(document.querySelectorAll('.reqore-modal').length).toBe(2);
|
|
195
|
+
expect(document.querySelectorAll('.reqore-confirmation-modal').length).toBe(1);
|
|
196
|
+
|
|
197
|
+
// @ts-ignore
|
|
198
|
+
const zIndex = document.querySelectorAll('.reqore-modal')[0].style.zIndex;
|
|
199
|
+
// @ts-ignore
|
|
200
|
+
const zIndexConfirmation = document.querySelectorAll('.reqore-confirmation-modal')[0].style
|
|
201
|
+
.zIndex;
|
|
202
|
+
|
|
203
|
+
expect(parseInt(zIndexConfirmation)).toBeGreaterThan(parseInt(zIndex));
|
|
204
|
+
});
|
package/__tests__/panel.test.tsx
CHANGED
|
@@ -100,33 +100,105 @@ test('Renders <Panel /> with actions', () => {
|
|
|
100
100
|
const fn = jest.fn();
|
|
101
101
|
|
|
102
102
|
render(
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
</ReqoreUIProvider>
|
|
126
|
-
</div>
|
|
103
|
+
<ReqoreUIProvider>
|
|
104
|
+
<ReqoreLayoutContent>
|
|
105
|
+
<ReqorePanel
|
|
106
|
+
label='Test'
|
|
107
|
+
onClose={fn}
|
|
108
|
+
actions={[
|
|
109
|
+
{ label: 'Test' },
|
|
110
|
+
{ actions: [{ label: 'Deep', value: 'deep' }] },
|
|
111
|
+
{ as: ReqoreInput },
|
|
112
|
+
{ label: 'hidden', show: false },
|
|
113
|
+
]}
|
|
114
|
+
bottomActions={[
|
|
115
|
+
{ label: 'Test', position: 'left' },
|
|
116
|
+
{ actions: [{ label: 'Deep', value: 'deep' }], position: 'right' },
|
|
117
|
+
{ label: 'hidden', show: false },
|
|
118
|
+
]}
|
|
119
|
+
>
|
|
120
|
+
{' '}
|
|
121
|
+
Panel{' '}
|
|
122
|
+
</ReqorePanel>
|
|
123
|
+
</ReqoreLayoutContent>
|
|
124
|
+
</ReqoreUIProvider>
|
|
127
125
|
);
|
|
128
126
|
|
|
129
127
|
expect(document.querySelectorAll('.reqore-button').length).toBe(5);
|
|
130
128
|
expect(document.querySelectorAll('.reqore-dropdown-control').length).toBe(2);
|
|
131
129
|
expect(document.querySelectorAll('.reqore-input').length).toBe(1);
|
|
132
130
|
});
|
|
131
|
+
|
|
132
|
+
test('Renders <Panel /> without actions group if all actins are not shown', () => {
|
|
133
|
+
const fn = jest.fn();
|
|
134
|
+
|
|
135
|
+
render(
|
|
136
|
+
<ReqoreUIProvider>
|
|
137
|
+
<ReqoreLayoutContent>
|
|
138
|
+
<ReqorePanel
|
|
139
|
+
label='Test'
|
|
140
|
+
actions={[
|
|
141
|
+
{ label: 'Test', show: false },
|
|
142
|
+
{ actions: [{ label: 'Deep', value: 'deep' }], show: false },
|
|
143
|
+
{ as: ReqoreInput, show: false },
|
|
144
|
+
{ label: 'hidden', show: false },
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
147
|
+
Panel
|
|
148
|
+
</ReqorePanel>
|
|
149
|
+
</ReqoreLayoutContent>
|
|
150
|
+
</ReqoreUIProvider>
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
expect(document.querySelectorAll('.reqore-control-group').length).toBe(0);
|
|
154
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(0);
|
|
155
|
+
expect(document.querySelectorAll('.reqore-dropdown-control').length).toBe(0);
|
|
156
|
+
expect(document.querySelectorAll('.reqore-input').length).toBe(0);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
test('Renders <Panel /> without title & bottom actions if all actions are not shown, there is no icon, title & is not collapsible', () => {
|
|
160
|
+
render(
|
|
161
|
+
<ReqoreUIProvider>
|
|
162
|
+
<ReqoreLayoutContent>
|
|
163
|
+
<ReqorePanel
|
|
164
|
+
actions={[
|
|
165
|
+
{ label: 'Test', show: false },
|
|
166
|
+
{ actions: [{ label: 'Deep', value: 'deep' }], show: false },
|
|
167
|
+
{ as: ReqoreInput, show: false },
|
|
168
|
+
{ label: 'hidden', show: false },
|
|
169
|
+
{
|
|
170
|
+
group: [
|
|
171
|
+
{ label: 'Test 2', show: true },
|
|
172
|
+
{ label: 'Test 3', show: true },
|
|
173
|
+
],
|
|
174
|
+
show: false,
|
|
175
|
+
},
|
|
176
|
+
]}
|
|
177
|
+
bottomActions={[
|
|
178
|
+
{ label: 'Test', show: false },
|
|
179
|
+
{ actions: [{ label: 'Deep', value: 'deep' }], show: false },
|
|
180
|
+
{ as: ReqoreInput, position: 'right', show: false },
|
|
181
|
+
{ label: 'hidden', show: false },
|
|
182
|
+
{
|
|
183
|
+
position: 'right',
|
|
184
|
+
group: [
|
|
185
|
+
{ label: 'Test 2', show: true },
|
|
186
|
+
{ label: 'Test 3', show: true },
|
|
187
|
+
],
|
|
188
|
+
show: false,
|
|
189
|
+
},
|
|
190
|
+
]}
|
|
191
|
+
>
|
|
192
|
+
Panel
|
|
193
|
+
</ReqorePanel>
|
|
194
|
+
</ReqoreLayoutContent>
|
|
195
|
+
</ReqoreUIProvider>
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
expect(document.querySelectorAll('.reqore-control-group').length).toBe(0);
|
|
199
|
+
expect(document.querySelectorAll('.reqore-button').length).toBe(0);
|
|
200
|
+
expect(document.querySelectorAll('.reqore-dropdown-control').length).toBe(0);
|
|
201
|
+
expect(document.querySelectorAll('.reqore-input').length).toBe(0);
|
|
202
|
+
expect(document.querySelectorAll('.reqore-panel-title').length).toBe(0);
|
|
203
|
+
expect(document.querySelectorAll('.reqore-panel-bottom-actions').length).toBe(0);
|
|
204
|
+
});
|
|
@@ -109,9 +109,9 @@ test('Runs callback function', async () => {
|
|
|
109
109
|
fireEvent.mouseLeave(screen.getByText('Hover me'));
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
test('Shows the popover after a delay', async () => {
|
|
112
|
+
test('Shows the popover after a local delay, ignoring global delay', async () => {
|
|
113
113
|
render(
|
|
114
|
-
<ReqoreUIProvider>
|
|
114
|
+
<ReqoreUIProvider options={{ tooltips: { delay: 1000 } }}>
|
|
115
115
|
<SimpleContent delay={500} />
|
|
116
116
|
</ReqoreUIProvider>
|
|
117
117
|
);
|
|
@@ -131,6 +131,28 @@ test('Shows the popover after a delay', async () => {
|
|
|
131
131
|
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(0);
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
test('Shows the popover after a global delay', async () => {
|
|
135
|
+
render(
|
|
136
|
+
<ReqoreUIProvider options={{ tooltips: { delay: 1000 } }}>
|
|
137
|
+
<SimpleContent />
|
|
138
|
+
</ReqoreUIProvider>
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
fireEvent.mouseEnter(screen.getByText('Hover me'));
|
|
142
|
+
|
|
143
|
+
jest.advanceTimersByTime(500);
|
|
144
|
+
|
|
145
|
+
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(0);
|
|
146
|
+
|
|
147
|
+
jest.advanceTimersByTime(500);
|
|
148
|
+
|
|
149
|
+
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
150
|
+
|
|
151
|
+
fireEvent.mouseLeave(screen.getByText('Hover me'));
|
|
152
|
+
|
|
153
|
+
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(0);
|
|
154
|
+
});
|
|
155
|
+
|
|
134
156
|
test('Does not show the popover with delay if time not reached', async () => {
|
|
135
157
|
render(
|
|
136
158
|
<ReqoreUIProvider>
|
package/__tests__/tabs.test.tsx
CHANGED
|
@@ -35,6 +35,49 @@ test('Renders full <Tabs /> properly', () => {
|
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
test('Renders shortened <Tabs /> properly', () => {
|
|
38
|
+
const fn = jest.fn();
|
|
39
|
+
act(() => {
|
|
40
|
+
render(
|
|
41
|
+
<ReqoreUIProvider>
|
|
42
|
+
<ReqoreLayoutContent>
|
|
43
|
+
<ReqoreTabs
|
|
44
|
+
_testWidth={300}
|
|
45
|
+
onTabChange={fn}
|
|
46
|
+
tabs={[
|
|
47
|
+
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
48
|
+
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
49
|
+
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3' },
|
|
50
|
+
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
51
|
+
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
52
|
+
]}
|
|
53
|
+
>
|
|
54
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
55
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
56
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
57
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
58
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
59
|
+
</ReqoreTabs>
|
|
60
|
+
</ReqoreLayoutContent>
|
|
61
|
+
</ReqoreUIProvider>
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
expect(document.querySelectorAll('.reqore-tabs-list-item').length).toBe(2);
|
|
66
|
+
expect(document.querySelectorAll('.reqore-tabs-list-item-menu').length).toBe(1);
|
|
67
|
+
|
|
68
|
+
fireEvent.mouseEnter(document.querySelector('.reqore-tabs-list-item-menu')!);
|
|
69
|
+
|
|
70
|
+
expect(document.querySelectorAll('.reqore-popover-content').length).toBe(1);
|
|
71
|
+
expect(document.querySelectorAll('.reqore-menu').length).toBe(1);
|
|
72
|
+
expect(document.querySelectorAll('.reqore-menu-item').length).toBe(4);
|
|
73
|
+
|
|
74
|
+
fireEvent.click(document.querySelectorAll('.reqore-menu-item')[0]);
|
|
75
|
+
|
|
76
|
+
expect(fn).toBeCalledTimes(1);
|
|
77
|
+
expect(fn).toBeCalledWith('tab2');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('Can select hidden <Tabs /> when shortened', () => {
|
|
38
81
|
act(() => {
|
|
39
82
|
render(
|
|
40
83
|
<ReqoreUIProvider>
|
|
@@ -163,6 +206,38 @@ test('Does not change tab and run callback when disabled', () => {
|
|
|
163
206
|
expect(document.querySelectorAll('.reqore-tabs-list-item-active').length).toBe(1);
|
|
164
207
|
});
|
|
165
208
|
|
|
209
|
+
test('Does not change tab when mounted and active tab is set', () => {
|
|
210
|
+
const cb = jest.fn();
|
|
211
|
+
|
|
212
|
+
act(() => {
|
|
213
|
+
render(
|
|
214
|
+
<ReqoreUIProvider>
|
|
215
|
+
<ReqoreLayoutContent>
|
|
216
|
+
<ReqoreTabs
|
|
217
|
+
tabs={[
|
|
218
|
+
{ label: 'Tab 1', icon: 'Home3Line', id: 'tab1' },
|
|
219
|
+
{ label: 'Tab 2', icon: 'Home3Line', id: 'tab2' },
|
|
220
|
+
{ label: 'Tab 3', icon: 'Home3Line', id: 'tab3', disabled: true },
|
|
221
|
+
{ label: 'Tab 4', icon: 'Home3Line', id: 'tab4' },
|
|
222
|
+
{ label: 'Tab 5', icon: 'Home3Line', id: 'tab5' },
|
|
223
|
+
]}
|
|
224
|
+
activeTab={'tab4'}
|
|
225
|
+
onTabChange={cb}
|
|
226
|
+
>
|
|
227
|
+
<ReqoreTabsContent tabId='tab1'>Tab 1 content</ReqoreTabsContent>
|
|
228
|
+
<ReqoreTabsContent tabId='tab2'>Tab 2 content</ReqoreTabsContent>
|
|
229
|
+
<ReqoreTabsContent tabId='tab3'>Tab 3 content</ReqoreTabsContent>
|
|
230
|
+
<ReqoreTabsContent tabId='tab4'>Tab 4 content</ReqoreTabsContent>
|
|
231
|
+
<ReqoreTabsContent tabId='tab5'>Tab 5 content</ReqoreTabsContent>
|
|
232
|
+
</ReqoreTabs>
|
|
233
|
+
</ReqoreLayoutContent>
|
|
234
|
+
</ReqoreUIProvider>
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
expect(cb).not.toHaveBeenCalled();
|
|
239
|
+
});
|
|
240
|
+
|
|
166
241
|
test('Changes tab programatically and runs callback', () => {
|
|
167
242
|
const cb = jest.fn();
|
|
168
243
|
|
|
@@ -3,9 +3,9 @@ import { TSizes } from '../../constants/sizes';
|
|
|
3
3
|
import { IReqoreCustomTheme, IReqoreTheme } from '../../constants/theme';
|
|
4
4
|
import { IReqoreDisabled, IReqoreIntent, IReqoreReadOnly, IWithReqoreEffect, IWithReqoreSize, TReqoreTooltipProp } from '../../types/global';
|
|
5
5
|
import { IReqoreIconName } from '../../types/icons';
|
|
6
|
-
import { TReqoreEffectColor, TReqoreHexColor } from '../Effect';
|
|
6
|
+
import { IReqoreEffect, TReqoreEffectColor, TReqoreHexColor } from '../Effect';
|
|
7
7
|
import { IReqoreTagProps } from '../Tag';
|
|
8
|
-
export type TReqoreBadge = string | number | IReqoreTagProps;
|
|
8
|
+
export declare type TReqoreBadge = string | number | IReqoreTagProps;
|
|
9
9
|
export interface IReqoreButtonProps extends React.HTMLAttributes<HTMLButtonElement>, IReqoreDisabled, IReqoreIntent, IReqoreReadOnly, IWithReqoreEffect {
|
|
10
10
|
icon?: IReqoreIconName;
|
|
11
11
|
size?: TSizes;
|
|
@@ -22,6 +22,11 @@ export interface IReqoreButtonProps extends React.HTMLAttributes<HTMLButtonEleme
|
|
|
22
22
|
description?: string | number;
|
|
23
23
|
maxWidth?: string;
|
|
24
24
|
textAlign?: 'left' | 'center' | 'right';
|
|
25
|
+
iconColor?: TReqoreEffectColor;
|
|
26
|
+
leftIconColor?: TReqoreEffectColor;
|
|
27
|
+
rightIconColor?: TReqoreEffectColor;
|
|
28
|
+
labelEffect?: IReqoreEffect;
|
|
29
|
+
descriptionEffect?: IReqoreEffect;
|
|
25
30
|
}
|
|
26
31
|
export interface IReqoreButtonStyle extends Omit<IReqoreButtonProps, 'intent'> {
|
|
27
32
|
theme: IReqoreTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,EAML,MAAM,EACP,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAezE,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,EAML,MAAM,EACP,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAezE,OAAO,EACL,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,aAAa,EAIb,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AAGnB,OAAkB,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGpD,oBAAY,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,eAAe,CAAC;AAE7D,MAAM,WAAW,kBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAC7C,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB;IACnB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,cAAc,CAAC,EAAE,kBAAkB,CAAC;IACpC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACnC;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC5E,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB;AAUD,eAAO,MAAM,yBAAyB,KAOrC,CAAC;AAEF,eAAO,MAAM,mBAAmB,KAkB/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,KAgBjC,CAAC;AAEF,eAAO,MAAM,sBAAsB,KAalC,CAAC;AAEF,eAAO,MAAM,YAAY,KA4IxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,KAgB/B,CAAC;AAEF,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,oCAAgB,uBAAuB,iBA0C7D,CAAC;AAEH,QAAA,MAAM,YAAY,yHA8IjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -76,23 +76,29 @@ var getButtonMainColor = function (theme, color) {
|
|
|
76
76
|
}
|
|
77
77
|
return theme.main;
|
|
78
78
|
};
|
|
79
|
-
exports.StyledAnimatedTextWrapper = styled_components_1["default"].span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow: hidden;\n position: relative;\n text-align:
|
|
80
|
-
|
|
79
|
+
exports.StyledAnimatedTextWrapper = styled_components_1["default"].span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow: hidden;\n position: relative;\n text-align: ", ";\n display: flex;\n flex-flow: column;\n align-items: ", ";\n"], ["\n overflow: hidden;\n position: relative;\n text-align: ", ";\n display: flex;\n flex-flow: column;\n align-items: ", ";\n"])), function (_a) {
|
|
80
|
+
var textAlign = _a.textAlign;
|
|
81
|
+
return textAlign;
|
|
82
|
+
}, function (_a) {
|
|
83
|
+
var textAlign = _a.textAlign;
|
|
84
|
+
return (0, utils_1.alignToFlexAlign)(textAlign);
|
|
85
|
+
});
|
|
86
|
+
exports.StyledActiveContent = (0, styled_components_1["default"])(Effect_1.StyledTextEffect)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: absolute;\n transform: translateY(-150%);\n opacity: 0;\n transition: all 0.2s ease-out;\n filter: blur(10px);\n\n ", "\n"], ["\n position: absolute;\n transform: translateY(-150%);\n opacity: 0;\n transition: all 0.2s ease-out;\n filter: blur(10px);\n\n ", "\n"])), function (_a) {
|
|
81
87
|
var wrap = _a.wrap;
|
|
82
88
|
return !wrap
|
|
83
89
|
? (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n "], ["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n "]))) : (0, styled_components_1.css)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n word-break: break-word;\n "], ["\n word-break: break-word;\n "])));
|
|
84
90
|
});
|
|
85
|
-
exports.StyledInActiveContent = styled_components_1["default"].
|
|
91
|
+
exports.StyledInActiveContent = (0, styled_components_1["default"])(Effect_1.StyledTextEffect)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n position: absolute;\n transform: translateY(0);\n transition: all 0.2s ease-out;\n\n ", "\n"], ["\n position: absolute;\n transform: translateY(0);\n transition: all 0.2s ease-out;\n\n ", "\n"])), function (_a) {
|
|
86
92
|
var wrap = _a.wrap;
|
|
87
93
|
return !wrap
|
|
88
94
|
? (0, styled_components_1.css)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n "], ["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n width: 100%;\n "]))) : (0, styled_components_1.css)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n word-break: break-word;\n "], ["\n word-break: break-word;\n "])));
|
|
89
95
|
});
|
|
90
|
-
exports.StyledInvisibleContent = styled_components_1["default"].
|
|
96
|
+
exports.StyledInvisibleContent = (0, styled_components_1["default"])(Effect_1.StyledTextEffect)(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n visibility: hidden;\n position: relative;\n overflow: hidden;\n\n ", "\n"], ["\n visibility: hidden;\n position: relative;\n overflow: hidden;\n\n ", "\n"])), function (_a) {
|
|
91
97
|
var wrap = _a.wrap;
|
|
92
98
|
return !wrap
|
|
93
99
|
? (0, styled_components_1.css)(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n white-space: nowrap;\n "], ["\n white-space: nowrap;\n "]))) : (0, styled_components_1.css)(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n word-break: break-word;\n "], ["\n word-break: break-word;\n "])));
|
|
94
100
|
});
|
|
95
|
-
exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n justify-content: center;\n margin: 0;\n font-weight: 600;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: 0 ", "px;\n font-size: ", "px;\n\n min-height: ", "px;\n min-width: ", "px;\n max-width: ", ";\n ", "\n\n flex: ", ";\n\n border-radius: ", "px;\n\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n\n ", "\n\n &:disabled {\n ", ";\n }\n\n &:focus,\n &:active {\n outline: none;\n }\n\n &:focus {\n border-color: ", ";\n }\n\n
|
|
101
|
+
exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect)(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n display: flex;\n flex-flow: column;\n justify-content: center;\n margin: 0;\n font-weight: 600;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: 0 ", "px;\n font-size: ", "px;\n\n min-height: ", "px;\n min-width: ", "px;\n max-width: ", ";\n ", "\n\n flex: ", ";\n align-self: ", ";\n\n border-radius: ", "px;\n\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n\n ", "\n\n &:disabled {\n ", ";\n }\n\n &:focus,\n &:active {\n outline: none;\n }\n\n &:focus {\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-bottom: ", "px;\n }\n"], ["\n display: flex;\n flex-flow: column;\n justify-content: center;\n margin: 0;\n font-weight: 600;\n position: relative;\n overflow: hidden;\n vertical-align: middle;\n border: ", ";\n padding: 0 ", "px;\n font-size: ", "px;\n\n min-height: ", "px;\n min-width: ", "px;\n max-width: ", ";\n ", "\n\n flex: ", ";\n align-self: ", ";\n\n border-radius: ", "px;\n\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n ", "\n\n ", "\n\n &:disabled {\n ", ";\n }\n\n &:focus,\n &:active {\n outline: none;\n }\n\n &:focus {\n border-color: ", ";\n }\n\n .reqore-button-description {\n padding-bottom: ", "px;\n }\n"])), function (_a) {
|
|
96
102
|
var theme = _a.theme, color = _a.color, flat = _a.flat;
|
|
97
103
|
return !flat ? "1px solid ".concat((0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.2)) : 0;
|
|
98
104
|
}, function (_a) {
|
|
@@ -108,8 +114,8 @@ exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect
|
|
|
108
114
|
var size = _a.size;
|
|
109
115
|
return sizes_1.SIZE_TO_PX[size];
|
|
110
116
|
}, function (_a) {
|
|
111
|
-
var maxWidth = _a.maxWidth;
|
|
112
|
-
return maxWidth || undefined;
|
|
117
|
+
var maxWidth = _a.maxWidth, fluid = _a.fluid, fixed = _a.fixed;
|
|
118
|
+
return maxWidth || (fluid && !fixed ? '100%' : undefined);
|
|
113
119
|
}, function (_a) {
|
|
114
120
|
var wrap = _a.wrap, description = _a.description;
|
|
115
121
|
return !wrap && !description
|
|
@@ -120,6 +126,9 @@ exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect
|
|
|
120
126
|
}, function (_a) {
|
|
121
127
|
var fluid = _a.fluid, fixed = _a.fixed;
|
|
122
128
|
return (fixed ? '0 0 auto' : fluid ? '1 auto' : '0 0 auto');
|
|
129
|
+
}, function (_a) {
|
|
130
|
+
var fixed = _a.fixed, fluid = _a.fluid;
|
|
131
|
+
return (fixed ? 'flex-start' : fluid ? 'stretch' : undefined);
|
|
123
132
|
}, function (_a) {
|
|
124
133
|
var size = _a.size;
|
|
125
134
|
return sizes_1.RADIUS_FROM_SIZE[size];
|
|
@@ -139,7 +148,7 @@ exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect
|
|
|
139
148
|
}, styles_1.InactiveIconScale, function (_a) {
|
|
140
149
|
var readOnly = _a.readOnly, animate = _a.animate, active = _a.active;
|
|
141
150
|
return !readOnly && !active
|
|
142
|
-
? (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n transform:
|
|
151
|
+
? (0, styled_components_1.css)(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n transform: scale(0.97);\n }\n\n &:hover,\n &:active,\n &:focus {\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n ", "\n }\n }\n "], ["\n &:not(:disabled) {\n ", "\n\n cursor: pointer;\n transition: all 0.2s ease-out;\n\n &:active {\n transform: scale(0.97);\n }\n\n &:hover,\n &:active,\n &:focus {\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n ", "\n }\n }\n "])), styles_1.ScaleIconOnHover, function (_a) {
|
|
143
152
|
var theme = _a.theme, color = _a.color, minimal = _a.minimal;
|
|
144
153
|
return minimal ? "#00000030" : (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.05);
|
|
145
154
|
}, function (_a) {
|
|
@@ -152,13 +161,17 @@ exports.StyledButton = (0, styled_components_1["default"])(Effect_1.StyledEffect
|
|
|
152
161
|
? (0, styled_components_1.css)(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n ", ";\n "], ["\n ", ";\n "])), styles_1.ReadOnlyElement) : undefined;
|
|
153
162
|
}, function (_a) {
|
|
154
163
|
var active = _a.active, flat = _a.flat, theme = _a.theme, color = _a.color;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
if (active) {
|
|
165
|
+
return (0, styled_components_1.css)(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "], ["\n cursor: pointer;\n background-color: ", ";\n color: ", ";\n border-color: ", ";\n\n &:hover,\n &:active,\n &:focus {\n border-color: ", ";\n }\n\n ", "\n "])), (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.1), (0, colors_1.getReadableColor)({ main: (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.1) }, undefined, undefined), flat
|
|
166
|
+
? undefined
|
|
167
|
+
: (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.175), flat
|
|
168
|
+
? undefined
|
|
169
|
+
: (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.275), styles_1.ActiveIconScale);
|
|
170
|
+
}
|
|
158
171
|
}, styles_1.DisabledElement, function (_a) {
|
|
159
172
|
var minimal = _a.minimal, theme = _a.theme, color = _a.color;
|
|
160
173
|
return minimal ? undefined : (0, colors_1.changeLightness)(getButtonMainColor(theme, color), 0.4);
|
|
161
|
-
},
|
|
174
|
+
}, function (_a) {
|
|
162
175
|
var size = _a.size;
|
|
163
176
|
return sizes_1.PADDING_FROM_SIZE[(0, utils_1.getOneLessSize)(size)];
|
|
164
177
|
});
|
|
@@ -186,12 +199,12 @@ exports.ButtonBadge = (0, react_1.memo)(function (props) {
|
|
|
186
199
|
}, [props]);
|
|
187
200
|
// If the content is a list
|
|
188
201
|
if (Array.isArray(props.content)) {
|
|
189
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size], height: !props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size] / 2 }), (0, jsx_runtime_1.jsx)(group_1["default"],
|
|
202
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size], height: !props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size] / 2 }), (0, jsx_runtime_1.jsx)(group_1["default"], { children: props.content.map(function (badge, index) { return renderTag(__assign(__assign({}, props), { content: badge, key: index })); }) })] }));
|
|
190
203
|
}
|
|
191
204
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size], height: !props.wrap ? undefined : sizes_1.PADDING_FROM_SIZE[props.size] / 2 }), renderTag(__assign(__assign({}, props), { key: 0 }))] }));
|
|
192
205
|
});
|
|
193
206
|
var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref) {
|
|
194
|
-
var icon = _a.icon, _b = _a.size, size = _b === void 0 ? 'normal' : _b, minimal = _a.minimal, children = _a.children, tooltip = _a.tooltip, className = _a.className, fluid = _a.fluid, fixed = _a.fixed, intent = _a.intent, active = _a.active, flat = _a.flat, rightIcon = _a.rightIcon, customTheme = _a.customTheme, wrap = _a.wrap, readOnly = _a.readOnly, badge = _a.badge, description = _a.description, maxWidth = _a.maxWidth, _c = _a.textAlign, textAlign = _c === void 0 ? 'left' : _c, effect = _a.effect, rest = __rest(_a, ["icon", "size", "minimal", "children", "tooltip", "className", "fluid", "fixed", "intent", "active", "flat", "rightIcon", "customTheme", "wrap", "readOnly", "badge", "description", "maxWidth", "textAlign", "effect"]);
|
|
207
|
+
var icon = _a.icon, _b = _a.size, size = _b === void 0 ? 'normal' : _b, minimal = _a.minimal, children = _a.children, tooltip = _a.tooltip, className = _a.className, fluid = _a.fluid, fixed = _a.fixed, intent = _a.intent, active = _a.active, flat = _a.flat, rightIcon = _a.rightIcon, customTheme = _a.customTheme, wrap = _a.wrap, readOnly = _a.readOnly, badge = _a.badge, description = _a.description, maxWidth = _a.maxWidth, _c = _a.textAlign, textAlign = _c === void 0 ? 'left' : _c, effect = _a.effect, labelEffect = _a.labelEffect, descriptionEffect = _a.descriptionEffect, leftIconColor = _a.leftIconColor, rightIconColor = _a.rightIconColor, iconColor = _a.iconColor, rest = __rest(_a, ["icon", "size", "minimal", "children", "tooltip", "className", "fluid", "fixed", "intent", "active", "flat", "rightIcon", "customTheme", "wrap", "readOnly", "badge", "description", "maxWidth", "textAlign", "effect", "labelEffect", "descriptionEffect", "leftIconColor", "rightIconColor", "iconColor"]);
|
|
195
208
|
var targetRef = (0, useCombinedRefs_1.useCombinedRefs)(ref).targetRef;
|
|
196
209
|
var animations = (0, react_1.useContext)(ReqoreContext_1["default"]).animations;
|
|
197
210
|
var theme = (0, useTheme_1.useReqoreTheme)('main', customTheme, intent);
|
|
@@ -206,12 +219,9 @@ var ReqoreButton = (0, react_1.memo)((0, react_1.forwardRef)(function (_a, ref)
|
|
|
206
219
|
? (0, colors_1.getReadableColor)(theme, undefined, undefined, true, theme.originalMain)
|
|
207
220
|
: (0, colors_1.getReadableColorFrom)(customColor, true)
|
|
208
221
|
: (0, colors_1.getReadableColor)(theme, undefined, undefined, true);
|
|
209
|
-
return ((0, jsx_runtime_1.jsxs)(exports.StyledButton, __assign({}, rest, { effect:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
color: "".concat(color, "90"),
|
|
213
|
-
textAlign: textAlign
|
|
214
|
-
} }, { children: description })))] })));
|
|
222
|
+
return ((0, jsx_runtime_1.jsxs)(exports.StyledButton, __assign({}, rest, { effect: intent
|
|
223
|
+
? undefined
|
|
224
|
+
: __assign({ interactive: !readOnly && !rest.disabled }, fixedEffect), as: 'button', theme: theme, ref: targetRef, fluid: fluid, fixed: fixed, maxWidth: maxWidth, minimal: minimal, size: size, color: customColor, animate: animations.buttons, flat: _flat, active: active, readOnly: readOnly, wrap: wrap, description: description, className: "".concat(className || '', " reqore-control reqore-button") }, { children: [(0, jsx_runtime_1.jsxs)(exports.StyledButtonContent, __assign({ size: size, wrap: wrap, description: description, flat: _flat }, { children: [icon && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Icon_1["default"], { icon: icon, size: size, color: leftIconColor || iconColor, style: textAlign !== 'left' ? { marginRight: 'auto' } : undefined }), children || badge || rightIcon ? ((0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] })) : null] })), children && ((0, jsx_runtime_1.jsxs)(exports.StyledAnimatedTextWrapper, __assign({ textAlign: textAlign }, { children: [(0, jsx_runtime_1.jsx)(exports.StyledActiveContent, __assign({ wrap: wrap, effect: labelEffect }, { children: children })), (0, jsx_runtime_1.jsx)(exports.StyledInActiveContent, __assign({ wrap: wrap, effect: labelEffect }, { children: children })), (0, jsx_runtime_1.jsx)(exports.StyledInvisibleContent, __assign({ wrap: wrap, effect: labelEffect }, { children: children })), (badge || badge === 0) && wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, color: color, wrap: true })) : null] }))), (badge || badge === 0) && !wrap ? ((0, jsx_runtime_1.jsx)(exports.ButtonBadge, { content: badge, size: size, color: color })) : null, rightIcon && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [children || badge ? (0, jsx_runtime_1.jsx)(Spacer_1.ReqoreSpacer, { width: sizes_1.PADDING_FROM_SIZE[size] }) : null, (0, jsx_runtime_1.jsx)(Icon_1["default"], { icon: rightIcon, size: size, style: textAlign !== 'right' ? { marginLeft: 'auto' } : undefined, color: rightIconColor || iconColor })] }))] })), description && ((0, jsx_runtime_1.jsx)(Effect_1.ReqoreTextEffect, __assign({ className: 'reqore-button-description', effect: __assign({ textSize: (0, utils_1.getOneLessSize)(size), weight: 'light', color: "".concat(color, "90"), textAlign: textAlign }, descriptionEffect) }, { children: description })))] })));
|
|
215
225
|
}));
|
|
216
226
|
exports["default"] = ReqoreButton;
|
|
217
227
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18;
|