@marigold/components 2.1.2 → 2.1.3

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/dist/index.js CHANGED
@@ -994,13 +994,14 @@ var Link = (0, import_react28.forwardRef)(
994
994
  linkRef
995
995
  );
996
996
  const styles = (0, import_system18.useComponentStyles)("Link", { variant, size });
997
- return /* @__PURE__ */ import_react28.default.createElement(import_system.Box, {
997
+ return /* @__PURE__ */ import_react28.default.createElement(import_react28.default.Fragment, null, " ", /* @__PURE__ */ import_react28.default.createElement(import_system.Box, {
998
998
  as,
999
+ role: "link",
999
1000
  css: styles,
1000
1001
  ref: linkRef,
1001
1002
  ...props,
1002
1003
  ...linkProps
1003
- }, children);
1004
+ }, children), " ");
1004
1005
  }
1005
1006
  );
1006
1007
 
@@ -2184,7 +2185,7 @@ var import_utils15 = require("@react-aria/utils");
2184
2185
  var import_system40 = require("@marigold/system");
2185
2186
  var TableCell = ({ cell }) => {
2186
2187
  const ref = (0, import_react57.useRef)(null);
2187
- const { state, styles } = useTableContext();
2188
+ const { interactive, state, styles } = useTableContext();
2188
2189
  const disabled = state.disabledKeys.has(cell.parentKey);
2189
2190
  const { gridCellProps } = (0, import_table2.useTableCell)(
2190
2191
  {
@@ -2193,13 +2194,18 @@ var TableCell = ({ cell }) => {
2193
2194
  state,
2194
2195
  ref
2195
2196
  );
2197
+ const cellProps = interactive ? gridCellProps : {
2198
+ ...gridCellProps,
2199
+ onMouseDown: (e) => e.stopPropagation(),
2200
+ onPointerDown: (e) => e.stopPropagation()
2201
+ };
2196
2202
  const { focusProps, isFocusVisible } = (0, import_focus11.useFocusRing)();
2197
2203
  const stateProps = (0, import_system40.useStateProps)({ disabled, focusVisible: isFocusVisible });
2198
2204
  return /* @__PURE__ */ import_react57.default.createElement(import_system40.Box, {
2199
2205
  as: "td",
2200
2206
  ref,
2201
2207
  css: styles.cell,
2202
- ...(0, import_utils15.mergeProps)(gridCellProps, focusProps),
2208
+ ...(0, import_utils15.mergeProps)(cellProps, focusProps),
2203
2209
  ...stateProps
2204
2210
  }, cell.rendered);
2205
2211
  };
@@ -2305,6 +2311,7 @@ var TableColumnHeader = ({ column }) => {
2305
2311
  as: "th",
2306
2312
  colSpan: column.colspan,
2307
2313
  ref,
2314
+ __baseCSS: { cursor: "default" },
2308
2315
  css: styles.header,
2309
2316
  ...(0, import_utils18.mergeProps)(columnHeaderProps, hoverProps, focusProps),
2310
2317
  ...stateProps
@@ -2346,7 +2353,7 @@ var import_utils19 = require("@react-aria/utils");
2346
2353
  var import_system43 = require("@marigold/system");
2347
2354
  var TableRow = ({ children, row }) => {
2348
2355
  const ref = (0, import_react62.useRef)(null);
2349
- const { state, styles } = useTableContext();
2356
+ const { interactive, state, styles } = useTableContext();
2350
2357
  const { rowProps, isPressed } = (0, import_table7.useTableRow)(
2351
2358
  {
2352
2359
  node: row
@@ -2357,7 +2364,9 @@ var TableRow = ({ children, row }) => {
2357
2364
  const disabled = state.disabledKeys.has(row.key);
2358
2365
  const selected = state.selectionManager.isSelected(row.key);
2359
2366
  const { focusProps, isFocusVisible } = (0, import_focus14.useFocusRing)({ within: true });
2360
- const { hoverProps, isHovered } = (0, import_interactions9.useHover)({ isDisabled: disabled });
2367
+ const { hoverProps, isHovered } = (0, import_interactions9.useHover)({
2368
+ isDisabled: disabled || !interactive
2369
+ });
2361
2370
  const stateProps = (0, import_system43.useStateProps)({
2362
2371
  disabled,
2363
2372
  selected,
@@ -2368,6 +2377,9 @@ var TableRow = ({ children, row }) => {
2368
2377
  return /* @__PURE__ */ import_react62.default.createElement(import_system43.Box, {
2369
2378
  as: "tr",
2370
2379
  ref,
2380
+ __baseCSS: {
2381
+ cursor: !interactive ? "text" : disabled ? "default" : "pointer"
2382
+ },
2371
2383
  css: styles.row,
2372
2384
  ...(0, import_utils19.mergeProps)(rowProps, focusProps, hoverProps),
2373
2385
  ...stateProps
@@ -2419,12 +2431,15 @@ var Table = ({
2419
2431
  variant,
2420
2432
  size,
2421
2433
  stretch,
2434
+ selectionMode = "none",
2422
2435
  ...props
2423
2436
  }) => {
2437
+ const interactive = selectionMode !== "none";
2424
2438
  const tableRef = (0, import_react64.useRef)(null);
2425
2439
  const state = (0, import_table10.useTableState)({
2426
2440
  ...props,
2427
- showSelectionCheckboxes: props.selectionMode === "multiple" && props.selectionBehavior !== "replace"
2441
+ selectionMode,
2442
+ showSelectionCheckboxes: selectionMode === "multiple" && props.selectionBehavior !== "replace"
2428
2443
  });
2429
2444
  const { gridProps } = (0, import_table9.useTable)(props, state, tableRef);
2430
2445
  const styles = (0, import_system45.useComponentStyles)(
@@ -2434,13 +2449,19 @@ var Table = ({
2434
2449
  );
2435
2450
  const { collection } = state;
2436
2451
  return /* @__PURE__ */ import_react64.default.createElement(TableContext.Provider, {
2437
- value: { state, styles }
2452
+ value: { state, interactive, styles }
2453
+ }, /* @__PURE__ */ import_react64.default.createElement(import_system45.Box, {
2454
+ __baseCSS: {
2455
+ overflow: ["scroll", "unset"],
2456
+ whiteSpace: ["nowrap", "unset"]
2457
+ }
2438
2458
  }, /* @__PURE__ */ import_react64.default.createElement(import_system45.Box, {
2439
2459
  as: "table",
2440
2460
  ref: tableRef,
2441
2461
  __baseCSS: {
2442
2462
  borderCollapse: "collapse",
2443
- width: stretch ? "100%" : void 0
2463
+ width: stretch ? "100%" : void 0,
2464
+ overflow: ["scroll", "unset"]
2444
2465
  },
2445
2466
  css: styles.table,
2446
2467
  ...gridProps
@@ -2472,7 +2493,7 @@ var Table = ({
2472
2493
  cell
2473
2494
  });
2474
2495
  }
2475
- ))))));
2496
+ )))))));
2476
2497
  };
2477
2498
  Table.Body = import_table10.TableBody;
2478
2499
  Table.Cell = import_table10.Cell;
package/dist/index.mjs CHANGED
@@ -941,13 +941,14 @@ var Link = forwardRef6(
941
941
  linkRef
942
942
  );
943
943
  const styles = useComponentStyles16("Link", { variant, size });
944
- return /* @__PURE__ */ React27.createElement(Box, {
944
+ return /* @__PURE__ */ React27.createElement(React27.Fragment, null, " ", /* @__PURE__ */ React27.createElement(Box, {
945
945
  as,
946
+ role: "link",
946
947
  css: styles,
947
948
  ref: linkRef,
948
949
  ...props,
949
950
  ...linkProps
950
- }, children);
951
+ }, children), " ");
951
952
  }
952
953
  );
953
954
 
@@ -2181,7 +2182,7 @@ import { mergeProps as mergeProps9 } from "@react-aria/utils";
2181
2182
  import { Box as Box29, useStateProps as useStateProps11 } from "@marigold/system";
2182
2183
  var TableCell = ({ cell }) => {
2183
2184
  const ref = useRef10(null);
2184
- const { state, styles } = useTableContext();
2185
+ const { interactive, state, styles } = useTableContext();
2185
2186
  const disabled = state.disabledKeys.has(cell.parentKey);
2186
2187
  const { gridCellProps } = useTableCell(
2187
2188
  {
@@ -2190,13 +2191,18 @@ var TableCell = ({ cell }) => {
2190
2191
  state,
2191
2192
  ref
2192
2193
  );
2194
+ const cellProps = interactive ? gridCellProps : {
2195
+ ...gridCellProps,
2196
+ onMouseDown: (e) => e.stopPropagation(),
2197
+ onPointerDown: (e) => e.stopPropagation()
2198
+ };
2193
2199
  const { focusProps, isFocusVisible } = useFocusRing9();
2194
2200
  const stateProps = useStateProps11({ disabled, focusVisible: isFocusVisible });
2195
2201
  return /* @__PURE__ */ React51.createElement(Box29, {
2196
2202
  as: "td",
2197
2203
  ref,
2198
2204
  css: styles.cell,
2199
- ...mergeProps9(gridCellProps, focusProps),
2205
+ ...mergeProps9(cellProps, focusProps),
2200
2206
  ...stateProps
2201
2207
  }, cell.rendered);
2202
2208
  };
@@ -2302,6 +2308,7 @@ var TableColumnHeader = ({ column }) => {
2302
2308
  as: "th",
2303
2309
  colSpan: column.colspan,
2304
2310
  ref,
2311
+ __baseCSS: { cursor: "default" },
2305
2312
  css: styles.header,
2306
2313
  ...mergeProps11(columnHeaderProps, hoverProps, focusProps),
2307
2314
  ...stateProps
@@ -2343,7 +2350,7 @@ import { mergeProps as mergeProps12 } from "@react-aria/utils";
2343
2350
  import { Box as Box32, useStateProps as useStateProps14 } from "@marigold/system";
2344
2351
  var TableRow = ({ children, row }) => {
2345
2352
  const ref = useRef14(null);
2346
- const { state, styles } = useTableContext();
2353
+ const { interactive, state, styles } = useTableContext();
2347
2354
  const { rowProps, isPressed } = useTableRow(
2348
2355
  {
2349
2356
  node: row
@@ -2354,7 +2361,9 @@ var TableRow = ({ children, row }) => {
2354
2361
  const disabled = state.disabledKeys.has(row.key);
2355
2362
  const selected = state.selectionManager.isSelected(row.key);
2356
2363
  const { focusProps, isFocusVisible } = useFocusRing12({ within: true });
2357
- const { hoverProps, isHovered } = useHover7({ isDisabled: disabled });
2364
+ const { hoverProps, isHovered } = useHover7({
2365
+ isDisabled: disabled || !interactive
2366
+ });
2358
2367
  const stateProps = useStateProps14({
2359
2368
  disabled,
2360
2369
  selected,
@@ -2365,6 +2374,9 @@ var TableRow = ({ children, row }) => {
2365
2374
  return /* @__PURE__ */ React56.createElement(Box32, {
2366
2375
  as: "tr",
2367
2376
  ref,
2377
+ __baseCSS: {
2378
+ cursor: !interactive ? "text" : disabled ? "default" : "pointer"
2379
+ },
2368
2380
  css: styles.row,
2369
2381
  ...mergeProps12(rowProps, focusProps, hoverProps),
2370
2382
  ...stateProps
@@ -2419,12 +2431,15 @@ var Table = ({
2419
2431
  variant,
2420
2432
  size,
2421
2433
  stretch,
2434
+ selectionMode = "none",
2422
2435
  ...props
2423
2436
  }) => {
2437
+ const interactive = selectionMode !== "none";
2424
2438
  const tableRef = useRef16(null);
2425
2439
  const state = useTableState({
2426
2440
  ...props,
2427
- showSelectionCheckboxes: props.selectionMode === "multiple" && props.selectionBehavior !== "replace"
2441
+ selectionMode,
2442
+ showSelectionCheckboxes: selectionMode === "multiple" && props.selectionBehavior !== "replace"
2428
2443
  });
2429
2444
  const { gridProps } = useTable(props, state, tableRef);
2430
2445
  const styles = useComponentStyles28(
@@ -2434,13 +2449,19 @@ var Table = ({
2434
2449
  );
2435
2450
  const { collection } = state;
2436
2451
  return /* @__PURE__ */ React58.createElement(TableContext.Provider, {
2437
- value: { state, styles }
2452
+ value: { state, interactive, styles }
2453
+ }, /* @__PURE__ */ React58.createElement(Box34, {
2454
+ __baseCSS: {
2455
+ overflow: ["scroll", "unset"],
2456
+ whiteSpace: ["nowrap", "unset"]
2457
+ }
2438
2458
  }, /* @__PURE__ */ React58.createElement(Box34, {
2439
2459
  as: "table",
2440
2460
  ref: tableRef,
2441
2461
  __baseCSS: {
2442
2462
  borderCollapse: "collapse",
2443
- width: stretch ? "100%" : void 0
2463
+ width: stretch ? "100%" : void 0,
2464
+ overflow: ["scroll", "unset"]
2444
2465
  },
2445
2466
  css: styles.table,
2446
2467
  ...gridProps
@@ -2472,7 +2493,7 @@ var Table = ({
2472
2493
  cell
2473
2494
  });
2474
2495
  }
2475
- ))))));
2496
+ )))))));
2476
2497
  };
2477
2498
  Table.Body = Body;
2478
2499
  Table.Cell = Cell;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marigold/components",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Components for the Marigold Design System",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -23,8 +23,8 @@
23
23
  "directory": "packages/components"
24
24
  },
25
25
  "dependencies": {
26
- "@marigold/icons": "1.0.3",
27
- "@marigold/system": "2.1.2",
26
+ "@marigold/icons": "1.0.4",
27
+ "@marigold/system": "2.1.3",
28
28
  "@marigold/tokens": "3.1.0",
29
29
  "@marigold/types": "0.5.2",
30
30
  "@react-aria/button": "3.6.0",