@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,190 @@
|
|
|
1
|
+
/* The panel: framed, with the search on top, then filters, then the list. */
|
|
2
|
+
.nm-command {
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--nm-space-24);
|
|
7
|
+
width: 100%;
|
|
8
|
+
padding: var(--nm-space-12) var(--nm-space-24) var(--nm-space-24);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
border: var(--nm-rule) solid var(--nm-line-strong);
|
|
11
|
+
border-radius: var(--nm-radius-lg);
|
|
12
|
+
background: var(--nm-panel);
|
|
13
|
+
color: var(--nm-fg);
|
|
14
|
+
font-family: var(--nm-font);
|
|
15
|
+
font-size: var(--nm-type-ui);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.nm-command-dialog .nm-command {
|
|
19
|
+
border: 0;
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.nm-command-dialog__header {
|
|
24
|
+
position: absolute;
|
|
25
|
+
width: var(--nm-rule);
|
|
26
|
+
height: var(--nm-rule);
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
clip-path: inset(50%);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nm-command__search {
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
gap: var(--nm-space-8);
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
height: calc(var(--control-h) * 1.5);
|
|
37
|
+
padding: 0 var(--nm-space-4);
|
|
38
|
+
color: var(--nm-fg-subtle);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nm-command__input {
|
|
42
|
+
flex: 1;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
height: 100%;
|
|
45
|
+
padding: 0;
|
|
46
|
+
border: 0;
|
|
47
|
+
background: transparent;
|
|
48
|
+
color: var(--nm-fg);
|
|
49
|
+
font: inherit;
|
|
50
|
+
outline: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.nm-command__input::placeholder {
|
|
54
|
+
color: var(--nm-fg-muted);
|
|
55
|
+
opacity: 1;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nm-command__clear {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
padding: var(--nm-space-4);
|
|
61
|
+
border: 0;
|
|
62
|
+
border-radius: var(--nm-control-r);
|
|
63
|
+
background: transparent;
|
|
64
|
+
color: var(--nm-fg-subtle);
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nm-command__clear:hover,
|
|
69
|
+
.nm-command__clear:focus-visible {
|
|
70
|
+
background: var(--nm-inset);
|
|
71
|
+
color: var(--nm-fg);
|
|
72
|
+
outline: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.nm-command__filters {
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: var(--nm-space-8);
|
|
78
|
+
overflow-x: auto;
|
|
79
|
+
scrollbar-width: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nm-command__list {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
max-height: var(--nm-height-command);
|
|
86
|
+
margin: calc(var(--nm-space-12) * -1) 0 0;
|
|
87
|
+
overflow-x: hidden;
|
|
88
|
+
overflow-y: auto;
|
|
89
|
+
scrollbar-width: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
[cmdk-list-sizer] {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
gap: var(--nm-space-12);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.nm-command__group {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: var(--nm-space-2);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* cmdk hides a group with no match by setting hidden. The flex display above must not undo it. */
|
|
105
|
+
.nm-command__group[hidden] {
|
|
106
|
+
display: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[cmdk-group-heading] {
|
|
110
|
+
padding: var(--nm-space-6);
|
|
111
|
+
color: var(--nm-fg-muted);
|
|
112
|
+
font-size: var(--nm-type-ui-sm);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[cmdk-group-items] {
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
gap: var(--nm-space-2);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.nm-command__item {
|
|
122
|
+
display: flex;
|
|
123
|
+
align-items: center;
|
|
124
|
+
gap: var(--nm-space-8);
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
min-height: calc(var(--control-h-lg) + var(--nm-space-2));
|
|
127
|
+
padding: var(--nm-space-12);
|
|
128
|
+
border-radius: var(--nm-control-r);
|
|
129
|
+
color: var(--nm-fg);
|
|
130
|
+
font-weight: var(--nm-weight-medium);
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
user-select: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.nm-command__item[data-selected='true'] {
|
|
136
|
+
background: var(--nm-line);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nm-command__item[data-disabled='true'] {
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.nm-command__item > .nm-icon {
|
|
145
|
+
flex-shrink: 0;
|
|
146
|
+
color: var(--nm-fg-muted);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.nm-command__actions {
|
|
150
|
+
display: none;
|
|
151
|
+
margin-left: auto;
|
|
152
|
+
color: var(--nm-fg-subtle);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.nm-command__item[data-selected='true'] .nm-command__actions {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.nm-command__shortcut {
|
|
160
|
+
margin-left: auto;
|
|
161
|
+
color: var(--nm-fg-subtle);
|
|
162
|
+
font-size: var(--nm-type-ui-sm);
|
|
163
|
+
font-weight: var(--nm-weight-regular);
|
|
164
|
+
letter-spacing: var(--nm-track);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.nm-command__separator {
|
|
168
|
+
height: var(--nm-rule);
|
|
169
|
+
background: var(--nm-line);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.nm-command__empty,
|
|
173
|
+
.nm-command__loading {
|
|
174
|
+
display: flex;
|
|
175
|
+
align-items: center;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
gap: var(--nm-space-8);
|
|
178
|
+
padding: var(--nm-space-24) 0;
|
|
179
|
+
color: var(--nm-fg-muted);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.nm-command__spinner {
|
|
183
|
+
animation: nm-command-spin 1s linear infinite;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@keyframes nm-command-spin {
|
|
187
|
+
to {
|
|
188
|
+
transform: rotate(360deg);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { NmChip } from '../nm-chip/nm-chip.tsx';
|
|
2
|
+
import { useState, type ComponentProps, type ReactNode } from 'react';
|
|
3
|
+
import { Command as CommandPrimitive } from 'cmdk';
|
|
4
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
5
|
+
import { NmDialog, NmDialogContent, NmDialogDescription, NmDialogHeader, NmDialogTitle } from '../nm-dialog/nm-dialog.tsx';
|
|
6
|
+
import { NmIcon } from '../nm-icon/nm-icon.tsx';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Command: search and run. The shadcn Command composition on cmdk, which gives filtering, arrow-key
|
|
10
|
+
* navigation and the listbox roles. Everything you see is NIF tokens.
|
|
11
|
+
*/
|
|
12
|
+
export function NmCommand({ className, ...props }: ComponentProps<typeof CommandPrimitive>) {
|
|
13
|
+
return <CommandPrimitive data-slot="command" className={nmClass('nm-command', className)} {...props} />;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function NmCommandDialog({
|
|
17
|
+
title = 'Command palette',
|
|
18
|
+
description = 'Search for a command to run',
|
|
19
|
+
children,
|
|
20
|
+
...props
|
|
21
|
+
}: Omit<ComponentProps<typeof NmDialog>, 'children'> & { title?: string; description?: string; children: ReactNode }) {
|
|
22
|
+
return (
|
|
23
|
+
<NmDialog {...props}>
|
|
24
|
+
<NmDialogContent className="nm-command-dialog">
|
|
25
|
+
<NmDialogHeader className="nm-command-dialog__header">
|
|
26
|
+
<NmDialogTitle>{title}</NmDialogTitle>
|
|
27
|
+
<NmDialogDescription>{description}</NmDialogDescription>
|
|
28
|
+
</NmDialogHeader>
|
|
29
|
+
{children}
|
|
30
|
+
</NmDialogContent>
|
|
31
|
+
</NmDialog>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The search row: an icon, the field and a clear button once there is text. */
|
|
36
|
+
export function NmCommandInput({ className, value, defaultValue, onValueChange, clearLabel = 'Clear', ...props }: ComponentProps<typeof CommandPrimitive.Input> & { clearLabel?: string; defaultValue?: string }) {
|
|
37
|
+
const [inner, setInner] = useState(defaultValue ?? '');
|
|
38
|
+
const text = value ?? inner;
|
|
39
|
+
const set = (next: string) => {
|
|
40
|
+
setInner(next);
|
|
41
|
+
onValueChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
return (
|
|
44
|
+
<div data-slot="command-input-wrapper" className="nm-command__search">
|
|
45
|
+
<NmIcon id="search" />
|
|
46
|
+
<CommandPrimitive.Input data-slot="command-input" value={text} onValueChange={set} className={nmClass('nm-command__input', className)} {...props} />
|
|
47
|
+
{text !== '' ? (
|
|
48
|
+
<button type="button" className="nm-command__clear" aria-label={clearLabel} onClick={() => set('')}>
|
|
49
|
+
<NmIcon id="x" />
|
|
50
|
+
</button>
|
|
51
|
+
) : null}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Chips that narrow the list to one kind of result. */
|
|
57
|
+
export function NmCommandFilters({
|
|
58
|
+
items,
|
|
59
|
+
value,
|
|
60
|
+
onValueChange,
|
|
61
|
+
label = 'Filter results',
|
|
62
|
+
}: {
|
|
63
|
+
items: readonly { id: string; label: string }[];
|
|
64
|
+
value: string;
|
|
65
|
+
onValueChange: (id: string) => void;
|
|
66
|
+
label?: string;
|
|
67
|
+
}) {
|
|
68
|
+
return (
|
|
69
|
+
<div data-slot="command-filters" className="nm-command__filters" role="tablist" aria-label={label}>
|
|
70
|
+
{items.map((item) => (
|
|
71
|
+
<NmChip
|
|
72
|
+
key={item.id}
|
|
73
|
+
role="tab"
|
|
74
|
+
aria-selected={item.id === value}
|
|
75
|
+
selected={item.id === value}
|
|
76
|
+
onClick={() => onValueChange(item.id)}
|
|
77
|
+
>
|
|
78
|
+
{item.label}
|
|
79
|
+
</NmChip>
|
|
80
|
+
))}
|
|
81
|
+
</div>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function NmCommandList({ className, ...props }: ComponentProps<typeof CommandPrimitive.List>) {
|
|
86
|
+
return <CommandPrimitive.List data-slot="command-list" className={nmClass('nm-command__list', className)} {...props} />;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function NmCommandEmpty({ className, ...props }: ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
90
|
+
return <CommandPrimitive.Empty data-slot="command-empty" className={nmClass('nm-command__empty', className)} {...props} />;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function NmCommandLoading({ className, children, ...props }: ComponentProps<typeof CommandPrimitive.Loading>) {
|
|
94
|
+
return (
|
|
95
|
+
<CommandPrimitive.Loading data-slot="command-loading" className={nmClass('nm-command__loading', className)} {...props}>
|
|
96
|
+
<NmIcon id="loader" className="nm-command__spinner" />
|
|
97
|
+
{children}
|
|
98
|
+
</CommandPrimitive.Loading>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function NmCommandGroup({ className, ...props }: ComponentProps<typeof CommandPrimitive.Group>) {
|
|
103
|
+
return <CommandPrimitive.Group data-slot="command-group" className={nmClass('nm-command__group', className)} {...props} />;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function NmCommandSeparator({ className, ...props }: ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
107
|
+
return <CommandPrimitive.Separator data-slot="command-separator" className={nmClass('nm-command__separator', className)} {...props} />;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function NmCommandItem({ className, children, ...props }: ComponentProps<typeof CommandPrimitive.Item>) {
|
|
111
|
+
return (
|
|
112
|
+
<CommandPrimitive.Item data-slot="command-item" className={nmClass('nm-command__item', className)} {...props}>
|
|
113
|
+
{children}
|
|
114
|
+
</CommandPrimitive.Item>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Shown on the right of an item, and only while the item is selected. */
|
|
119
|
+
export function NmCommandItemActions({ className, ...props }: ComponentProps<'span'>) {
|
|
120
|
+
return <span data-slot="command-item-actions" className={nmClass('nm-command__actions', className)} {...props} />;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function NmCommandShortcut({ className, ...props }: ComponentProps<'span'>) {
|
|
124
|
+
return <span data-slot="command-shortcut" className={nmClass('nm-command__shortcut', className)} {...props} />;
|
|
125
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
.nm-composer {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--nm-space-24);
|
|
6
|
+
width: 100%;
|
|
7
|
+
padding: var(--nm-space-12);
|
|
8
|
+
border: var(--nm-rule) solid var(--nm-line-strong);
|
|
9
|
+
border-radius: var(--nm-radius-lg);
|
|
10
|
+
background: var(--nm-raised);
|
|
11
|
+
color: var(--nm-fg);
|
|
12
|
+
font-family: var(--nm-font);
|
|
13
|
+
font-size: var(--nm-type-ui);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.nm-composer:focus-within {
|
|
17
|
+
border-color: var(--nm-stroke);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.nm-composer[data-disabled='true'] {
|
|
21
|
+
opacity: 0.6;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.nm-composer__main {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: var(--nm-space-12);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nm-composer__attachments {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
gap: var(--nm-space-8);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nm-composer__field {
|
|
37
|
+
display: block;
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
width: 100%;
|
|
40
|
+
--nm-composer-line: calc(var(--nm-space-16) + var(--nm-space-4));
|
|
41
|
+
min-height: var(--nm-composer-line);
|
|
42
|
+
max-height: calc(var(--nm-composer-line) * 8);
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
border: 0;
|
|
46
|
+
background: transparent;
|
|
47
|
+
color: var(--nm-fg);
|
|
48
|
+
font: inherit;
|
|
49
|
+
line-height: var(--nm-composer-line);
|
|
50
|
+
outline: none;
|
|
51
|
+
resize: none;
|
|
52
|
+
field-sizing: content;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.nm-composer__field::placeholder {
|
|
56
|
+
color: var(--nm-fg-muted);
|
|
57
|
+
opacity: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.nm-composer__bar {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: space-between;
|
|
64
|
+
gap: var(--nm-space-24);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.nm-composer__start,
|
|
68
|
+
.nm-composer__end {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: var(--nm-space-8);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* 24px square at the default icon size: the icon plus the 6px micro-unit on each side. */
|
|
75
|
+
.nm-composer__button {
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
box-sizing: content-box;
|
|
81
|
+
width: var(--nm-icon-button);
|
|
82
|
+
height: var(--nm-icon-button);
|
|
83
|
+
padding: calc(var(--nm-space-6) / 2);
|
|
84
|
+
border: 0;
|
|
85
|
+
border-radius: var(--nm-control-r);
|
|
86
|
+
background: transparent;
|
|
87
|
+
color: var(--nm-fg-muted);
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.nm-composer__button .nm-icon {
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.nm-composer__button:hover:not(:disabled),
|
|
97
|
+
.nm-composer__button:focus-visible,
|
|
98
|
+
.nm-composer__button[aria-pressed='true'] {
|
|
99
|
+
background: var(--nm-inset);
|
|
100
|
+
color: var(--nm-fg);
|
|
101
|
+
outline: none;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.nm-composer__button--primary {
|
|
105
|
+
background: var(--nm-fg);
|
|
106
|
+
color: var(--nm-canvas);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.nm-composer__button--primary:hover:not(:disabled),
|
|
110
|
+
.nm-composer__button--primary:focus-visible {
|
|
111
|
+
background: var(--nm-fg);
|
|
112
|
+
color: var(--nm-canvas);
|
|
113
|
+
opacity: 0.88;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.nm-composer__button:disabled {
|
|
117
|
+
cursor: default;
|
|
118
|
+
opacity: 0.4;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.nm-composer__stop-mark {
|
|
122
|
+
display: block;
|
|
123
|
+
width: 60%;
|
|
124
|
+
height: 60%;
|
|
125
|
+
border-radius: var(--nm-radius-sm);
|
|
126
|
+
background: currentColor;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Queued messages stack above the text, inside the same frame, dimmed until their turn. */
|
|
130
|
+
.nm-composer__queue {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
margin: 0;
|
|
134
|
+
padding: 0 0 var(--nm-space-12);
|
|
135
|
+
list-style: none;
|
|
136
|
+
border-bottom: var(--nm-rule) solid var(--nm-line);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.nm-composer__queued {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: var(--nm-space-12);
|
|
143
|
+
padding: var(--nm-space-4) 0;
|
|
144
|
+
color: var(--nm-fg-subtle);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.nm-composer__queued > .nm-icon {
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.nm-composer__queued-text {
|
|
152
|
+
flex: 1;
|
|
153
|
+
min-width: 0;
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
text-overflow: ellipsis;
|
|
156
|
+
white-space: nowrap;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.nm-composer__queued-actions {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-shrink: 0;
|
|
162
|
+
gap: var(--nm-space-4);
|
|
163
|
+
opacity: 0;
|
|
164
|
+
transition: opacity 0.12s;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.nm-composer__queued:hover .nm-composer__queued-actions,
|
|
168
|
+
.nm-composer__queued:focus-within .nm-composer__queued-actions {
|
|
169
|
+
opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* A notice card and the composer, one above the other. */
|
|
173
|
+
.nm-composer-stack {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
gap: var(--nm-space-8);
|
|
177
|
+
width: 100%;
|
|
178
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { NmChip } from '../nm-chip/nm-chip.tsx';
|
|
2
|
+
import { useRef, type KeyboardEvent, type ReactNode } from 'react';
|
|
3
|
+
import {
|
|
4
|
+
NM_COMPOSER_CLASSES as C,
|
|
5
|
+
NM_COMPOSER_COPY as COPY,
|
|
6
|
+
type NmComposerAttachment,
|
|
7
|
+
type NmComposerQueued,
|
|
8
|
+
} from '../../config/nm-composer.ts';
|
|
9
|
+
import { NmIcon } from '../nm-icon/nm-icon.tsx';
|
|
10
|
+
|
|
11
|
+
export type NmComposerProps = {
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
onSend: () => void;
|
|
15
|
+
/** While the agent answers, the send button becomes Stop. */
|
|
16
|
+
busy?: boolean;
|
|
17
|
+
onStop?: () => void;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
/** A card shown above the box, such as a usage warning. It stacks directly over the frame. */
|
|
20
|
+
notice?: ReactNode;
|
|
21
|
+
/** Messages waiting for the agent to finish. They stack above the text, oldest first. */
|
|
22
|
+
queue?: readonly NmComposerQueued[];
|
|
23
|
+
onEditQueued?: (id: string) => void;
|
|
24
|
+
onRemoveQueued?: (id: string) => void;
|
|
25
|
+
attachments?: readonly NmComposerAttachment[];
|
|
26
|
+
onRemoveAttachment?: (id: string) => void;
|
|
27
|
+
/** The add button on the left. Omit it to hide the button. */
|
|
28
|
+
onAdd?: () => void;
|
|
29
|
+
/** Dictation. Pressed while it listens. */
|
|
30
|
+
onMic?: () => void;
|
|
31
|
+
micActive?: boolean;
|
|
32
|
+
/** Voice mode. It shows while the box is empty. Typing swaps it for Send. */
|
|
33
|
+
onVoice?: () => void;
|
|
34
|
+
/** Replaces the add button, for a menu of what to add. Give the trigger the composer button class. */
|
|
35
|
+
addControl?: ReactNode;
|
|
36
|
+
/** Controls beside the add button, such as the model selector. */
|
|
37
|
+
start?: ReactNode;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
testId?: string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export function NmComposer(props: NmComposerProps): ReactNode {
|
|
43
|
+
const field = useRef<HTMLTextAreaElement>(null);
|
|
44
|
+
const hasText = props.value.trim() !== '';
|
|
45
|
+
|
|
46
|
+
function send(): void {
|
|
47
|
+
// While the agent answers, Enter still sends. The host puts the message in the queue.
|
|
48
|
+
if (props.disabled || !hasText) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
props.onSend();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function onKeyDown(event: KeyboardEvent<HTMLTextAreaElement>): void {
|
|
55
|
+
if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
send();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let action: ReactNode;
|
|
62
|
+
if (props.busy) {
|
|
63
|
+
action = (
|
|
64
|
+
<button type="button" className={`${C.button} ${C.primary}`} aria-label={COPY.stop} onClick={props.onStop}>
|
|
65
|
+
<span className={C.stopMark} />
|
|
66
|
+
</button>
|
|
67
|
+
);
|
|
68
|
+
} else if (hasText || props.onVoice == null) {
|
|
69
|
+
action = (
|
|
70
|
+
<button type="submit" className={`${C.button} ${C.primary}`} aria-label={COPY.send} disabled={props.disabled || !hasText}>
|
|
71
|
+
<NmIcon id="send" />
|
|
72
|
+
</button>
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
75
|
+
action = (
|
|
76
|
+
<button type="button" className={C.button} aria-label={COPY.voice} disabled={props.disabled} onClick={props.onVoice}>
|
|
77
|
+
<NmIcon id="audio-lines" />
|
|
78
|
+
</button>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const form = (
|
|
83
|
+
<form
|
|
84
|
+
className={C.root}
|
|
85
|
+
data-disabled={props.disabled ? 'true' : undefined}
|
|
86
|
+
data-testid={props.testId}
|
|
87
|
+
onSubmit={(event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
send();
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<div className={C.main}>
|
|
93
|
+
{props.queue && props.queue.length > 0 ? (
|
|
94
|
+
<ul className={C.queue} aria-label={COPY.queued}>
|
|
95
|
+
{props.queue.map((q) => (
|
|
96
|
+
<li key={q.id} className={C.queued}>
|
|
97
|
+
<NmIcon id="chat-dashed" />
|
|
98
|
+
<span className={C.queuedText}>{q.text}</span>
|
|
99
|
+
<span className={C.queuedActions}>
|
|
100
|
+
{props.onEditQueued ? (
|
|
101
|
+
<button type="button" className={C.button} aria-label={COPY.editQueued} onClick={() => props.onEditQueued?.(q.id)}><NmIcon id="pen" /></button>
|
|
102
|
+
) : null}
|
|
103
|
+
<button type="button" className={C.button} aria-label={COPY.removeQueued} onClick={() => props.onRemoveQueued?.(q.id)}><NmIcon id="x" /></button>
|
|
104
|
+
</span>
|
|
105
|
+
</li>
|
|
106
|
+
))}
|
|
107
|
+
</ul>
|
|
108
|
+
) : null}
|
|
109
|
+
{props.attachments && props.attachments.length > 0 ? (
|
|
110
|
+
<div className={C.attachments}>
|
|
111
|
+
{props.attachments.map((a) => (
|
|
112
|
+
<NmChip key={a.id} tone="outline" icon="file-text" removeLabel={COPY.remove(a.name)} onRemove={() => props.onRemoveAttachment?.(a.id)}>
|
|
113
|
+
{a.name}
|
|
114
|
+
</NmChip>
|
|
115
|
+
))}
|
|
116
|
+
</div>
|
|
117
|
+
) : null}
|
|
118
|
+
<textarea
|
|
119
|
+
ref={field}
|
|
120
|
+
className={C.field}
|
|
121
|
+
rows={1}
|
|
122
|
+
value={props.value}
|
|
123
|
+
placeholder={props.placeholder ?? COPY.placeholder}
|
|
124
|
+
aria-label={props.placeholder ?? COPY.placeholder}
|
|
125
|
+
disabled={props.disabled}
|
|
126
|
+
onChange={(event) => props.onChange(event.target.value)}
|
|
127
|
+
onKeyDown={onKeyDown}
|
|
128
|
+
/>
|
|
129
|
+
</div>
|
|
130
|
+
<div className={C.bar}>
|
|
131
|
+
<div className={C.start}>
|
|
132
|
+
{props.addControl ?? (props.onAdd ? (
|
|
133
|
+
<button type="button" className={C.button} aria-label={COPY.attach} disabled={props.disabled} onClick={props.onAdd}>
|
|
134
|
+
<NmIcon id="plus" />
|
|
135
|
+
</button>
|
|
136
|
+
) : null)}
|
|
137
|
+
{props.start}
|
|
138
|
+
</div>
|
|
139
|
+
<div className={C.end}>
|
|
140
|
+
{props.onMic ? (
|
|
141
|
+
<button type="button" className={C.button} aria-label={COPY.mic} aria-pressed={props.micActive === true} disabled={props.disabled} onClick={props.onMic}>
|
|
142
|
+
<NmIcon id="mic" />
|
|
143
|
+
</button>
|
|
144
|
+
) : null}
|
|
145
|
+
{action}
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</form>
|
|
149
|
+
);
|
|
150
|
+
return props.notice != null ? <div className={C.stack}>{props.notice}{form}</div> : form;
|
|
151
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu';
|
|
2
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base UI Context Menu: the menu that opens on right click or long press. Its items are the dropdown menu parts
|
|
6
|
+
* (NmDropdownMenuItem, NmDropdownMenuSub, NmDropdownMenuCheckboxItem and the rest).
|
|
7
|
+
*/
|
|
8
|
+
export function NmContextMenu(props: ContextMenuPrimitive.Root.Props) {
|
|
9
|
+
return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The area that answers a right click. */
|
|
13
|
+
export function NmContextMenuTrigger({ className, ...props }: ContextMenuPrimitive.Trigger.Props) {
|
|
14
|
+
return <ContextMenuPrimitive.Trigger data-slot="context-menu-trigger" className={className as string} {...props} />;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function NmContextMenuContent({ className, ...props }: ContextMenuPrimitive.Popup.Props) {
|
|
18
|
+
return (
|
|
19
|
+
<ContextMenuPrimitive.Portal>
|
|
20
|
+
<ContextMenuPrimitive.Positioner className="nm-menu__positioner">
|
|
21
|
+
<ContextMenuPrimitive.Popup data-slot="context-menu-content" className={nmClass('nm-menu', className as string)} {...props} />
|
|
22
|
+
</ContextMenuPrimitive.Positioner>
|
|
23
|
+
</ContextMenuPrimitive.Portal>
|
|
24
|
+
);
|
|
25
|
+
}
|