@pingux/astro 2.206.2-alpha.0 → 2.207.0-alpha.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.
Files changed (27) hide show
  1. package/lib/cjs/components/Button/Buttons.styles.d.ts +14 -0
  2. package/lib/cjs/components/Button/Buttons.styles.js +11 -1
  3. package/lib/cjs/components/TableBase/TableBase.js +138 -32
  4. package/lib/cjs/components/TableBase/TableBase.mdx +46 -13
  5. package/lib/cjs/components/TableBase/TableBase.stories.js +52 -2
  6. package/lib/cjs/components/TableBase/TableBase.styles.d.ts +84 -9
  7. package/lib/cjs/components/TableBase/TableBase.styles.js +61 -10
  8. package/lib/cjs/components/TableBase/TableBase.test.js +585 -105
  9. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.d.ts +14 -0
  10. package/lib/cjs/styles/themeOverrides/nextGenDarkMode/variants/variants.js +16 -2
  11. package/lib/cjs/styles/themes/next-gen/next-gen.d.ts +10 -0
  12. package/lib/cjs/styles/themes/next-gen/variants/button.d.ts +7 -0
  13. package/lib/cjs/styles/themes/next-gen/variants/button.js +4 -1
  14. package/lib/cjs/styles/themes/next-gen/variants/tableBase.d.ts +3 -0
  15. package/lib/cjs/styles/themes/next-gen/variants/tableBase.js +6 -1
  16. package/lib/cjs/styles/themes/next-gen/variants/variants.d.ts +3 -0
  17. package/lib/cjs/types/tableBase.d.ts +21 -5
  18. package/lib/components/Button/Buttons.styles.js +11 -1
  19. package/lib/components/TableBase/TableBase.js +139 -33
  20. package/lib/components/TableBase/TableBase.mdx +46 -13
  21. package/lib/components/TableBase/TableBase.stories.js +51 -1
  22. package/lib/components/TableBase/TableBase.styles.js +61 -10
  23. package/lib/components/TableBase/TableBase.test.js +585 -105
  24. package/lib/styles/themeOverrides/nextGenDarkMode/variants/variants.js +16 -2
  25. package/lib/styles/themes/next-gen/variants/button.js +4 -1
  26. package/lib/styles/themes/next-gen/variants/tableBase.js +6 -1
  27. package/package.json +1 -1
@@ -36,7 +36,7 @@ import { items as listData } from '../../utils/devUtils/constants/items';
36
36
  import TableReadme from './TableBase.mdx';
37
37
  import { jsx as ___EmotionJSX } from "@emotion/react";
