@nurvus/ui 0.1.0-alpha.15 → 0.1.0-alpha.16
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/README.md +11 -1
- package/dist/icons.svg +73 -0
- package/dist/index.js +1 -1
- package/dist/nurvus.css +13 -10
- package/dist/respawn.js +1 -1
- package/dist/types/breakpoints.d.ts +14 -0
- package/dist/types/components/FullPageModal/FullPageModal.d.ts +11 -2
- package/dist/types/components/Grid/Grid.d.ts +26 -0
- package/dist/types/components/Loader/Loader.d.ts +21 -0
- package/dist/types/components/Menu/Menu.d.ts +54 -19
- package/dist/types/components/Progress/Progress.d.ts +19 -5
- package/dist/types/components/Stack/Stack.d.ts +26 -0
- package/dist/types/dialog.d.ts +12 -0
- package/dist/types/icons.d.ts +28 -0
- package/dist/types/index.d.ts +9 -1
- package/dist/types/loader.d.ts +28 -0
- package/dist/types/logo.d.ts +5 -0
- package/dist/types/menu.d.ts +43 -14
- package/dist/types/progress.d.ts +11 -0
- package/dist/types/respawn/FullPageModal.d.ts +7 -1
- package/dist/types/respawn/Grid.d.ts +21 -0
- package/dist/types/respawn/Loader.d.ts +18 -0
- package/dist/types/respawn/Menu.d.ts +45 -15
- package/dist/types/respawn/Progress.d.ts +18 -6
- package/dist/types/respawn/Stack.d.ts +21 -0
- package/dist/types/respawn/index.d.ts +9 -1
- package/package.json +1 -3
- package/src/breakpoints.ts +28 -0
- package/src/components/Button/Button.scss +20 -20
- package/src/components/FullPageModal/FullPageModal.md +20 -17
- package/src/components/FullPageModal/FullPageModal.scss +5 -0
- package/src/components/FullPageModal/FullPageModal.tsx +37 -3
- package/src/components/Grid/Grid.md +37 -0
- package/src/components/Grid/Grid.scss +37 -0
- package/src/components/Grid/Grid.tsx +54 -0
- package/src/components/HistoryList/HistoryList.scss +2 -2
- package/src/components/Loader/Loader.md +30 -0
- package/src/components/Loader/Loader.scss +42 -0
- package/src/components/Loader/Loader.tsx +68 -0
- package/src/components/Menu/Menu.md +67 -3
- package/src/components/Menu/Menu.scss +48 -18
- package/src/components/Menu/Menu.tsx +146 -39
- package/src/components/Progress/Progress.md +27 -26
- package/src/components/Progress/Progress.scss +41 -36
- package/src/components/Progress/Progress.tsx +50 -6
- package/src/components/Select/Select.scss +20 -19
- package/src/components/Stack/Stack.md +43 -0
- package/src/components/Stack/Stack.scss +36 -0
- package/src/components/Stack/Stack.tsx +52 -0
- package/src/components/Table/Table.scss +1 -1
- package/src/components/Tag/Tag.scss +2 -2
- package/src/components/Title/Title.scss +6 -6
- package/src/components/Tree/Tree.md +1 -1
- package/src/css.ts +3 -0
- package/src/dialog.ts +47 -0
- package/src/icons.ts +29 -0
- package/src/index.ts +9 -1
- package/src/loader.ts +43 -0
- package/src/logo.ts +12 -0
- package/src/menu.ts +91 -21
- package/src/progress.ts +21 -0
- package/src/respawn/FullPageModal.ts +30 -3
- package/src/respawn/Grid.ts +41 -0
- package/src/respawn/Loader.ts +77 -0
- package/src/respawn/Menu.ts +138 -34
- package/src/respawn/Progress.ts +56 -13
- package/src/respawn/Stack.ts +37 -0
- package/src/respawn/index.ts +9 -1
- package/src/styles/breakpoints.scss +3 -0
- package/src/styles/theme.scss +55 -55
- package/src/styles/type.json +9 -9
package/src/respawn/Progress.ts
CHANGED
|
@@ -1,29 +1,72 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
2
|
import CONSTANT from '../constants';
|
|
3
|
-
import {
|
|
3
|
+
import { PROGRESS_STATUS, clampPercent, progressValueText, ProgressStatus } from '../progress';
|
|
4
|
+
import Icon from './Icon';
|
|
5
|
+
import { spawn, ElementProps } from './spawn';
|
|
4
6
|
import { updatable, NurvusElement } from './update';
|
|
5
7
|
import '../components/Progress/Progress.scss';
|
|
6
8
|
|
|
7
9
|
export type ProgressSize = 'small' | 'medium' | 'large';
|
|
8
|
-
export type ProgressStatus
|
|
10
|
+
export type { ProgressStatus };
|
|
9
11
|
|
|
10
|
-
export interface ProgressProps {
|
|
12
|
+
export interface ProgressProps extends ElementProps {
|
|
11
13
|
/** How far along, 0 to 100. */
|
|
12
14
|
percent?: number;
|
|
13
15
|
/** Bar height. */
|
|
14
16
|
size?: ProgressSize;
|
|
15
|
-
/** The bar color: active (accent), success, warning or critical (danger). */
|
|
17
|
+
/** The bar color: active (accent), success, warning or critical (danger). With a label or showValue, a status also shows as an icon and a word. */
|
|
16
18
|
status?: ProgressStatus;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
+
/** What is in progress ("Uploading"): shown above the bar, and its name for screen readers. */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Keeps the label for screen readers only. */
|
|
22
|
+
hideLabel?: boolean;
|
|
23
|
+
/** Shows the percent (and the status, as an icon and a word) at the right, above the bar. */
|
|
24
|
+
showValue?: boolean;
|
|
25
|
+
/** What screen readers say for the value, instead of "40%" (e.g. "3 of 8 files"). */
|
|
26
|
+
valueText?: string;
|
|
19
27
|
}
|
|
20
28
|
|
|
21
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* A progress bar, the same markup as the React one: a progressbar with its
|
|
31
|
+
* label and value for screen readers, and the status as an icon and a word
|
|
32
|
+
* when it has a label or showValue. bar.update({ percent: 60 }) moves it.
|
|
33
|
+
*/
|
|
22
34
|
export default function Progress(props: ProgressProps = {}): NurvusElement<HTMLDivElement, ProgressProps> {
|
|
23
|
-
return updatable(({
|
|
24
|
-
className
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
return updatable(({
|
|
36
|
+
className, percent = 0, size = 'medium', status = 'active', label, hideLabel = false, showValue = false, valueText, ...rest
|
|
37
|
+
}: ProgressProps) => {
|
|
38
|
+
const value = clampPercent(percent);
|
|
39
|
+
const meaning = PROGRESS_STATUS[status] || PROGRESS_STATUS.active;
|
|
40
|
+
const head = (label && !hideLabel) || showValue;
|
|
41
|
+
return spawn<HTMLDivElement>({
|
|
42
|
+
className: classNames(className, 'progress', CONSTANT.CLASS_PREFIX),
|
|
43
|
+
'data-size': size,
|
|
44
|
+
'data-status': status,
|
|
45
|
+
role: 'progressbar',
|
|
46
|
+
'aria-label': label || 'Progress',
|
|
47
|
+
'aria-valuemin': 0,
|
|
48
|
+
'aria-valuemax': 100,
|
|
49
|
+
'aria-valuenow': value,
|
|
50
|
+
'aria-valuetext': valueText || progressValueText(value, status),
|
|
51
|
+
...rest,
|
|
52
|
+
children: [
|
|
53
|
+
head ? spawn({
|
|
54
|
+
className: 'progress-head',
|
|
55
|
+
children: [
|
|
56
|
+
label && !hideLabel ? spawn({ tag: 'span', className: 'progress-label', children: label }) : null,
|
|
57
|
+
showValue ? spawn({
|
|
58
|
+
tag: 'span',
|
|
59
|
+
className: 'progress-value',
|
|
60
|
+
children: [
|
|
61
|
+
meaning.icon ? Icon({ name: meaning.icon }) : null,
|
|
62
|
+
meaning.word ? spawn({ tag: 'span', className: 'progress-word', children: meaning.word }) : null,
|
|
63
|
+
spawn({ tag: 'span', children: `${value}%` }),
|
|
64
|
+
],
|
|
65
|
+
}) : null,
|
|
66
|
+
],
|
|
67
|
+
}) : null,
|
|
68
|
+
spawn({ className: 'progress-track', children: spawn({ className: 'bar', style: { width: `${value}%` } }) }),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
}, props);
|
|
29
72
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
import CONSTANT from '../constants';
|
|
3
|
+
import { Spacing } from '../spacing';
|
|
4
|
+
import { Responsive, responsiveData } from '../breakpoints';
|
|
5
|
+
import { spawn, Child, ElementProps } from './spawn';
|
|
6
|
+
import { updatable, NurvusElement } from './update';
|
|
7
|
+
import '../components/Stack/Stack.scss';
|
|
8
|
+
|
|
9
|
+
export type StackDirection = 'column' | 'row';
|
|
10
|
+
|
|
11
|
+
export interface StackProps extends ElementProps {
|
|
12
|
+
/** column (top to bottom, the default) or row. Can change with the width: { base: 'column', md: 'row' }. */
|
|
13
|
+
direction?: Responsive<StackDirection>;
|
|
14
|
+
/** Space between the children, from the 4px grid: 0, 2, 4, 8, 12, 16, 24, 32, 48 or 64. */
|
|
15
|
+
gap?: Spacing;
|
|
16
|
+
/** How the children line up across the stack. */
|
|
17
|
+
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
18
|
+
/** How the children spread along the stack. */
|
|
19
|
+
justify?: 'start' | 'center' | 'end' | 'between';
|
|
20
|
+
/** Lets a row wrap onto more lines when it runs out of room. */
|
|
21
|
+
wrap?: boolean;
|
|
22
|
+
/** What to lay out. */
|
|
23
|
+
children?: Child;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A column or a row with even space between the children, the same markup as the React Stack. */
|
|
27
|
+
export default function Stack(props: StackProps = {}): NurvusElement<HTMLDivElement, StackProps> {
|
|
28
|
+
return updatable(({ direction = 'column', gap = 16, align, justify, wrap = false, className, ...rest }: StackProps) => spawn<HTMLDivElement>({
|
|
29
|
+
className: classNames(className, 'stack', CONSTANT.CLASS_PREFIX),
|
|
30
|
+
...responsiveData('direction', direction),
|
|
31
|
+
'data-gap': gap,
|
|
32
|
+
'data-align': align,
|
|
33
|
+
'data-justify': justify,
|
|
34
|
+
'data-wrap': wrap || undefined,
|
|
35
|
+
...rest,
|
|
36
|
+
}), props);
|
|
37
|
+
}
|
package/src/respawn/index.ts
CHANGED
|
@@ -45,8 +45,16 @@ export { ICONS, ICON_NAMES } from '../icons';
|
|
|
45
45
|
export type { IconName, IconNode } from '../icons';
|
|
46
46
|
export { default as Tree } from './Tree';
|
|
47
47
|
export type { TreeProps, TreeItem } from './Tree';
|
|
48
|
+
export { default as Stack } from './Stack';
|
|
49
|
+
export type { StackProps, StackDirection } from './Stack';
|
|
50
|
+
export { default as Grid } from './Grid';
|
|
51
|
+
export type { GridProps, GridColumns } from './Grid';
|
|
52
|
+
export { BREAKPOINTS, isAtLeast } from '../breakpoints';
|
|
53
|
+
export type { Breakpoint, Responsive } from '../breakpoints';
|
|
54
|
+
export { default as Loader } from './Loader';
|
|
55
|
+
export type { LoaderProps } from './Loader';
|
|
48
56
|
export { default as Menu } from './Menu';
|
|
49
|
-
export type { MenuProps, MenuItem, MenuSection } from './Menu';
|
|
57
|
+
export type { MenuProps, MenuListProps, MenuTreeProps, MenuItem, MenuSection, MenuKind } from './Menu';
|
|
50
58
|
export { default as Select } from './Select';
|
|
51
59
|
export type { SelectProps, SelectOption, SelectOptionState } from './Select';
|
|
52
60
|
export { default as FullPageModal } from './FullPageModal';
|
package/src/styles/theme.scss
CHANGED
|
@@ -190,52 +190,52 @@
|
|
|
190
190
|
--pink-opacity--16: rgba(214, 1, 214, 0.1599999964237213);
|
|
191
191
|
--pink-opacity--8: rgba(214, 1, 214, 0.07999999821186066);
|
|
192
192
|
--pink-opacity--4: rgba(214, 1, 214, 0.03999999910593033);
|
|
193
|
-
--36--regular:
|
|
194
|
-
--36--semi-bold:
|
|
195
|
-
--36--bold:
|
|
196
|
-
--24--regular:
|
|
197
|
-
--24--medium:
|
|
198
|
-
--24--semi-bold:
|
|
199
|
-
--24--bold:
|
|
200
|
-
--16--regular:
|
|
201
|
-
--16--medium:
|
|
202
|
-
--16--semi-bold:
|
|
203
|
-
--16--bold:
|
|
204
|
-
--14--regular:
|
|
205
|
-
--14--medium:
|
|
206
|
-
--14--semibold:
|
|
207
|
-
--14--bold:
|
|
208
|
-
--13--regular:
|
|
209
|
-
--13--medium:
|
|
210
|
-
--13--semi-bold:
|
|
211
|
-
--13--bold:
|
|
212
|
-
--12--regular:
|
|
213
|
-
--12--medium:
|
|
214
|
-
--12--semi-bold:
|
|
215
|
-
--12--bold:
|
|
216
|
-
--11--regular:
|
|
217
|
-
--11--medium:
|
|
218
|
-
--11--semibold:
|
|
219
|
-
--11--bold:
|
|
220
|
-
--10--regular:
|
|
221
|
-
--10--medium:
|
|
222
|
-
--10--semibold:
|
|
223
|
-
--10--bold:
|
|
224
|
-
--32--medium:
|
|
225
|
-
--space--0:
|
|
226
|
-
--space--2:
|
|
227
|
-
--space--4:
|
|
228
|
-
--space--8:
|
|
229
|
-
--space--12:
|
|
230
|
-
--space--16:
|
|
231
|
-
--space--24:
|
|
232
|
-
--space--32:
|
|
233
|
-
--space--48:
|
|
234
|
-
--space--64:
|
|
235
|
-
--radius--2:
|
|
236
|
-
--radius--4:
|
|
237
|
-
--radius--8:
|
|
238
|
-
--radius--12:
|
|
193
|
+
--36--regular: 2.25rem;
|
|
194
|
+
--36--semi-bold: 2.25rem;
|
|
195
|
+
--36--bold: 2.25rem;
|
|
196
|
+
--24--regular: 1.5rem;
|
|
197
|
+
--24--medium: 1.5rem;
|
|
198
|
+
--24--semi-bold: 1.5rem;
|
|
199
|
+
--24--bold: 1.5rem;
|
|
200
|
+
--16--regular: 1rem;
|
|
201
|
+
--16--medium: 1rem;
|
|
202
|
+
--16--semi-bold: 1rem;
|
|
203
|
+
--16--bold: 1rem;
|
|
204
|
+
--14--regular: 0.875rem;
|
|
205
|
+
--14--medium: 0.875rem;
|
|
206
|
+
--14--semibold: 0.875rem;
|
|
207
|
+
--14--bold: 0.875rem;
|
|
208
|
+
--13--regular: 0.8125rem;
|
|
209
|
+
--13--medium: 0.8125rem;
|
|
210
|
+
--13--semi-bold: 0.8125rem;
|
|
211
|
+
--13--bold: 0.8125rem;
|
|
212
|
+
--12--regular: 0.75rem;
|
|
213
|
+
--12--medium: 0.75rem;
|
|
214
|
+
--12--semi-bold: 0.75rem;
|
|
215
|
+
--12--bold: 0.75rem;
|
|
216
|
+
--11--regular: 0.6875rem;
|
|
217
|
+
--11--medium: 0.6875rem;
|
|
218
|
+
--11--semibold: 0.6875rem;
|
|
219
|
+
--11--bold: 0.6875rem;
|
|
220
|
+
--10--regular: 0.625rem;
|
|
221
|
+
--10--medium: 0.625rem;
|
|
222
|
+
--10--semibold: 0.625rem;
|
|
223
|
+
--10--bold: 0.625rem;
|
|
224
|
+
--32--medium: 2rem;
|
|
225
|
+
--space--0: 0rem;
|
|
226
|
+
--space--2: 0.125rem;
|
|
227
|
+
--space--4: 0.25rem;
|
|
228
|
+
--space--8: 0.5rem;
|
|
229
|
+
--space--12: 0.75rem;
|
|
230
|
+
--space--16: 1rem;
|
|
231
|
+
--space--24: 1.5rem;
|
|
232
|
+
--space--32: 2rem;
|
|
233
|
+
--space--48: 3rem;
|
|
234
|
+
--space--64: 4rem;
|
|
235
|
+
--radius--2: 0.125rem;
|
|
236
|
+
--radius--4: 0.25rem;
|
|
237
|
+
--radius--8: 0.5rem;
|
|
238
|
+
--radius--12: 0.75rem;
|
|
239
239
|
--radius--full: 9999px;
|
|
240
240
|
--shadow---xs: 0px 1px 2px rgba(16, 24, 40, 0.04);
|
|
241
241
|
--shadow---sm: 0px 1px 3px rgba(16, 24, 40, 0.06);
|
|
@@ -249,24 +249,24 @@
|
|
|
249
249
|
:root {
|
|
250
250
|
--nv-font-sans: 'Inter Variable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
251
251
|
--nv-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
252
|
-
--nv-type-display-size: clamp(
|
|
252
|
+
--nv-type-display-size: clamp(1.875rem, 4vw, 2.75rem);
|
|
253
253
|
--nv-type-display-line: 1.08;
|
|
254
254
|
--nv-type-display-weight: 600;
|
|
255
255
|
--nv-type-display-tracking: -0.02em;
|
|
256
|
-
--nv-type-title-size:
|
|
257
|
-
--nv-type-title-line:
|
|
256
|
+
--nv-type-title-size: 1.375rem;
|
|
257
|
+
--nv-type-title-line: 1.75rem;
|
|
258
258
|
--nv-type-title-weight: 600;
|
|
259
259
|
--nv-type-title-tracking: -0.01em;
|
|
260
|
-
--nv-type-body-size:
|
|
261
|
-
--nv-type-body-line:
|
|
260
|
+
--nv-type-body-size: 1rem;
|
|
261
|
+
--nv-type-body-line: 1.5rem;
|
|
262
262
|
--nv-type-body-weight: 400;
|
|
263
263
|
--nv-type-body-tracking: 0;
|
|
264
|
-
--nv-type-caption-size:
|
|
265
|
-
--nv-type-caption-line:
|
|
264
|
+
--nv-type-caption-size: 0.875rem;
|
|
265
|
+
--nv-type-caption-line: 1.25rem;
|
|
266
266
|
--nv-type-caption-weight: 400;
|
|
267
267
|
--nv-type-caption-tracking: 0;
|
|
268
|
-
--nv-type-mono-size:
|
|
269
|
-
--nv-type-mono-line:
|
|
268
|
+
--nv-type-mono-size: 0.8125rem;
|
|
269
|
+
--nv-type-mono-line: 1.25rem;
|
|
270
270
|
--nv-type-mono-weight: 400;
|
|
271
271
|
--nv-type-mono-tracking: 0;
|
|
272
272
|
}
|
package/src/styles/type.json
CHANGED
|
@@ -5,36 +5,36 @@
|
|
|
5
5
|
},
|
|
6
6
|
"roles": {
|
|
7
7
|
"display": {
|
|
8
|
-
"size": "clamp(
|
|
8
|
+
"size": "clamp(1.875rem, 4vw, 2.75rem)",
|
|
9
9
|
"line": "1.08",
|
|
10
10
|
"weight": "600",
|
|
11
11
|
"tracking": "-0.02em",
|
|
12
12
|
"use": "The one big headline on a page."
|
|
13
13
|
},
|
|
14
14
|
"title": {
|
|
15
|
-
"size": "
|
|
16
|
-
"line": "
|
|
15
|
+
"size": "1.375rem",
|
|
16
|
+
"line": "1.75rem",
|
|
17
17
|
"weight": "600",
|
|
18
18
|
"tracking": "-0.01em",
|
|
19
19
|
"use": "Section headings and panel titles."
|
|
20
20
|
},
|
|
21
21
|
"body": {
|
|
22
|
-
"size": "
|
|
23
|
-
"line": "
|
|
22
|
+
"size": "1rem",
|
|
23
|
+
"line": "1.5rem",
|
|
24
24
|
"weight": "400",
|
|
25
25
|
"tracking": "0",
|
|
26
26
|
"use": "Running text."
|
|
27
27
|
},
|
|
28
28
|
"caption": {
|
|
29
|
-
"size": "
|
|
30
|
-
"line": "
|
|
29
|
+
"size": "0.875rem",
|
|
30
|
+
"line": "1.25rem",
|
|
31
31
|
"weight": "400",
|
|
32
32
|
"tracking": "0",
|
|
33
33
|
"use": "Labels, captions, table cells, notes."
|
|
34
34
|
},
|
|
35
35
|
"mono": {
|
|
36
|
-
"size": "
|
|
37
|
-
"line": "
|
|
36
|
+
"size": "0.8125rem",
|
|
37
|
+
"line": "1.25rem",
|
|
38
38
|
"weight": "400",
|
|
39
39
|
"tracking": "0",
|
|
40
40
|
"use": "Values: hex codes, tokens, numbers, code."
|