@nordmanai/nif 0.2.9 → 0.2.11
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/dist/index.js +12 -16
- package/dist/styles.css +1 -1
- package/dist/ui/components/nm-form-field/nm-form-field.d.ts +12 -2
- package/package.json +1 -1
- package/registry/index.json +1 -1
- package/registry/ui/components/nm-combobox/nm-combobox.tsx +0 -3
- package/registry/ui/components/nm-form-field/nm-form-field.css +22 -0
- package/registry/ui/components/nm-form-field/nm-form-field.tsx +28 -3
- package/registry/ui/components/nm-select/nm-select.css +7 -3
- package/registry/ui/components/nm-select/nm-select.tsx +0 -3
- package/registry/ui/styles/tokens.css +4 -0
|
@@ -4,11 +4,21 @@ export declare function NmFieldSet({ className, ...props }: ComponentProps<'fiel
|
|
|
4
4
|
export declare function NmFieldLegend({ className, variant, ...props }: ComponentProps<'legend'> & {
|
|
5
5
|
variant?: 'legend' | 'label';
|
|
6
6
|
}): import("react").JSX.Element;
|
|
7
|
-
export
|
|
8
|
-
|
|
7
|
+
export type NmFieldGroupColumns = 1 | 2 | 3;
|
|
8
|
+
/**
|
|
9
|
+
* A group stacks by default. With columns, it lays fields out in a grid of up to two or three
|
|
10
|
+
* columns, falling back to fewer when the container is narrow so long pages stay short on wide
|
|
11
|
+
* screens without getting cramped on small ones. A child with span="full" takes the whole row.
|
|
12
|
+
*/
|
|
13
|
+
export declare function NmFieldGroup({ className, columns, ...props }: ComponentProps<'div'> & {
|
|
14
|
+
columns?: NmFieldGroupColumns;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function NmFormField({ className, orientation, invalid, disabled, span, ...props }: ComponentProps<'div'> & {
|
|
9
17
|
orientation?: 'vertical' | 'horizontal';
|
|
10
18
|
invalid?: boolean;
|
|
11
19
|
disabled?: boolean;
|
|
20
|
+
/** Inside a multi-column group: take the whole row. */
|
|
21
|
+
span?: 'full';
|
|
12
22
|
}): import("react").JSX.Element;
|
|
13
23
|
export declare function NmFieldContent({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
14
24
|
export declare function NmFieldLabel({ className, ...props }: ComponentProps<'label'>): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordmanai/nif",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Nordman Interface Framework: the one UI and UX system for every Nordman product. Base UI, in the shadcn composition, styled by NIF tokens.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
package/registry/index.json
CHANGED
|
@@ -55,9 +55,6 @@ export function NmComboboxItem({ className, children, ...props }: ComboboxPrimit
|
|
|
55
55
|
return (
|
|
56
56
|
<ComboboxPrimitive.Item data-slot="combobox-item" className={nmClass('nm-menu__item nm-select__item', className as string)} {...props}>
|
|
57
57
|
<span className="nm-select__text">{children}</span>
|
|
58
|
-
<ComboboxPrimitive.ItemIndicator className="nm-select__check">
|
|
59
|
-
<NmIcon id="check" />
|
|
60
|
-
</ComboboxPrimitive.ItemIndicator>
|
|
61
58
|
</ComboboxPrimitive.Item>
|
|
62
59
|
);
|
|
63
60
|
}
|
|
@@ -27,6 +27,28 @@
|
|
|
27
27
|
gap: var(--nm-space-24);
|
|
28
28
|
width: 100%;
|
|
29
29
|
}
|
|
30
|
+
/* Columns: a cell is never narrower than --nm-width-field-min, so the count drops as the
|
|
31
|
+
container narrows and reaches one column on small screens. */
|
|
32
|
+
.nm-field-group[data-columns] {
|
|
33
|
+
display: grid;
|
|
34
|
+
gap: var(--nm-space-24) var(--nm-space-16);
|
|
35
|
+
align-items: start;
|
|
36
|
+
}
|
|
37
|
+
.nm-field-group[data-columns='2'] {
|
|
38
|
+
grid-template-columns: repeat(
|
|
39
|
+
auto-fit,
|
|
40
|
+
minmax(min(100%, max(var(--nm-width-field-min), calc(var(--nm-field-col-2) - var(--nm-space-16)))), 1fr)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
.nm-field-group[data-columns='3'] {
|
|
44
|
+
grid-template-columns: repeat(
|
|
45
|
+
auto-fit,
|
|
46
|
+
minmax(min(100%, max(var(--nm-width-field-min), calc(var(--nm-field-col-3) - var(--nm-space-16)))), 1fr)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
.nm-field-group[data-columns] > [data-span='full'] {
|
|
50
|
+
grid-column: 1 / -1;
|
|
51
|
+
}
|
|
30
52
|
|
|
31
53
|
.nm-form-field {
|
|
32
54
|
display: flex;
|
|
@@ -11,8 +11,25 @@ export function NmFieldLegend({ className, variant = 'legend', ...props }: Compo
|
|
|
11
11
|
return <legend data-slot="field-legend" data-variant={variant} className={nmClass('nm-field-legend', className)} {...props} />;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
15
|
-
|
|
14
|
+
export type NmFieldGroupColumns = 1 | 2 | 3;
|
|
15
|
+
/**
|
|
16
|
+
* A group stacks by default. With columns, it lays fields out in a grid of up to two or three
|
|
17
|
+
* columns, falling back to fewer when the container is narrow so long pages stay short on wide
|
|
18
|
+
* screens without getting cramped on small ones. A child with span="full" takes the whole row.
|
|
19
|
+
*/
|
|
20
|
+
export function NmFieldGroup({
|
|
21
|
+
className,
|
|
22
|
+
columns = 1,
|
|
23
|
+
...props
|
|
24
|
+
}: ComponentProps<'div'> & { columns?: NmFieldGroupColumns }) {
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
data-slot="field-group"
|
|
28
|
+
data-columns={columns > 1 ? columns : undefined}
|
|
29
|
+
className={nmClass('nm-field-group', className)}
|
|
30
|
+
{...props}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
16
33
|
}
|
|
17
34
|
|
|
18
35
|
export function NmFormField({
|
|
@@ -20,13 +37,21 @@ export function NmFormField({
|
|
|
20
37
|
orientation = 'vertical',
|
|
21
38
|
invalid,
|
|
22
39
|
disabled,
|
|
40
|
+
span,
|
|
23
41
|
...props
|
|
24
|
-
}: ComponentProps<'div'> & {
|
|
42
|
+
}: ComponentProps<'div'> & {
|
|
43
|
+
orientation?: 'vertical' | 'horizontal';
|
|
44
|
+
invalid?: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Inside a multi-column group: take the whole row. */
|
|
47
|
+
span?: 'full';
|
|
48
|
+
}) {
|
|
25
49
|
return (
|
|
26
50
|
<div
|
|
27
51
|
data-slot="field"
|
|
28
52
|
role="group"
|
|
29
53
|
data-orientation={orientation}
|
|
54
|
+
data-span={span}
|
|
30
55
|
data-invalid={invalid ? '' : undefined}
|
|
31
56
|
data-disabled={disabled ? '' : undefined}
|
|
32
57
|
className={nmClass('nm-form-field', className)}
|
|
@@ -72,7 +72,11 @@
|
|
|
72
72
|
min-width: 0;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
/* One choice is in effect, so the chosen row is shown by its fill. No mark: a mark reads as a toggle. */
|
|
76
|
+
.nm-select__item[data-selected] {
|
|
77
|
+
background: var(--nm-panel);
|
|
78
|
+
color: var(--nm-fg);
|
|
79
|
+
}
|
|
80
|
+
.nm-select__item[data-selected][data-highlighted] {
|
|
81
|
+
background: var(--nm-line);
|
|
78
82
|
}
|
|
@@ -44,9 +44,6 @@ export function NmSelectItem({ className, children, ...props }: SelectPrimitive.
|
|
|
44
44
|
return (
|
|
45
45
|
<SelectPrimitive.Item data-slot="select-item" className={nmClass('nm-menu__item nm-select__item', className as string)} {...props}>
|
|
46
46
|
<SelectPrimitive.ItemText className="nm-select__text">{children}</SelectPrimitive.ItemText>
|
|
47
|
-
<SelectPrimitive.ItemIndicator className="nm-select__check">
|
|
48
|
-
<NmIcon id="check" />
|
|
49
|
-
</SelectPrimitive.ItemIndicator>
|
|
50
47
|
</SelectPrimitive.Item>
|
|
51
48
|
);
|
|
52
49
|
}
|
|
@@ -274,6 +274,10 @@
|
|
|
274
274
|
--nm-width-popup: 18rem;
|
|
275
275
|
--nm-width-tooltip: 20rem;
|
|
276
276
|
--nm-width-form: 28rem;
|
|
277
|
+
/* Field grids: the narrowest a field cell may be, and the share of the row per column. */
|
|
278
|
+
--nm-width-field-min: 14rem;
|
|
279
|
+
--nm-field-col-2: 50%;
|
|
280
|
+
--nm-field-col-3: 33.333%;
|
|
277
281
|
--nm-code-gutter: 3ch;
|
|
278
282
|
--nm-width-date: 11rem;
|
|
279
283
|
--nm-width-dialog: 40rem;
|