@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,43 @@
|
|
|
1
|
+
import { DayPicker, type ChevronProps, type DayPickerProps } from 'react-day-picker';
|
|
2
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
3
|
+
import { NmIcon } from '../nm-icon/nm-icon.tsx';
|
|
4
|
+
|
|
5
|
+
function NmCalendarChevron({ orientation = 'left' }: ChevronProps) {
|
|
6
|
+
return <NmIcon id="chevron" className={`nm-calendar__chevron nm-calendar__chevron--${orientation}`} />;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** react-day-picker, in the shadcn Calendar composition, drawn entirely by NIF tokens. Single, multiple or range. */
|
|
10
|
+
export function NmCalendar({ className, showOutsideDays = true, ...props }: DayPickerProps) {
|
|
11
|
+
return (
|
|
12
|
+
<DayPicker
|
|
13
|
+
showOutsideDays={showOutsideDays}
|
|
14
|
+
className={nmClass('nm-calendar', className)}
|
|
15
|
+
classNames={{
|
|
16
|
+
root: 'nm-calendar__root',
|
|
17
|
+
months: 'nm-calendar__months',
|
|
18
|
+
month: 'nm-calendar__month',
|
|
19
|
+
nav: 'nm-calendar__nav',
|
|
20
|
+
button_previous: 'nm-calendar__nav-button',
|
|
21
|
+
button_next: 'nm-calendar__nav-button',
|
|
22
|
+
month_caption: 'nm-calendar__caption',
|
|
23
|
+
caption_label: 'nm-calendar__caption-label',
|
|
24
|
+
month_grid: 'nm-calendar__grid',
|
|
25
|
+
weekdays: 'nm-calendar__weekdays',
|
|
26
|
+
weekday: 'nm-calendar__weekday',
|
|
27
|
+
week: 'nm-calendar__week',
|
|
28
|
+
day: 'nm-calendar__day',
|
|
29
|
+
day_button: 'nm-calendar__day-button',
|
|
30
|
+
selected: 'nm-calendar__day--selected',
|
|
31
|
+
today: 'nm-calendar__day--today',
|
|
32
|
+
outside: 'nm-calendar__day--outside',
|
|
33
|
+
disabled: 'nm-calendar__day--disabled',
|
|
34
|
+
hidden: 'nm-calendar__day--hidden',
|
|
35
|
+
range_start: 'nm-calendar__day--range-start',
|
|
36
|
+
range_middle: 'nm-calendar__day--range-middle',
|
|
37
|
+
range_end: 'nm-calendar__day--range-end',
|
|
38
|
+
}}
|
|
39
|
+
components={{ Chevron: NmCalendarChevron }}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
.nm-card {
|
|
2
|
+
--nm-card-pad: var(--nm-space-16);
|
|
3
|
+
box-sizing: border-box;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--nm-space-12);
|
|
7
|
+
min-width: 0;
|
|
8
|
+
padding: var(--nm-card-pad);
|
|
9
|
+
border: var(--nm-rule) solid var(--nm-line-strong);
|
|
10
|
+
border-radius: var(--nm-radius-lg);
|
|
11
|
+
background: var(--nm-raised);
|
|
12
|
+
color: var(--nm-fg);
|
|
13
|
+
font-family: var(--nm-font);
|
|
14
|
+
font-size: var(--nm-type-ui);
|
|
15
|
+
text-decoration: none;
|
|
16
|
+
transition:
|
|
17
|
+
border-color 0.15s,
|
|
18
|
+
background 0.15s;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* The small card is the compact one: 12px padding and the control radius. */
|
|
22
|
+
.nm-card[data-size='sm'] {
|
|
23
|
+
--nm-card-pad: var(--nm-space-12);
|
|
24
|
+
gap: var(--nm-space-8);
|
|
25
|
+
border-radius: var(--nm-control-r);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.nm-card[data-variant='outline'] {
|
|
29
|
+
background: transparent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.nm-card[data-variant='muted'] {
|
|
33
|
+
border-color: transparent;
|
|
34
|
+
background: var(--nm-panel);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nm-card[data-interactive] {
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.nm-card[data-interactive]:hover:not([data-disabled]) {
|
|
42
|
+
border-color: var(--nm-stroke);
|
|
43
|
+
background: var(--nm-inset);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.nm-card[data-interactive]:focus-visible {
|
|
47
|
+
border-color: var(--nm-fg);
|
|
48
|
+
outline: var(--nm-rule) solid var(--focus);
|
|
49
|
+
outline-offset: var(--nm-space-2);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.nm-card[data-selected] {
|
|
53
|
+
border-color: var(--nm-fg);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.nm-card[data-disabled] {
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
opacity: 0.5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.nm-card__header {
|
|
62
|
+
display: grid;
|
|
63
|
+
grid-template-columns: 1fr auto;
|
|
64
|
+
align-items: start;
|
|
65
|
+
gap: var(--nm-space-2) var(--nm-space-12);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.nm-card__title {
|
|
69
|
+
grid-column: 1;
|
|
70
|
+
font-weight: var(--nm-weight-medium);
|
|
71
|
+
line-height: var(--nm-leading-snug);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.nm-card__description {
|
|
75
|
+
grid-column: 1;
|
|
76
|
+
color: var(--nm-fg-muted);
|
|
77
|
+
font-size: var(--nm-type-ui-sm);
|
|
78
|
+
line-height: var(--nm-leading-normal);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.nm-card__action {
|
|
82
|
+
grid-column: 2;
|
|
83
|
+
grid-row: 1 / span 2;
|
|
84
|
+
align-self: start;
|
|
85
|
+
justify-self: end;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.nm-card__content {
|
|
89
|
+
color: var(--nm-fg-muted);
|
|
90
|
+
line-height: var(--nm-leading-normal);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.nm-card__footer {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--nm-space-8);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.nm-card__media {
|
|
100
|
+
grid-column: 1;
|
|
101
|
+
grid-row: 1 / span 2;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: flex-start;
|
|
104
|
+
padding-top: var(--nm-space-2);
|
|
105
|
+
color: var(--nm-fg-subtle);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* With media, the header has three columns and the text moves to the middle one. */
|
|
109
|
+
.nm-card__header:has(.nm-card__media) {
|
|
110
|
+
grid-template-columns: auto 1fr auto;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.nm-card__header:has(.nm-card__media) > .nm-card__title,
|
|
114
|
+
.nm-card__header:has(.nm-card__media) > .nm-card__description {
|
|
115
|
+
grid-column: 2;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.nm-card__header:has(.nm-card__media) > .nm-card__action {
|
|
119
|
+
grid-column: 3;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.nm-card:has(.nm-card__media) > .nm-card__footer {
|
|
123
|
+
padding-left: calc(var(--nm-icon-button) + var(--nm-space-12));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.nm-card__header[data-align='center'] > .nm-card__media,
|
|
127
|
+
.nm-card__header[data-align='center'] > .nm-card__action {
|
|
128
|
+
align-self: center;
|
|
129
|
+
padding-top: 0;
|
|
130
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { nmClass } from '../../lib/nm-class.ts';
|
|
3
|
+
|
|
4
|
+
export const NM_CARD_VARIANTS = ['default', 'outline', 'muted'] as const;
|
|
5
|
+
export const NM_CARD_SIZES = ['default', 'sm'] as const;
|
|
6
|
+
export type NmCardVariant = (typeof NM_CARD_VARIANTS)[number];
|
|
7
|
+
export type NmCardSize = (typeof NM_CARD_SIZES)[number];
|
|
8
|
+
|
|
9
|
+
type CardOptions = {
|
|
10
|
+
variant?: NmCardVariant;
|
|
11
|
+
size?: NmCardSize;
|
|
12
|
+
/** The card is the person's current choice. */
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
/** The card cannot be used. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A surface that groups related content. The shadcn Card composition, styled by NIF tokens.
|
|
20
|
+
* Give it an `href` and it becomes a link, with hover and focus states.
|
|
21
|
+
*/
|
|
22
|
+
export function NmCard({
|
|
23
|
+
className,
|
|
24
|
+
variant = 'default',
|
|
25
|
+
size = 'default',
|
|
26
|
+
selected,
|
|
27
|
+
disabled,
|
|
28
|
+
href,
|
|
29
|
+
...props
|
|
30
|
+
}: Omit<ComponentProps<'div'>, 'onClick'> & CardOptions & { href?: string; onClick?: ComponentProps<'a'>['onClick'] }) {
|
|
31
|
+
const common = {
|
|
32
|
+
'data-slot': 'card',
|
|
33
|
+
'data-variant': variant,
|
|
34
|
+
'data-size': size,
|
|
35
|
+
'data-selected': selected ? '' : undefined,
|
|
36
|
+
'data-disabled': disabled ? '' : undefined,
|
|
37
|
+
'data-interactive': href != null || props.onClick != null ? '' : undefined,
|
|
38
|
+
className: nmClass('nm-card', className),
|
|
39
|
+
} as const;
|
|
40
|
+
if (href != null) {
|
|
41
|
+
return (
|
|
42
|
+
<a
|
|
43
|
+
{...common}
|
|
44
|
+
href={disabled ? undefined : href}
|
|
45
|
+
aria-current={selected ? 'true' : undefined}
|
|
46
|
+
aria-disabled={disabled ? true : undefined}
|
|
47
|
+
{...(props as ComponentProps<'a'>)}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return <div {...common} {...(props as ComponentProps<'div'>)} />;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `align="center"` centres a leading icon and a trailing action against the text, as in a row of apps. */
|
|
55
|
+
export function NmCardHeader({ className, align = 'start', ...props }: ComponentProps<'div'> & { align?: 'start' | 'center' }) {
|
|
56
|
+
return <div data-slot="card-header" data-align={align} className={nmClass('nm-card__header', className)} {...props} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function NmCardTitle({ className, ...props }: ComponentProps<'div'>) {
|
|
60
|
+
return <div data-slot="card-title" className={nmClass('nm-card__title', className)} {...props} />;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function NmCardDescription({ className, ...props }: ComponentProps<'div'>) {
|
|
64
|
+
return <div data-slot="card-description" className={nmClass('nm-card__description', className)} {...props} />;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Sits at the end of the header, beside the title. */
|
|
68
|
+
export function NmCardAction({ className, ...props }: ComponentProps<'div'>) {
|
|
69
|
+
return <div data-slot="card-action" className={nmClass('nm-card__action', className)} {...props} />;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function NmCardContent({ className, ...props }: ComponentProps<'div'>) {
|
|
73
|
+
return <div data-slot="card-content" className={nmClass('nm-card__content', className)} {...props} />;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function NmCardFooter({ className, ...props }: ComponentProps<'div'>) {
|
|
77
|
+
return <div data-slot="card-footer" className={nmClass('nm-card__footer', className)} {...props} />;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A leading icon or image in the header. The title, description and footer line up beside it. */
|
|
81
|
+
export function NmCardMedia({ className, ...props }: ComponentProps<'div'>) {
|
|
82
|
+
return <div data-slot="card-media" className={nmClass('nm-card__media', className)} {...props} />;
|
|
83
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { NM_CHATBOX_ICON_SRC, type NmChatboxIconId } from '../../config/nm-chatbox-icons.ts';
|
|
3
|
+
import { hasNmLucide, NmLucide } from '../nm-icon/nm-lucide.tsx';
|
|
4
|
+
|
|
5
|
+
export const NM_CHATBOX_LUCIDE_MAP: Record<NmChatboxIconId, string> = {
|
|
6
|
+
paperclip: 'plus',
|
|
7
|
+
settings: 'settings',
|
|
8
|
+
globe: 'globe',
|
|
9
|
+
spreadsheet: 'spreadsheet',
|
|
10
|
+
pointer: 'mouse-pointer',
|
|
11
|
+
mic: 'mic',
|
|
12
|
+
'mic-off': 'mic-off',
|
|
13
|
+
'audio-lines': 'audio-lines',
|
|
14
|
+
send: 'send',
|
|
15
|
+
stop: 'stop',
|
|
16
|
+
loader: 'loader',
|
|
17
|
+
x: 'x',
|
|
18
|
+
check: 'check',
|
|
19
|
+
integration: 'cable',
|
|
20
|
+
app: 'app',
|
|
21
|
+
steer: 'workflow',
|
|
22
|
+
queue: 'ellipsis',
|
|
23
|
+
'interrupt-steer': 'pause',
|
|
24
|
+
'interrupt-send': 'monitor',
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export function NmChatboxIcon({
|
|
28
|
+
id,
|
|
29
|
+
className,
|
|
30
|
+
}: {
|
|
31
|
+
id: NmChatboxIconId;
|
|
32
|
+
className?: string;
|
|
33
|
+
}): ReactNode {
|
|
34
|
+
const lucideId = NM_CHATBOX_LUCIDE_MAP[id];
|
|
35
|
+
if (lucideId != null && hasNmLucide(lucideId)) {
|
|
36
|
+
return <NmLucide id={lucideId} className={className ?? 'nm-icon'} />;
|
|
37
|
+
}
|
|
38
|
+
return <img className={className ?? 'nm-icon'} src={NM_CHATBOX_ICON_SRC[id]} alt="" />;
|
|
39
|
+
}
|