@licklist/design 0.78.35 → 0.78.37
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 +9 -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/Button/GhostButton.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/InputCheckbox/InputCheckbox.d.ts +7 -0
- package/dist/v2/components/InputCheckbox/InputCheckbox.d.ts.map +1 -0
- package/dist/v2/components/InputCheckbox/InputCheckbox.js +85 -0
- package/dist/v2/components/InputCheckbox/InputCheckbox.scss.js +6 -0
- package/dist/v2/components/InputCheckbox/index.d.ts +3 -0
- package/dist/v2/components/InputCheckbox/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/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 +7 -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 +6 -0
- package/dist/v2/pages/Settings/components/SidebarNavItem.js +6 -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/Button/GhostButton.scss +1 -1
- package/src/v2/components/Checkbox/Checkbox.scss +3 -3
- package/src/v2/components/Customer/CustomersList.scss +26 -8
- 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/InputCheckbox/InputCheckbox.scss +53 -0
- package/src/v2/components/InputCheckbox/InputCheckbox.tsx +24 -0
- package/src/v2/components/InputCheckbox/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 +0 -1
- 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 +14 -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
package/src/index.ts
CHANGED
|
@@ -29,7 +29,8 @@ export * from './report'
|
|
|
29
29
|
export * from './venue-map-sets'
|
|
30
30
|
export * from './affiliate'
|
|
31
31
|
export * from './typeahead-helper'
|
|
32
|
-
export
|
|
32
|
+
export { ZoneForm } from './zone/form'
|
|
33
|
+
export type { ZoneFormProps } from './zone/form'
|
|
33
34
|
export * from './resource'
|
|
34
35
|
export * from './virtualized'
|
|
35
36
|
export * from './customers'
|
|
@@ -50,3 +51,5 @@ export * from './v2/components'
|
|
|
50
51
|
export * from './v2/dashboard-analytics'
|
|
51
52
|
export * from './v2/navigation/DashboardLayout'
|
|
52
53
|
export * from './v2/pages/Settings'
|
|
54
|
+
export * from './v2/pages/ZonesResources'
|
|
55
|
+
export * from './v2/components'
|
|
@@ -7,46 +7,33 @@
|
|
|
7
7
|
|
|
8
8
|
&__trigger {
|
|
9
9
|
display: flex;
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
12
|
-
padding:
|
|
10
|
+
width: 32px;
|
|
11
|
+
height: 32px;
|
|
12
|
+
padding: 0;
|
|
13
13
|
justify-content: center;
|
|
14
14
|
align-items: center;
|
|
15
15
|
border-radius: 50%;
|
|
16
|
-
border:
|
|
16
|
+
border: none;
|
|
17
17
|
background: var(--surface-action-soft);
|
|
18
18
|
color: var(--actions-regular, #5D5BF4);
|
|
19
19
|
cursor: pointer;
|
|
20
20
|
transition: all 0.2s ease;
|
|
21
|
+
position: relative;
|
|
21
22
|
|
|
22
23
|
&:hover {
|
|
23
|
-
|
|
24
|
+
opacity: 0.8;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
&--close {
|
|
27
28
|
border-radius: 50%;
|
|
28
29
|
background: #F4F4FE;
|
|
29
|
-
border: 1px solid #F4F4FE;
|
|
30
30
|
|
|
31
31
|
&:hover {
|
|
32
32
|
background: #E8E8FD;
|
|
33
|
+
opacity: 1;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
svg {
|
|
37
|
-
width: 28px;
|
|
38
|
-
height: 28px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.action-menu__circle {
|
|
42
|
-
position: absolute;
|
|
43
|
-
top: 50%;
|
|
44
|
-
left: 50%;
|
|
45
|
-
transform: translate(-50%, -50%);
|
|
46
|
-
width: 32px;
|
|
47
|
-
height: 32px;
|
|
48
|
-
z-index: -1;
|
|
49
|
-
}
|
|
50
37
|
}
|
|
51
38
|
|
|
52
39
|
&__dropdown {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { ActionMenu } from './ActionMenu'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'v2/Components/ActionMenu',
|
|
7
|
+
component: ActionMenu,
|
|
8
|
+
} as Meta<typeof ActionMenu>
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof ActionMenu>
|
|
11
|
+
|
|
12
|
+
const defaultItems = [
|
|
13
|
+
{ label: 'Edit', onClick: () => console.log('Edit') },
|
|
14
|
+
{ label: 'Duplicate', onClick: () => console.log('Duplicate') },
|
|
15
|
+
{ label: 'Delete', onClick: () => console.log('Delete'), variant: 'danger' as const },
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
items: defaultItems,
|
|
21
|
+
},
|
|
22
|
+
decorators: [
|
|
23
|
+
(Story) => (
|
|
24
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', paddingTop: 200 }}>
|
|
25
|
+
<Story />
|
|
26
|
+
</div>
|
|
27
|
+
),
|
|
28
|
+
],
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const OpenDown: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
items: defaultItems,
|
|
34
|
+
direction: 'down',
|
|
35
|
+
},
|
|
36
|
+
decorators: [
|
|
37
|
+
(Story) => (
|
|
38
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', paddingTop: 20 }}>
|
|
39
|
+
<Story />
|
|
40
|
+
</div>
|
|
41
|
+
),
|
|
42
|
+
],
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const WithCustomIconColour: Story = {
|
|
46
|
+
args: {
|
|
47
|
+
items: defaultItems,
|
|
48
|
+
iconColour: '#E0423A',
|
|
49
|
+
direction: 'down',
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const SingleItem: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
items: [{ label: 'Edit', onClick: () => console.log('Edit') }],
|
|
56
|
+
direction: 'down',
|
|
57
|
+
},
|
|
58
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect, useLayoutEffect } from 'react'
|
|
2
|
-
import { CloseIcon, EllipsisIcon
|
|
2
|
+
import { CloseIcon, EllipsisIcon } from '../../icons'
|
|
3
3
|
import './ActionMenu.scss'
|
|
4
4
|
|
|
5
5
|
export interface ActionMenuItem {
|
|
@@ -83,10 +83,7 @@ export const ActionMenu: React.FC<ActionMenuProps> = ({ items, className = '', i
|
|
|
83
83
|
{isOpen ? (
|
|
84
84
|
<CloseIcon width={18} height={18} />
|
|
85
85
|
) : (
|
|
86
|
-
|
|
87
|
-
<CircleIcon width={32} height={32} className="action-menu__circle" fill="var(--surface-action-soft)" />
|
|
88
|
-
<EllipsisIcon width={18} height={18} fill="var(--fill-action)" />
|
|
89
|
-
</>
|
|
86
|
+
<EllipsisIcon width={18} height={4} fill="var(--fill-action)" />
|
|
90
87
|
)}
|
|
91
88
|
</button>
|
|
92
89
|
|
|
@@ -112,4 +109,4 @@ export const ActionMenu: React.FC<ActionMenuProps> = ({ items, className = '', i
|
|
|
112
109
|
)}
|
|
113
110
|
</div>
|
|
114
111
|
)
|
|
115
|
-
}
|
|
112
|
+
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
.checkbox {
|
|
4
4
|
display: flex;
|
|
5
5
|
max-width: 500px;
|
|
6
|
-
align-items:
|
|
6
|
+
align-items: center;
|
|
7
7
|
gap: 11px;
|
|
8
|
-
align-self: stretch;
|
|
9
8
|
|
|
10
9
|
@media (min-width: 992px) {
|
|
11
10
|
max-width: unset;
|
|
@@ -13,11 +12,12 @@
|
|
|
13
12
|
|
|
14
13
|
&__wrapper {
|
|
15
14
|
display: flex;
|
|
16
|
-
align-items:
|
|
15
|
+
align-items: center;
|
|
17
16
|
gap: 11px;
|
|
18
17
|
cursor: pointer;
|
|
19
18
|
user-select: none;
|
|
20
19
|
width: 100%;
|
|
20
|
+
margin: 0;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&__input {
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
&__content {
|
|
98
98
|
display: flex;
|
|
99
99
|
flex-direction: column;
|
|
100
|
-
gap:
|
|
100
|
+
gap: 16px;
|
|
101
101
|
padding: 0 32px 32px;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -586,11 +586,16 @@
|
|
|
586
586
|
display: grid;
|
|
587
587
|
grid-template-areas:
|
|
588
588
|
"customer bookings"
|
|
589
|
-
"divider divider"
|
|
590
589
|
"next last"
|
|
591
|
-
"
|
|
592
|
-
"
|
|
593
|
-
|
|
590
|
+
"divider divider"
|
|
591
|
+
"status actions";
|
|
592
|
+
|
|
593
|
+
:is(.waivers-page--compact) & {
|
|
594
|
+
grid-template-areas:
|
|
595
|
+
"customer customer"
|
|
596
|
+
"divider divider"
|
|
597
|
+
"status actions";
|
|
598
|
+
}
|
|
594
599
|
border: 1px solid var(--border-primary, #E8E9EF);
|
|
595
600
|
border-radius: 12px;
|
|
596
601
|
margin-bottom: 16px;
|
|
@@ -619,11 +624,24 @@
|
|
|
619
624
|
&.tw-text-right {
|
|
620
625
|
grid-area: actions;
|
|
621
626
|
text-align: right;
|
|
622
|
-
padding
|
|
623
|
-
border-top: 1px solid var(--border-primary, #E8E9EF);
|
|
624
|
-
margin-top: 4px;
|
|
627
|
+
padding: 0;
|
|
625
628
|
display: flex;
|
|
626
629
|
justify-content: flex-end;
|
|
630
|
+
align-items: center;
|
|
631
|
+
|
|
632
|
+
:is(.waivers-page--compact) & {
|
|
633
|
+
padding-top: 0;
|
|
634
|
+
border-top: none;
|
|
635
|
+
margin-top: 0;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
&.waiver-col {
|
|
639
|
+
grid-area: status;
|
|
640
|
+
justify-content: flex-start;
|
|
641
|
+
border-top: none;
|
|
642
|
+
padding-top: 0;
|
|
643
|
+
margin-top: 0;
|
|
644
|
+
}
|
|
627
645
|
}
|
|
628
646
|
|
|
629
647
|
&:first-child {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
padding: 8px 10px;
|
|
34
34
|
height: 40px;
|
|
35
35
|
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
36
|
-
font-size: var(--text-regular-size,
|
|
36
|
+
font-size: var(--text-regular-size, 16px);
|
|
37
37
|
line-height: var(--text-regular-line, 20px);
|
|
38
38
|
color: var(--label-primary, #121e52);
|
|
39
39
|
background-color: var(--surface-secondary, #f8f8fa);
|
|
@@ -66,6 +66,14 @@
|
|
|
66
66
|
cursor: not-allowed;
|
|
67
67
|
opacity: 0.6;
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
&--on-surface {
|
|
71
|
+
background-color: var(--surface-primary, #fff);
|
|
72
|
+
|
|
73
|
+
&:focus {
|
|
74
|
+
background-color: var(--surface-primary, #fff);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
&__help-text {
|
|
@@ -81,3 +89,14 @@
|
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
|
|
92
|
+
// Auto-detect: swap input backgrounds when inside a surface-secondary container
|
|
93
|
+
.surface-context--secondary {
|
|
94
|
+
.form-field__input {
|
|
95
|
+
background-color: var(--surface-primary, #fff);
|
|
96
|
+
|
|
97
|
+
&:focus {
|
|
98
|
+
background-color: var(--surface-primary, #fff);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
@@ -4,30 +4,44 @@ import './FormField.scss'
|
|
|
4
4
|
export interface FormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
5
|
label?: string
|
|
6
6
|
error?: string
|
|
7
|
+
hasError?: boolean
|
|
8
|
+
success?: boolean
|
|
7
9
|
helpText?: string
|
|
8
10
|
required?: boolean
|
|
11
|
+
variant?: 'default' | 'on-surface'
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export const FormField = forwardRef<HTMLInputElement, FormFieldProps>(
|
|
12
|
-
({ label, error, helpText, required, className = '', ...props }, ref) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
({ label, error, hasError, success, helpText, required, variant, className = '', ...props }, ref) => {
|
|
16
|
+
const showError = error || hasError
|
|
17
|
+
const showSuccess = success && !showError
|
|
18
|
+
const inputClassName = [
|
|
19
|
+
'form-field__input',
|
|
20
|
+
showError ? 'form-field__input--error' : '',
|
|
21
|
+
showSuccess ? 'form-field__input--success' : '',
|
|
22
|
+
variant === 'on-surface' ? 'form-field__input--on-surface' : '',
|
|
23
|
+
].filter(Boolean).join(' ')
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div className={`form-field ${className}`}>
|
|
27
|
+
{label && (
|
|
28
|
+
<label className="form-field__label">
|
|
29
|
+
{label}
|
|
30
|
+
{required && <span className="form-field__required">*</span>}
|
|
31
|
+
</label>
|
|
32
|
+
)}
|
|
33
|
+
<input
|
|
34
|
+
ref={ref}
|
|
35
|
+
className={inputClassName}
|
|
36
|
+
{...props}
|
|
37
|
+
/>
|
|
38
|
+
{helpText && !showError && (
|
|
39
|
+
<span className="form-field__help-text">{helpText}</span>
|
|
40
|
+
)}
|
|
41
|
+
{error && <span className="form-field__error-text">{error}</span>}
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
31
45
|
)
|
|
32
46
|
|
|
33
47
|
FormField.displayName = 'FormField'
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.input-checkbox {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 6px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
user-select: none;
|
|
7
|
+
|
|
8
|
+
&__input {
|
|
9
|
+
position: absolute;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
width: 0;
|
|
12
|
+
height: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__box {
|
|
16
|
+
width: 16px;
|
|
17
|
+
height: 16px;
|
|
18
|
+
min-width: 16px;
|
|
19
|
+
border: 1px solid var(--border-primary, #e2e2e2);
|
|
20
|
+
border-radius: 3px;
|
|
21
|
+
background: var(--surface-primary, #fff);
|
|
22
|
+
transition: all 0.15s ease;
|
|
23
|
+
position: relative;
|
|
24
|
+
|
|
25
|
+
&::after {
|
|
26
|
+
content: '';
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 1px;
|
|
29
|
+
left: 4.5px;
|
|
30
|
+
width: 5px;
|
|
31
|
+
height: 9px;
|
|
32
|
+
border: solid white;
|
|
33
|
+
border-width: 0 2px 2px 0;
|
|
34
|
+
transform: rotate(45deg);
|
|
35
|
+
opacity: 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__input:checked + &__box {
|
|
40
|
+
background: var(--fill-selected, #14215a);
|
|
41
|
+
border-color: var(--fill-selected, #14215a);
|
|
42
|
+
|
|
43
|
+
&::after {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&__label {
|
|
49
|
+
font-family: var(--font-family-sans, 'Geist', sans-serif);
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
color: var(--label-primary, #121e52);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { InputHTMLAttributes, forwardRef } from 'react'
|
|
2
|
+
import './InputCheckbox.scss'
|
|
3
|
+
|
|
4
|
+
export interface InputCheckboxProps
|
|
5
|
+
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
6
|
+
label?: string | React.ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const InputCheckbox = forwardRef<HTMLInputElement, InputCheckboxProps>(
|
|
10
|
+
({ label, className = '', ...props }, ref) => (
|
|
11
|
+
<label className={`input-checkbox ${className}`}>
|
|
12
|
+
<input
|
|
13
|
+
ref={ref}
|
|
14
|
+
type="checkbox"
|
|
15
|
+
className="input-checkbox__input"
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
<span className="input-checkbox__box" />
|
|
19
|
+
{label && <span className="input-checkbox__label">{label}</span>}
|
|
20
|
+
</label>
|
|
21
|
+
),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
InputCheckbox.displayName = 'InputCheckbox'
|
|
@@ -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
|
|