@nordmanai/nif 0.2.10 → 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.
@@ -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 declare function NmFieldGroup({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
8
- export declare function NmFormField({ className, orientation, invalid, disabled, ...props }: ComponentProps<'div'> & {
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.10",
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": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.10",
2
+ "version": "0.2.11",
3
3
  "versions": {
4
4
  "@animate-ui/react": "^2.4.2",
5
5
  "@base-ui/react": "^1.9.0",
@@ -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 function NmFieldGroup({ className, ...props }: ComponentProps<'div'>) {
15
- return <div data-slot="field-group" className={nmClass('nm-field-group', className)} {...props} />;
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'> & { orientation?: 'vertical' | 'horizontal'; invalid?: boolean; disabled?: boolean }) {
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)}
@@ -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;