@linzjs/lui 21.38.0 → 21.38.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [21.38.1](https://github.com/linz/lui/compare/v21.38.0...v21.38.1) (2024-07-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **ColorPalette:** prevent id errors ([#1130](https://github.com/linz/lui/issues/1130)) ([1925e57](https://github.com/linz/lui/commit/1925e576760f523e2b3170ff3a9263b1d1c9bb07))
7
+
1
8
  # [21.38.0](https://github.com/linz/lui/compare/v21.37.0...v21.38.0) (2024-07-01)
2
9
 
3
10
 
@@ -5,5 +5,5 @@ export declare const ColorInput: React.ForwardRefExoticComponent<{
5
5
  name: string;
6
6
  color: string;
7
7
  description?: string | undefined;
8
- label?: Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "aria-label" | "htmlFor"> | undefined;
9
- } & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "id" | "name" | "type" | "value"> & React.RefAttributes<HTMLInputElement>>;
8
+ label?: Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "title" | "aria-label" | "htmlFor"> | undefined;
9
+ } & Omit<Pick<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "name" | "type" | "value"> & React.RefAttributes<HTMLInputElement>>;
package/dist/index.js CHANGED
@@ -59351,10 +59351,13 @@ var ColorInputGroup = React.forwardRef(function (props, ref) {
59351
59351
  return (React__default["default"].createElement("div", __assign({ ref: ref }, props, { role: (_a = props.role) !== null && _a !== void 0 ? _a : 'lui-input-color-group', className: clsx('lui-input-color-group', props.className) })));
59352
59352
  });
59353
59353
  var ColorInput = React.forwardRef(function (props, ref) {
59354
- var name = props.name, color = props.color, description = props.description, label = props.label, input = __rest(props, ["name", "color", "description", "label"]);
59354
+ var _a;
59355
+ var randomId = $bdb11010cef70236$export$f680877a34711e37();
59356
+ var name = props.name, color = props.color, description = props.description, label = props.label, _b = props.id, id = _b === void 0 ? randomId : _b, input = __rest(props, ["name", "color", "description", "label", "id"]);
59357
+ var title = description || color;
59355
59358
  return (React__default["default"].createElement(React__default["default"].Fragment, null,
59356
- React__default["default"].createElement("input", __assign({ ref: ref }, input, { name: name, type: "radio", id: color, value: color, className: clsx('lui-input-color-radio', input.className) })),
59357
- React__default["default"].createElement("label", __assign({}, label, { htmlFor: color, style: __assign(__assign({}, label === null || label === void 0 ? void 0 : label.style), { color: color, backgroundColor: color }), className: clsx('lui-input-colour-label', label === null || label === void 0 ? void 0 : label.className), "aria-label": description || color, title: description }))));
59359
+ React__default["default"].createElement("input", __assign({ ref: ref }, input, { title: (_a = input.title) !== null && _a !== void 0 ? _a : title, name: name, type: "radio", id: id, value: color, className: clsx('lui-input-color-radio', input.className) })),
59360
+ React__default["default"].createElement("label", __assign({}, label, { htmlFor: id, style: __assign(__assign({}, label === null || label === void 0 ? void 0 : label.style), { color: color, backgroundColor: color }), className: clsx('lui-input-colour-label', label === null || label === void 0 ? void 0 : label.className), "aria-label": description || color, title: description }))));
59358
59361
  });
59359
59362
 
59360
59363
  /**
@@ -59367,7 +59370,7 @@ var ColorInput = React.forwardRef(function (props, ref) {
59367
59370
  var ColorPalette = React.forwardRef(function (_a, ref) {
59368
59371
  var _b;
59369
59372
  var _c = _a.selected, selected = _c === void 0 ? (_b = defaultColours[0]) === null || _b === void 0 ? void 0 : _b.color : _c, onSelect = _a.onSelect; _a.children; var name = _a.name, className = _a.className, divProps = __rest(_a, ["selected", "onSelect", "children", "name", "className"]);
59370
- var colourGroupIdentifier = v4();
59373
+ var colourGroupIdentifier = $bdb11010cef70236$export$f680877a34711e37();
59371
59374
  return (React__default["default"].createElement(ColorInputGroup, __assign({ ref: ref }, divProps, { className: clsx('lui-color-picker', className) }), defaultColours.map(function (_a) {
59372
59375
  var color = _a.color, description = _a.description;
59373
59376
  return (React__default["default"].createElement(ColorInput, __assign({ key: color, name: name !== null && name !== void 0 ? name : colourGroupIdentifier }, { color: color, description: description }, { checked: color === selected, onChange: function () { return onSelect(color); } })));