@furystack/shades-common-components 12.5.0 → 12.6.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/CHANGELOG.md +63 -0
- package/esm/components/data-grid/data-grid.d.ts +7 -1
- package/esm/components/data-grid/data-grid.d.ts.map +1 -1
- package/esm/components/data-grid/data-grid.js +1 -1
- package/esm/components/data-grid/data-grid.js.map +1 -1
- package/esm/components/data-grid/footer.d.ts +1 -0
- package/esm/components/data-grid/footer.d.ts.map +1 -1
- package/esm/components/data-grid/footer.js +8 -15
- package/esm/components/data-grid/footer.js.map +1 -1
- package/esm/components/data-grid/footer.spec.js +85 -47
- package/esm/components/data-grid/footer.spec.js.map +1 -1
- package/esm/components/grid.d.ts +3 -0
- package/esm/components/grid.d.ts.map +1 -1
- package/esm/components/grid.js +3 -0
- package/esm/components/grid.js.map +1 -1
- package/esm/components/inputs/autocomplete.d.ts +3 -0
- package/esm/components/inputs/autocomplete.d.ts.map +1 -1
- package/esm/components/inputs/autocomplete.js +3 -0
- package/esm/components/inputs/autocomplete.js.map +1 -1
- package/esm/components/list/list.d.ts +10 -0
- package/esm/components/list/list.d.ts.map +1 -1
- package/esm/components/list/list.js +23 -2
- package/esm/components/list/list.js.map +1 -1
- package/esm/components/list/list.spec.js +101 -0
- package/esm/components/list/list.spec.js.map +1 -1
- package/esm/components/markdown/markdown-input.d.ts +14 -0
- package/esm/components/markdown/markdown-input.d.ts.map +1 -1
- package/esm/components/markdown/markdown-input.js +48 -2
- package/esm/components/markdown/markdown-input.js.map +1 -1
- package/esm/components/markdown/markdown-input.spec.js +97 -0
- package/esm/components/markdown/markdown-input.spec.js.map +1 -1
- package/esm/components/suggest/index.d.ts +10 -2
- package/esm/components/suggest/index.d.ts.map +1 -1
- package/esm/components/suggest/index.js +21 -1
- package/esm/components/suggest/index.js.map +1 -1
- package/esm/components/suggest/index.spec.js +50 -0
- package/esm/components/suggest/index.spec.js.map +1 -1
- package/esm/components/wizard/index.d.ts +8 -0
- package/esm/components/wizard/index.d.ts.map +1 -1
- package/esm/components/wizard/index.js +90 -0
- package/esm/components/wizard/index.js.map +1 -1
- package/esm/components/wizard/index.spec.js +79 -2
- package/esm/components/wizard/index.spec.js.map +1 -1
- package/package.json +3 -3
- package/src/components/data-grid/data-grid.tsx +13 -2
- package/src/components/data-grid/footer.spec.tsx +104 -50
- package/src/components/data-grid/footer.tsx +25 -31
- package/src/components/grid.tsx +3 -0
- package/src/components/inputs/autocomplete.tsx +3 -0
- package/src/components/list/list.spec.tsx +173 -0
- package/src/components/list/list.tsx +56 -19
- package/src/components/markdown/markdown-input.spec.tsx +142 -0
- package/src/components/markdown/markdown-input.tsx +65 -1
- package/src/components/suggest/index.spec.tsx +83 -0
- package/src/components/suggest/index.tsx +36 -3
- package/src/components/wizard/index.spec.tsx +118 -1
- package/src/components/wizard/index.tsx +125 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChildrenList } from '@furystack/shades'
|
|
2
2
|
import { createComponent, Shade } from '@furystack/shades'
|
|
3
|
+
import { cssVariableTheme } from '../../services/css-variable-theme.js'
|
|
3
4
|
import { Paper } from '../paper.js'
|
|
4
5
|
|
|
5
6
|
export interface WizardStepProps {
|
|
@@ -30,6 +31,14 @@ export interface WizardProps {
|
|
|
30
31
|
* A callback that will be executed when the wizard is completed
|
|
31
32
|
*/
|
|
32
33
|
onFinish?: () => void
|
|
34
|
+
/**
|
|
35
|
+
* Optional labels for each step. When provided, a step indicator is shown above the content.
|
|
36
|
+
*/
|
|
37
|
+
stepLabels?: string[]
|
|
38
|
+
/**
|
|
39
|
+
* When true, a progress bar is shown above the content.
|
|
40
|
+
*/
|
|
41
|
+
showProgress?: boolean
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export const Wizard = Shade<WizardProps>({
|
|
@@ -42,15 +51,131 @@ export const Wizard = Shade<WizardProps>({
|
|
|
42
51
|
width: '100%',
|
|
43
52
|
height: '100%',
|
|
44
53
|
},
|
|
54
|
+
'& .wizard-step-indicator': {
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
padding: '16px 24px 8px',
|
|
59
|
+
gap: '0',
|
|
60
|
+
},
|
|
61
|
+
'& .wizard-step-node': {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
gap: '4px',
|
|
66
|
+
zIndex: '1',
|
|
67
|
+
minWidth: '32px',
|
|
68
|
+
},
|
|
69
|
+
'& .wizard-step-circle': {
|
|
70
|
+
width: '28px',
|
|
71
|
+
height: '28px',
|
|
72
|
+
borderRadius: '50%',
|
|
73
|
+
display: 'flex',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
fontSize: cssVariableTheme.typography.fontSize.xs,
|
|
77
|
+
fontWeight: cssVariableTheme.typography.fontWeight.semibold,
|
|
78
|
+
border: `2px solid ${cssVariableTheme.action.subtleBorder}`,
|
|
79
|
+
background: cssVariableTheme.background.default,
|
|
80
|
+
color: cssVariableTheme.text.secondary,
|
|
81
|
+
transition: `all ${cssVariableTheme.transitions.duration.normal} ease`,
|
|
82
|
+
},
|
|
83
|
+
'& .wizard-step-circle[data-active]': {
|
|
84
|
+
borderColor: cssVariableTheme.palette.primary.main,
|
|
85
|
+
background: cssVariableTheme.palette.primary.main,
|
|
86
|
+
color: cssVariableTheme.palette.primary.mainContrast,
|
|
87
|
+
},
|
|
88
|
+
'& .wizard-step-circle[data-completed]': {
|
|
89
|
+
borderColor: cssVariableTheme.palette.primary.main,
|
|
90
|
+
background: cssVariableTheme.palette.primary.main,
|
|
91
|
+
color: cssVariableTheme.palette.primary.mainContrast,
|
|
92
|
+
opacity: '0.7',
|
|
93
|
+
},
|
|
94
|
+
'& .wizard-step-label': {
|
|
95
|
+
fontSize: cssVariableTheme.typography.fontSize.xs,
|
|
96
|
+
color: cssVariableTheme.text.secondary,
|
|
97
|
+
textAlign: 'center',
|
|
98
|
+
maxWidth: '80px',
|
|
99
|
+
overflow: 'hidden',
|
|
100
|
+
textOverflow: 'ellipsis',
|
|
101
|
+
whiteSpace: 'nowrap',
|
|
102
|
+
},
|
|
103
|
+
'& .wizard-step-label[data-active]': {
|
|
104
|
+
color: cssVariableTheme.palette.primary.main,
|
|
105
|
+
fontWeight: cssVariableTheme.typography.fontWeight.semibold,
|
|
106
|
+
},
|
|
107
|
+
'& .wizard-step-connector': {
|
|
108
|
+
flex: '1',
|
|
109
|
+
height: '2px',
|
|
110
|
+
background: cssVariableTheme.action.subtleBorder,
|
|
111
|
+
minWidth: '24px',
|
|
112
|
+
alignSelf: 'flex-start',
|
|
113
|
+
marginTop: '14px',
|
|
114
|
+
transition: `background ${cssVariableTheme.transitions.duration.normal} ease`,
|
|
115
|
+
},
|
|
116
|
+
'& .wizard-step-connector[data-completed]': {
|
|
117
|
+
background: cssVariableTheme.palette.primary.main,
|
|
118
|
+
},
|
|
119
|
+
'& .wizard-progress-bar': {
|
|
120
|
+
height: '4px',
|
|
121
|
+
background: cssVariableTheme.action.subtleBorder,
|
|
122
|
+
margin: '12px 24px 4px',
|
|
123
|
+
borderRadius: '2px',
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
},
|
|
126
|
+
'& .wizard-progress-fill': {
|
|
127
|
+
height: '100%',
|
|
128
|
+
background: cssVariableTheme.palette.primary.main,
|
|
129
|
+
borderRadius: '2px',
|
|
130
|
+
transition: `width ${cssVariableTheme.transitions.duration.normal} ease`,
|
|
131
|
+
},
|
|
45
132
|
},
|
|
46
133
|
render: ({ props, useState }) => {
|
|
47
134
|
const [currentPage, setCurrentPage] = useState('currentPage', 0)
|
|
48
135
|
|
|
136
|
+
if (props.stepLabels && props.stepLabels.length !== props.steps.length) {
|
|
137
|
+
console.warn(
|
|
138
|
+
`[Wizard] stepLabels length (${props.stepLabels.length}) does not match steps length (${props.steps.length}).`,
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
49
142
|
const CurrentPage = props.steps[currentPage]
|
|
143
|
+
const progressPercent = props.steps.length > 1 ? (currentPage / (props.steps.length - 1)) * 100 : 100
|
|
50
144
|
|
|
51
145
|
return (
|
|
52
146
|
<div className="wizard-container">
|
|
53
147
|
<Paper style={{ maxWidth: '100%', maxHeight: '100%' }} elevation={3} onclick={(ev) => ev.stopPropagation()}>
|
|
148
|
+
{props.stepLabels && props.stepLabels.length > 0 && (
|
|
149
|
+
<div className="wizard-step-indicator" data-testid="wizard-step-indicator">
|
|
150
|
+
{props.steps.map((_, index) => (
|
|
151
|
+
<>
|
|
152
|
+
{index > 0 && (
|
|
153
|
+
<div
|
|
154
|
+
className="wizard-step-connector"
|
|
155
|
+
{...(index <= currentPage ? { 'data-completed': '' } : {})}
|
|
156
|
+
/>
|
|
157
|
+
)}
|
|
158
|
+
<div className="wizard-step-node">
|
|
159
|
+
<div
|
|
160
|
+
className="wizard-step-circle"
|
|
161
|
+
{...(index === currentPage ? { 'data-active': '' } : {})}
|
|
162
|
+
{...(index < currentPage ? { 'data-completed': '' } : {})}
|
|
163
|
+
>
|
|
164
|
+
{(index + 1).toString()}
|
|
165
|
+
</div>
|
|
166
|
+
<span className="wizard-step-label" {...(index === currentPage ? { 'data-active': '' } : {})}>
|
|
167
|
+
{props.stepLabels?.[index] ?? ''}
|
|
168
|
+
</span>
|
|
169
|
+
</div>
|
|
170
|
+
</>
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
{props.showProgress && (
|
|
175
|
+
<div className="wizard-progress-bar" data-testid="wizard-progress-bar">
|
|
176
|
+
<div className="wizard-progress-fill" style={{ width: `${progressPercent}%` }} />
|
|
177
|
+
</div>
|
|
178
|
+
)}
|
|
54
179
|
<CurrentPage
|
|
55
180
|
currentPage={currentPage}
|
|
56
181
|
maxPages={props.steps.length}
|