@qoretechnologies/reqore 0.39.0 → 0.40.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ControlGroup/index.d.ts +4 -2
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/index.js +13 -33
- package/dist/components/ControlGroup/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +17 -16
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/section.d.ts +12 -0
- package/dist/components/Menu/section.d.ts.map +1 -0
- package/dist/components/Menu/section.js +64 -0
- package/dist/components/Menu/section.js.map +1 -0
- package/dist/hooks/useCloneThroughFragments.d.ts +5 -0
- package/dist/hooks/useCloneThroughFragments.d.ts.map +1 -0
- package/dist/hooks/useCloneThroughFragments.js +53 -0
- package/dist/hooks/useCloneThroughFragments.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +8 -1
- package/src/components/ControlGroup/index.tsx +59 -80
- package/src/components/Menu/index.tsx +15 -16
- package/src/components/Menu/section.tsx +81 -0
- package/src/hooks/useCloneThroughFragments.ts +39 -0
- package/src/index.tsx +2 -1
- package/src/mock/menu.ts +46 -48
- package/src/stories/Menu/Menu.stories.tsx +171 -108
- package/tests.json +1 -1
- package/__tests__/sidebar.test.tsx +0 -225
- package/dist/components/Sidebar/index.d.ts +0 -60
- package/dist/components/Sidebar/index.d.ts.map +0 -1
- package/dist/components/Sidebar/index.js +0 -266
- package/dist/components/Sidebar/index.js.map +0 -1
- package/dist/components/Sidebar/item.d.ts +0 -35
- package/dist/components/Sidebar/item.d.ts.map +0 -1
- package/dist/components/Sidebar/item.js +0 -98
- package/dist/components/Sidebar/item.js.map +0 -1
- package/dist/helpers/sidebar.d.ts +0 -5
- package/dist/helpers/sidebar.d.ts.map +0 -1
- package/dist/helpers/sidebar.js +0 -92
- package/dist/helpers/sidebar.js.map +0 -1
- package/src/components/Sidebar/index.tsx +0 -536
- package/src/components/Sidebar/item.tsx +0 -264
- package/src/helpers/sidebar.ts +0 -89
- package/src/stories/Sidebar/Sidebar.stories.tsx +0 -97
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { StoryFn, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fireEvent, within } from '@storybook/testing-library';
|
|
3
|
+
import { noop } from 'lodash';
|
|
2
4
|
import { IReqoreMenuProps } from '../../components/Menu';
|
|
3
5
|
import { IReqoreMenuItemProps } from '../../components/Menu/item';
|
|
6
|
+
import { ReqoreMenuSection } from '../../components/Menu/section';
|
|
4
7
|
import {
|
|
8
|
+
ReqoreControlGroup,
|
|
5
9
|
ReqoreInput,
|
|
6
10
|
ReqoreMenu,
|
|
7
11
|
ReqoreMenuDivider,
|
|
@@ -91,121 +95,162 @@ const meta = {
|
|
|
91
95
|
export default meta;
|
|
92
96
|
type Story = StoryObj<typeof meta>;
|
|
93
97
|
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
Selected success
|
|
98
|
+
const MenuWithSubmenus = (args: IReqoreMenuProps) => (
|
|
99
|
+
<ReqoreMenu {...args} width='300px'>
|
|
100
|
+
<ReqoreMenuSection label='Submenu 1' icon='Apps2Fill'>
|
|
101
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine' onRightIconClick={noop}>
|
|
102
|
+
Submenu Item 1
|
|
100
103
|
</ReqoreMenuItem>
|
|
101
|
-
<ReqoreMenuItem icon='Save3Fill' badge={10}>
|
|
102
|
-
Save
|
|
103
|
-
</ReqoreMenuItem>
|
|
104
|
-
<ReqoreMenuDivider label='BIG Divider' size='huge' />
|
|
105
104
|
<ReqoreMenuItem
|
|
106
|
-
icon='
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
onRightIconClick={
|
|
110
|
-
tooltip={{
|
|
111
|
-
content: 'You sure?',
|
|
112
|
-
}}
|
|
113
|
-
intent='danger'
|
|
105
|
+
icon='DualSim1Line'
|
|
106
|
+
rightIcon='MoneyEuroBoxLine'
|
|
107
|
+
disabled
|
|
108
|
+
onRightIconClick={noop}
|
|
114
109
|
>
|
|
115
|
-
|
|
110
|
+
Submenu Item 2
|
|
116
111
|
</ReqoreMenuItem>
|
|
112
|
+
<ReqoreMenuSection icon='PlayListLine' label='Submenu 2 active' activeIntent='info'>
|
|
113
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine'>
|
|
114
|
+
Submenu Item 3
|
|
115
|
+
</ReqoreMenuItem>
|
|
116
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine'>
|
|
117
|
+
Submenu Item 4
|
|
118
|
+
</ReqoreMenuItem>
|
|
119
|
+
</ReqoreMenuSection>
|
|
120
|
+
<ReqoreMenuSection label='Collapsed submenu' isCollapsed={true} icon='ListOrdered'>
|
|
121
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine'>
|
|
122
|
+
Submenu Item 5
|
|
123
|
+
</ReqoreMenuItem>
|
|
124
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine'>
|
|
125
|
+
Submenu Item 6
|
|
126
|
+
</ReqoreMenuItem>
|
|
127
|
+
</ReqoreMenuSection>
|
|
128
|
+
</ReqoreMenuSection>
|
|
129
|
+
</ReqoreMenu>
|
|
130
|
+
);
|
|
117
131
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
const Template: StoryFn<IReqoreMenuProps> = (args) => {
|
|
133
|
+
return (
|
|
134
|
+
<ReqoreControlGroup verticalAlign='flex-start'>
|
|
135
|
+
<ReqoreMenu {...args}>
|
|
136
|
+
<ReqoreInput placeholder='Custom component' icon='Search2Fill' flat={false} />
|
|
137
|
+
<ReqoreMenuItem icon='Save3Fill' intent='success' selected>
|
|
138
|
+
Selected success
|
|
139
|
+
</ReqoreMenuItem>
|
|
140
|
+
<ReqoreMenuItem icon='Save3Fill' badge={[10, 20]}>
|
|
141
|
+
Save this item
|
|
142
|
+
</ReqoreMenuItem>
|
|
143
|
+
<ReqoreMenuDivider label='BIG Divider' size='huge' />
|
|
144
|
+
<ReqoreMenuItem
|
|
145
|
+
icon='ChatPollFill'
|
|
146
|
+
onClick={() => alert('Item clicked')}
|
|
147
|
+
rightIcon='FahrenheitFill'
|
|
148
|
+
onRightIconClick={() => alert('Icon clicked')}
|
|
149
|
+
tooltip={{
|
|
150
|
+
content: 'You sure?',
|
|
151
|
+
}}
|
|
152
|
+
intent='danger'
|
|
153
|
+
>
|
|
154
|
+
Delete
|
|
155
|
+
</ReqoreMenuItem>
|
|
129
156
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
157
|
+
<>
|
|
158
|
+
<ReqoreMenuItem
|
|
159
|
+
icon='BluetoothConnectLine'
|
|
160
|
+
rightIcon='EditLine'
|
|
161
|
+
onRightIconClick={() => alert('Icon clicked')}
|
|
162
|
+
description='Button with right icon and description'
|
|
163
|
+
customTheme={{
|
|
164
|
+
main: 'info:darken:1:0.3',
|
|
165
|
+
}}
|
|
166
|
+
>
|
|
167
|
+
Some button
|
|
168
|
+
</ReqoreMenuItem>
|
|
169
|
+
</>
|
|
170
|
+
|
|
171
|
+
<ReqoreMenuItem icon='Lock2Fill' description='I also have a description'>
|
|
172
|
+
This is a really long item that should wrap
|
|
173
|
+
</ReqoreMenuItem>
|
|
174
|
+
<ReqoreMenuItem icon='Lock2Fill' disabled>
|
|
175
|
+
Disabled
|
|
176
|
+
</ReqoreMenuItem>
|
|
177
|
+
<ReqoreMenuItem icon='Lock2Fill' disabled intent='warning'>
|
|
178
|
+
Disabled intent
|
|
179
|
+
</ReqoreMenuItem>
|
|
180
|
+
<ReqoreMenuDivider label='Divider' />
|
|
181
|
+
<ReqorePopover
|
|
182
|
+
component={ReqoreMenuItem}
|
|
183
|
+
flat={args.flat}
|
|
184
|
+
componentProps={
|
|
185
|
+
{
|
|
186
|
+
icon: 'EmotionUnhappyLine',
|
|
187
|
+
rightIcon: 'Scissors2Fill',
|
|
188
|
+
leftIconColor: 'danger:lighten',
|
|
189
|
+
wrap: args.wrapText,
|
|
190
|
+
flat: args.flat,
|
|
191
|
+
} as IReqoreMenuItemProps
|
|
192
|
+
}
|
|
193
|
+
openOnMount
|
|
194
|
+
content={
|
|
195
|
+
<ReqoreMenu {...args}>
|
|
196
|
+
<ReqoreMenuItem icon='ZhihuFill'>Item 1</ReqoreMenuItem>
|
|
197
|
+
<ReqoreMenuItem
|
|
198
|
+
icon='AccountCircleFill'
|
|
199
|
+
description='Would you look at that beautiful description'
|
|
200
|
+
intent='warning'
|
|
201
|
+
>
|
|
202
|
+
Item 2
|
|
203
|
+
</ReqoreMenuItem>
|
|
204
|
+
<ReqoreMenuItem icon='AnticlockwiseFill' disabled>
|
|
205
|
+
Item 3
|
|
206
|
+
</ReqoreMenuItem>
|
|
207
|
+
<ReqoreMenuItem
|
|
208
|
+
icon='ArchiveFill'
|
|
209
|
+
badge={{
|
|
210
|
+
label: '10',
|
|
211
|
+
effect: { gradient: { colors: { 0: '#00e3e8', 100: '#eb0e8c' } } },
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
Item 4
|
|
215
|
+
</ReqoreMenuItem>
|
|
216
|
+
</ReqoreMenu>
|
|
217
|
+
}
|
|
218
|
+
isReqoreComponent
|
|
219
|
+
noWrapper
|
|
220
|
+
handler='click'
|
|
221
|
+
placement='right'
|
|
222
|
+
>
|
|
223
|
+
I have a submenu on click
|
|
224
|
+
</ReqorePopover>
|
|
225
|
+
<ReqoreMenuDivider
|
|
226
|
+
label='Fancy divider'
|
|
227
|
+
effect={{ gradient: { colors: { 0: '#0d5ba5', 100: '#ff5dfd' } } }}
|
|
228
|
+
align='left'
|
|
229
|
+
padded='none'
|
|
230
|
+
margin='none'
|
|
231
|
+
/>
|
|
232
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine' selected>
|
|
233
|
+
I am selected!
|
|
234
|
+
</ReqoreMenuItem>
|
|
235
|
+
<ReqoreMenuItem
|
|
236
|
+
icon='FireLine'
|
|
237
|
+
rightIcon='ArrowRightDownLine'
|
|
238
|
+
effect={{
|
|
239
|
+
gradient: {
|
|
240
|
+
colors: {
|
|
241
|
+
0: '#000000',
|
|
242
|
+
100: 'transparent',
|
|
243
|
+
},
|
|
200
244
|
},
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</
|
|
208
|
-
|
|
245
|
+
}}
|
|
246
|
+
description='I also have a description'
|
|
247
|
+
badge={10}
|
|
248
|
+
>
|
|
249
|
+
Fancy
|
|
250
|
+
</ReqoreMenuItem>
|
|
251
|
+
</ReqoreMenu>
|
|
252
|
+
<MenuWithSubmenus {...args} />
|
|
253
|
+
</ReqoreControlGroup>
|
|
209
254
|
);
|
|
210
255
|
};
|
|
211
256
|
|
|
@@ -252,3 +297,21 @@ export const Transparent: Story = {
|
|
|
252
297
|
transparent: true,
|
|
253
298
|
},
|
|
254
299
|
};
|
|
300
|
+
|
|
301
|
+
export const BigGapSize: Story = {
|
|
302
|
+
render: Template,
|
|
303
|
+
|
|
304
|
+
args: {
|
|
305
|
+
itemGap: 'big',
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export const SubmenuCanBeToggled: Story = {
|
|
310
|
+
render: (args) => <MenuWithSubmenus {...args} />,
|
|
311
|
+
play: async ({ canvasElement, ...rest }) => {
|
|
312
|
+
const canvas = within(canvasElement);
|
|
313
|
+
|
|
314
|
+
await fireEvent.click(canvas.queryAllByText('Submenu 2 active')[0]);
|
|
315
|
+
await fireEvent.click(canvas.queryAllByText('Collapsed submenu')[0]);
|
|
316
|
+
},
|
|
317
|
+
};
|