@panneau/ui 5.0.0-alpha.11 → 5.0.0-alpha.12

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.
@@ -155,3 +155,20 @@
155
155
  margin: 0 0 var(--panneau-space-1);
156
156
  padding: 0;
157
157
  }
158
+
159
+ /* A legend with controls at the end of its line. */
160
+ .panneau-field-legend-row {
161
+ display: flex;
162
+ flex-wrap: wrap;
163
+ align-items: center;
164
+ gap: var(--panneau-space-1) var(--panneau-space-3);
165
+ min-height: var(--panneau-control-height-sm);
166
+ }
167
+
168
+ .panneau-field-legend-end {
169
+ display: flex;
170
+ flex-wrap: wrap;
171
+ align-items: center;
172
+ gap: var(--panneau-space-2);
173
+ margin-inline-start: auto;
174
+ }
@@ -11,6 +11,8 @@ var bare = "panneau-field-bare";
11
11
  var adornment = "panneau-field-adornment";
12
12
  var fieldset = "panneau-field-fieldset";
13
13
  var legend = "panneau-field-legend";
14
+ var legendRow = "panneau-field-legend-row";
15
+ var legendEnd = "panneau-field-legend-end";
14
16
  var Field_module_default = {
15
17
  field,
16
18
  label,
@@ -22,9 +24,11 @@ var Field_module_default = {
22
24
  bare,
23
25
  adornment,
24
26
  fieldset,
25
- legend
27
+ legend,
28
+ legendRow,
29
+ legendEnd
26
30
  };
27
31
  //#endregion
28
- export { adornment, bare, control, Field_module_default as default, description, error, errors, field, fieldset, label, legend, required };
32
+ export { adornment, bare, control, Field_module_default as default, description, error, errors, field, fieldset, label, legend, legendEnd, legendRow, required };
29
33
 
30
34
  //# sourceMappingURL=Field.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.module.js","names":[],"sources":["../../src/field/Field.module.css"],"sourcesContent":["/* Shared look of labelled controls: label, description, errors and the control itself. */\n\n.field {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-field-gap, var(--panneau-space-1));\n min-width: 0;\n}\n\n.label {\n font-size: var(--panneau-field-label-font-size, var(--panneau-font-size-md));\n font-weight: var(--panneau-field-label-font-weight, var(--panneau-font-weight-medium));\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n overflow-wrap: anywhere;\n}\n\n.required {\n margin-inline-start: 0.2em;\n color: var(--panneau-color-danger);\n}\n\n.description {\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-text-muted);\n}\n\n.errors {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-danger);\n}\n\n.error {\n display: block;\n}\n\n.control {\n display: flex;\n align-items: center;\n width: 100%;\n min-width: 0;\n min-height: var(--panneau-control-height);\n padding: 0 var(--panneau-input-padding-x, var(--panneau-control-padding-x));\n font-size: var(--panneau-font-size-control);\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n background-color: var(--panneau-input-bg, var(--panneau-color-surface));\n border: var(--panneau-input-border-width, var(--panneau-border-width)) solid\n var(--panneau-input-border-color, var(--panneau-color-border-control));\n border-radius: var(--panneau-input-radius, var(--panneau-radius-md));\n transition:\n border-color var(--panneau-duration),\n box-shadow var(--panneau-duration);\n}\n\n.control::placeholder {\n color: var(--panneau-color-text-muted);\n opacity: 1;\n}\n\n.control[data-hovered],\n.control:hover {\n border-color: var(--panneau-input-border-color-hover, var(--panneau-color-text-muted));\n}\n\n.control[data-focused],\n.control[data-focus-within],\n.control[data-focus-visible],\n.control:focus-within {\n border-color: var(--panneau-color-focus);\n outline: none;\n box-shadow: 0 0 0 1px var(--panneau-color-focus);\n}\n\n.control[data-invalid] {\n border-color: var(--panneau-color-danger);\n}\n\n.control[data-invalid][data-focused],\n.control[data-invalid][data-focus-within],\n.control[data-invalid]:focus-within {\n box-shadow: 0 0 0 1px var(--panneau-color-danger);\n}\n\n.control[data-disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n background-color: var(--panneau-color-surface-sunken);\n}\n\n.control[data-readonly],\n.control[readonly] {\n background-color: var(--panneau-color-surface-sunken);\n}\n\n/* An input inside a control (with adornments, segments or buttons): the control draws the box. */\n.bare {\n flex: 1 1 auto;\n min-width: 0;\n height: 100%;\n min-height: calc(var(--panneau-control-height) - 2 * var(--panneau-border-width));\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n outline: none;\n}\n\n.bare::placeholder {\n color: var(--panneau-color-text-muted);\n opacity: 1;\n}\n\n.adornment {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n gap: var(--panneau-space-1);\n color: var(--panneau-color-text-muted);\n white-space: nowrap;\n}\n\n.adornment:first-child {\n margin-inline-end: var(--panneau-space-2);\n}\n\n.adornment:last-child {\n margin-inline-start: var(--panneau-space-2);\n}\n\n/* A text before or after the value reads with it, as one URL or one amount: `/pages/home`. */\n.adornment[data-text]:first-child {\n margin-inline-end: 0;\n}\n\n.adornment[data-text]:last-child {\n margin-inline-start: 0;\n}\n\n.fieldset {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-2);\n min-width: 0;\n}\n\n.legend {\n display: block;\n float: none;\n width: 100%;\n margin: 0 0 var(--panneau-space-1);\n padding: 0;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"Field.module.js","names":[],"sources":["../../src/field/Field.module.css"],"sourcesContent":["/* Shared look of labelled controls: label, description, errors and the control itself. */\n\n.field {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-field-gap, var(--panneau-space-1));\n min-width: 0;\n}\n\n.label {\n font-size: var(--panneau-field-label-font-size, var(--panneau-font-size-md));\n font-weight: var(--panneau-field-label-font-weight, var(--panneau-font-weight-medium));\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n overflow-wrap: anywhere;\n}\n\n.required {\n margin-inline-start: 0.2em;\n color: var(--panneau-color-danger);\n}\n\n.description {\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-text-muted);\n}\n\n.errors {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-1);\n font-size: var(--panneau-font-size-sm);\n color: var(--panneau-color-danger);\n}\n\n.error {\n display: block;\n}\n\n.control {\n display: flex;\n align-items: center;\n width: 100%;\n min-width: 0;\n min-height: var(--panneau-control-height);\n padding: 0 var(--panneau-input-padding-x, var(--panneau-control-padding-x));\n font-size: var(--panneau-font-size-control);\n line-height: var(--panneau-line-height-tight);\n color: var(--panneau-color-text);\n background-color: var(--panneau-input-bg, var(--panneau-color-surface));\n border: var(--panneau-input-border-width, var(--panneau-border-width)) solid\n var(--panneau-input-border-color, var(--panneau-color-border-control));\n border-radius: var(--panneau-input-radius, var(--panneau-radius-md));\n transition:\n border-color var(--panneau-duration),\n box-shadow var(--panneau-duration);\n}\n\n.control::placeholder {\n color: var(--panneau-color-text-muted);\n opacity: 1;\n}\n\n.control[data-hovered],\n.control:hover {\n border-color: var(--panneau-input-border-color-hover, var(--panneau-color-text-muted));\n}\n\n.control[data-focused],\n.control[data-focus-within],\n.control[data-focus-visible],\n.control:focus-within {\n border-color: var(--panneau-color-focus);\n outline: none;\n box-shadow: 0 0 0 1px var(--panneau-color-focus);\n}\n\n.control[data-invalid] {\n border-color: var(--panneau-color-danger);\n}\n\n.control[data-invalid][data-focused],\n.control[data-invalid][data-focus-within],\n.control[data-invalid]:focus-within {\n box-shadow: 0 0 0 1px var(--panneau-color-danger);\n}\n\n.control[data-disabled] {\n cursor: not-allowed;\n opacity: 0.6;\n background-color: var(--panneau-color-surface-sunken);\n}\n\n.control[data-readonly],\n.control[readonly] {\n background-color: var(--panneau-color-surface-sunken);\n}\n\n/* An input inside a control (with adornments, segments or buttons): the control draws the box. */\n.bare {\n flex: 1 1 auto;\n min-width: 0;\n height: 100%;\n min-height: calc(var(--panneau-control-height) - 2 * var(--panneau-border-width));\n padding: 0;\n font: inherit;\n color: inherit;\n background: transparent;\n border: 0;\n outline: none;\n}\n\n.bare::placeholder {\n color: var(--panneau-color-text-muted);\n opacity: 1;\n}\n\n.adornment {\n display: inline-flex;\n flex: 0 0 auto;\n align-items: center;\n gap: var(--panneau-space-1);\n color: var(--panneau-color-text-muted);\n white-space: nowrap;\n}\n\n.adornment:first-child {\n margin-inline-end: var(--panneau-space-2);\n}\n\n.adornment:last-child {\n margin-inline-start: var(--panneau-space-2);\n}\n\n/* A text before or after the value reads with it, as one URL or one amount: `/pages/home`. */\n.adornment[data-text]:first-child {\n margin-inline-end: 0;\n}\n\n.adornment[data-text]:last-child {\n margin-inline-start: 0;\n}\n\n.fieldset {\n display: flex;\n flex-direction: column;\n gap: var(--panneau-space-2);\n min-width: 0;\n}\n\n.legend {\n display: block;\n float: none;\n width: 100%;\n margin: 0 0 var(--panneau-space-1);\n padding: 0;\n}\n\n/* A legend with controls at the end of its line. */\n.legendRow {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--panneau-space-1) var(--panneau-space-3);\n min-height: var(--panneau-control-height-sm);\n}\n\n.legendEnd {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--panneau-space-2);\n margin-inline-start: auto;\n}\n"],"mappings":""}
@@ -2,6 +2,11 @@ import { type ReactNode } from 'react';
2
2
  export interface FieldsetProps {
3
3
  /** Title of the group of controls. */
4
4
  legend?: ReactNode;
5
+ /**
6
+ * Controls at the end of the legend's line, such as the locales of a value. The group is then
7
+ * named by the legend through `aria-labelledby`, since a `<legend>` can't share its line.
8
+ */
9
+ legendEnd?: ReactNode;
5
10
  description?: ReactNode;
6
11
  /** Errors of the group as a whole. */
7
12
  errors?: readonly string[];
@@ -18,5 +23,5 @@ export interface FieldsetProps {
18
23
  * (a group of fields, a list of blocks, a value per locale). The description and the errors
19
24
  * describe the group for assistive technologies.
20
25
  */
21
- export declare function Fieldset({ legend, description, errors, isRequired, isDisabled, children, className, legendClassName, descriptionClassName, errorsClassName, }: FieldsetProps): import("react").JSX.Element;
26
+ export declare function Fieldset({ legend, legendEnd, description, errors, isRequired, isDisabled, children, className, legendClassName, descriptionClassName, errorsClassName, }: FieldsetProps): import("react").JSX.Element;
22
27
  //# sourceMappingURL=Fieldset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../src/field/Fieldset.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,aAAa;IAC1B,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACrB,MAAM,EACN,WAAW,EACX,MAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,eAAe,GAClB,EAAE,aAAa,+BAyCf"}
1
+ {"version":3,"file":"Fieldset.d.ts","sourceRoot":"","sources":["../../src/field/Fieldset.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAS,MAAM,OAAO,CAAC;AAKxD,MAAM,WAAW,aAAa;IAC1B,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,sCAAsC;IACtC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EACrB,MAAM,EACN,SAAS,EACT,WAAW,EACX,MAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,QAAQ,EACR,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,eAAe,GAClB,EAAE,aAAa,+BA0Df"}
@@ -1,7 +1,7 @@
1
1
  import { cx } from "../utils/cx.js";
2
2
  import Field_module_default from "./Field.module.js";
3
3
  import { c } from "react/compiler-runtime";
4
- import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Fragment as Fragment$1, useId } from "react";
6
6
  //#region src/field/Fieldset.tsx
7
7
  /**
@@ -10,8 +10,8 @@ import { Fragment as Fragment$1, useId } from "react";
10
10
  * describe the group for assistive technologies.
11
11
  */
12
12
  function Fieldset(t0) {
13
- const $ = c(28);
14
- const { legend, description, errors: t1, isRequired: t2, isDisabled: t3, children, className, legendClassName, descriptionClassName, errorsClassName } = t0;
13
+ const $ = c(37);
14
+ const { legend, legendEnd, description, errors: t1, isRequired: t2, isDisabled: t3, children, className, legendClassName, descriptionClassName, errorsClassName } = t0;
15
15
  let t4;
16
16
  if ($[0] !== t1) {
17
17
  t4 = t1 === void 0 ? [] : t1;
@@ -32,78 +32,110 @@ function Fieldset(t0) {
32
32
  $[4] = t5;
33
33
  } else t5 = $[4];
34
34
  const describedBy = t5.join(" ");
35
+ const hasLegend = legend !== void 0 && legend !== null;
36
+ const hasLegendEnd = legendEnd !== void 0 && legendEnd !== null;
35
37
  let t6;
36
- if ($[5] !== className) {
37
- t6 = cx("panneau-fieldset", Field_module_default.fieldset, className);
38
- $[5] = className;
38
+ if ($[5] !== isRequired) {
39
+ t6 = isRequired ? /* @__PURE__ */ jsx("span", {
40
+ className: Field_module_default.required,
41
+ "aria-hidden": "true",
42
+ children: "*"
43
+ }) : null;
44
+ $[5] = isRequired;
39
45
  $[6] = t6;
40
46
  } else t6 = $[6];
41
- const t7 = describedBy !== "" ? describedBy : void 0;
42
- const t8 = errors.length > 0 ? true : void 0;
43
- let t9;
44
- if ($[7] !== isRequired || $[8] !== legend || $[9] !== legendClassName) {
45
- t9 = legend !== void 0 && legend !== null ? /* @__PURE__ */ jsxs("legend", {
47
+ let t7;
48
+ if ($[7] !== legend || $[8] !== t6) {
49
+ t7 = /* @__PURE__ */ jsxs(Fragment, { children: [legend, t6] });
50
+ $[7] = legend;
51
+ $[8] = t6;
52
+ $[9] = t7;
53
+ } else t7 = $[9];
54
+ const legendContent = t7;
55
+ let t8;
56
+ if ($[10] !== className) {
57
+ t8 = cx("panneau-fieldset", Field_module_default.fieldset, className);
58
+ $[10] = className;
59
+ $[11] = t8;
60
+ } else t8 = $[11];
61
+ const t9 = hasLegend && hasLegendEnd ? `${id}-legend` : void 0;
62
+ const t10 = describedBy !== "" ? describedBy : void 0;
63
+ const t11 = errors.length > 0 ? true : void 0;
64
+ let t12;
65
+ if ($[12] !== hasLegend || $[13] !== hasLegendEnd || $[14] !== id || $[15] !== legendClassName || $[16] !== legendContent || $[17] !== legendEnd) {
66
+ t12 = hasLegendEnd ? /* @__PURE__ */ jsxs("div", {
67
+ className: Field_module_default.legendRow,
68
+ children: [hasLegend ? /* @__PURE__ */ jsx("span", {
69
+ id: `${id}-legend`,
70
+ className: cx(Field_module_default.label, legendClassName),
71
+ children: legendContent
72
+ }) : null, /* @__PURE__ */ jsx("div", {
73
+ className: Field_module_default.legendEnd,
74
+ children: legendEnd
75
+ })]
76
+ }) : hasLegend ? /* @__PURE__ */ jsx("legend", {
46
77
  className: cx(Field_module_default.legend, Field_module_default.label, legendClassName),
47
- children: [legend, isRequired ? /* @__PURE__ */ jsx("span", {
48
- className: Field_module_default.required,
49
- "aria-hidden": "true",
50
- children: "*"
51
- }) : null]
78
+ children: legendContent
52
79
  }) : null;
53
- $[7] = isRequired;
54
- $[8] = legend;
55
- $[9] = legendClassName;
56
- $[10] = t9;
57
- } else t9 = $[10];
58
- let t10;
59
- if ($[11] !== description || $[12] !== descriptionClassName || $[13] !== descriptionId) {
60
- t10 = descriptionId !== null ? /* @__PURE__ */ jsx("div", {
80
+ $[12] = hasLegend;
81
+ $[13] = hasLegendEnd;
82
+ $[14] = id;
83
+ $[15] = legendClassName;
84
+ $[16] = legendContent;
85
+ $[17] = legendEnd;
86
+ $[18] = t12;
87
+ } else t12 = $[18];
88
+ let t13;
89
+ if ($[19] !== description || $[20] !== descriptionClassName || $[21] !== descriptionId) {
90
+ t13 = descriptionId !== null ? /* @__PURE__ */ jsx("div", {
61
91
  id: descriptionId,
62
92
  className: cx(Field_module_default.description, descriptionClassName),
63
93
  children: description
64
94
  }) : null;
65
- $[11] = description;
66
- $[12] = descriptionClassName;
67
- $[13] = descriptionId;
68
- $[14] = t10;
69
- } else t10 = $[14];
70
- let t11;
71
- if ($[15] !== errors || $[16] !== errorsClassName || $[17] !== errorsId) {
72
- t11 = errorsId !== null ? /* @__PURE__ */ jsx("div", {
95
+ $[19] = description;
96
+ $[20] = descriptionClassName;
97
+ $[21] = descriptionId;
98
+ $[22] = t13;
99
+ } else t13 = $[22];
100
+ let t14;
101
+ if ($[23] !== errors || $[24] !== errorsClassName || $[25] !== errorsId) {
102
+ t14 = errorsId !== null ? /* @__PURE__ */ jsx("div", {
73
103
  id: errorsId,
74
104
  className: cx(Field_module_default.errors, errorsClassName),
75
105
  children: errors.map(_temp)
76
106
  }) : null;
77
- $[15] = errors;
78
- $[16] = errorsClassName;
79
- $[17] = errorsId;
80
- $[18] = t11;
81
- } else t11 = $[18];
82
- let t12;
83
- if ($[19] !== children || $[20] !== isDisabled || $[21] !== t10 || $[22] !== t11 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
84
- t12 = /* @__PURE__ */ jsxs("fieldset", {
85
- className: t6,
86
- "aria-describedby": t7,
87
- "aria-invalid": t8,
107
+ $[23] = errors;
108
+ $[24] = errorsClassName;
109
+ $[25] = errorsId;
110
+ $[26] = t14;
111
+ } else t14 = $[26];
112
+ let t15;
113
+ if ($[27] !== children || $[28] !== isDisabled || $[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t8 || $[35] !== t9) {
114
+ t15 = /* @__PURE__ */ jsxs("fieldset", {
115
+ className: t8,
116
+ "aria-labelledby": t9,
117
+ "aria-describedby": t10,
118
+ "aria-invalid": t11,
88
119
  disabled: isDisabled,
89
120
  children: [
90
- t9,
91
- t10,
121
+ t12,
122
+ t13,
92
123
  children,
93
- t11
124
+ t14
94
125
  ]
95
126
  });
96
- $[19] = children;
97
- $[20] = isDisabled;
98
- $[21] = t10;
99
- $[22] = t11;
100
- $[23] = t6;
101
- $[24] = t7;
102
- $[25] = t8;
103
- $[26] = t9;
104
- $[27] = t12;
105
- } else t12 = $[27];
106
- return t12;
127
+ $[27] = children;
128
+ $[28] = isDisabled;
129
+ $[29] = t10;
130
+ $[30] = t11;
131
+ $[31] = t12;
132
+ $[32] = t13;
133
+ $[33] = t14;
134
+ $[34] = t8;
135
+ $[35] = t9;
136
+ $[36] = t15;
137
+ } else t15 = $[36];
138
+ return t15;
107
139
  }
108
140
  function _temp(error, index) {
109
141
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [index > 0 ? " " : null, /* @__PURE__ */ jsx("span", {
@@ -1 +1 @@
1
- {"version":3,"file":"Fieldset.js","names":["Fragment","ReactNode","useId","cx","styles","FieldsetProps","legend","description","errors","isRequired","isDisabled","children","className","legendClassName","descriptionClassName","errorsClassName","Fieldset","t0","$","_c","t1","t2","t3","t4","undefined","id","descriptionId","errorsId","length","t5","filter","Boolean","describedBy","join","t6","fieldset","t7","t8","t9","label","required","t10","t11","map","_temp","t12","error","index","_c","styles","Fragment"],"sources":["../../src/field/Fieldset.tsx"],"sourcesContent":["import { Fragment, type ReactNode, useId } from 'react';\n\nimport { cx } from '../utils/cx';\nimport styles from './Field.module.css';\n\nexport interface FieldsetProps {\n /** Title of the group of controls. */\n legend?: ReactNode;\n description?: ReactNode;\n /** Errors of the group as a whole. */\n errors?: readonly string[];\n isRequired?: boolean;\n isDisabled?: boolean;\n children?: ReactNode;\n className?: string;\n legendClassName?: string;\n descriptionClassName?: string;\n errorsClassName?: string;\n}\n\n/**\n * Groups related controls under a legend, with a description and errors: for composite values\n * (a group of fields, a list of blocks, a value per locale). The description and the errors\n * describe the group for assistive technologies.\n */\nexport function Fieldset({\n legend,\n description,\n errors = [],\n isRequired = false,\n isDisabled = false,\n children,\n className,\n legendClassName,\n descriptionClassName,\n errorsClassName,\n}: FieldsetProps) {\n const id = useId();\n const descriptionId = description !== undefined ? `${id}-description` : null;\n const errorsId = errors.length > 0 ? `${id}-errors` : null;\n const describedBy = [descriptionId, errorsId].filter(Boolean).join(' ');\n return (\n <fieldset\n className={cx('panneau-fieldset', styles.fieldset, className)}\n aria-describedby={describedBy !== '' ? describedBy : undefined}\n aria-invalid={errors.length > 0 ? true : undefined}\n disabled={isDisabled}\n >\n {legend !== undefined && legend !== null ? (\n <legend className={cx(styles.legend, styles.label, legendClassName)}>\n {legend}\n {isRequired ? (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n ) : null}\n </legend>\n ) : null}\n {descriptionId !== null ? (\n <div id={descriptionId} className={cx(styles.description, descriptionClassName)}>\n {description}\n </div>\n ) : null}\n {children}\n {errorsId !== null ? (\n <div id={errorsId} className={cx(styles.errors, errorsClassName)}>\n {errors.map((error, index) => (\n <Fragment key={index}>\n {/* A space between messages, for assistive technologies. */}\n {index > 0 ? ' ' : null}\n <span className={styles.error}>{error}</span>\n </Fragment>\n ))}\n </div>\n ) : null}\n </fieldset>\n );\n}\n"],"mappings":";;;;;;;;;;;AAyBA,SAAOgB,SAAAC,IAAA;CAAA,MAAAC,IAAAC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QAAAoB,IAAA;EAhCZO,MAAA,qBAAA,YAAA;GACe,WAAAX;GACO,oBAAAE;GACJ,gBAAAC;GACJ3B,UAAAA;GAJd,UAAA;IAMK4B;IAUAG;IAKA9B;IACA+B;GAWM;;EAAAxB,EAAA,MAAAP;EAAAO,EAAA,MAAAR;EAAAQ,EAAA,MAAAuB;EAAAvB,EAAA,MAAAwB;EAAAxB,EAAA,MAAAgB;EAAAhB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAmB;EAAAnB,EAAA,MAAAoB;EAAApB,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,OAjCX2B;AAiCW;AAlDZ,SAAAD,MAAAE,OAAAC,OAAA;CAAA,OA0CiB,qBAACG,YAAD,EAAA,UAAA,CAEKH,QAAQ,IAAR,MAAA,MACD,oBAAA,QAAA;EAAiB,WAAA3C,qBAAM0C;EAASA,UAAAA;CAAa,CAAA,CAHxC,EAAA,GAAMC,KAAN;AAIE"}
1
+ {"version":3,"file":"Fieldset.js","names":["Fragment","ReactNode","useId","cx","styles","FieldsetProps","legend","legendEnd","description","errors","isRequired","isDisabled","children","className","legendClassName","descriptionClassName","errorsClassName","Fieldset","t0","$","_c","t1","t2","t3","t4","undefined","id","descriptionId","errorsId","length","t5","filter","Boolean","describedBy","join","hasLegend","hasLegendEnd","t6","required","t7","legendContent","t8","fieldset","t9","t10","t11","t12","legendRow","label","t13","t14","map","_temp","t15","error","index","_c","styles","_Fragment","Fragment"],"sources":["../../src/field/Fieldset.tsx"],"sourcesContent":["import { Fragment, type ReactNode, useId } from 'react';\n\nimport { cx } from '../utils/cx';\nimport styles from './Field.module.css';\n\nexport interface FieldsetProps {\n /** Title of the group of controls. */\n legend?: ReactNode;\n /**\n * Controls at the end of the legend's line, such as the locales of a value. The group is then\n * named by the legend through `aria-labelledby`, since a `<legend>` can't share its line.\n */\n legendEnd?: ReactNode;\n description?: ReactNode;\n /** Errors of the group as a whole. */\n errors?: readonly string[];\n isRequired?: boolean;\n isDisabled?: boolean;\n children?: ReactNode;\n className?: string;\n legendClassName?: string;\n descriptionClassName?: string;\n errorsClassName?: string;\n}\n\n/**\n * Groups related controls under a legend, with a description and errors: for composite values\n * (a group of fields, a list of blocks, a value per locale). The description and the errors\n * describe the group for assistive technologies.\n */\nexport function Fieldset({\n legend,\n legendEnd,\n description,\n errors = [],\n isRequired = false,\n isDisabled = false,\n children,\n className,\n legendClassName,\n descriptionClassName,\n errorsClassName,\n}: FieldsetProps) {\n const id = useId();\n const descriptionId = description !== undefined ? `${id}-description` : null;\n const errorsId = errors.length > 0 ? `${id}-errors` : null;\n const describedBy = [descriptionId, errorsId].filter(Boolean).join(' ');\n const hasLegend = legend !== undefined && legend !== null;\n const hasLegendEnd = legendEnd !== undefined && legendEnd !== null;\n const legendContent = (\n <>\n {legend}\n {isRequired ? (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n ) : null}\n </>\n );\n return (\n <fieldset\n className={cx('panneau-fieldset', styles.fieldset, className)}\n aria-labelledby={hasLegend && hasLegendEnd ? `${id}-legend` : undefined}\n aria-describedby={describedBy !== '' ? describedBy : undefined}\n aria-invalid={errors.length > 0 ? true : undefined}\n disabled={isDisabled}\n >\n {hasLegendEnd ? (\n <div className={styles.legendRow}>\n {hasLegend ? (\n <span id={`${id}-legend`} className={cx(styles.label, legendClassName)}>\n {legendContent}\n </span>\n ) : null}\n <div className={styles.legendEnd}>{legendEnd}</div>\n </div>\n ) : hasLegend ? (\n <legend className={cx(styles.legend, styles.label, legendClassName)}>\n {legendContent}\n </legend>\n ) : null}\n {descriptionId !== null ? (\n <div id={descriptionId} className={cx(styles.description, descriptionClassName)}>\n {description}\n </div>\n ) : null}\n {children}\n {errorsId !== null ? (\n <div id={errorsId} className={cx(styles.errors, errorsClassName)}>\n {errors.map((error, index) => (\n <Fragment key={index}>\n {/* A space between messages, for assistive technologies. */}\n {index > 0 ? ' ' : null}\n <span className={styles.error}>{error}</span>\n </Fragment>\n ))}\n </div>\n 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A,MAAAP;EAAAO,EAAA,MAAAR;EAAAQ,EAAA,MAAAyB;EAAAzB,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;EAAA3B,EAAA,MAAA8B;EAAA9B,EAAA,MAAA+B;EAAA/B,EAAA,MAAAsB;EAAAtB,EAAA,MAAAwB;EAAAxB,EAAA,MAAAkC;CAAA,OAAAA,MAAAlC,EAAA;CAAA,OAtCXkC;AAsCW;AApEZ,SAAAD,MAAAE,OAAAC,OAAA;CAAA,OA4DiB,qBAACI,YAAD,EAAA,UAAA,CAEKJ,QAAQ,IAAR,MAAA,MACD,oBAAA,QAAA;EAAiB,WAAAnD,qBAAMkD;EAASA,UAAAA;CAAa,CAAA,CAHxC,EAAA,GAAMC,KAAN;AAIE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/ui",
3
- "version": "5.0.0-alpha.11",
3
+ "version": "5.0.0-alpha.12",
4
4
  "description": "Design tokens, themes and accessible primitives of Panneau, built on React Aria Components.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -57,10 +57,10 @@
57
57
  "react-intl": "^12.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@panneau/intl": "5.0.0-alpha.11",
60
+ "@panneau/intl": "5.0.0-alpha.12",
61
61
  "lucide-react": "^1.57.0"
62
62
  },
63
63
  "devDependencies": {
64
- "@panneau/protocol": "5.0.0-alpha.11"
64
+ "@panneau/protocol": "5.0.0-alpha.12"
65
65
  }
66
66
  }