@licklist/design 0.78.34 → 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/provider/location-input/LocationInput.js +1 -1
- 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/Badge/Badge.d.ts +1 -0
- package/dist/v2/components/Badge/Badge.d.ts.map +1 -1
- package/dist/v2/components/Badge/Badge.js +2 -1
- package/dist/v2/components/Badge/Badge.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/QuickFilter/QuickFilter.scss.js +1 -1
- package/dist/v2/components/TableSortIcon/TableSortIcon.d.ts.map +1 -1
- package/dist/v2/components/TableSortIcon/TableSortIcon.js +5 -3
- 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.d.ts +36 -2
- package/dist/v2/icons/index.d.ts.map +1 -1
- package/dist/v2/icons/index.js +97 -29
- 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 +3 -3
- package/src/index.ts +4 -1
- package/src/provider/location-input/LocationInput.tsx +1 -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/Badge/Badge.scss +25 -23
- package/src/v2/components/Badge/Badge.tsx +3 -0
- package/src/v2/components/Checkbox/Checkbox.scss +3 -3
- package/src/v2/components/Customer/CustomersList.scss +60 -9
- 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/QuickFilter/QuickFilter.scss +14 -3
- package/src/v2/components/TableSortIcon/TableSortIcon.tsx +3 -5
- 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 +13 -1
- package/src/v2/icons/index.tsx +147 -14
- 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,81 @@
|
|
|
1
|
+
.icon-button {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
width: fit-content;
|
|
5
|
+
gap: var(--spacing-sm, 8px);
|
|
6
|
+
padding: 0 16px 0 12px;
|
|
7
|
+
height: 36px;
|
|
8
|
+
background: transparent;
|
|
9
|
+
border: 1px solid var(--border-primary);
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
transition: all 0.2s ease;
|
|
13
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
14
|
+
|
|
15
|
+
@media (max-width: 768px) {
|
|
16
|
+
height: 44px;
|
|
17
|
+
padding: 0 20px 0 16px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
background: var(--surface-secondary);
|
|
22
|
+
color: var(--label-primary);
|
|
23
|
+
|
|
24
|
+
.icon-button__icon {
|
|
25
|
+
color: var(--label-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.icon-button__label {
|
|
29
|
+
color: var(--label-primary);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&:active {
|
|
34
|
+
background: var(--surface-tertiary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&__icon {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
color: var(--label-primary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__label {
|
|
44
|
+
font-size: 13px;
|
|
45
|
+
font-weight: 500;
|
|
46
|
+
line-height: 16px;
|
|
47
|
+
color: var(--label-primary);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Icon-only variant (no label)
|
|
52
|
+
.icon-button--icon-only {
|
|
53
|
+
display: inline-flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
width: 32px;
|
|
57
|
+
height: 32px;
|
|
58
|
+
border: 1px solid var(--border-primary);
|
|
59
|
+
border-radius: 8px;
|
|
60
|
+
background: transparent;
|
|
61
|
+
color: var(--label-primary);
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
transition: all 0.2s ease;
|
|
64
|
+
|
|
65
|
+
&:hover {
|
|
66
|
+
background: var(--surface-primary, #fff);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&:active {
|
|
70
|
+
background: var(--surface-tertiary);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Danger variant
|
|
75
|
+
.icon-button--danger {
|
|
76
|
+
color: var(--label-danger, #cc3c35);
|
|
77
|
+
|
|
78
|
+
&:hover {
|
|
79
|
+
background: var(--surface-primary, #fff);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { IconButton } from './IconButton'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'v2/Components/IconButton',
|
|
7
|
+
component: IconButton,
|
|
8
|
+
} as Meta<typeof IconButton>
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof IconButton>
|
|
11
|
+
|
|
12
|
+
export const BackWithLabel: Story = {
|
|
13
|
+
args: {
|
|
14
|
+
label: 'Go Back',
|
|
15
|
+
icon: 'back',
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const AddWithLabel: Story = {
|
|
20
|
+
args: {
|
|
21
|
+
label: 'Add Item',
|
|
22
|
+
icon: 'add',
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const DeleteWithLabel: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
label: 'Remove Item',
|
|
29
|
+
icon: 'delete',
|
|
30
|
+
variant: 'danger',
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const IconOnlyBack: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
icon: 'back',
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const IconOnlyAdd: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
icon: 'add',
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const IconOnlyDelete: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
icon: 'delete',
|
|
49
|
+
variant: 'danger',
|
|
50
|
+
},
|
|
51
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, ReactNode } from 'react'
|
|
2
|
+
import { ArrowLeftIcon, PlusIcon, DeleteIcon } from '../../icons'
|
|
3
|
+
import './IconButton.scss'
|
|
4
|
+
|
|
5
|
+
export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
label?: string
|
|
7
|
+
icon?: 'back' | 'add' | 'delete' | ReactNode
|
|
8
|
+
variant?: 'default' | 'danger'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function IconButton({
|
|
12
|
+
label,
|
|
13
|
+
icon = 'back',
|
|
14
|
+
variant = 'default',
|
|
15
|
+
className = '',
|
|
16
|
+
...props
|
|
17
|
+
}: IconButtonProps) {
|
|
18
|
+
const isIconOnly = !label
|
|
19
|
+
const classes = [
|
|
20
|
+
isIconOnly ? 'icon-button--icon-only' : 'icon-button',
|
|
21
|
+
variant === 'danger' ? 'icon-button--danger' : '',
|
|
22
|
+
className,
|
|
23
|
+
].filter(Boolean).join(' ')
|
|
24
|
+
|
|
25
|
+
const iconSize = isIconOnly ? 32 : 16
|
|
26
|
+
|
|
27
|
+
const renderIcon = () => {
|
|
28
|
+
if (icon === 'back') return ArrowLeftIcon({ width: iconSize, height: iconSize })
|
|
29
|
+
if (icon === 'add') return PlusIcon({ width: iconSize, height: iconSize })
|
|
30
|
+
if (icon === 'delete') return DeleteIcon({ width: iconSize, height: iconSize })
|
|
31
|
+
return icon
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (isIconOnly) {
|
|
35
|
+
return (
|
|
36
|
+
<button type="button" className={classes} {...props}>
|
|
37
|
+
{renderIcon()}
|
|
38
|
+
</button>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<button className={classes} {...props}>
|
|
44
|
+
<span className="icon-button__icon">
|
|
45
|
+
{renderIcon()}
|
|
46
|
+
</span>
|
|
47
|
+
<span className="icon-button__label">{label}</span>
|
|
48
|
+
</button>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -10,6 +10,7 @@ type CommonInputProps = {
|
|
|
10
10
|
iconPosition?: 'left' | 'right';
|
|
11
11
|
required?: boolean;
|
|
12
12
|
onIconClick?: () => void;
|
|
13
|
+
variant?: 'default' | 'on-surface';
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
type InputProps = CommonInputProps & {
|
|
@@ -23,13 +24,14 @@ type TextareaProps = CommonInputProps & {
|
|
|
23
24
|
export type NewInputProps = InputProps | TextareaProps
|
|
24
25
|
|
|
25
26
|
export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewInputProps>(
|
|
26
|
-
({label, optional, helperText, error, icon, iconPosition = 'left', as = 'input', required, className = '', onIconClick, ...props}, ref) => {
|
|
27
|
+
({label, optional, helperText, error, icon, iconPosition = 'left', as = 'input', required, variant, className = '', onIconClick, ...props}, ref) => {
|
|
27
28
|
const inputRef = React.useRef<HTMLInputElement>(null);
|
|
28
29
|
const isError = !!error;
|
|
29
30
|
const containerClasses = [
|
|
30
31
|
'new-form-input',
|
|
31
32
|
isError ? 'new-form-input--error' : '',
|
|
32
33
|
props.disabled ? 'new-form-input--disabled' : '',
|
|
34
|
+
variant === 'on-surface' ? 'new-form-input--on-surface' : '',
|
|
33
35
|
className
|
|
34
36
|
].filter(Boolean).join(' ');
|
|
35
37
|
|
|
@@ -94,7 +96,8 @@ export const NewInput = forwardRef<HTMLInputElement | HTMLTextAreaElement, NewIn
|
|
|
94
96
|
<div className={containerClasses}>
|
|
95
97
|
{(label || optional) && (
|
|
96
98
|
<label className="new-form-input__label">
|
|
97
|
-
{label}
|
|
99
|
+
<span>{label}</span>
|
|
100
|
+
{optional && <span className="new-form-input__label-optional">(optional)</span>}
|
|
98
101
|
</label>
|
|
99
102
|
)}
|
|
100
103
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
import { NewPageHeader } from './NewPageHeader'
|
|
3
|
+
import { Button, ButtonText } from '../Button'
|
|
3
4
|
|
|
4
5
|
const meta: Meta<typeof NewPageHeader> = {
|
|
5
6
|
title: 'V2/Components/NewPageHeader',
|
|
@@ -42,3 +43,30 @@ export const CustomCancelLabel: Story = {
|
|
|
42
43
|
onCancel: () => alert('Go Back clicked'),
|
|
43
44
|
},
|
|
44
45
|
}
|
|
46
|
+
|
|
47
|
+
export const WithAction: Story = {
|
|
48
|
+
args: {
|
|
49
|
+
title: 'Zones & Resources',
|
|
50
|
+
renderRight: () => (
|
|
51
|
+
<Button variant="primary" onClick={() => alert('Add Zone clicked')}>
|
|
52
|
+
<ButtonText color="white">+ Add Zone</ButtonText>
|
|
53
|
+
</Button>
|
|
54
|
+
),
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const WithMultipleActions: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
title: 'Zones & Resources',
|
|
61
|
+
renderRight: () => (
|
|
62
|
+
<>
|
|
63
|
+
<Button variant="secondary" onClick={() => alert('Export clicked')}>
|
|
64
|
+
<ButtonText color="action">Export</ButtonText>
|
|
65
|
+
</Button>
|
|
66
|
+
<Button variant="primary" onClick={() => alert('Add Zone clicked')}>
|
|
67
|
+
<ButtonText color="white">+ Add Zone</ButtonText>
|
|
68
|
+
</Button>
|
|
69
|
+
</>
|
|
70
|
+
),
|
|
71
|
+
},
|
|
72
|
+
}
|
|
@@ -12,11 +12,21 @@
|
|
|
12
12
|
|
|
13
13
|
&__options {
|
|
14
14
|
display: flex;
|
|
15
|
-
flex-wrap:
|
|
15
|
+
flex-wrap: nowrap;
|
|
16
|
+
overflow-x: auto;
|
|
16
17
|
gap: 8px;
|
|
18
|
+
-ms-overflow-style: none; /* IE and Edge */
|
|
19
|
+
scrollbar-width: none; /* Firefox */
|
|
20
|
+
padding-bottom: 2px; /* Prevent button shadows/borders from being cut off during scroll if any */
|
|
21
|
+
|
|
22
|
+
&::-webkit-scrollbar {
|
|
23
|
+
display: none; /* Chrome, Safari and Opera */
|
|
24
|
+
}
|
|
17
25
|
|
|
18
26
|
.ghost-button {
|
|
19
27
|
border-radius: 100px;
|
|
28
|
+
font-family: var(--font-family-mono, 'Geist Mono', monospace);
|
|
29
|
+
flex-shrink: 0;
|
|
20
30
|
}
|
|
21
31
|
}
|
|
22
32
|
}
|
|
@@ -26,7 +36,7 @@
|
|
|
26
36
|
.quick-filter {
|
|
27
37
|
display: flex;
|
|
28
38
|
flex-direction: row;
|
|
29
|
-
align-items:
|
|
39
|
+
align-items: center;
|
|
30
40
|
gap: 12px;
|
|
31
41
|
width: 100%;
|
|
32
42
|
|
|
@@ -37,7 +47,8 @@
|
|
|
37
47
|
&__options {
|
|
38
48
|
flex: 1;
|
|
39
49
|
display: flex;
|
|
40
|
-
flex-wrap:
|
|
50
|
+
flex-wrap: nowrap;
|
|
51
|
+
overflow-x: auto;
|
|
41
52
|
gap: 6px;
|
|
42
53
|
padding: 0;
|
|
43
54
|
margin: 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { TableHeaderArrowUpIcon, TableHeaderArrowDownIcon} from '../../icons'
|
|
3
3
|
|
|
4
4
|
export type SortDirection = 'asc' | 'desc' | null
|
|
5
5
|
|
|
@@ -10,11 +10,9 @@ export interface TableSortIconProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const TableSortIcon: React.FC<TableSortIconProps> = ({ active = false, direction, className = '' }) => {
|
|
13
|
-
if (!active || !direction) return null
|
|
14
|
-
|
|
15
13
|
return (
|
|
16
|
-
<span className={className}>
|
|
17
|
-
{direction === 'asc' ? <
|
|
14
|
+
<span className={className} style={{ visibility: active && direction ? 'visible' : 'hidden' }}>
|
|
15
|
+
{direction === 'asc' ? <TableHeaderArrowUpIcon /> : <TableHeaderArrowDownIcon />}
|
|
18
16
|
</span>
|
|
19
17
|
)
|
|
20
18
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconButton } from '../IconButton'
|
|
3
|
+
|
|
4
|
+
export interface AddResourceButtonProps {
|
|
5
|
+
label?: string
|
|
6
|
+
onClick: () => void
|
|
7
|
+
className?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const AddResourceButton: React.FC<AddResourceButtonProps> = ({
|
|
11
|
+
label = 'Add Resource',
|
|
12
|
+
onClick,
|
|
13
|
+
className = '',
|
|
14
|
+
}) => {
|
|
15
|
+
return (
|
|
16
|
+
<div className={`zone-card__add-resource-wrapper ${className}`}>
|
|
17
|
+
<IconButton label={label} icon='add' onClick={onClick} />
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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 ResourceRowLabels {
|
|
8
|
+
quantity?: string
|
|
9
|
+
capacity?: string
|
|
10
|
+
total?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ResourceRowProps {
|
|
14
|
+
name: string
|
|
15
|
+
quantity: number
|
|
16
|
+
capacity: number
|
|
17
|
+
labels?: ResourceRowLabels
|
|
18
|
+
menuItems?: ActionMenuItem[]
|
|
19
|
+
draggable?: boolean
|
|
20
|
+
dragHandleProps?: DragHandleProps
|
|
21
|
+
onClick?: () => void
|
|
22
|
+
className?: string
|
|
23
|
+
style?: React.CSSProperties
|
|
24
|
+
isMobile?: boolean
|
|
25
|
+
isFirst?: boolean
|
|
26
|
+
isLast?: boolean
|
|
27
|
+
onMoveUp?: () => void
|
|
28
|
+
onMoveDown?: () => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const ResourceRow = React.forwardRef<HTMLDivElement, ResourceRowProps>(({
|
|
32
|
+
name,
|
|
33
|
+
quantity,
|
|
34
|
+
capacity,
|
|
35
|
+
labels = {},
|
|
36
|
+
menuItems = [],
|
|
37
|
+
draggable = true,
|
|
38
|
+
dragHandleProps,
|
|
39
|
+
onClick,
|
|
40
|
+
className = '',
|
|
41
|
+
style,
|
|
42
|
+
isMobile = false,
|
|
43
|
+
isFirst = false,
|
|
44
|
+
isLast = false,
|
|
45
|
+
onMoveUp,
|
|
46
|
+
onMoveDown,
|
|
47
|
+
}, ref) => {
|
|
48
|
+
const qtyLabel = labels.quantity ?? 'Qty'
|
|
49
|
+
const capLabel = labels.capacity ?? 'Cap'
|
|
50
|
+
const totalLabel = labels.total ?? 'Total'
|
|
51
|
+
const classes = [
|
|
52
|
+
'zone-card__resource',
|
|
53
|
+
onClick ? 'zone-card__resource--clickable' : '',
|
|
54
|
+
isMobile ? 'zone-card__resource--mobile' : '',
|
|
55
|
+
className,
|
|
56
|
+
].filter(Boolean).join(' ')
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div ref={ref} className={classes} style={style} onClick={onClick}>
|
|
60
|
+
{draggable && !isMobile && (
|
|
61
|
+
<div
|
|
62
|
+
className="zone-card__drag-handle zone-card__drag-handle--resource"
|
|
63
|
+
{...dragHandleProps}
|
|
64
|
+
onClick={(e) => e.stopPropagation()}
|
|
65
|
+
>
|
|
66
|
+
{GripVerticalIcon({ width: 16, height: 16 })}
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
{draggable && isMobile && (
|
|
70
|
+
<div className="zone-card__reorder-arrows zone-card__reorder-arrows--resource" onClick={(e) => e.stopPropagation()}>
|
|
71
|
+
<button
|
|
72
|
+
className="zone-card__arrow-btn"
|
|
73
|
+
disabled={isFirst}
|
|
74
|
+
onClick={(e) => { e.stopPropagation(); onMoveUp?.() }}
|
|
75
|
+
>
|
|
76
|
+
<ArrowUpIcon />
|
|
77
|
+
</button>
|
|
78
|
+
<button
|
|
79
|
+
className="zone-card__arrow-btn"
|
|
80
|
+
disabled={isLast}
|
|
81
|
+
onClick={(e) => { e.stopPropagation(); onMoveDown?.() }}
|
|
82
|
+
>
|
|
83
|
+
<ArrowDownIcon />
|
|
84
|
+
</button>
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
{isMobile ? (
|
|
88
|
+
<div className="zone-card__resource-info">
|
|
89
|
+
<span className="zone-card__resource-name">{name}</span>
|
|
90
|
+
<span className="zone-card__resource-stats-mobile">
|
|
91
|
+
{qtyLabel}: {quantity} · {capLabel}: {capacity} · {totalLabel}: {quantity * capacity}
|
|
92
|
+
</span>
|
|
93
|
+
</div>
|
|
94
|
+
) : (
|
|
95
|
+
<>
|
|
96
|
+
<span className="zone-card__resource-name">{name}</span>
|
|
97
|
+
<div className="zone-card__resource-stats">
|
|
98
|
+
<span className="zone-card__resource-stat">{qtyLabel}: {quantity}</span>
|
|
99
|
+
<span className="zone-card__resource-stat">{capLabel}: {capacity}</span>
|
|
100
|
+
<span className="zone-card__resource-stat zone-card__resource-stat--total">
|
|
101
|
+
{totalLabel}: {quantity * capacity}
|
|
102
|
+
</span>
|
|
103
|
+
</div>
|
|
104
|
+
</>
|
|
105
|
+
)}
|
|
106
|
+
{menuItems.length > 0 && (
|
|
107
|
+
<div className="zone-card__resource-actions" onClick={(e) => e.stopPropagation()}>
|
|
108
|
+
<ActionMenu items={menuItems} />
|
|
109
|
+
</div>
|
|
110
|
+
)}
|
|
111
|
+
</div>
|
|
112
|
+
)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
ResourceRow.displayName = 'ResourceRow'
|
|
@@ -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
|
+
}
|