@streamline-pulse/formkrafter-core 0.34.0 → 0.36.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.
@@ -5,12 +5,22 @@ import type { Rule } from "../rules/rule.js";
5
5
  import type { BrickType } from "./brick-type.js";
6
6
  import type { BrickBaseConfigs } from "./common-brick-props.js";
7
7
  import type { BrickStyles } from "../utils/brick-styles.js";
8
- /** Where a brick sits in its row: `columns` on a row, `span` on one of its children. */
8
+ /** One column of a row: `auto`, `min-content`, `max-content`, `2fr`, `12rem`, `30%`, or `minmax(a, b)` of those. */
9
+ export type RowTrack = string;
10
+ /** Where a brick sits in its row: `columns` and `labels` on a row, `span` on one of its children. */
9
11
  export interface BrickLayout {
10
- /** On a row: the number of equal columns, so a lone field keeps its share instead of the whole width. */
11
- columns?: number;
12
+ /**
13
+ * On a row: the number of equal columns, so a lone field keeps its share instead of the whole width;
14
+ * or one track size per column, e.g. `["auto", "1fr", "2fr"]`, so a checkbox column takes only its content.
15
+ */
16
+ columns?: number | RowTrack[];
12
17
  /** On a child of a row: how many of the row's columns it takes (1 by default). */
13
18
  span?: number;
19
+ /**
20
+ * On a row: `"hidden"` hides its fields' labels from view and keeps them as accessible names,
21
+ * so a row of a table is one line high. A checkbox keeps its label beside the box.
22
+ */
23
+ labels?: "visible" | "hidden";
14
24
  }
15
25
  export interface BrickSpec {
16
26
  type: BrickType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamline-pulse/formkrafter-core",
3
- "version": "0.34.0",
3
+ "version": "0.36.0",
4
4
  "description": "Framework-agnostic core for FormKrafter: form specs, RFC 6902 ops with undo/redo, Ajv validation, sandboxed rules engine and injectable services",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,7 +41,8 @@
41
41
  "types": "./dist/index.d.ts",
42
42
  "import": "./dist/index.js"
43
43
  },
44
- "./schema/form-spec.schema.json": "./schema/form-spec.schema.json"
44
+ "./schema/form-spec.schema.json": "./schema/form-spec.schema.json",
45
+ "./schema/form-spec.strict.schema.json": "./schema/form-spec.strict.schema.json"
45
46
  },
46
47
  "publishConfig": {
47
48
  "access": "public"
@@ -70,10 +70,25 @@
70
70
  },
71
71
  "layout": {
72
72
  "type": "object",
73
- "description": "Placement in a row: \"columns\" on the row itself (equal columns, a lone field keeps its share), \"span\" on one of its children (how many columns it takes). A row still stacks on narrow screens.",
73
+ "description": "Placement in a row: \"columns\" and \"labels\" on the row itself, \"span\" on one of its children (how many columns it takes). A row still stacks on narrow screens.",
74
74
  "properties": {
75
- "columns": { "type": "integer", "minimum": 1, "maximum": 12 },
76
- "span": { "type": "integer", "minimum": 1, "maximum": 12 }
75
+ "columns": {
76
+ "description": "A number of equal columns (a lone field keeps its share), or one track size per column, e.g. [\"auto\", \"1fr\", \"2fr\"], so a checkbox column takes only its content.",
77
+ "anyOf": [
78
+ { "type": "integer", "minimum": 1, "maximum": 12 },
79
+ {
80
+ "type": "array",
81
+ "minItems": 1,
82
+ "maxItems": 12,
83
+ "items": { "$ref": "#/$defs/rowTrack" }
84
+ }
85
+ ]
86
+ },
87
+ "span": { "type": "integer", "minimum": 1, "maximum": 12 },
88
+ "labels": {
89
+ "enum": ["visible", "hidden"],
90
+ "description": "\"hidden\" hides the labels of the row's fields from view and keeps them as accessible names, so a row of a table is one line high. A checkbox keeps its label beside the box."
91
+ }
77
92
  },
78
93
  "additionalProperties": false
79
94
  },
@@ -86,6 +101,12 @@
86
101
  "additionalProperties": false
87
102
  },
88
103
 
104
+ "rowTrack": {
105
+ "type": "string",
106
+ "description": "One column of a row: auto, min-content, max-content, 0, a length in fr, px, rem, em, ch or %, or minmax(a, b) of those.",
107
+ "pattern": "^((auto|min-content|max-content|0|[0-9]+(\\.[0-9]+)?(fr|px|rem|em|ch|%))|minmax\\( *(auto|min-content|max-content|0|[0-9]+(\\.[0-9]+)?(fr|px|rem|em|ch|%)) *, *(auto|min-content|max-content|0|[0-9]+(\\.[0-9]+)?(fr|px|rem|em|ch|%)) *\\))$"
108
+ },
109
+
89
110
  "brickType": {
90
111
  "enum": ["panel", "input", "collection", "output", "action"]
91
112
  },