design-zystem 1.0.436 → 1.0.437

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.
@@ -954,6 +954,7 @@ interface TableGroupBandProps extends TableGroupLabelProps {
954
954
 
955
955
  interface TableSectionRowProps extends TableGroupBandProps {
956
956
  endContent?: ReactNode;
957
+ onBandClick?: () => void;
957
958
  }
958
959
  declare const TableSectionRow: (props: TableSectionRowProps) => react.JSX.Element;
959
960
 
@@ -954,6 +954,7 @@ interface TableGroupBandProps extends TableGroupLabelProps {
954
954
 
955
955
  interface TableSectionRowProps extends TableGroupBandProps {
956
956
  endContent?: ReactNode;
957
+ onBandClick?: () => void;
957
958
  }
958
959
  declare const TableSectionRow: (props: TableSectionRowProps) => react.JSX.Element;
959
960
 
package/dist/ui/index.js CHANGED
@@ -4385,6 +4385,15 @@ var TableFooterCell = ({
4385
4385
  }
4386
4386
  );
4387
4387
 
4388
+ // src/ui/components/ui/table/activateFromKeyboard.ts
4389
+ var ACTIVATION_KEYS = ["Enter", " "];
4390
+ var activateFromKeyboard = (activate) => (event) => {
4391
+ if (event.target !== event.currentTarget) return;
4392
+ if (!ACTIVATION_KEYS.includes(event.key)) return;
4393
+ event.preventDefault();
4394
+ activate();
4395
+ };
4396
+
4388
4397
  // src/ui/components/ui/table/TableGroupLabel.tsx
4389
4398
  var import_jsx_runtime53 = require("react/jsx-runtime");
4390
4399
  var TableGroupLabel = ({
@@ -4420,31 +4429,38 @@ var TableGroupLabel = ({
4420
4429
 
4421
4430
  // src/ui/components/ui/table/TableGroupBand.tsx
4422
4431
  var import_jsx_runtime54 = require("react/jsx-runtime");
4423
- var isFromControl = (event) => event.target.closest("button, a, input") !== null;
4432
+ var isFromControl = (event) => event.target.closest(
4433
+ 'button, a, input, select, textarea, label, [role="button"]'
4434
+ ) !== null;
4424
4435
  var TableGroupBand = (_a) => {
4425
4436
  var _b = _a, {
4426
4437
  colSpan,
4427
4438
  canCollapseFromBand = false,
4439
+ onBandClick,
4428
4440
  endContent,
4429
4441
  className
4430
4442
  } = _b, label = __objRest(_b, [
4431
4443
  "colSpan",
4432
4444
  "canCollapseFromBand",
4445
+ "onBandClick",
4433
4446
  "endContent",
4434
4447
  "className"
4435
4448
  ]);
4436
4449
  const { onToggleCollapse } = label;
4437
- const isBandCollapsible = canCollapseFromBand && onToggleCollapse;
4438
- const collapseFromBand = (event) => {
4450
+ const collapseFromBand = canCollapseFromBand ? onToggleCollapse : void 0;
4451
+ const bandAction = onBandClick != null ? onBandClick : collapseFromBand;
4452
+ const runBandAction = (event) => {
4439
4453
  if (isFromControl(event)) return;
4440
- onToggleCollapse == null ? void 0 : onToggleCollapse();
4454
+ bandAction == null ? void 0 : bandAction();
4441
4455
  };
4442
4456
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
4443
4457
  "td",
4444
4458
  {
4445
4459
  colSpan,
4446
- onClick: isBandCollapsible ? collapseFromBand : void 0,
4447
- className: cn(className, isBandCollapsible && "cursor-pointer"),
4460
+ onClick: bandAction && runBandAction,
4461
+ onKeyDown: onBandClick && activateFromKeyboard(onBandClick),
4462
+ tabIndex: onBandClick ? 0 : void 0,
4463
+ className: cn(className, bandAction && "cursor-pointer"),
4448
4464
  children: endContent ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Layout, { row: true, gap: 2, align: "center", justify: "between", children: [
4449
4465
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TableGroupLabel, __spreadValues({}, label)),
4450
4466
  endContent
@@ -4517,31 +4533,22 @@ var TableAlertRow = ({
4517
4533
 
4518
4534
  // src/ui/components/ui/table/TableExpandedRow.tsx
4519
4535
  var import_jsx_runtime58 = require("react/jsx-runtime");
4520
- var ACTIVATION_KEYS = ["Enter", " "];
4521
4536
  var TableExpandedRow = ({
4522
4537
  children,
4523
4538
  onClick
4524
- }) => {
4525
- const activateFromKeyboard = (event) => {
4526
- if (event.target !== event.currentTarget) return;
4527
- if (!ACTIVATION_KEYS.includes(event.key)) return;
4528
- event.preventDefault();
4529
- onClick == null ? void 0 : onClick();
4530
- };
4531
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
4532
- "tr",
4533
- {
4534
- onClick,
4535
- onKeyDown: onClick && activateFromKeyboard,
4536
- tabIndex: onClick ? 0 : void 0,
4537
- className: cn(
4538
- "animate-[fade-in_150ms_ease-out] bg-grey-100 transition-colors hover:bg-grey-100",
4539
- onClick && "cursor-pointer"
4540
- ),
4541
- children
4542
- }
4543
- );
4544
- };
4539
+ }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
4540
+ "tr",
4541
+ {
4542
+ onClick,
4543
+ onKeyDown: onClick && activateFromKeyboard(onClick),
4544
+ tabIndex: onClick ? 0 : void 0,
4545
+ className: cn(
4546
+ "animate-[fade-in_150ms_ease-out] bg-grey-100 transition-colors hover:bg-grey-100",
4547
+ onClick && "cursor-pointer"
4548
+ ),
4549
+ children
4550
+ }
4551
+ );
4545
4552
 
4546
4553
  // src/utils/string/capitalizeFirstLetter.ts
4547
4554
  var capitalizeFirstLetter = (str) => {
package/dist/ui/index.mjs CHANGED
@@ -4181,6 +4181,15 @@ var TableFooterCell = ({
4181
4181
  }
4182
4182
  );
4183
4183
 
4184
+ // src/ui/components/ui/table/activateFromKeyboard.ts
4185
+ var ACTIVATION_KEYS = ["Enter", " "];
4186
+ var activateFromKeyboard = (activate) => (event) => {
4187
+ if (event.target !== event.currentTarget) return;
4188
+ if (!ACTIVATION_KEYS.includes(event.key)) return;
4189
+ event.preventDefault();
4190
+ activate();
4191
+ };
4192
+
4184
4193
  // src/ui/components/ui/table/TableGroupLabel.tsx
4185
4194
  import { jsx as jsx53, jsxs as jsxs26 } from "react/jsx-runtime";
4186
4195
  var TableGroupLabel = ({
@@ -4216,31 +4225,38 @@ var TableGroupLabel = ({
4216
4225
 
4217
4226
  // src/ui/components/ui/table/TableGroupBand.tsx
4218
4227
  import { jsx as jsx54, jsxs as jsxs27 } from "react/jsx-runtime";
4219
- var isFromControl = (event) => event.target.closest("button, a, input") !== null;
4228
+ var isFromControl = (event) => event.target.closest(
4229
+ 'button, a, input, select, textarea, label, [role="button"]'
4230
+ ) !== null;
4220
4231
  var TableGroupBand = (_a) => {
4221
4232
  var _b = _a, {
4222
4233
  colSpan,
4223
4234
  canCollapseFromBand = false,
4235
+ onBandClick,
4224
4236
  endContent,
4225
4237
  className
4226
4238
  } = _b, label = __objRest(_b, [
4227
4239
  "colSpan",
4228
4240
  "canCollapseFromBand",
4241
+ "onBandClick",
4229
4242
  "endContent",
4230
4243
  "className"
4231
4244
  ]);
4232
4245
  const { onToggleCollapse } = label;
4233
- const isBandCollapsible = canCollapseFromBand && onToggleCollapse;
4234
- const collapseFromBand = (event) => {
4246
+ const collapseFromBand = canCollapseFromBand ? onToggleCollapse : void 0;
4247
+ const bandAction = onBandClick != null ? onBandClick : collapseFromBand;
4248
+ const runBandAction = (event) => {
4235
4249
  if (isFromControl(event)) return;
4236
- onToggleCollapse == null ? void 0 : onToggleCollapse();
4250
+ bandAction == null ? void 0 : bandAction();
4237
4251
  };
4238
4252
  return /* @__PURE__ */ jsx54(TableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx54(
4239
4253
  "td",
4240
4254
  {
4241
4255
  colSpan,
4242
- onClick: isBandCollapsible ? collapseFromBand : void 0,
4243
- className: cn(className, isBandCollapsible && "cursor-pointer"),
4256
+ onClick: bandAction && runBandAction,
4257
+ onKeyDown: onBandClick && activateFromKeyboard(onBandClick),
4258
+ tabIndex: onBandClick ? 0 : void 0,
4259
+ className: cn(className, bandAction && "cursor-pointer"),
4244
4260
  children: endContent ? /* @__PURE__ */ jsxs27(Layout, { row: true, gap: 2, align: "center", justify: "between", children: [
4245
4261
  /* @__PURE__ */ jsx54(TableGroupLabel, __spreadValues({}, label)),
4246
4262
  endContent
@@ -4313,31 +4329,22 @@ var TableAlertRow = ({
4313
4329
 
4314
4330
  // src/ui/components/ui/table/TableExpandedRow.tsx
4315
4331
  import { jsx as jsx58 } from "react/jsx-runtime";
4316
- var ACTIVATION_KEYS = ["Enter", " "];
4317
4332
  var TableExpandedRow = ({
4318
4333
  children,
4319
4334
  onClick
4320
- }) => {
4321
- const activateFromKeyboard = (event) => {
4322
- if (event.target !== event.currentTarget) return;
4323
- if (!ACTIVATION_KEYS.includes(event.key)) return;
4324
- event.preventDefault();
4325
- onClick == null ? void 0 : onClick();
4326
- };
4327
- return /* @__PURE__ */ jsx58(
4328
- "tr",
4329
- {
4330
- onClick,
4331
- onKeyDown: onClick && activateFromKeyboard,
4332
- tabIndex: onClick ? 0 : void 0,
4333
- className: cn(
4334
- "animate-[fade-in_150ms_ease-out] bg-grey-100 transition-colors hover:bg-grey-100",
4335
- onClick && "cursor-pointer"
4336
- ),
4337
- children
4338
- }
4339
- );
4340
- };
4335
+ }) => /* @__PURE__ */ jsx58(
4336
+ "tr",
4337
+ {
4338
+ onClick,
4339
+ onKeyDown: onClick && activateFromKeyboard(onClick),
4340
+ tabIndex: onClick ? 0 : void 0,
4341
+ className: cn(
4342
+ "animate-[fade-in_150ms_ease-out] bg-grey-100 transition-colors hover:bg-grey-100",
4343
+ onClick && "cursor-pointer"
4344
+ ),
4345
+ children
4346
+ }
4347
+ );
4341
4348
 
4342
4349
  // src/utils/string/capitalizeFirstLetter.ts
4343
4350
  var capitalizeFirstLetter = (str) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "design-zystem",
3
- "version": "1.0.436",
3
+ "version": "1.0.437",
4
4
  "description": "A React design system of importable components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",