38
38
  export default {
39
- title: 'Experimental/Table',
39
+ title: 'Components/TableBase',
40
40
  component: TableBase,
41
41
  parameters: {
42
42
  docs: {
@@ -383,6 +383,56 @@ DynamicWithSorting.parameters = {
383
383
  }
384
384
  }
385
385
  };
386
+ export var WithResizableColumns = function WithResizableColumns() {
387
+ return ___EmotionJSX(Card, {
388
+ variant: "cards.tableWrapper"
389
+ }, ___EmotionJSX(TableBase, {
390
+ caption: "Lorem ipsum",
391
+ "aria-label": "table"
392
+ }, ___EmotionJSX(THead, null, ___EmotionJSX(Column, {
393
+ minWidth: 100,
394
+ allowsResizing: true
395
+ }, "Type"), ___EmotionJSX(Column, {
396
+ minWidth: 100,
397
+ allowsResizing: true
398
+ }, "Date"), ___EmotionJSX(Column, {
399
+ minWidth: 100
400
+ }, "Additional Grant"), ___EmotionJSX(Column, {
401
+ minWidth: 100
402
+ }, "Total Grant")), ___EmotionJSX(TBody, {
403
+ items: objects
404
+ }, function (item) {
405
+ return ___EmotionJSX(Row, {
406
+ key: item.id
407
+ }, ___EmotionJSX(Cell, null, item.type), ___EmotionJSX(Cell, null, item.date), ___EmotionJSX(Cell, null, item.additional_grant), ___EmotionJSX(Cell, null, item.total_grant));
408
+ })));
409
+ };
410
+ export var WithMinMaxColumnWidth = function WithMinMaxColumnWidth() {
411
+ return ___EmotionJSX(Card, {
412
+ variant: "cards.tableWrapper"
413
+ }, ___EmotionJSX(TableBase, {
414
+ caption: "Lorem ipsum",
415
+ "aria-label": "table"
416
+ }, ___EmotionJSX(THead, null, ___EmotionJSX(Column, {
417
+ minWidth: 80,
418
+ maxWidth: 200
419
+ }, "Type"), ___EmotionJSX(Column, {
420
+ minWidth: 120,
421
+ maxWidth: 300
422
+ }, "Date"), ___EmotionJSX(Column, {
423
+ minWidth: 100,
424
+ maxWidth: 180
425
+ }, "Additional Grant"), ___EmotionJSX(Column, {
426
+ minWidth: 100,
427
+ maxWidth: 180
428
+ }, "Total Grant")), ___EmotionJSX(TBody, {
429
+ items: objects
430
+ }, function (item) {
431
+ return ___EmotionJSX(Row, {
432
+ key: item.id
433
+ }, ___EmotionJSX(Cell, null, item.type), ___EmotionJSX(Cell, null, item.date), ___EmotionJSX(Cell, null, item.additional_grant), ___EmotionJSX(Cell, null, item.total_grant));
434
+ })));
435
+ };
386
436
  export var WithLastColumnSticky = function WithLastColumnSticky() {
387
437
  return ___EmotionJSX(Card, {
388
438
  variant: "cards.tableWrapper",
@@ -9,6 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
9
9
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
10
10
  function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ import { astroTokens } from '@pingux/onyx-tokens';
12
13
  import { text } from '../Text/Text.styles';
13
14
  var defaultFocus = {
14
15
  outline: '1px',
@@ -17,6 +18,37 @@ var defaultFocus = {
17
18
  outlineOffset: '-1px',
18
19
  zIndex: 2
19
20
  };
21
+
22
+ // Pseudo-element styles for the sticky last column separator and shadow.
23
+ // Using ::after/::before instead of border-left + box-shadow because:
24
+ // - border-collapse:collapse absorbs border-left (invisible until adjacent cell scrolls away)
25
+ // - overflow:auto on the scroll container clips outward box-shadow
26
+ // Pseudo-elements live inside the sticky cell's stacking context and render
27
+ // within the visible viewport, so neither constraint applies.
28
+ var stickyColumnSeparator = {
29
+ // 1px left border line — unaffected by border-collapse
30
+ '&::after': {
31
+ content: '""',
32
+ position: 'absolute',
33
+ top: 0,
34
+ bottom: 0,
35
+ left: 0,
36
+ width: '1px',
37
+ backgroundColor: astroTokens.color.common.border,
38
+ pointerEvents: 'none'
39
+ },
40
+ // drop shadow extending left into the scrolling area — unaffected by overflow clipping
41
+ '&::before': {
42
+ content: '""',
43
+ position: 'absolute',
44
+ top: 0,
45
+ bottom: 0,
46
+ left: '-6px',
47
+ width: '6px',
48
+ background: 'linear-gradient(to right, transparent, rgba(0, 0, 0, 0.13))',
49
+ pointerEvents: 'none'
50
+ }
51
+ };
20
52
  var container = {
21
53
  width: '100%',
22
54
  height: '100%',
@@ -24,43 +56,48 @@ var container = {
24
56
  borderCollapse: 'collapse',
25
57
  position: 'relative',
26
58
  '&.is-last-column-sticky': {
27
- 'thead tr th:last-of-type': {
59
+ 'thead tr th:last-of-type': _objectSpread(_objectSpread({
28
60
  position: 'sticky',
29
61
  right: 0,
30
62
  backgroundColor: 'white',
31
- zIndex: 2,
63
+ zIndex: 2
64
+ }, stickyColumnSeparator), {}, {
32
65
  '&.is-focused': {
33
66
  borderStyle: 'solid',
34
67
  borderColor: 'transparent',
35
68
  borderWidth: '2px'
36
69
  }
37
- },
70
+ }),
38
71
  'tbody tr': {
39
72
  '&.is-focused td:last-of-type': {
40
73
  borderStyle: 'solid',
41
74
  borderColor: 'transparent',
42
75
  borderWidth: '4px 2px'
43
76
  },
44
- '&:nth-of-type(odd) td:last-of-type': {
77
+ '&:nth-of-type(odd) td:last-of-type': _objectSpread(_objectSpread({
45
78
  position: 'sticky',
46
79
  right: 0,
47
- backgroundColor: 'inherit',
80
+ zIndex: 1,
81
+ backgroundColor: 'inherit'
82
+ }, stickyColumnSeparator), {}, {
48
83
  '&.is-focused': {
49
84
  borderStyle: 'solid',
50
85
  borderColor: 'transparent',
51
86
  borderWidth: '2px'
52
87
  }
53
- },
54
- '&:nth-of-type(even) td:last-of-type': {
88
+ }),
89
+ '&:nth-of-type(even) td:last-of-type': _objectSpread(_objectSpread({
55
90
  position: 'sticky',
56
91
  right: 0,
57
- backgroundColor: 'white',
92
+ zIndex: 1,
93
+ backgroundColor: 'white'
94
+ }, stickyColumnSeparator), {}, {
58
95
  '&.is-focused': {
59
96
  borderStyle: 'solid',
60
97
  borderColor: 'transparent',
61
98
  borderWidth: '2px'
62
99
  }
63
- }
100
+ })
64
101
  }
65
102
  }
66
103
  };
@@ -92,6 +129,19 @@ var head = _objectSpread(_objectSpread({}, text.label), {}, {
92
129
  },
93
130
  '&.is-focused': _objectSpread({}, defaultFocus)
94
131
  });
132
+ var resizer = {
133
+ cursor: 'col-resize',
134
+ display: 'inline-block',
135
+ width: '2px',
136
+ height: '100%',
137
+ backgroundColor: 'neutral.10',
138
+ position: 'absolute',
139
+ right: '0px',
140
+ top: '0',
141
+ '&.is-focused': {
142
+ backgroundColor: 'focus'
143
+ }
144
+ };
95
145
  var tbody = {
96
146
  borderBottom: '1px solid',
97
147
  borderBottomColor: 'neutral.80',
@@ -132,5 +182,6 @@ export default {
132
182
  container: container,
133
183
  data: data,
134
184
  head: head,
135
- row: row
185
+ row: row,
186
+ resizer: resizer
136
187
  };