@qoretechnologies/reqore 0.39.0 → 0.40.0
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/ControlGroup/index.d.ts +4 -2
- package/dist/components/ControlGroup/index.d.ts.map +1 -1
- package/dist/components/ControlGroup/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 +87 -0
- package/dist/components/Menu/section.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ControlGroup/index.tsx +8 -4
- package/src/components/Menu/section.tsx +82 -0
- package/src/index.tsx +1 -1
- package/src/mock/menu.ts +46 -48
- package/src/stories/Menu/Menu.stories.tsx +161 -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,160 @@ 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
|
|
100
|
-
</ReqoreMenuItem>
|
|
101
|
-
<ReqoreMenuItem icon='Save3Fill' badge={10}>
|
|
102
|
-
Save
|
|
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
|
|
103
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}>
|
|
141
|
+
Save
|
|
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
|
-
icon
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
icon='
|
|
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
|
+
<ReqoreMenuItem
|
|
158
|
+
icon='BluetoothConnectLine'
|
|
159
|
+
rightIcon='EditLine'
|
|
160
|
+
onRightIconClick={() => alert('Icon clicked')}
|
|
161
|
+
description='Button with right icon and description'
|
|
162
|
+
customTheme={{
|
|
163
|
+
main: 'info:darken:1:0.3',
|
|
164
|
+
}}
|
|
165
|
+
>
|
|
166
|
+
Some button
|
|
167
|
+
</ReqoreMenuItem>
|
|
168
|
+
|
|
169
|
+
<ReqoreMenuItem icon='Lock2Fill' description='I also have a description'>
|
|
170
|
+
This is a really long item that should wrap
|
|
171
|
+
</ReqoreMenuItem>
|
|
172
|
+
<ReqoreMenuItem icon='Lock2Fill' disabled>
|
|
173
|
+
Disabled
|
|
174
|
+
</ReqoreMenuItem>
|
|
175
|
+
<ReqoreMenuItem icon='Lock2Fill' disabled intent='warning'>
|
|
176
|
+
Disabled intent
|
|
177
|
+
</ReqoreMenuItem>
|
|
178
|
+
<ReqoreMenuDivider label='Divider' />
|
|
179
|
+
<ReqorePopover
|
|
180
|
+
component={ReqoreMenuItem}
|
|
181
|
+
flat={args.flat}
|
|
182
|
+
componentProps={
|
|
183
|
+
{
|
|
184
|
+
icon: 'EmotionUnhappyLine',
|
|
185
|
+
rightIcon: 'Scissors2Fill',
|
|
186
|
+
leftIconColor: 'danger:lighten',
|
|
187
|
+
wrap: args.wrapText,
|
|
188
|
+
flat: args.flat,
|
|
189
|
+
} as IReqoreMenuItemProps
|
|
190
|
+
}
|
|
191
|
+
openOnMount
|
|
192
|
+
content={
|
|
193
|
+
<ReqoreMenu {...args}>
|
|
194
|
+
<ReqoreMenuItem icon='ZhihuFill'>Item 1</ReqoreMenuItem>
|
|
195
|
+
<ReqoreMenuItem
|
|
196
|
+
icon='AccountCircleFill'
|
|
197
|
+
description='Would you look at that beautiful description'
|
|
198
|
+
intent='warning'
|
|
199
|
+
>
|
|
200
|
+
Item 2
|
|
201
|
+
</ReqoreMenuItem>
|
|
202
|
+
<ReqoreMenuItem icon='AnticlockwiseFill' disabled>
|
|
203
|
+
Item 3
|
|
204
|
+
</ReqoreMenuItem>
|
|
205
|
+
<ReqoreMenuItem
|
|
206
|
+
icon='ArchiveFill'
|
|
207
|
+
badge={{
|
|
208
|
+
label: '10',
|
|
209
|
+
effect: { gradient: { colors: { 0: '#00e3e8', 100: '#eb0e8c' } } },
|
|
210
|
+
}}
|
|
211
|
+
>
|
|
212
|
+
Item 4
|
|
213
|
+
</ReqoreMenuItem>
|
|
214
|
+
</ReqoreMenu>
|
|
215
|
+
}
|
|
216
|
+
isReqoreComponent
|
|
217
|
+
noWrapper
|
|
218
|
+
handler='click'
|
|
219
|
+
placement='right'
|
|
220
|
+
>
|
|
221
|
+
I have a submenu on click
|
|
222
|
+
</ReqorePopover>
|
|
223
|
+
<ReqoreMenuDivider
|
|
224
|
+
label='Fancy divider'
|
|
225
|
+
effect={{ gradient: { colors: { 0: '#0d5ba5', 100: '#ff5dfd' } } }}
|
|
226
|
+
align='left'
|
|
227
|
+
padded='none'
|
|
228
|
+
margin='none'
|
|
229
|
+
/>
|
|
230
|
+
<ReqoreMenuItem icon='DualSim1Line' rightIcon='MoneyEuroBoxLine' selected>
|
|
231
|
+
I am selected!
|
|
232
|
+
</ReqoreMenuItem>
|
|
233
|
+
<ReqoreMenuItem
|
|
234
|
+
icon='FireLine'
|
|
235
|
+
rightIcon='ArrowRightDownLine'
|
|
236
|
+
effect={{
|
|
237
|
+
gradient: {
|
|
238
|
+
colors: {
|
|
239
|
+
0: '#000000',
|
|
240
|
+
100: 'transparent',
|
|
241
|
+
},
|
|
200
242
|
},
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</
|
|
208
|
-
|
|
243
|
+
}}
|
|
244
|
+
description='I also have a description'
|
|
245
|
+
badge={10}
|
|
246
|
+
>
|
|
247
|
+
Fancy
|
|
248
|
+
</ReqoreMenuItem>
|
|
249
|
+
</ReqoreMenu>
|
|
250
|
+
<MenuWithSubmenus {...args} />
|
|
251
|
+
</ReqoreControlGroup>
|
|
209
252
|
);
|
|
210
253
|
};
|
|
211
254
|
|
|
@@ -252,3 +295,13 @@ export const Transparent: Story = {
|
|
|
252
295
|
transparent: true,
|
|
253
296
|
},
|
|
254
297
|
};
|
|
298
|
+
|
|
299
|
+
export const SubmenuCanBeToggled: Story = {
|
|
300
|
+
render: (args) => <MenuWithSubmenus {...args} />,
|
|
301
|
+
play: async ({ canvasElement, ...rest }) => {
|
|
302
|
+
const canvas = within(canvasElement);
|
|
303
|
+
|
|
304
|
+
await fireEvent.click(canvas.queryAllByText('Submenu 2 active')[0]);
|
|
305
|
+
await fireEvent.click(canvas.queryAllByText('Collapsed submenu')[0]);
|
|
306
|
+
},
|
|
307
|
+
};
|