@nordmanai/nif 0.1.0 → 0.2.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/README.md +18 -0
- package/bin/nif.mjs +196 -0
- package/dist/index.d.ts +30 -1
- package/dist/index.js +9661 -2499
- package/dist/styles.css +1 -1
- package/dist/tokens.css +4 -1
- package/dist/ui/components/nm-ai/nm-ai.d.ts +7 -7
- package/dist/ui/components/nm-brand-logo/nm-brand-logo.d.ts +10 -0
- package/dist/ui/components/nm-breadcrumb/nm-breadcrumb.d.ts +11 -0
- package/dist/ui/components/nm-button/nm-button.d.ts +2 -0
- package/dist/ui/components/nm-button-group/nm-button-group.d.ts +17 -0
- package/dist/ui/components/nm-calendar/nm-calendar.d.ts +3 -0
- package/dist/ui/components/nm-card/nm-card.d.ts +34 -0
- package/dist/ui/components/nm-chip/nm-chip.d.ts +38 -0
- package/dist/ui/components/nm-code-block/nm-code-block.d.ts +55 -0
- package/dist/ui/components/nm-color-picker/nm-color-picker.d.ts +15 -0
- package/dist/ui/components/nm-combobox/nm-combobox.d.ts +26 -0
- package/dist/ui/components/nm-command/nm-command.d.ts +37 -0
- package/dist/ui/components/nm-composer/nm-composer.d.ts +4 -0
- package/dist/ui/components/nm-context-menu/nm-context-menu.d.ts +9 -0
- package/dist/ui/components/nm-date-picker/nm-date-picker.d.ts +35 -0
- package/dist/ui/components/nm-dialog/nm-dialog.d.ts +13 -0
- package/dist/ui/components/nm-field/nm-field.d.ts +2 -0
- package/dist/ui/components/nm-form-field/nm-form-field.d.ts +18 -0
- package/dist/ui/components/nm-gallery/nm-gallery.d.ts +8 -0
- package/dist/ui/components/nm-input/nm-input.d.ts +5 -0
- package/dist/ui/components/nm-input-group/nm-input-group.d.ts +9 -0
- package/dist/ui/components/nm-label/nm-label.d.ts +2 -0
- package/dist/ui/components/nm-menubar/nm-menubar.d.ts +9 -0
- package/dist/ui/components/nm-native-select/nm-native-select.d.ts +5 -0
- package/dist/ui/components/nm-panel/nm-panel.d.ts +14 -0
- package/dist/ui/components/nm-prose/nm-prose.d.ts +6 -0
- package/dist/ui/components/nm-resize-handle/nm-resize-handle.d.ts +18 -0
- package/dist/ui/components/nm-select/nm-select.d.ts +22 -0
- package/dist/ui/components/nm-side-panel/nm-side-panel.d.ts +33 -0
- package/dist/ui/components/nm-slider/nm-slider.d.ts +5 -1
- package/dist/ui/components/nm-status-bar/nm-status-bar.d.ts +8 -0
- package/dist/ui/components/nm-table/nm-table.d.ts +38 -0
- package/dist/ui/components/nm-textarea/nm-textarea.d.ts +2 -0
- package/dist/ui/components/nm-toolbar/nm-toolbar.d.ts +21 -0
- package/dist/ui/config/nm-ai.d.ts +0 -3
- package/dist/ui/config/nm-appearance.d.ts +36 -1
- package/dist/ui/config/nm-button.d.ts +2 -1
- package/dist/ui/config/nm-composer.d.ts +1 -2
- package/dist/ui/config/nm-field.d.ts +2 -0
- package/dist/ui/config/nm-icons.d.ts +13 -1
- package/dist/ui/config/nm-radius.d.ts +4 -4
- package/dist/ui/config/nm-side-panel.d.ts +33 -0
- package/dist/ui/lib/appearance/appearanceState.d.ts +1 -0
- package/dist/ui/lib/appearance/deriveTokens.d.ts +2 -0
- package/package.json +12 -4
- package/registry/index.json +1634 -0
- package/registry/tokens.css +72 -0
- package/registry/ui/components/nm-ai/nm-ai.css +358 -0
- package/registry/ui/components/nm-ai/nm-ai.tsx +632 -0
- package/registry/ui/components/nm-app-panel/nm-app-panel.css +169 -0
- package/registry/ui/components/nm-ask/nm-ask.css +277 -0
- package/registry/ui/components/nm-avatar/nm-avatar.css +85 -0
- package/registry/ui/components/nm-avatar/nm-avatar.tsx +30 -0
- package/registry/ui/components/nm-bar-overflow/nm-bar-overflow.css +43 -0
- package/registry/ui/components/nm-bar-overflow/nm-bar-overflow.tsx +61 -0
- package/registry/ui/components/nm-bar-overflow/use-bar-overflow.ts +92 -0
- package/registry/ui/components/nm-brand-logo/nm-brand-logo.css +20 -0
- package/registry/ui/components/nm-brand-logo/nm-brand-logo.tsx +21 -0
- package/registry/ui/components/nm-breadcrumb/nm-breadcrumb.css +57 -0
- package/registry/ui/components/nm-breadcrumb/nm-breadcrumb.tsx +42 -0
- package/registry/ui/components/nm-button/nm-button.css +110 -0
- package/registry/ui/components/nm-button/nm-button.tsx +58 -0
- package/registry/ui/components/nm-button-group/nm-button-group.css +87 -0
- package/registry/ui/components/nm-button-group/nm-button-group.tsx +32 -0
- package/registry/ui/components/nm-calendar/nm-calendar.css +178 -0
- package/registry/ui/components/nm-calendar/nm-calendar.tsx +43 -0
- package/registry/ui/components/nm-card/nm-card.css +130 -0
- package/registry/ui/components/nm-card/nm-card.tsx +83 -0
- package/registry/ui/components/nm-chatbox/nm-chatbox-icon.tsx +39 -0
- package/registry/ui/components/nm-chatbox/nm-chatbox.css +682 -0
- package/registry/ui/components/nm-chatbox/nm-chatbox.tsx +101 -0
- package/registry/ui/components/nm-checkbox/nm-checkbox.css +61 -0
- package/registry/ui/components/nm-checkbox/nm-checkbox.tsx +14 -0
- package/registry/ui/components/nm-chip/nm-chip.css +112 -0
- package/registry/ui/components/nm-chip/nm-chip.tsx +86 -0
- package/registry/ui/components/nm-code-block/nm-code-block.css +240 -0
- package/registry/ui/components/nm-code-block/nm-code-block.tsx +196 -0
- package/registry/ui/components/nm-collection/nm-collection-bar.tsx +65 -0
- package/registry/ui/components/nm-collection/nm-collection-grid.tsx +69 -0
- package/registry/ui/components/nm-collection/nm-collection-query.tsx +99 -0
- package/registry/ui/components/nm-collection/nm-collection-row-menu.tsx +55 -0
- package/registry/ui/components/nm-collection/nm-collection-table.tsx +99 -0
- package/registry/ui/components/nm-collection/nm-collection-tile-actions.tsx +50 -0
- package/registry/ui/components/nm-collection/nm-collection-title.tsx +25 -0
- package/registry/ui/components/nm-collection/nm-collection.css +353 -0
- package/registry/ui/components/nm-collection/use-collection-scroll-reveal.ts +38 -0
- package/registry/ui/components/nm-color-picker/nm-color-picker.css +67 -0
- package/registry/ui/components/nm-color-picker/nm-color-picker.tsx +79 -0
- package/registry/ui/components/nm-combobox/nm-combobox.css +72 -0
- package/registry/ui/components/nm-combobox/nm-combobox.tsx +80 -0
- package/registry/ui/components/nm-command/nm-command.css +190 -0
- package/registry/ui/components/nm-command/nm-command.tsx +125 -0
- package/registry/ui/components/nm-composer/nm-composer.css +178 -0
- package/registry/ui/components/nm-composer/nm-composer.tsx +151 -0
- package/registry/ui/components/nm-context-menu/nm-context-menu.tsx +25 -0
- package/registry/ui/components/nm-date-picker/nm-date-picker.css +140 -0
- package/registry/ui/components/nm-date-picker/nm-date-picker.tsx +153 -0
- package/registry/ui/components/nm-dialog/nm-dialog.css +84 -0
- package/registry/ui/components/nm-dialog/nm-dialog.tsx +40 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown-item.ts +68 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown-options.tsx +242 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown-panel.tsx +171 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown-placement.ts +157 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown.css +312 -0
- package/registry/ui/components/nm-dropdown/nm-dropdown.tsx +412 -0
- package/registry/ui/components/nm-dropdown-menu/nm-dropdown-menu.css +145 -0
- package/registry/ui/components/nm-dropdown-menu/nm-dropdown-menu.tsx +118 -0
- package/registry/ui/components/nm-field/nm-field.css +356 -0
- package/registry/ui/components/nm-field/nm-field.tsx +355 -0
- package/registry/ui/components/nm-form-field/nm-form-field.css +103 -0
- package/registry/ui/components/nm-form-field/nm-form-field.tsx +71 -0
- package/registry/ui/components/nm-gallery/nm-gallery.css +66 -0
- package/registry/ui/components/nm-gallery/nm-gallery.tsx +31 -0
- package/registry/ui/components/nm-hover-card/nm-hover-card.css +26 -0
- package/registry/ui/components/nm-hover-card/nm-hover-card.tsx +28 -0
- package/registry/ui/components/nm-icon/nm-icon.css +6 -0
- package/registry/ui/components/nm-icon/nm-icon.tsx +69 -0
- package/registry/ui/components/nm-icon/nm-lucide.tsx +180 -0
- package/registry/ui/components/nm-icon-border/nm-icon-border.tsx +56 -0
- package/registry/ui/components/nm-input/nm-input.css +75 -0
- package/registry/ui/components/nm-input/nm-input.tsx +7 -0
- package/registry/ui/components/nm-input-group/nm-input-group.css +66 -0
- package/registry/ui/components/nm-input-group/nm-input-group.tsx +20 -0
- package/registry/ui/components/nm-label/nm-label.css +11 -0
- package/registry/ui/components/nm-label/nm-label.tsx +6 -0
- package/registry/ui/components/nm-list-item/nm-list-item.css +177 -0
- package/registry/ui/components/nm-list-item/nm-list-item.tsx +112 -0
- package/registry/ui/components/nm-menubar/nm-menubar.css +32 -0
- package/registry/ui/components/nm-menubar/nm-menubar.tsx +19 -0
- package/registry/ui/components/nm-message/nm-message-actions.tsx +24 -0
- package/registry/ui/components/nm-message/nm-message-meta.tsx +49 -0
- package/registry/ui/components/nm-message/nm-message.css +686 -0
- package/registry/ui/components/nm-message/nm-text-shimmer.tsx +6 -0
- package/registry/ui/components/nm-message/nm-trace.tsx +219 -0
- package/registry/ui/components/nm-modal/nm-modal.css +763 -0
- package/registry/ui/components/nm-modal/nm-modal.tsx +497 -0
- package/registry/ui/components/nm-native-select/nm-native-select.css +47 -0
- package/registry/ui/components/nm-native-select/nm-native-select.tsx +23 -0
- package/registry/ui/components/nm-panel/nm-panel.css +73 -0
- package/registry/ui/components/nm-panel/nm-panel.tsx +35 -0
- package/registry/ui/components/nm-panel-bar/nm-panel-bar.css +20 -0
- package/registry/ui/components/nm-panel-bar/nm-panel-bar.tsx +48 -0
- package/registry/ui/components/nm-popover/nm-popover.css +43 -0
- package/registry/ui/components/nm-popover/nm-popover.tsx +40 -0
- package/registry/ui/components/nm-progress/nm-progress.css +21 -0
- package/registry/ui/components/nm-progress/nm-progress.tsx +14 -0
- package/registry/ui/components/nm-prose/nm-prose.css +81 -0
- package/registry/ui/components/nm-prose/nm-prose.tsx +10 -0
- package/registry/ui/components/nm-questionnaire/nm-questionnaire.css +182 -0
- package/registry/ui/components/nm-questionnaire/nm-questionnaire.tsx +221 -0
- package/registry/ui/components/nm-radio-group/nm-radio-group.css +48 -0
- package/registry/ui/components/nm-radio-group/nm-radio-group.tsx +15 -0
- package/registry/ui/components/nm-rail-icon/nm-rail-icon.css +6 -0
- package/registry/ui/components/nm-rail-icon/nm-rail-icon.tsx +28 -0
- package/registry/ui/components/nm-resize-handle/nm-resize-handle.css +45 -0
- package/registry/ui/components/nm-resize-handle/nm-resize-handle.tsx +102 -0
- package/registry/ui/components/nm-segmented/nm-segmented.css +104 -0
- package/registry/ui/components/nm-segmented/nm-segmented.tsx +77 -0
- package/registry/ui/components/nm-select/nm-select.css +78 -0
- package/registry/ui/components/nm-select/nm-select.tsx +64 -0
- package/registry/ui/components/nm-separator/nm-separator.css +14 -0
- package/registry/ui/components/nm-separator/nm-separator.tsx +6 -0
- package/registry/ui/components/nm-side-panel/nm-side-panel.css +93 -0
- package/registry/ui/components/nm-side-panel/nm-side-panel.tsx +86 -0
- package/registry/ui/components/nm-slider/nm-slider.css +53 -0
- package/registry/ui/components/nm-slider/nm-slider.tsx +40 -0
- package/registry/ui/components/nm-small-icon-button/nm-small-icon-button.tsx +66 -0
- package/registry/ui/components/nm-status-bar/nm-status-bar.css +50 -0
- package/registry/ui/components/nm-status-bar/nm-status-bar.tsx +28 -0
- package/registry/ui/components/nm-switch/nm-switch.css +45 -0
- package/registry/ui/components/nm-switch/nm-switch.tsx +10 -0
- package/registry/ui/components/nm-table/nm-table.css +155 -0
- package/registry/ui/components/nm-table/nm-table.tsx +95 -0
- package/registry/ui/components/nm-tabs/nm-tabs.css +28 -0
- package/registry/ui/components/nm-tabs/nm-tabs.tsx +32 -0
- package/registry/ui/components/nm-textarea/nm-textarea.css +41 -0
- package/registry/ui/components/nm-textarea/nm-textarea.tsx +6 -0
- package/registry/ui/components/nm-toggle/nm-toggle.css +55 -0
- package/registry/ui/components/nm-toggle/nm-toggle.tsx +16 -0
- package/registry/ui/components/nm-toolbar/nm-toolbar.css +42 -0
- package/registry/ui/components/nm-toolbar/nm-toolbar.tsx +54 -0
- package/registry/ui/components/nm-tooltip/nm-tooltip.css +37 -0
- package/registry/ui/components/nm-tooltip/nm-tooltip.tsx +35 -0
- package/registry/ui/components/nm-top-bar/nm-top-bar.css +29 -0
- package/registry/ui/components/nm-top-bar/nm-top-bar.tsx +34 -0
- package/registry/ui/components/nordman-icon-button/nordman-icon-button.css +119 -0
- package/registry/ui/components/nordman-icon-button/nordman-icon-button.tsx +185 -0
- package/registry/ui/components/nordman-login/nordman-login.css +195 -0
- package/registry/ui/components/nordman-login/nordman-login.tsx +136 -0
- package/registry/ui/components/nordman-login-field/nordman-login-field.tsx +55 -0
- package/registry/ui/components/nordman-login-forgot/nordman-login-forgot.tsx +56 -0
- package/registry/ui/components/nordman-login-google/nordman-login-google.tsx +28 -0
- package/registry/ui/components/nordman-login-hero/nordman-login-hero.tsx +38 -0
- package/registry/ui/components/nordman-login-register/nordman-login-register.tsx +70 -0
- package/registry/ui/components/nordman-login-reset/nordman-login-reset.tsx +71 -0
- package/registry/ui/components/nordman-login-reveal/nordman-login-reveal.tsx +41 -0
- package/registry/ui/components/nordman-login-sign-in/nordman-login-sign-in.tsx +69 -0
- package/registry/ui/components/nordman-toggle/nordman-toggle.css +28 -0
- package/registry/ui/components/nordman-toggle/nordman-toggle.tsx +35 -0
- package/registry/ui/config/nm-ai.ts +59 -0
- package/registry/ui/config/nm-appearance.ts +275 -0
- package/registry/ui/config/nm-bar-overflow.ts +10 -0
- package/registry/ui/config/nm-button.ts +38 -0
- package/registry/ui/config/nm-chatbox-icons.ts +67 -0
- package/registry/ui/config/nm-chatbox.ts +42 -0
- package/registry/ui/config/nm-collection.ts +101 -0
- package/registry/ui/config/nm-composer.ts +39 -0
- package/registry/ui/config/nm-dropdown.ts +62 -0
- package/registry/ui/config/nm-field.ts +43 -0
- package/registry/ui/config/nm-icon-button.ts +35 -0
- package/registry/ui/config/nm-icons.ts +417 -0
- package/registry/ui/config/nm-list-item.ts +14 -0
- package/registry/ui/config/nm-message.ts +106 -0
- package/registry/ui/config/nm-modal.ts +76 -0
- package/registry/ui/config/nm-panel-bar.ts +11 -0
- package/registry/ui/config/nm-questionnaire.ts +53 -0
- package/registry/ui/config/nm-radius.ts +56 -0
- package/registry/ui/config/nm-rail-icons.ts +27 -0
- package/registry/ui/config/nm-segmented.ts +19 -0
- package/registry/ui/config/nm-side-panel.ts +16 -0
- package/registry/ui/config/nm-site-palette.ts +30 -0
- package/registry/ui/config/nm-small-icon-button.ts +17 -0
- package/registry/ui/config/nm-tabs.ts +9 -0
- package/registry/ui/config/nm-top-bar.ts +4 -0
- package/registry/ui/config/nordman-chrome.ts +14 -0
- package/registry/ui/config/nordman-login.ts +28 -0
- package/registry/ui/content/nm-modal.ts +5 -0
- package/registry/ui/content/nordman-login.ts +85 -0
- package/registry/ui/kit-logger.ts +1 -0
- package/registry/ui/lib/appearance/appearanceState.ts +240 -0
- package/registry/ui/lib/appearance/applyAppearance.ts +36 -0
- package/registry/ui/lib/appearance/cloudOrbAppearance.ts +36 -0
- package/registry/ui/lib/appearance/color.ts +96 -0
- package/registry/ui/lib/appearance/deriveTokens.ts +218 -0
- package/registry/ui/lib/appearance/index.ts +6 -0
- package/registry/ui/lib/appearance/markTokens.ts +49 -0
- package/registry/ui/lib/appearance/readLayoutMetrics.ts +28 -0
- package/registry/ui/lib/bar-overflow.ts +41 -0
- package/registry/ui/lib/logger.ts +53 -0
- package/registry/ui/lib/menu-motion.ts +187 -0
- package/registry/ui/lib/nm-class.ts +4 -0
- package/registry/ui/lib/nordman-ui-locale.ts +43 -0
- package/registry/ui/styles/interface-theme.css +196 -0
- package/registry/ui/styles/light-appearance.css +72 -0
- package/registry/ui/styles/tokens.css +424 -0
- package/registry/ui/styles/utilities.css +12 -0
- package/dist/ui/components/nm-accordion/nm-accordion.d.ts +0 -6
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
.nm-app-panel,
|
|
2
|
+
.nm-logs-panel {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: 100%;
|
|
6
|
+
background: var(--nm-canvas);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.nm-app-panel__body,
|
|
10
|
+
.nm-logs-panel__body {
|
|
11
|
+
position: relative;
|
|
12
|
+
flex: 1;
|
|
13
|
+
min-height: 0;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
background: var(--nm-canvas);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nm-app-panel__canvas {
|
|
19
|
+
position: relative;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
background: var(--nm-canvas);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nm-app-panel__loader {
|
|
27
|
+
position: absolute;
|
|
28
|
+
inset: 0;
|
|
29
|
+
display: grid;
|
|
30
|
+
place-items: center;
|
|
31
|
+
pointer-events: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nm-app-panel__loader .nm-mark-morph,
|
|
35
|
+
.nm-app-panel__loader .nm-mark-morph__svg,
|
|
36
|
+
.nm-app-panel__publish .nm-mark-morph,
|
|
37
|
+
.nm-app-panel__publish .nm-mark-morph__svg {
|
|
38
|
+
width: calc(var(--nm-space-40) * 2);
|
|
39
|
+
height: calc(var(--nm-space-40) * 2);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.nm-app-panel__publish {
|
|
43
|
+
position: absolute;
|
|
44
|
+
inset: 0;
|
|
45
|
+
z-index: 2;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
gap: var(--nm-space-16);
|
|
51
|
+
background: color-mix(in srgb, var(--nm-canvas) 78%, transparent);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nm-app-panel__publish-status {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
gap: var(--nm-space-8);
|
|
58
|
+
color: var(--nm-fg);
|
|
59
|
+
font-family: var(--nm-font);
|
|
60
|
+
font-size: var(--nm-type-body);
|
|
61
|
+
line-height: normal;
|
|
62
|
+
white-space: nowrap;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.nm-app-panel__publish-status .nm-mark-morph,
|
|
66
|
+
.nm-app-panel__publish-status .nm-mark-morph__svg {
|
|
67
|
+
width: var(--nm-space-16);
|
|
68
|
+
height: var(--nm-space-16);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.nm-app-panel__publish-label {
|
|
72
|
+
margin: 0;
|
|
73
|
+
color: var(--nm-fg);
|
|
74
|
+
font-family: var(--nm-font);
|
|
75
|
+
font-size: var(--nm-type-body);
|
|
76
|
+
font-weight: var(--nm-weight-regular);
|
|
77
|
+
line-height: normal;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.nm-app-panel__progress-wrap {
|
|
81
|
+
position: absolute;
|
|
82
|
+
left: 50%;
|
|
83
|
+
bottom: var(--nm-space-24);
|
|
84
|
+
transform: translateX(-50%);
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: var(--nm-space-8);
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
z-index: 2;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nm-app-panel__progress-label {
|
|
94
|
+
margin: 0;
|
|
95
|
+
color: var(--nm-fg-muted);
|
|
96
|
+
font-family: var(--nm-font);
|
|
97
|
+
font-size: var(--nm-type-caption);
|
|
98
|
+
font-weight: var(--nm-weight-regular);
|
|
99
|
+
line-height: var(--nm-leading-snug);
|
|
100
|
+
white-space: nowrap;
|
|
101
|
+
text-align: center;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.nm-app-panel__progress {
|
|
105
|
+
width: calc(var(--nm-space-40) * 5);
|
|
106
|
+
height: var(--nm-space-8);
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
border-radius: var(--nm-radius-md);
|
|
109
|
+
background: var(--nm-line);
|
|
110
|
+
pointer-events: none;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.nm-app-panel__progress-fill {
|
|
114
|
+
height: 100%;
|
|
115
|
+
background: var(--nm-stroke);
|
|
116
|
+
border-radius: var(--nm-radius-md) 0 0 var(--nm-radius-md);
|
|
117
|
+
transition: width 240ms var(--ease);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.nm-app-panel__progress-fill[data-stage='waiting'] {
|
|
121
|
+
width: 8%;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.nm-app-panel__progress-fill[data-stage='mounting'] {
|
|
125
|
+
width: 20%;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nm-app-panel__progress-fill[data-stage='booting'] {
|
|
129
|
+
width: 36%;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.nm-app-panel__progress-fill[data-stage='installing'] {
|
|
133
|
+
width: 55%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.nm-app-panel__progress-fill[data-stage='starting'] {
|
|
137
|
+
width: 80%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.nm-app-panel__progress-fill[data-stage='ready'] {
|
|
141
|
+
width: 100%;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nm-app-panel__blocked {
|
|
145
|
+
position: absolute;
|
|
146
|
+
inset: 0;
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
align-items: flex-start;
|
|
150
|
+
justify-content: center;
|
|
151
|
+
gap: var(--nm-space-8);
|
|
152
|
+
padding: var(--nm-space-24);
|
|
153
|
+
background: var(--nm-canvas);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.nm-app-panel__blocked-title,
|
|
157
|
+
.nm-app-panel__blocked-body {
|
|
158
|
+
font-family: var(--nm-font);
|
|
159
|
+
font-size: var(--nm-type-body);
|
|
160
|
+
font-weight: var(--nm-weight-regular);
|
|
161
|
+
line-height: normal;
|
|
162
|
+
color: var(--nm-fg);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.nm-app-panel__blocked-body {
|
|
166
|
+
color: var(--nm-stroke);
|
|
167
|
+
word-break: break-word;
|
|
168
|
+
}
|
|
169
|
+
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/* Same surface as the connect card: raised, borderless, part of the chat. */
|
|
2
|
+
.nm-ask {
|
|
3
|
+
--nm-ask-radius: var(--nm-radius-lg);
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--nm-space-12);
|
|
7
|
+
min-height: 0;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
padding: var(--nm-space-16);
|
|
10
|
+
border: 0;
|
|
11
|
+
border-radius: var(--nm-ask-radius);
|
|
12
|
+
background: var(--nm-raised);
|
|
13
|
+
color: var(--nm-fg);
|
|
14
|
+
font-family: var(--nm-font);
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nm-ask__content {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: var(--nm-space-12);
|
|
22
|
+
min-height: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.nm-ask__bar,
|
|
26
|
+
.nm-ask__footer {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
gap: var(--nm-space-8);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nm-ask__footer[data-end='true'] {
|
|
35
|
+
justify-content: flex-end;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.nm-ask__actions {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: var(--nm-space-8);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.nm-ask__title {
|
|
45
|
+
margin: 0;
|
|
46
|
+
font-size: var(--nm-type-ui);
|
|
47
|
+
font-weight: var(--nm-weight-medium);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nm-ask__body {
|
|
51
|
+
min-height: 0;
|
|
52
|
+
flex: 1;
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nm-ask__step {
|
|
57
|
+
min-width: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
padding: 0;
|
|
60
|
+
border: 0;
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.nm-ask__step[data-stepped='true'] {
|
|
65
|
+
min-height: 10rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nm-ask__legend,
|
|
69
|
+
.nm-ask__hint {
|
|
70
|
+
padding: 0;
|
|
71
|
+
color: var(--nm-fg-muted);
|
|
72
|
+
font-size: var(--nm-type-ui-sm);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.nm-ask__legend {
|
|
76
|
+
margin-bottom: var(--nm-space-4);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.nm-ask__question,
|
|
80
|
+
.nm-ask__description {
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-size: var(--nm-type-ui);
|
|
83
|
+
overflow-wrap: anywhere;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.nm-ask__question {
|
|
87
|
+
font-weight: var(--nm-weight-medium);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.nm-ask__description {
|
|
91
|
+
margin-top: var(--nm-space-4);
|
|
92
|
+
color: var(--nm-fg-muted);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nm-ask__choices {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-wrap: wrap;
|
|
98
|
+
gap: var(--nm-space-8);
|
|
99
|
+
margin-top: var(--nm-space-8);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.nm-ask__choice,
|
|
103
|
+
.nm-ask__option {
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
border: 0;
|
|
106
|
+
background: var(--nm-panel);
|
|
107
|
+
color: var(--nm-fg);
|
|
108
|
+
font-family: var(--nm-font);
|
|
109
|
+
font-size: var(--nm-type-ui);
|
|
110
|
+
text-align: left;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
transition:
|
|
113
|
+
background 0.15s,
|
|
114
|
+
opacity 0.15s;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.nm-ask__choice {
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: var(--nm-space-6);
|
|
121
|
+
max-width: 100%;
|
|
122
|
+
min-height: var(--control-h-sm);
|
|
123
|
+
padding: var(--nm-space-6) var(--nm-space-10);
|
|
124
|
+
border-radius: var(--nm-control-r);
|
|
125
|
+
overflow-wrap: anywhere;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.nm-ask__option {
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
gap: var(--nm-space-10);
|
|
132
|
+
width: 100%;
|
|
133
|
+
padding: var(--nm-space-8) var(--nm-space-10);
|
|
134
|
+
background: transparent;
|
|
135
|
+
border-radius: var(--nm-radius-md);
|
|
136
|
+
overflow-wrap: anywhere;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nm-ask__choice:hover:not(:disabled) {
|
|
140
|
+
opacity: var(--btn-hover);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.nm-ask__option:hover:not(:disabled),
|
|
144
|
+
.nm-ask__option[data-active='true'] {
|
|
145
|
+
background: var(--nm-panel);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.nm-ask__choice[aria-checked='true'],
|
|
149
|
+
.nm-ask__choice[aria-pressed='true'] {
|
|
150
|
+
background: var(--nm-fg);
|
|
151
|
+
color: var(--nm-canvas);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.nm-ask__badge {
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
align-items: center;
|
|
158
|
+
justify-content: center;
|
|
159
|
+
width: var(--nm-space-24);
|
|
160
|
+
height: var(--nm-space-24);
|
|
161
|
+
border-radius: var(--nm-radius-sm);
|
|
162
|
+
background: var(--nm-panel);
|
|
163
|
+
color: var(--nm-fg-muted);
|
|
164
|
+
font-size: var(--nm-type-ui-sm);
|
|
165
|
+
font-variant-numeric: tabular-nums;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.nm-ask__option[aria-checked='true'] .nm-ask__badge {
|
|
169
|
+
background: var(--nm-fg);
|
|
170
|
+
color: var(--nm-canvas);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.nm-ask__input {
|
|
174
|
+
display: block;
|
|
175
|
+
box-sizing: border-box;
|
|
176
|
+
width: 100%;
|
|
177
|
+
margin-top: var(--nm-space-8);
|
|
178
|
+
padding: var(--nm-space-8) var(--nm-space-10);
|
|
179
|
+
border: 0;
|
|
180
|
+
border-radius: var(--nm-radius-md);
|
|
181
|
+
background: var(--nm-panel);
|
|
182
|
+
color: var(--nm-fg);
|
|
183
|
+
font-family: var(--nm-font);
|
|
184
|
+
font-size: var(--nm-type-ui);
|
|
185
|
+
resize: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* The caret is the focus indicator, as in the chatbox. */
|
|
189
|
+
.nm-ask__input:is(:focus, :focus-visible),
|
|
190
|
+
html[data-input-modality='keyboard'] .nm-ask__input:is(:focus, :focus-visible) {
|
|
191
|
+
outline: none !important;
|
|
192
|
+
outline-offset: 0 !important;
|
|
193
|
+
box-shadow: none !important;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.nm-ask__input::placeholder {
|
|
197
|
+
color: var(--nm-fg-subtle);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.nm-ask__error {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
gap: var(--nm-space-6);
|
|
204
|
+
color: rgb(var(--nm-destructive-rgb));
|
|
205
|
+
font-size: var(--nm-type-ui-sm);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.nm-ask__hint {
|
|
209
|
+
border: 0;
|
|
210
|
+
background: transparent;
|
|
211
|
+
font-family: var(--nm-font);
|
|
212
|
+
cursor: text;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.nm-ask__hint:hover {
|
|
216
|
+
color: var(--nm-fg);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.nm-ask__remaining {
|
|
220
|
+
padding: 0;
|
|
221
|
+
border: 0;
|
|
222
|
+
background: transparent;
|
|
223
|
+
color: var(--nm-fg-muted);
|
|
224
|
+
font-family: var(--nm-font);
|
|
225
|
+
font-size: var(--nm-type-ui-sm);
|
|
226
|
+
text-align: left;
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.nm-ask__dots {
|
|
231
|
+
display: flex;
|
|
232
|
+
flex-wrap: wrap;
|
|
233
|
+
align-items: center;
|
|
234
|
+
justify-content: flex-end;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.nm-ask__dot {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
justify-content: center;
|
|
241
|
+
height: var(--nm-space-24);
|
|
242
|
+
padding: 0 var(--nm-space-4);
|
|
243
|
+
border: 0;
|
|
244
|
+
background: transparent;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.nm-ask__dot::after {
|
|
249
|
+
content: '';
|
|
250
|
+
width: var(--nm-space-8);
|
|
251
|
+
height: var(--nm-space-8);
|
|
252
|
+
border-radius: var(--nm-radius-sm);
|
|
253
|
+
background: var(--nm-line-strong);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.nm-ask__dot[data-answered='true']::after {
|
|
257
|
+
background: var(--nm-fg);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.nm-ask__dot[aria-current='step']::after {
|
|
261
|
+
width: var(--nm-space-16);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.nm-ask__choice:focus-visible,
|
|
265
|
+
.nm-ask__option:focus-visible,
|
|
266
|
+
.nm-ask__dot:focus-visible,
|
|
267
|
+
.nm-ask__hint:focus-visible,
|
|
268
|
+
.nm-ask__remaining:focus-visible {
|
|
269
|
+
outline: 2px solid var(--focus);
|
|
270
|
+
outline-offset: 2px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.nm-ask__choice:disabled,
|
|
274
|
+
.nm-ask__option:disabled {
|
|
275
|
+
opacity: var(--nm-soon-opacity);
|
|
276
|
+
cursor: default;
|
|
277
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
.nm-avatar {
|
|
2
|
+
--nm-avatar-size: var(--nm-icon-control);
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
width: var(--nm-avatar-size);
|
|
9
|
+
height: var(--nm-avatar-size);
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
background: var(--nm-panel);
|
|
12
|
+
color: var(--nm-fg-muted);
|
|
13
|
+
font-family: var(--nm-font);
|
|
14
|
+
font-size: var(--nm-type-ui-sm);
|
|
15
|
+
font-weight: var(--nm-weight-medium);
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.nm-avatar[data-size='sm'] {
|
|
20
|
+
--nm-avatar-size: var(--control-h-sm);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.nm-avatar[data-size='lg'] {
|
|
24
|
+
--nm-avatar-size: var(--control-h-lg);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nm-avatar__image {
|
|
28
|
+
width: 100%;
|
|
29
|
+
height: 100%;
|
|
30
|
+
border-radius: inherit;
|
|
31
|
+
object-fit: cover;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.nm-avatar__fallback {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
width: 100%;
|
|
39
|
+
height: 100%;
|
|
40
|
+
border-radius: inherit;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.nm-avatar__badge {
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: 0;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
width: var(--nm-space-8);
|
|
48
|
+
height: var(--nm-space-8);
|
|
49
|
+
border: var(--nm-space-2) solid var(--nm-canvas);
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
background: var(--ok);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nm-avatar-group {
|
|
55
|
+
--nm-avatar-size: var(--nm-icon-control);
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nm-avatar-group > .nm-avatar,
|
|
61
|
+
.nm-avatar-group > .nm-avatar-group__count {
|
|
62
|
+
box-shadow: 0 0 0 var(--nm-space-2) var(--nm-canvas);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.nm-avatar-group > :not(:first-child) {
|
|
66
|
+
margin-left: calc(var(--nm-space-8) * -1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* The count is an avatar with a number in it. */
|
|
70
|
+
.nm-avatar-group__count {
|
|
71
|
+
position: relative;
|
|
72
|
+
display: inline-flex;
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
width: var(--nm-avatar-size);
|
|
78
|
+
height: var(--nm-avatar-size);
|
|
79
|
+
border-radius: 50%;
|
|
80
|
+
background: var(--nm-panel);
|
|
81
|
+
color: var(--nm-fg-muted);
|
|
82
|
+
font-family: var(--nm-font);
|
|
83
|
+
font-size: var(--nm-type-ui-sm);
|
|
84
|
+
font-weight: var(--nm-weight-medium);
|
|
85
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
3
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
4
|
+
|
|
5
|
+
export const NM_AVATAR_SIZES = ['sm', 'default', 'lg'] as const;
|
|
6
|
+
export type NmAvatarSize = (typeof NM_AVATAR_SIZES)[number];
|
|
7
|
+
|
|
8
|
+
export function NmAvatar({ className, size = 'default', ...props }: AvatarPrimitive.Root.Props & { size?: NmAvatarSize }) {
|
|
9
|
+
return <AvatarPrimitive.Root data-slot="avatar" data-size={size} className={nmClass('nm-avatar', className as string)} {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function NmAvatarImage({ className, ...props }: AvatarPrimitive.Image.Props) {
|
|
13
|
+
return <AvatarPrimitive.Image data-slot="avatar-image" className={nmClass('nm-avatar__image', className as string)} {...props} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function NmAvatarFallback({ className, ...props }: AvatarPrimitive.Fallback.Props) {
|
|
17
|
+
return <AvatarPrimitive.Fallback data-slot="avatar-fallback" className={nmClass('nm-avatar__fallback', className as string)} {...props} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function NmAvatarBadge({ className, ...props }: ComponentProps<'span'>) {
|
|
21
|
+
return <span data-slot="avatar-badge" className={nmClass('nm-avatar__badge', className)} {...props} />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function NmAvatarGroup({ className, ...props }: ComponentProps<'div'>) {
|
|
25
|
+
return <div data-slot="avatar-group" className={nmClass('nm-avatar-group', className)} {...props} />;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function NmAvatarGroupCount({ className, ...props }: ComponentProps<'div'>) {
|
|
29
|
+
return <div data-slot="avatar-group-count" className={nmClass('nm-avatar-group__count', className)} {...props} />;
|
|
30
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.nm-bar-overflow {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
min-width: 0;
|
|
5
|
+
flex: 1 1 auto;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: var(--nm-space-8);
|
|
8
|
+
overflow: visible;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.nm-bar-overflow[data-mode='menu'] {
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.nm-bar-overflow__row {
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
min-width: max-content;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.nm-bar-overflow__start {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: var(--nm-space-8);
|
|
27
|
+
min-width: max-content;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nm-bar-overflow[data-mode='menu'] .nm-bar-overflow__row {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
inset-inline-start: 0;
|
|
34
|
+
width: max-content;
|
|
35
|
+
visibility: hidden;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (max-width: 48rem) {
|
|
40
|
+
.nm-bar-overflow[data-hidden-narrow='true'] {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useRef, type ReactNode } from 'react';
|
|
2
|
+
import type { NmDropdownItem } from '../nm-dropdown/nm-dropdown-item';
|
|
3
|
+
import type { NmIconId } from '../../config/nm-icons.ts';
|
|
4
|
+
import { NM_BAR_OVERFLOW_CLASSES, NM_BAR_OVERFLOW_TEST_IDS } from '../../config/nm-bar-overflow.ts';
|
|
5
|
+
import { NM_DROPDOWN_TRIGGER } from '../../config/nm-dropdown.ts';
|
|
6
|
+
import { BAR_OVERFLOW_MODES } from '../../lib/bar-overflow.ts';
|
|
7
|
+
import { NmDropdown } from '../nm-dropdown/nm-dropdown.tsx';
|
|
8
|
+
import { useBarOverflow } from './use-bar-overflow.ts';
|
|
9
|
+
|
|
10
|
+
export type NmBarOverflowProps = {
|
|
11
|
+
menuLabel: string;
|
|
12
|
+
items: readonly NmDropdownItem[];
|
|
13
|
+
onSelect: (id: string) => void;
|
|
14
|
+
testId?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
hiddenOnNarrow?: boolean;
|
|
17
|
+
menuIcon?: NmIconId;
|
|
18
|
+
trailing?: ReactNode;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function rootClassName(className: string | undefined): string {
|
|
23
|
+
return [NM_BAR_OVERFLOW_CLASSES.root, className]
|
|
24
|
+
.filter((value) => value != null && value !== '')
|
|
25
|
+
.join(' ');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function NmBarOverflow(props: NmBarOverflowProps): ReactNode {
|
|
29
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
30
|
+
const rowRef = useRef<HTMLDivElement>(null);
|
|
31
|
+
const { mode } = useBarOverflow(rootRef, rowRef);
|
|
32
|
+
const menu = mode === BAR_OVERFLOW_MODES.menu;
|
|
33
|
+
const testId = props.testId ?? NM_BAR_OVERFLOW_TEST_IDS.root;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
ref={rootRef}
|
|
38
|
+
className={rootClassName(props.className)}
|
|
39
|
+
data-mode={mode}
|
|
40
|
+
data-hidden-narrow={props.hiddenOnNarrow ? 'true' : 'false'}
|
|
41
|
+
data-testid={testId}
|
|
42
|
+
>
|
|
43
|
+
{menu ? (
|
|
44
|
+
<NmDropdown
|
|
45
|
+
label={props.menuLabel}
|
|
46
|
+
items={props.items}
|
|
47
|
+
icon={props.menuIcon ?? 'ellipsis'}
|
|
48
|
+
trigger={NM_DROPDOWN_TRIGGER.icon}
|
|
49
|
+
portal
|
|
50
|
+
testId={`${testId}-menu`}
|
|
51
|
+
onSelect={props.onSelect}
|
|
52
|
+
/>
|
|
53
|
+
) : null}
|
|
54
|
+
{menu ? props.trailing : null}
|
|
55
|
+
{/* Stays mounted while collapsed so the natural row width can be measured. */}
|
|
56
|
+
<div ref={rowRef} className={NM_BAR_OVERFLOW_CLASSES.row} aria-hidden={menu}>
|
|
57
|
+
<div className={NM_BAR_OVERFLOW_CLASSES.start}>{props.children}</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|