@nordmanai/nif 0.1.0 → 0.2.1
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 +106 -0
- package/registry/ui/components/nm-button/nm-button.tsx +58 -0
- package/registry/ui/components/nm-button-group/nm-button-group.css +98 -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,101 @@
|
|
|
1
|
+
import type { FormEvent, ReactNode } from 'react';
|
|
2
|
+
import { NM_ICON_BUTTON_CLASSES, NM_ICON_BUTTON_TONES } from '../../config/nm-icon-button.ts';
|
|
3
|
+
import { NM_CHATBOX_CLASSES } from '../../config/nm-chatbox.ts';
|
|
4
|
+
import { NmChatboxIcon } from './nm-chatbox-icon.tsx';
|
|
5
|
+
import { createLogger } from '../../kit-logger.ts';
|
|
6
|
+
|
|
7
|
+
const logger = createLogger('interface-nm-chatbox');
|
|
8
|
+
|
|
9
|
+
export type NmChatboxProps = {
|
|
10
|
+
placeholder: string;
|
|
11
|
+
placeholderEmphasis?: string;
|
|
12
|
+
value: string;
|
|
13
|
+
sendLabel: string;
|
|
14
|
+
attachLabel: string;
|
|
15
|
+
micLabel: string;
|
|
16
|
+
fieldId?: string;
|
|
17
|
+
micPressed?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
testId?: string;
|
|
20
|
+
tools?: ReactNode;
|
|
21
|
+
onChange: (value: string) => void;
|
|
22
|
+
onSend: () => void;
|
|
23
|
+
onAttach?: () => void;
|
|
24
|
+
onMic?: () => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function NmChatbox(props: NmChatboxProps): ReactNode {
|
|
28
|
+
logger.debug('render', 'composer', { length: props.value.length });
|
|
29
|
+
|
|
30
|
+
function onSubmit(event: FormEvent<HTMLFormElement>): void {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
if (props.disabled || props.value.trim() === '') {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
props.onSend();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<form className={NM_CHATBOX_CLASSES.root} data-testid={props.testId} onSubmit={onSubmit}>
|
|
40
|
+
<div className={NM_CHATBOX_CLASSES.prompt}>
|
|
41
|
+
<div
|
|
42
|
+
className={NM_CHATBOX_CLASSES.placeholder}
|
|
43
|
+
data-hidden={props.value.trim() === '' ? 'false' : 'true'}
|
|
44
|
+
>
|
|
45
|
+
{props.placeholder}
|
|
46
|
+
{props.placeholderEmphasis ? (
|
|
47
|
+
<>
|
|
48
|
+
{' '}
|
|
49
|
+
<span className="nm-chatbox__placeholder-emphasis">{props.placeholderEmphasis}</span>
|
|
50
|
+
</>
|
|
51
|
+
) : null}
|
|
52
|
+
</div>
|
|
53
|
+
<textarea
|
|
54
|
+
className={NM_CHATBOX_CLASSES.field}
|
|
55
|
+
id={props.fieldId}
|
|
56
|
+
value={props.value}
|
|
57
|
+
placeholder={props.placeholder}
|
|
58
|
+
rows={1}
|
|
59
|
+
disabled={props.disabled}
|
|
60
|
+
onChange={(event) => props.onChange(event.target.value)}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
<div className={NM_CHATBOX_CLASSES.row}>
|
|
64
|
+
<div className={NM_CHATBOX_CLASSES.tools}>
|
|
65
|
+
{props.onAttach ? (
|
|
66
|
+
<button
|
|
67
|
+
className={`${NM_ICON_BUTTON_CLASSES.root} nm-chatbox__tool`}
|
|
68
|
+
type="button"
|
|
69
|
+
aria-label={props.attachLabel}
|
|
70
|
+
onClick={props.onAttach}
|
|
71
|
+
>
|
|
72
|
+
<NmChatboxIcon id="paperclip" />
|
|
73
|
+
</button>
|
|
74
|
+
) : null}
|
|
75
|
+
{props.tools}
|
|
76
|
+
</div>
|
|
77
|
+
<div className={NM_CHATBOX_CLASSES.actions}>
|
|
78
|
+
{props.onMic ? (
|
|
79
|
+
<button
|
|
80
|
+
className={`${NM_ICON_BUTTON_CLASSES.root} nm-chatbox__tool`}
|
|
81
|
+
type="button"
|
|
82
|
+
aria-label={props.micLabel}
|
|
83
|
+
aria-pressed={props.micPressed}
|
|
84
|
+
onClick={props.onMic}
|
|
85
|
+
>
|
|
86
|
+
<NmChatboxIcon id="mic" />
|
|
87
|
+
</button>
|
|
88
|
+
) : null}
|
|
89
|
+
<button
|
|
90
|
+
className={`${NM_ICON_BUTTON_CLASSES.root} ${NM_ICON_BUTTON_CLASSES[NM_ICON_BUTTON_TONES.invert]} nm-chatbox__send`}
|
|
91
|
+
type="submit"
|
|
92
|
+
aria-label={props.sendLabel}
|
|
93
|
+
disabled={props.disabled || props.value.trim() === ''}
|
|
94
|
+
>
|
|
95
|
+
<NmChatboxIcon id="send" />
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</form>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.nm-checkbox {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
flex-shrink: 0;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
width: var(--nm-icon-button);
|
|
9
|
+
height: var(--nm-icon-button);
|
|
10
|
+
padding: 0;
|
|
11
|
+
border: var(--nm-rule) solid var(--nm-stroke);
|
|
12
|
+
border-radius: var(--nm-radius-sm);
|
|
13
|
+
background: transparent;
|
|
14
|
+
color: var(--nm-canvas);
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition:
|
|
17
|
+
background 0.15s,
|
|
18
|
+
border-color 0.15s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.nm-checkbox:focus-visible {
|
|
22
|
+
outline: var(--nm-rule) solid var(--focus);
|
|
23
|
+
outline-offset: var(--nm-space-2);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.nm-checkbox[data-checked],
|
|
27
|
+
.nm-checkbox[data-indeterminate] {
|
|
28
|
+
border-color: var(--nm-fg);
|
|
29
|
+
background: var(--nm-fg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.nm-checkbox[data-invalid] {
|
|
33
|
+
border-color: var(--nm-destructive);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nm-checkbox[data-disabled] {
|
|
37
|
+
cursor: not-allowed;
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nm-checkbox__indicator {
|
|
42
|
+
display: grid;
|
|
43
|
+
place-content: center;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.nm-checkbox__indicator .nm-icon {
|
|
49
|
+
width: 80%;
|
|
50
|
+
height: 80%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* One mark at a time: a tick when checked, a dash when only some are. */
|
|
54
|
+
.nm-checkbox__minus,
|
|
55
|
+
.nm-checkbox[data-indeterminate] .nm-checkbox__check {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.nm-checkbox[data-indeterminate] .nm-checkbox__minus {
|
|
60
|
+
display: block;
|
|
61
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Checkbox as CheckboxPrimitive } from '@base-ui/react/checkbox';
|
|
2
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
3
|
+
import { NmIcon } from '../nm-icon/nm-icon.tsx';
|
|
4
|
+
|
|
5
|
+
export function NmCheckbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
|
|
6
|
+
return (
|
|
7
|
+
<CheckboxPrimitive.Root data-slot="checkbox" className={nmClass('nm-checkbox', className as string)} {...props}>
|
|
8
|
+
<CheckboxPrimitive.Indicator data-slot="checkbox-indicator" className="nm-checkbox__indicator">
|
|
9
|
+
<NmIcon id="check" className="nm-checkbox__check" />
|
|
10
|
+
<NmIcon id="minus" className="nm-checkbox__minus" />
|
|
11
|
+
</CheckboxPrimitive.Indicator>
|
|
12
|
+
</CheckboxPrimitive.Root>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.nm-chip {
|
|
2
|
+
--nm-chip-h: var(--control-h-sm);
|
|
3
|
+
--nm-chip-fs: var(--nm-type-ui-sm);
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: var(--nm-space-4);
|
|
9
|
+
height: var(--nm-chip-h);
|
|
10
|
+
padding: 0 var(--nm-space-8);
|
|
11
|
+
border: var(--nm-rule) solid transparent;
|
|
12
|
+
border-radius: var(--badge-r);
|
|
13
|
+
background: var(--nm-panel);
|
|
14
|
+
color: var(--nm-fg-muted);
|
|
15
|
+
font: inherit;
|
|
16
|
+
font-size: var(--nm-chip-fs);
|
|
17
|
+
font-weight: var(--nm-weight-medium);
|
|
18
|
+
line-height: var(--nm-leading-none);
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.nm-chip[data-size='sm'] {
|
|
24
|
+
--nm-chip-h: var(--badge-h);
|
|
25
|
+
--nm-chip-fs: var(--badge-fs);
|
|
26
|
+
padding: 0 var(--badge-px);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Icons read these two tokens, so the chip scales them to its own type. */
|
|
30
|
+
.nm-chip {
|
|
31
|
+
--nm-icon: var(--nm-chip-fs);
|
|
32
|
+
--nm-icon-button: var(--nm-chip-fs);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.nm-chip svg {
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.nm-chip[data-tone='outline'] {
|
|
40
|
+
border-color: var(--nm-line-strong);
|
|
41
|
+
background: transparent;
|
|
42
|
+
color: var(--nm-fg);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.nm-chip[data-tone='filled'] {
|
|
46
|
+
background: var(--nm-fg);
|
|
47
|
+
color: var(--nm-canvas);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nm-chip[data-tone='ok'] {
|
|
51
|
+
color: var(--ok);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.nm-chip[data-tone='warn'] {
|
|
55
|
+
color: var(--nm-fg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.nm-chip[data-tone='error'] {
|
|
59
|
+
color: var(--nm-destructive);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
button.nm-chip,
|
|
63
|
+
a.nm-chip {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
button.nm-chip:hover:not(:disabled),
|
|
68
|
+
a.nm-chip:hover:not([aria-disabled]) {
|
|
69
|
+
background: var(--nm-line);
|
|
70
|
+
color: var(--nm-fg);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.nm-chip[data-tone='filled']:is(button, a):hover:not(:disabled):not([aria-disabled]) {
|
|
74
|
+
background: var(--nm-fg-muted);
|
|
75
|
+
color: var(--nm-canvas);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.nm-chip[data-selected] {
|
|
79
|
+
border-color: var(--nm-fg);
|
|
80
|
+
background: var(--nm-line);
|
|
81
|
+
color: var(--nm-fg);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.nm-chip:is(button, a):focus-visible {
|
|
85
|
+
outline: var(--nm-rule) solid var(--focus);
|
|
86
|
+
outline-offset: var(--nm-space-2);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.nm-chip[data-disabled] {
|
|
90
|
+
opacity: 0.5;
|
|
91
|
+
cursor: not-allowed;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.nm-chip__remove {
|
|
95
|
+
display: inline-flex;
|
|
96
|
+
flex-shrink: 0;
|
|
97
|
+
align-items: center;
|
|
98
|
+
padding: 0;
|
|
99
|
+
border: 0;
|
|
100
|
+
border-radius: var(--badge-r);
|
|
101
|
+
background: transparent;
|
|
102
|
+
color: var(--nm-fg-subtle);
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.nm-chip__remove:hover:not(:disabled) {
|
|
107
|
+
color: var(--nm-fg);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.nm-chip__remove:focus-visible {
|
|
111
|
+
outline: var(--nm-rule) solid var(--focus);
|
|
112
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
3
|
+
import type { NmIconId } from '../../config/nm-icons.ts';
|
|
4
|
+
import { NmIcon } from '../nm-icon/nm-icon.tsx';
|
|
5
|
+
|
|
6
|
+
export const NM_CHIP_TONES = ['neutral', 'outline', 'filled', 'ok', 'warn', 'error'] as const;
|
|
7
|
+
export const NM_CHIP_SIZES = ['default', 'sm'] as const;
|
|
8
|
+
export type NmChipTone = (typeof NM_CHIP_TONES)[number];
|
|
9
|
+
export type NmChipSize = (typeof NM_CHIP_SIZES)[number];
|
|
10
|
+
|
|
11
|
+
type NmChipBase = {
|
|
12
|
+
tone?: NmChipTone;
|
|
13
|
+
size?: NmChipSize;
|
|
14
|
+
icon?: NmIconId;
|
|
15
|
+
/** A chip that stands for a chosen filter or option. */
|
|
16
|
+
selected?: boolean;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type NmChipProps = NmChipBase &
|
|
23
|
+
(
|
|
24
|
+
| { onClick?: undefined; href?: undefined; onRemove?: () => void; removeLabel?: string }
|
|
25
|
+
| { onClick: () => void; href?: undefined; onRemove?: undefined; removeLabel?: undefined }
|
|
26
|
+
| { href: string; onClick?: undefined; onRemove?: undefined; removeLabel?: undefined }
|
|
27
|
+
) &
|
|
28
|
+
Omit<ComponentProps<'span'>, 'children' | 'className' | 'onClick'>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A small label for a status, a filter, an attachment or a tag. Static by default. Give it `onClick` and it
|
|
32
|
+
* becomes a button, `href` and it becomes a link, `onRemove` and it gains a remove button.
|
|
33
|
+
*/
|
|
34
|
+
export function NmChip({
|
|
35
|
+
tone = 'neutral',
|
|
36
|
+
size = 'default',
|
|
37
|
+
icon,
|
|
38
|
+
selected,
|
|
39
|
+
disabled,
|
|
40
|
+
children,
|
|
41
|
+
className,
|
|
42
|
+
onClick,
|
|
43
|
+
href,
|
|
44
|
+
onRemove,
|
|
45
|
+
removeLabel = 'Remove',
|
|
46
|
+
...rest
|
|
47
|
+
}: NmChipProps) {
|
|
48
|
+
const classes = nmClass('nm-chip', className);
|
|
49
|
+
const state = {
|
|
50
|
+
'data-slot': 'chip',
|
|
51
|
+
'data-tone': tone,
|
|
52
|
+
'data-size': size,
|
|
53
|
+
'data-selected': selected ? '' : undefined,
|
|
54
|
+
'data-disabled': disabled ? '' : undefined,
|
|
55
|
+
} as const;
|
|
56
|
+
const body = (
|
|
57
|
+
<>
|
|
58
|
+
{icon ? <NmIcon id={icon} /> : null}
|
|
59
|
+
{children}
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
if (href != null) {
|
|
63
|
+
return (
|
|
64
|
+
<a className={classes} {...(rest as ComponentProps<'a'>)} {...state} href={disabled ? undefined : href} aria-disabled={disabled || undefined}>
|
|
65
|
+
{body}
|
|
66
|
+
</a>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (onClick) {
|
|
70
|
+
return (
|
|
71
|
+
<button className={classes} {...(rest as ComponentProps<'button'>)} {...state} type="button" disabled={disabled} aria-pressed={rest.role ? undefined : (selected ?? undefined)} onClick={onClick}>
|
|
72
|
+
{body}
|
|
73
|
+
</button>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return (
|
|
77
|
+
<span {...rest} {...state} className={classes}>
|
|
78
|
+
{body}
|
|
79
|
+
{onRemove ? (
|
|
80
|
+
<button type="button" className="nm-chip__remove" aria-label={removeLabel} disabled={disabled} onClick={onRemove}>
|
|
81
|
+
<NmIcon id="x" />
|
|
82
|
+
</button>
|
|
83
|
+
) : null}
|
|
84
|
+
</span>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
.nm-code-block {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
width: 100%;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
border: var(--nm-rule) solid var(--nm-line-strong);
|
|
9
|
+
border-radius: var(--nm-radius-lg);
|
|
10
|
+
background: var(--nm-inset);
|
|
11
|
+
color: var(--nm-fg);
|
|
12
|
+
font-size: var(--nm-type-ui);
|
|
13
|
+
/* shiki's css-variables theme reads these. They come from the NIF syntax tokens. */
|
|
14
|
+
--shiki-foreground: var(--nm-fg);
|
|
15
|
+
--shiki-background: transparent;
|
|
16
|
+
--shiki-token-keyword: var(--nm-syntax-keyword);
|
|
17
|
+
--shiki-token-string: var(--nm-syntax-string);
|
|
18
|
+
--shiki-token-string-expression: var(--nm-syntax-string);
|
|
19
|
+
--shiki-token-function: var(--nm-syntax-function);
|
|
20
|
+
--shiki-token-constant: var(--nm-syntax-constant);
|
|
21
|
+
--shiki-token-comment: var(--nm-syntax-comment);
|
|
22
|
+
--shiki-token-parameter: var(--nm-fg);
|
|
23
|
+
--shiki-token-punctuation: var(--nm-fg);
|
|
24
|
+
--shiki-token-link: var(--nm-syntax-string);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.nm-code-block[data-size='sm'] {
|
|
28
|
+
font-size: var(--nm-type-ui-sm);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.nm-code-block[data-variant='destructive'] {
|
|
32
|
+
border-color: var(--nm-destructive);
|
|
33
|
+
color: var(--nm-destructive);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.nm-code-block:has(.nm-code-block__content:focus-visible) {
|
|
37
|
+
border-color: var(--nm-fg);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.nm-code-block__header {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
align-items: center;
|
|
44
|
+
gap: var(--nm-space-8);
|
|
45
|
+
min-width: 0;
|
|
46
|
+
padding: var(--nm-space-12) var(--nm-space-16) 0;
|
|
47
|
+
color: var(--nm-fg-muted);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nm-code-block__title {
|
|
51
|
+
min-width: 0;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
color: var(--nm-fg);
|
|
54
|
+
font-family: var(--nm-font);
|
|
55
|
+
font-size: var(--nm-type-ui-sm);
|
|
56
|
+
font-weight: var(--nm-weight-medium);
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
white-space: nowrap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nm-code-block__actions {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-shrink: 0;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: var(--nm-space-4);
|
|
66
|
+
margin-left: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Placed straight in the block, the actions float over the top right corner. */
|
|
70
|
+
.nm-code-block > .nm-code-block__actions {
|
|
71
|
+
position: absolute;
|
|
72
|
+
z-index: 1;
|
|
73
|
+
top: var(--nm-space-8);
|
|
74
|
+
right: var(--nm-space-8);
|
|
75
|
+
margin: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.nm-code-block[data-collapsed] > .nm-code-block__actions {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.nm-code-block__content {
|
|
83
|
+
min-width: 0;
|
|
84
|
+
min-height: 0;
|
|
85
|
+
margin: 0;
|
|
86
|
+
padding: var(--nm-space-16);
|
|
87
|
+
overflow: auto;
|
|
88
|
+
font-family: var(--nm-font-mono);
|
|
89
|
+
line-height: var(--nm-leading-relaxed);
|
|
90
|
+
text-align: start;
|
|
91
|
+
outline: none;
|
|
92
|
+
scrollbar-width: thin;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.nm-code-block[data-size='sm'] .nm-code-block__content {
|
|
96
|
+
padding: var(--nm-space-12);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* Leave room on the right so a line never runs under the floating actions. */
|
|
100
|
+
.nm-code-block > .nm-code-block__actions ~ .nm-code-block__content,
|
|
101
|
+
.nm-code-block > .nm-code-block__content:has(~ .nm-code-block__actions) {
|
|
102
|
+
padding-right: calc(var(--nm-icon-control) + var(--nm-space-16));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.nm-code-block__content[data-wrap] {
|
|
106
|
+
white-space: pre-wrap;
|
|
107
|
+
overflow-wrap: anywhere;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.nm-code-block__content[data-collapsed] {
|
|
111
|
+
max-height: calc(var(--nm-code-collapsed) * 1lh + var(--nm-space-16) * 2);
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
opacity: 0.45;
|
|
114
|
+
-webkit-mask-image: linear-gradient(to bottom, var(--nm-fg) 55%, transparent);
|
|
115
|
+
mask-image: linear-gradient(to bottom, var(--nm-fg) 55%, transparent);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.nm-code-block__code {
|
|
119
|
+
display: grid;
|
|
120
|
+
min-width: max-content;
|
|
121
|
+
min-height: 1lh;
|
|
122
|
+
align-content: start;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.nm-code-block__content[data-wrap] .nm-code-block__code {
|
|
126
|
+
min-width: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.nm-code-block__line {
|
|
130
|
+
position: relative;
|
|
131
|
+
display: block;
|
|
132
|
+
min-height: 1lh;
|
|
133
|
+
margin: 0 calc(var(--nm-space-16) * -1);
|
|
134
|
+
padding: 0 var(--nm-space-16);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.nm-code-block__content[data-numbered] .nm-code-block__line {
|
|
138
|
+
counter-increment: line;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.nm-code-block__content[data-numbered] .nm-code-block__line::before {
|
|
142
|
+
content: counter(line);
|
|
143
|
+
display: inline-block;
|
|
144
|
+
width: var(--nm-code-gutter);
|
|
145
|
+
margin-right: var(--nm-space-16);
|
|
146
|
+
color: var(--nm-fg-subtle);
|
|
147
|
+
text-align: end;
|
|
148
|
+
user-select: none;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.nm-code-block__line[data-variant='highlighted'],
|
|
152
|
+
.nm-code-block__line[data-variant='added'] {
|
|
153
|
+
background: var(--nm-panel);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.nm-code-block__line[data-variant='removed'] {
|
|
157
|
+
background: rgb(var(--nm-destructive-rgb) / 0.12);
|
|
158
|
+
color: var(--nm-destructive);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.nm-code-block__line[data-variant='added']::after,
|
|
162
|
+
.nm-code-block__line[data-variant='removed']::after {
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: 0;
|
|
165
|
+
left: var(--nm-space-4);
|
|
166
|
+
color: var(--nm-fg-subtle);
|
|
167
|
+
user-select: none;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.nm-code-block__line[data-variant='added']::after {
|
|
171
|
+
content: '+';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.nm-code-block__line[data-variant='removed']::after {
|
|
175
|
+
content: '−';
|
|
176
|
+
color: var(--nm-destructive);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.nm-code-block__toggle {
|
|
180
|
+
position: absolute;
|
|
181
|
+
bottom: var(--nm-space-16);
|
|
182
|
+
left: 50%;
|
|
183
|
+
z-index: 1;
|
|
184
|
+
transform: translateX(-50%);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Once open, the button sits below the code. */
|
|
188
|
+
.nm-code-block:not([data-collapsed]) > .nm-code-block__toggle {
|
|
189
|
+
position: static;
|
|
190
|
+
display: flex;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
padding: 0 0 var(--nm-space-16);
|
|
193
|
+
transform: none;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.nm-code-block__footer {
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
gap: var(--nm-space-8);
|
|
200
|
+
padding: var(--nm-space-8) var(--nm-space-16) var(--nm-space-12);
|
|
201
|
+
color: var(--nm-fg-muted);
|
|
202
|
+
font-size: var(--nm-type-ui-sm);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.nm-code-block__token[data-token='keyword'] {
|
|
206
|
+
color: var(--nm-syntax-keyword);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.nm-code-block__token[data-token='string'] {
|
|
210
|
+
color: var(--nm-syntax-string);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.nm-code-block__token[data-token='function'] {
|
|
214
|
+
color: var(--nm-syntax-function);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.nm-code-block__token[data-token='constant'] {
|
|
218
|
+
color: var(--nm-syntax-constant);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.nm-code-block__token[data-token='comment'] {
|
|
222
|
+
color: var(--nm-syntax-comment);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/* The toggle shows when the block is hovered or the button has focus. Touch screens always show it. */
|
|
226
|
+
.nm-code-block__toggle {
|
|
227
|
+
opacity: 0;
|
|
228
|
+
transition: opacity var(--nm-motion-fast, 0.12s);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.nm-code-block:hover .nm-code-block__toggle,
|
|
232
|
+
.nm-code-block__toggle:focus-within {
|
|
233
|
+
opacity: 1;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
@media (hover: none) {
|
|
237
|
+
.nm-code-block__toggle {
|
|
238
|
+
opacity: 1;
|
|
239
|
+
}
|
|
240
|
+
}
|