@licklist/design 0.78.35 → 0.78.36
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/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/v2/components/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/v2/components/ActionMenu/ActionMenu.js +6 -16
- package/dist/v2/components/ActionMenu/ActionMenu.scss.js +1 -1
- package/dist/v2/components/Button/Button.scss.js +1 -1
- package/dist/v2/components/Checkbox/Checkbox.scss.js +1 -1
- package/dist/v2/components/FormField/FormField.d.ts +3 -0
- package/dist/v2/components/FormField/FormField.d.ts.map +1 -1
- package/dist/v2/components/FormField/FormField.js +14 -3
- package/dist/v2/components/FormField/FormField.scss.js +1 -1
- package/dist/v2/components/IconButton/IconButton.d.ts +9 -0
- package/dist/v2/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/v2/components/IconButton/IconButton.js +137 -0
- package/dist/v2/components/IconButton/IconButton.scss.js +6 -0
- package/dist/v2/components/IconButton/index.d.ts +3 -0
- package/dist/v2/components/IconButton/index.d.ts.map +1 -0
- package/dist/v2/components/NewInput/NewInput.d.ts +1 -0
- package/dist/v2/components/NewInput/NewInput.d.ts.map +1 -1
- package/dist/v2/components/NewInput/NewInput.js +7 -4
- package/dist/v2/components/NewPageHeader/NewPageHeader.scss.js +1 -1
- package/dist/v2/components/ZoneCard/AddResourceButton.d.ts +8 -0
- package/dist/v2/components/ZoneCard/AddResourceButton.d.ts.map +1 -0
- package/dist/v2/components/ZoneCard/AddResourceButton.js +17 -0
- package/dist/v2/components/ZoneCard/ResourceRow.d.ts +28 -0
- package/dist/v2/components/ZoneCard/ResourceRow.d.ts.map +1 -0
- package/dist/v2/components/ZoneCard/ResourceRow.js +191 -0
- package/dist/v2/components/ZoneCard/ZoneCard.d.ts +25 -0
- package/dist/v2/components/ZoneCard/ZoneCard.d.ts.map +1 -0
- package/dist/v2/components/ZoneCard/ZoneCard.js +43 -0
- package/dist/v2/components/ZoneCard/ZoneCard.scss.js +6 -0
- package/dist/v2/components/ZoneCard/ZoneContainer.d.ts +12 -0
- package/dist/v2/components/ZoneCard/ZoneContainer.d.ts.map +1 -0
- package/dist/v2/components/ZoneCard/ZoneContainer.js +16 -0
- package/dist/v2/components/ZoneCard/ZoneHeader.d.ts +20 -0
- package/dist/v2/components/ZoneCard/ZoneHeader.d.ts.map +1 -0
- package/dist/v2/components/ZoneCard/ZoneHeader.js +149 -0
- package/dist/v2/components/ZoneCard/index.d.ts +11 -0
- package/dist/v2/components/ZoneCard/index.d.ts.map +1 -0
- package/dist/v2/components/index.d.ts +5 -1
- package/dist/v2/components/index.d.ts.map +1 -1
- package/dist/v2/icons/index.js +57 -1
- package/dist/v2/index.d.ts +10 -0
- package/dist/v2/index.d.ts.map +1 -1
- package/dist/v2/pages/Settings/components/SidebarCustomisation.js +5 -0
- package/dist/v2/pages/Settings/components/SidebarNavItem.js +5 -0
- package/dist/v2/pages/ZonesResources/ZonesResourcesPage.d.ts +12 -0
- package/dist/v2/pages/ZonesResources/ZonesResourcesPage.d.ts.map +1 -0
- package/dist/v2/pages/ZonesResources/ZonesResourcesPage.js +47 -0
- package/dist/v2/pages/ZonesResources/ZonesResourcesPage.scss.js +6 -0
- package/dist/v2/pages/ZonesResources/index.d.ts +3 -0
- package/dist/v2/pages/ZonesResources/index.d.ts.map +1 -0
- package/dist/v2/styles/form/NewInput.scss.js +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/v2/components/ActionMenu/ActionMenu.scss +7 -20
- package/src/v2/components/ActionMenu/ActionMenu.stories.tsx +58 -0
- package/src/v2/components/ActionMenu/ActionMenu.tsx +3 -6
- package/src/v2/components/Checkbox/Checkbox.scss +3 -3
- package/src/v2/components/FormField/FormField.scss +20 -1
- package/src/v2/components/FormField/FormField.tsx +33 -19
- package/src/v2/components/IconButton/IconButton.scss +81 -0
- package/src/v2/components/IconButton/IconButton.stories.tsx +51 -0
- package/src/v2/components/IconButton/IconButton.tsx +50 -0
- package/src/v2/components/IconButton/index.ts +2 -0
- package/src/v2/components/NewInput/NewInput.tsx +5 -2
- package/src/v2/components/NewPageHeader/NewPageHeader.scss +1 -5
- package/src/v2/components/NewPageHeader/NewPageHeader.stories.tsx +28 -0
- package/src/v2/components/ZoneCard/AddResourceButton.tsx +20 -0
- package/src/v2/components/ZoneCard/ResourceRow.tsx +115 -0
- package/src/v2/components/ZoneCard/ZoneCard.scss +226 -0
- package/src/v2/components/ZoneCard/ZoneCard.stories.tsx +137 -0
- package/src/v2/components/ZoneCard/ZoneCard.tsx +69 -0
- package/src/v2/components/ZoneCard/ZoneContainer.tsx +26 -0
- package/src/v2/components/ZoneCard/ZoneHeader.tsx +84 -0
- package/src/v2/components/ZoneCard/index.ts +14 -0
- package/src/v2/components/index.ts +11 -1
- package/src/v2/index.ts +21 -0
- package/src/v2/pages/ZonesResources/ZonesResourcesPage.scss +43 -0
- package/src/v2/pages/ZonesResources/ZonesResourcesPage.stories.tsx +46 -0
- package/src/v2/pages/ZonesResources/ZonesResourcesPage.tsx +49 -0
- package/src/v2/pages/ZonesResources/index.ts +2 -0
- package/src/v2/styles/components/Button.scss +1 -0
- package/src/v2/styles/form/NewInput.scss +39 -6
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
.zone-card {
|
|
2
|
+
border: 1px solid var(--border-primary);
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
overflow: visible;
|
|
5
|
+
background: var(--surface-primary);
|
|
6
|
+
|
|
7
|
+
&__header {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 16px;
|
|
11
|
+
padding: 12px 16px;
|
|
12
|
+
background: var(--surface-secondary);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__drag-handle {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
padding: 6px;
|
|
19
|
+
border-radius: 6px;
|
|
20
|
+
cursor: grab;
|
|
21
|
+
color: var(--label-tertiary, var(--label-secondary));
|
|
22
|
+
transition: all 0.2s ease;
|
|
23
|
+
flex-shrink: 0;
|
|
24
|
+
|
|
25
|
+
&:hover {
|
|
26
|
+
color: var(--label-secondary);
|
|
27
|
+
background: var(--surface-primary);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&:active {
|
|
31
|
+
cursor: grabbing;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&--resource {
|
|
35
|
+
color: var(--label-tertiary, var(--label-secondary));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Mobile reorder arrows (replaces drag handles)
|
|
40
|
+
&__reorder-arrows {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 2px;
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
|
|
46
|
+
&--resource {
|
|
47
|
+
margin-right: 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&__arrow-btn {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
width: 28px;
|
|
56
|
+
height: 28px;
|
|
57
|
+
border: none;
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
background: transparent;
|
|
60
|
+
color: var(--label-tertiary, var(--label-secondary));
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
transition: all 0.2s ease;
|
|
63
|
+
padding: 0;
|
|
64
|
+
|
|
65
|
+
&:hover:not(:disabled) {
|
|
66
|
+
color: var(--label-secondary);
|
|
67
|
+
background: var(--surface-primary);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:disabled {
|
|
71
|
+
opacity: 0.25;
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__name {
|
|
77
|
+
flex: 1;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
80
|
+
font-size: 15px;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
line-height: 20px;
|
|
83
|
+
color: var(--label-primary);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&__header-info {
|
|
87
|
+
display: flex;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
flex: 1;
|
|
90
|
+
min-width: 0;
|
|
91
|
+
gap: 2px;
|
|
92
|
+
|
|
93
|
+
.zone-card__total {
|
|
94
|
+
text-align: left;
|
|
95
|
+
min-width: auto;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&__header-right {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
gap: 16px;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__total {
|
|
107
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
font-weight: 400;
|
|
110
|
+
line-height: 16px;
|
|
111
|
+
color: var(--label-secondary);
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
min-width: 72px;
|
|
114
|
+
text-align: right;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Resource rows
|
|
118
|
+
&__resource {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 16px;
|
|
122
|
+
padding: 10px 16px 10px 32px;
|
|
123
|
+
border-top: 1px solid var(--border-primary);
|
|
124
|
+
transition: background 0.2s ease;
|
|
125
|
+
|
|
126
|
+
&--clickable {
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
|
|
129
|
+
&:hover {
|
|
130
|
+
background: var(--surface-secondary);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&--mobile {
|
|
135
|
+
padding-left: 16px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&__resource-name {
|
|
140
|
+
flex: 1;
|
|
141
|
+
min-width: 0;
|
|
142
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
143
|
+
font-size: 15px;
|
|
144
|
+
font-weight: 400;
|
|
145
|
+
line-height: 20px;
|
|
146
|
+
color: var(--label-primary);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__resource-stats {
|
|
150
|
+
display: flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 32px;
|
|
153
|
+
flex-shrink: 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
&__resource-stat {
|
|
157
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
158
|
+
font-size: 13px;
|
|
159
|
+
font-weight: 400;
|
|
160
|
+
line-height: 16px;
|
|
161
|
+
color: var(--label-secondary);
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
min-width: 72px;
|
|
164
|
+
|
|
165
|
+
&--total {
|
|
166
|
+
min-width: 72px;
|
|
167
|
+
text-align: right;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&__resource-info {
|
|
172
|
+
display: flex;
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
flex: 1;
|
|
175
|
+
min-width: 0;
|
|
176
|
+
gap: 2px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Mobile-only compact stats line
|
|
180
|
+
&__resource-stats-mobile {
|
|
181
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
182
|
+
font-size: 12px;
|
|
183
|
+
font-weight: 400;
|
|
184
|
+
line-height: 16px;
|
|
185
|
+
color: var(--label-secondary);
|
|
186
|
+
white-space: nowrap;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
&__resource-actions {
|
|
190
|
+
flex-shrink: 0;
|
|
191
|
+
width: 32px;
|
|
192
|
+
display: flex;
|
|
193
|
+
justify-content: flex-end;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Add resource button wrapper
|
|
197
|
+
&__add-resource-wrapper {
|
|
198
|
+
padding: 12px 16px;
|
|
199
|
+
border-top: 1px solid var(--border-primary);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@media (max-width: 768px) {
|
|
204
|
+
.zone-card {
|
|
205
|
+
&__header {
|
|
206
|
+
padding: 10px 12px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&__resource {
|
|
210
|
+
padding: 10px 12px 10px 12px;
|
|
211
|
+
gap: 12px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&__resource-stats {
|
|
215
|
+
gap: 16px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&__resource-stat {
|
|
219
|
+
min-width: auto;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&__add-resource-wrapper {
|
|
223
|
+
padding: 10px 12px;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { ZoneCard } from './ZoneCard'
|
|
4
|
+
import { ZoneContainer } from './ZoneContainer'
|
|
5
|
+
import { ZoneHeader } from './ZoneHeader'
|
|
6
|
+
import { ResourceRow } from './ResourceRow'
|
|
7
|
+
import { AddResourceButton } from './AddResourceButton'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'v2/Components/ZoneCard',
|
|
11
|
+
component: ZoneCard,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'padded',
|
|
14
|
+
},
|
|
15
|
+
} as Meta<typeof ZoneCard>
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof ZoneCard>
|
|
18
|
+
|
|
19
|
+
const zoneMenuItems = [
|
|
20
|
+
{ label: 'Edit Zone', onClick: () => alert('Edit Zone') },
|
|
21
|
+
{ label: 'Delete Zone', onClick: () => alert('Delete Zone'), variant: 'danger' as const },
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
const resourceMenuItems = [
|
|
25
|
+
{ label: 'Edit Resource', onClick: () => alert('Edit Resource') },
|
|
26
|
+
{ label: 'Delete Resource', onClick: () => alert('Delete Resource'), variant: 'danger' as const },
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
// Composed ZoneCard (all-in-one)
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
name: 'Bowling',
|
|
33
|
+
|
|
34
|
+
totalCapacity: 2,
|
|
35
|
+
menuItems: zoneMenuItems,
|
|
36
|
+
onAddResource: () => alert('Add Resource'),
|
|
37
|
+
resources: [
|
|
38
|
+
{ id: '1', name: 'Table', quantity: 1, capacity: 1, menuItems: resourceMenuItems },
|
|
39
|
+
{ id: '2', name: 'Lane', quantity: 1, capacity: 1, menuItems: resourceMenuItems },
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const EmptyZone: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
name: 'VIP Lounge',
|
|
47
|
+
totalCapacity: 0,
|
|
48
|
+
menuItems: zoneMenuItems,
|
|
49
|
+
onAddResource: () => alert('Add Resource'),
|
|
50
|
+
resources: [],
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Individual components composed manually
|
|
55
|
+
export const ComposedManually: Story = {
|
|
56
|
+
render: () => (
|
|
57
|
+
<ZoneContainer>
|
|
58
|
+
<ZoneHeader
|
|
59
|
+
name="Bowling"
|
|
60
|
+
totalCapacity={2}
|
|
61
|
+
menuItems={zoneMenuItems}
|
|
62
|
+
/>
|
|
63
|
+
<ResourceRow
|
|
64
|
+
name="Table"
|
|
65
|
+
quantity={1}
|
|
66
|
+
capacity={1}
|
|
67
|
+
menuItems={resourceMenuItems}
|
|
68
|
+
onClick={() => alert('Edit Table')}
|
|
69
|
+
/>
|
|
70
|
+
<ResourceRow
|
|
71
|
+
name="Lane"
|
|
72
|
+
quantity={1}
|
|
73
|
+
capacity={1}
|
|
74
|
+
menuItems={resourceMenuItems}
|
|
75
|
+
onClick={() => alert('Edit Lane')}
|
|
76
|
+
/>
|
|
77
|
+
<AddResourceButton onClick={() => alert('Add Resource')} />
|
|
78
|
+
</ZoneContainer>
|
|
79
|
+
),
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Standalone ZoneHeader
|
|
83
|
+
export const StandaloneHeader: Story = {
|
|
84
|
+
render: () => (
|
|
85
|
+
<ZoneContainer>
|
|
86
|
+
<ZoneHeader
|
|
87
|
+
name="Main Floor"
|
|
88
|
+
totalCapacity={50}
|
|
89
|
+
menuItems={zoneMenuItems}
|
|
90
|
+
/>
|
|
91
|
+
</ZoneContainer>
|
|
92
|
+
),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Standalone ResourceRow
|
|
96
|
+
export const StandaloneResource: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<ZoneContainer>
|
|
99
|
+
<ResourceRow
|
|
100
|
+
name="Table"
|
|
101
|
+
quantity={10}
|
|
102
|
+
capacity={4}
|
|
103
|
+
menuItems={resourceMenuItems}
|
|
104
|
+
onClick={() => alert('Edit Table')}
|
|
105
|
+
/>
|
|
106
|
+
</ZoneContainer>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Multiple zones
|
|
111
|
+
export const MultipleZones: Story = {
|
|
112
|
+
render: () => (
|
|
113
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
114
|
+
<ZoneCard
|
|
115
|
+
name="Bowling"
|
|
116
|
+
status="active"
|
|
117
|
+
totalCapacity={2}
|
|
118
|
+
menuItems={zoneMenuItems}
|
|
119
|
+
onAddResource={() => alert('Add Resource')}
|
|
120
|
+
resources={[
|
|
121
|
+
{ id: '1', name: 'Table', quantity: 1, capacity: 1, menuItems: resourceMenuItems },
|
|
122
|
+
{ id: '2', name: 'Lane', quantity: 1, capacity: 1, menuItems: resourceMenuItems },
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
<ZoneCard
|
|
126
|
+
name="VIP Lounge"
|
|
127
|
+
status="active"
|
|
128
|
+
totalCapacity={20}
|
|
129
|
+
menuItems={zoneMenuItems}
|
|
130
|
+
onAddResource={() => alert('Add Resource')}
|
|
131
|
+
resources={[
|
|
132
|
+
{ id: '3', name: 'Sofa', quantity: 4, capacity: 5, menuItems: resourceMenuItems },
|
|
133
|
+
]}
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
),
|
|
137
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ActionMenuItem } from '../ActionMenu'
|
|
3
|
+
import { ZoneContainer } from './ZoneContainer'
|
|
4
|
+
import { ZoneHeader } from './ZoneHeader'
|
|
5
|
+
import { ResourceRow } from './ResourceRow'
|
|
6
|
+
import { AddResourceButton } from './AddResourceButton'
|
|
7
|
+
import { DragHandleProps } from './ZoneContainer'
|
|
8
|
+
|
|
9
|
+
export interface ZoneResource {
|
|
10
|
+
id: string
|
|
11
|
+
name: string
|
|
12
|
+
quantity: number
|
|
13
|
+
capacity: number
|
|
14
|
+
menuItems?: ActionMenuItem[]
|
|
15
|
+
dragHandleProps?: DragHandleProps
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ZoneCardProps {
|
|
19
|
+
name: string
|
|
20
|
+
totalCapacity: number
|
|
21
|
+
resources?: ZoneResource[]
|
|
22
|
+
menuItems?: ActionMenuItem[]
|
|
23
|
+
onAddResource?: () => void
|
|
24
|
+
className?: string
|
|
25
|
+
draggable?: boolean
|
|
26
|
+
onResourceClick?: (resource: ZoneResource) => void
|
|
27
|
+
dragHandleProps?: DragHandleProps
|
|
28
|
+
style?: React.CSSProperties
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const ZoneCard = React.forwardRef<HTMLDivElement, ZoneCardProps>(({
|
|
32
|
+
name,
|
|
33
|
+
totalCapacity,
|
|
34
|
+
resources = [],
|
|
35
|
+
menuItems = [],
|
|
36
|
+
onAddResource,
|
|
37
|
+
className = '',
|
|
38
|
+
draggable = true,
|
|
39
|
+
onResourceClick,
|
|
40
|
+
dragHandleProps,
|
|
41
|
+
style,
|
|
42
|
+
}, ref) => {
|
|
43
|
+
return (
|
|
44
|
+
<ZoneContainer ref={ref} className={className} style={style}>
|
|
45
|
+
<ZoneHeader
|
|
46
|
+
name={name}
|
|
47
|
+
totalCapacity={totalCapacity}
|
|
48
|
+
menuItems={menuItems}
|
|
49
|
+
draggable={draggable}
|
|
50
|
+
dragHandleProps={dragHandleProps}
|
|
51
|
+
/>
|
|
52
|
+
{resources.map((resource) => (
|
|
53
|
+
<ResourceRow
|
|
54
|
+
key={resource.id}
|
|
55
|
+
name={resource.name}
|
|
56
|
+
quantity={resource.quantity}
|
|
57
|
+
capacity={resource.capacity}
|
|
58
|
+
menuItems={resource.menuItems}
|
|
59
|
+
draggable={draggable}
|
|
60
|
+
dragHandleProps={resource.dragHandleProps}
|
|
61
|
+
onClick={onResourceClick ? () => onResourceClick(resource) : undefined}
|
|
62
|
+
/>
|
|
63
|
+
))}
|
|
64
|
+
{onAddResource && <AddResourceButton onClick={onAddResource} />}
|
|
65
|
+
</ZoneContainer>
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
ZoneCard.displayName = 'ZoneCard'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import './ZoneCard.scss'
|
|
3
|
+
|
|
4
|
+
export interface DragHandleProps {
|
|
5
|
+
[key: string]: unknown
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface ZoneContainerProps {
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
className?: string
|
|
11
|
+
style?: React.CSSProperties
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ZoneContainer = React.forwardRef<HTMLDivElement, ZoneContainerProps>(({
|
|
15
|
+
children,
|
|
16
|
+
className = '',
|
|
17
|
+
style,
|
|
18
|
+
}, ref) => {
|
|
19
|
+
return (
|
|
20
|
+
<div ref={ref} className={`zone-card ${className}`} style={style}>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
ZoneContainer.displayName = 'ZoneContainer'
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { ActionMenu, ActionMenuItem } from '../ActionMenu'
|
|
3
|
+
import { GripVerticalIcon, ArrowUpIcon, ArrowDownIcon } from '../../icons'
|
|
4
|
+
import { DragHandleProps } from './ZoneContainer'
|
|
5
|
+
import './ZoneCard.scss'
|
|
6
|
+
|
|
7
|
+
export interface ZoneHeaderProps {
|
|
8
|
+
name: string
|
|
9
|
+
totalCapacity: number
|
|
10
|
+
totalLabel?: string
|
|
11
|
+
menuItems?: ActionMenuItem[]
|
|
12
|
+
draggable?: boolean
|
|
13
|
+
dragHandleProps?: DragHandleProps
|
|
14
|
+
className?: string
|
|
15
|
+
isMobile?: boolean
|
|
16
|
+
isFirst?: boolean
|
|
17
|
+
isLast?: boolean
|
|
18
|
+
onMoveUp?: () => void
|
|
19
|
+
onMoveDown?: () => void
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const ZoneHeader: React.FC<ZoneHeaderProps> = ({
|
|
23
|
+
name,
|
|
24
|
+
totalCapacity,
|
|
25
|
+
totalLabel = 'Total',
|
|
26
|
+
menuItems = [],
|
|
27
|
+
draggable = true,
|
|
28
|
+
dragHandleProps,
|
|
29
|
+
className = '',
|
|
30
|
+
isMobile = false,
|
|
31
|
+
isFirst = false,
|
|
32
|
+
isLast = false,
|
|
33
|
+
onMoveUp,
|
|
34
|
+
onMoveDown,
|
|
35
|
+
}) => {
|
|
36
|
+
return (
|
|
37
|
+
<div className={`zone-card__header ${className}`}>
|
|
38
|
+
{draggable && !isMobile && (
|
|
39
|
+
<div className="zone-card__drag-handle" {...dragHandleProps}>
|
|
40
|
+
{GripVerticalIcon({ width: 20, height: 20 })}
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
43
|
+
{draggable && isMobile && (
|
|
44
|
+
<div className="zone-card__reorder-arrows">
|
|
45
|
+
<button
|
|
46
|
+
className="zone-card__arrow-btn"
|
|
47
|
+
disabled={isFirst}
|
|
48
|
+
onClick={(e) => { e.stopPropagation(); onMoveUp?.() }}
|
|
49
|
+
>
|
|
50
|
+
<ArrowUpIcon />
|
|
51
|
+
</button>
|
|
52
|
+
<button
|
|
53
|
+
className="zone-card__arrow-btn"
|
|
54
|
+
disabled={isLast}
|
|
55
|
+
onClick={(e) => { e.stopPropagation(); onMoveDown?.() }}
|
|
56
|
+
>
|
|
57
|
+
<ArrowDownIcon />
|
|
58
|
+
</button>
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
{isMobile ? (
|
|
62
|
+
<>
|
|
63
|
+
<div className="zone-card__header-info">
|
|
64
|
+
<span className="zone-card__name">{name}</span>
|
|
65
|
+
<span className="zone-card__total">{totalLabel}: {totalCapacity}</span>
|
|
66
|
+
</div>
|
|
67
|
+
{menuItems.length > 0 && (
|
|
68
|
+
<div className="zone-card__header-right">
|
|
69
|
+
<ActionMenu items={menuItems} />
|
|
70
|
+
</div>
|
|
71
|
+
)}
|
|
72
|
+
</>
|
|
73
|
+
) : (
|
|
74
|
+
<>
|
|
75
|
+
<span className="zone-card__name">{name}</span>
|
|
76
|
+
<div className="zone-card__header-right">
|
|
77
|
+
<span className="zone-card__total">{totalLabel}: {totalCapacity}</span>
|
|
78
|
+
{menuItems.length > 0 && <ActionMenu items={menuItems} />}
|
|
79
|
+
</div>
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { ZoneCard } from './ZoneCard'
|
|
2
|
+
export type { ZoneCardProps, ZoneResource } from './ZoneCard'
|
|
3
|
+
|
|
4
|
+
export { ZoneContainer } from './ZoneContainer'
|
|
5
|
+
export type { ZoneContainerProps, DragHandleProps } from './ZoneContainer'
|
|
6
|
+
|
|
7
|
+
export { ZoneHeader } from './ZoneHeader'
|
|
8
|
+
export type { ZoneHeaderProps } from './ZoneHeader'
|
|
9
|
+
|
|
10
|
+
export { ResourceRow } from './ResourceRow'
|
|
11
|
+
export type { ResourceRowProps, ResourceRowLabels } from './ResourceRow'
|
|
12
|
+
|
|
13
|
+
export { AddResourceButton } from './AddResourceButton'
|
|
14
|
+
export type { AddResourceButtonProps } from './AddResourceButton'
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { IconButton } from './IconButton'
|
|
2
|
+
export type { IconButtonProps } from './IconButton'
|
|
3
|
+
|
|
1
4
|
export { Badge } from './Badge'
|
|
2
5
|
export type { BadgeProps } from './Badge'
|
|
3
6
|
|
|
@@ -58,6 +61,9 @@ export { NPSScore } from './NPSScore'
|
|
|
58
61
|
export { Pagination } from './Pagination'
|
|
59
62
|
export type { PaginationProps } from './Pagination'
|
|
60
63
|
|
|
64
|
+
export { ZoneCard, ZoneContainer, ZoneHeader, ResourceRow, AddResourceButton } from './ZoneCard'
|
|
65
|
+
export type { ZoneCardProps, ZoneResource, ZoneContainerProps, DragHandleProps, ZoneHeaderProps, ResourceRowProps, AddResourceButtonProps } from './ZoneCard'
|
|
66
|
+
|
|
61
67
|
// Icons
|
|
62
68
|
export {
|
|
63
69
|
InfoIcon,
|
|
@@ -76,6 +82,10 @@ export {
|
|
|
76
82
|
ClearIcon,
|
|
77
83
|
CloseIcon,
|
|
78
84
|
EllipsisIcon,
|
|
79
|
-
CircleIcon
|
|
85
|
+
CircleIcon,
|
|
86
|
+
GripVerticalIcon,
|
|
87
|
+
PlusIcon,
|
|
88
|
+
DeleteIcon,
|
|
89
|
+
ClockIcon
|
|
80
90
|
} from '../icons'
|
|
81
91
|
|
package/src/v2/index.ts
CHANGED
|
@@ -21,6 +21,19 @@ export type { AlertProps, AlertVariant } from './components/Alert'
|
|
|
21
21
|
export { Button } from './components/Button'
|
|
22
22
|
export type { ButtonProps } from './components/Button'
|
|
23
23
|
|
|
24
|
+
// NewInput Component
|
|
25
|
+
export { NewInput } from './components/NewInput'
|
|
26
|
+
export type { NewInputProps } from './components/NewInput'
|
|
27
|
+
|
|
28
|
+
// Checkbox Component
|
|
29
|
+
export { Checkbox } from './components/Checkbox'
|
|
30
|
+
export type { CheckboxProps } from './components/Checkbox'
|
|
31
|
+
|
|
32
|
+
// NewPageHeader Component
|
|
33
|
+
export { NewPageHeader } from './components/NewPageHeader'
|
|
34
|
+
export type { NewPageHeaderProps } from './components/NewPageHeader'
|
|
35
|
+
|
|
36
|
+
|
|
24
37
|
// EntityHeader Component
|
|
25
38
|
export { EntityHeader } from './components/EntityHeader'
|
|
26
39
|
export type { EntityHeaderProps } from './components/EntityHeader'
|
|
@@ -36,6 +49,14 @@ export type { NPSScoreProps, NPSSubmitData } from './components/NPSScore'
|
|
|
36
49
|
export { UserPanel } from './components/UserPanel'
|
|
37
50
|
export type { UserPanelProps } from './components/UserPanel'
|
|
38
51
|
|
|
52
|
+
// ZoneCard Components
|
|
53
|
+
export { ZoneCard, ZoneContainer, ZoneHeader, ResourceRow, AddResourceButton } from './components/ZoneCard'
|
|
54
|
+
export type { ZoneCardProps, ZoneResource, ZoneContainerProps, DragHandleProps, ZoneHeaderProps, ResourceRowProps, ResourceRowLabels, AddResourceButtonProps } from './components/ZoneCard'
|
|
55
|
+
|
|
56
|
+
// ZonesResources Page
|
|
57
|
+
export { ZonesResourcesPage } from './pages/ZonesResources'
|
|
58
|
+
export type { ZonesResourcesPageProps } from './pages/ZonesResources'
|
|
59
|
+
|
|
39
60
|
// ============================================================================
|
|
40
61
|
// Navigation Components
|
|
41
62
|
// ============================================================================
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.zones-resources-page {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-self: stretch;
|
|
5
|
+
|
|
6
|
+
&__back {
|
|
7
|
+
padding: 24px 32px 0 32px;
|
|
8
|
+
align-self: flex-start;
|
|
9
|
+
|
|
10
|
+
.ghost-button {
|
|
11
|
+
color: var(--fill-action, #5D5BF4);
|
|
12
|
+
border-color: var(--borders-main-border-primary, #E8E9EF);
|
|
13
|
+
|
|
14
|
+
&:not(.active):hover:not(:disabled) {
|
|
15
|
+
background-color: var(--surface-action-soft, #F4F4FE);
|
|
16
|
+
color: var(--fill-action, #5D5BF4);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ghost-button__icon svg {
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (max-width: 768px) {
|
|
26
|
+
padding: 16px 16px 0 16px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__content {
|
|
31
|
+
padding: 24px 32px;
|
|
32
|
+
|
|
33
|
+
@media (max-width: 768px) {
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__action {
|
|
39
|
+
margin-bottom: 16px;
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: flex-end;
|
|
42
|
+
}
|
|
43
|
+
}
|