@linzjs/lui 24.12.0 → 24.13.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@
5
5
 
6
6
  * **LuiComboSelect:** restore interface to support styling of the input element. ([#1270](https://github.com/linz/lui/issues/1270)) ([7ce6a13](https://github.com/linz/lui/commit/7ce6a137c7f16ffa3acbe4357569a6eb59ef47db))
7
7
 
8
+ ## [24.13.0](https://github.com/linz/Lui/compare/lui-v24.12.0...lui-v24.13.0) (2026-04-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * **useToast:** Remove dismiss button from info and success toasts ([#1334](https://github.com/linz/Lui/issues/1334)) ([eaf35e2](https://github.com/linz/Lui/commit/eaf35e2fc9cf4e04b54e96a8dfe941ae37ac7816))
14
+
8
15
  ## [24.12.0](https://github.com/linz/Lui/compare/lui-v24.11.0...lui-v24.12.0) (2026-03-23)
9
16
 
10
17
 
@@ -9,6 +9,12 @@ export type ToastOptions = {
9
9
  timeout?: number;
10
10
  position?: ToastPosition;
11
11
  onLeave?: (id: number) => void;
12
+ /**
13
+ * If true, the toast will require a user to dismiss it. This will set timeout to Infinity and override any provided timeout value.
14
+ * If false, the toast will not have a dismiss button and will automatically dismiss based on the timeout value (default 5s).
15
+ * If not provided, the toast will require dismissal if timeout is Infinity, and auto-dismiss otherwise, while still showing a dismiss button.
16
+ */
17
+ requireDismiss?: boolean;
12
18
  };
13
19
  export type ToastAction = {
14
20
  type: 'add';
package/dist/index.js CHANGED
@@ -41197,8 +41197,12 @@ var getUniqueToastId = function () {
41197
41197
  };
41198
41198
  var toastFunctions = function (dispatch) {
41199
41199
  var toast = function (notification, config) {
41200
+ var _a;
41200
41201
  if (config === void 0) { config = {}; }
41201
- var _a = config.id, id = _a === void 0 ? getUniqueToastId() : _a, options = __rest(config, ["id"]);
41202
+ var _b = config.id, id = _b === void 0 ? getUniqueToastId() : _b, options = __rest(config, ["id"]);
41203
+ if (options.requireDismiss) {
41204
+ options.timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
41205
+ }
41202
41206
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'add', notification: notification, options: options, id: id });
41203
41207
  return id;
41204
41208
  };
@@ -41208,18 +41212,19 @@ var toastFunctions = function (dispatch) {
41208
41212
  if (config === void 0) { config = {}; }
41209
41213
  var options = __assign(__assign({}, defaults), config);
41210
41214
  return toast(function (_a) {
41211
- var onDismiss = _a.close;
41212
- return (React__namespace.createElement(ToastBanner, __assign({}, { level: level, children: children, onDismiss: onDismiss })));
41215
+ var onDismissFn = _a.close;
41216
+ var onDismiss = options.requireDismiss === false ? undefined : onDismissFn;
41217
+ return React__namespace.createElement(ToastBanner, __assign({}, { level: level, children: children, onDismiss: onDismiss }));
41213
41218
  }, options);
41214
41219
  };
41215
41220
  };
41216
41221
  return {
41217
41222
  toast: toast,
41218
41223
  dismiss: function (id) { return dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'remove', id: id }); },
41219
- info: banner('info'),
41220
- success: banner('success'),
41221
- error: banner('error', { timeout: Infinity }),
41222
- warning: banner('warning', { timeout: Infinity }),
41224
+ info: banner('info', { requireDismiss: false }),
41225
+ success: banner('success', { requireDismiss: false }),
41226
+ error: banner('error', { requireDismiss: true }),
41227
+ warning: banner('warning', { requireDismiss: true }),
41223
41228
  plain: banner()
41224
41229
  };
41225
41230
  };