@sebgroup/green-core 2.23.0 → 2.24.0-rc.20260120115958844

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.
@@ -15,6 +15,7 @@ import { repeat } from "lit/directives/repeat.js";
15
15
  import { until } from "lit/directives/until.js";
16
16
  import { when } from "lit/directives/when.js";
17
17
  import { isSameDay } from "date-fns";
18
+ import lastDayOfMonth from "date-fns/lastDayOfMonth";
18
19
  import { GdsButton } from "../../components/button/button.component.js";
19
20
  import { GdsDropdown } from "../../components/dropdown/dropdown.component.js";
20
21
  import { GdsFlex } from "../../components/flex/flex.component.js";
@@ -192,11 +193,13 @@ let Datepicker = class extends GdsFormControlElement {
192
193
  });
193
194
  __privateAdd(this, _handleSpinnerChange, (val, name) => {
194
195
  __privateGet(this, _spinnerState)[name] = val;
195
- const newDate = /* @__PURE__ */ new Date();
196
- newDate.setFullYear(parseInt(__privateGet(this, _spinnerState).year));
197
- newDate.setMonth(parseInt(__privateGet(this, _spinnerState).month) - 1);
198
- newDate.setDate(parseInt(__privateGet(this, _spinnerState).day));
196
+ const newDate = /* @__PURE__ */ new Date("0000-01-01");
199
197
  newDate.setUTCHours(this.utcHours, 0, 0, 0);
198
+ newDate.setUTCFullYear(parseInt(__privateGet(this, _spinnerState).year));
199
+ newDate.setUTCMonth(parseInt(__privateGet(this, _spinnerState).month) - 1);
200
+ const lastOfMonth = lastDayOfMonth(newDate).getDate();
201
+ const setDay = lastOfMonth < parseInt(__privateGet(this, _spinnerState).day) ? lastOfMonth : parseInt(__privateGet(this, _spinnerState).day);
202
+ newDate.setUTCDate(isNaN(setDay) ? 1 : setDay);
200
203
  if (newDate.toString() === "Invalid Date") return;
201
204
  this.value = newDate;
202
205
  __privateMethod(this, _Datepicker_instances, dispatchChangeEvent_fn).call(this);
@@ -37,7 +37,7 @@ const style = css`
37
37
  margin: calc(-1 * var(--gds-sys-space-4xs));
38
38
  border-radius: var(--gds-sys-radius-3xs);
39
39
 
40
- &:focus-visible {
40
+ &:focus {
41
41
  background-color: var(--gds-sys-color-l3-neutral-01);
42
42
  color: var(--gds-sys-color-content-inversed);
43
43
  }
@@ -63,6 +63,10 @@ export declare class GdsPagination extends GdsPagination_base {
63
63
  * Enables first and last button
64
64
  */
65
65
  jump: boolean;
66
+ /**
67
+ * Hide options
68
+ */
69
+ hideOptions: boolean;
66
70
  /**
67
71
  * Controls density mode on pagination
68
72
  * Accepts: `comfortable`, `compact`, `spacious`
@@ -77,6 +77,7 @@ let GdsPagination = class extends withMarginProps(
77
77
  this.total = 0;
78
78
  this.options = [5, 10, 25, 50];
79
79
  this.jump = false;
80
+ this.hideOptions = false;
80
81
  this.density = "comfortable";
81
82
  this.label = "";
82
83
  this._isMobile = false;
@@ -295,7 +296,7 @@ renderPageSizeOption_fn = function(size) {
295
296
  `;
296
297
  };
297
298
  renderPageSizeMenu_fn = function() {
298
- if (this._isMobile) return null;
299
+ if (this._isMobile || this.hideOptions) return null;
299
300
  const rowsLabel = `${msg("Rows per page")}, ${this.rows} ${msg("selected")}`;
300
301
  return html`
301
302
  <gds-flex align-items="center" gap="s">
@@ -394,6 +395,13 @@ __decorateClass([
394
395
  __decorateClass([
395
396
  property({ type: Boolean })
396
397
  ], GdsPagination.prototype, "jump", 2);
398
+ __decorateClass([
399
+ property({
400
+ attribute: "hide-options",
401
+ type: Boolean,
402
+ reflect: false
403
+ })
404
+ ], GdsPagination.prototype, "hideOptions", 2);
397
405
  __decorateClass([
398
406
  property({ reflect: false })
399
407
  ], GdsPagination.prototype, "density", 2);
@@ -58,6 +58,10 @@ export declare class GdsPopover extends GdsElement {
58
58
  * Whether to use a modal dialog in mobile viewport.
59
59
  */
60
60
  disableMobileStyles: boolean;
61
+ /**
62
+ * Whether to disable closing the popover when the page is scrolled.
63
+ */
64
+ disableScrollClose: boolean;
61
65
  /**
62
66
  * Whether the popover should autofocus the first slotted child when opened.
63
67
  */
@@ -43,6 +43,7 @@ let GdsPopover = class extends GdsElement {
43
43
  this.label = void 0;
44
44
  this.placement = "bottom-start";
45
45
  this.disableMobileStyles = false;
46
+ this.disableScrollClose = false;
46
47
  this.autofocus = false;
47
48
  this.calcMinWidth = (referenceEl) => `${referenceEl.offsetWidth}px`;
48
49
  this.calcMaxWidth = (_referenceEl) => `auto`;
@@ -117,7 +118,7 @@ let GdsPopover = class extends GdsElement {
117
118
  }
118
119
  });
119
120
  __privateAdd(this, _handlePageScroll, () => {
120
- if (this.open && window.innerWidth > 767 && __privateGet(this, _dispatchUiStateEvent).call(this, "close")) {
121
+ if (this.open && !this.disableScrollClose && window.innerWidth > 767 && __privateGet(this, _dispatchUiStateEvent).call(this, "close")) {
121
122
  this.open = false;
122
123
  }
123
124
  });
@@ -353,6 +354,9 @@ __decorateClass([
353
354
  __decorateClass([
354
355
  property({ type: Boolean })
355
356
  ], GdsPopover.prototype, "disableMobileStyles", 2);
357
+ __decorateClass([
358
+ property({ type: Boolean })
359
+ ], GdsPopover.prototype, "disableScrollClose", 2);
356
360
  __decorateClass([
357
361
  property({ type: Boolean })
358
362
  ], GdsPopover.prototype, "autofocus", 2);
@@ -19,6 +19,18 @@ import * as Types from './table.types';
19
19
  export declare class GdsTable<T extends Types.Row = Types.Row> extends GdsElement {
20
20
  #private;
21
21
  static styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
22
+ /**
23
+ * The main headline text displayed at the top of the table.
24
+ */
25
+ headline?: string;
26
+ /**
27
+ * The HTML tag to use for the headline (e.g., 'h1', 'h2', etc.).
28
+ */
29
+ headlineTag: string;
30
+ /**
31
+ * A brief description or summary displayed below the headline.
32
+ */
33
+ summary?: string;
22
34
  /**
23
35
  * Configurable options for rows per page.
24
36
  * Accepts: number array (e.g., `[5, 10, 20, 50, 100]`)
@@ -5,7 +5,7 @@ import {
5
5
  __privateMethod,
6
6
  __privateSet
7
7
  } from "../../chunks/chunk.QU3DSPNU.js";
8
- var _cache, _cacheDuration, _templateCache, _GdsTable_instances, Density_get, hasSelection_get, isAllSelected_get, isPartialSelection_get, getCacheKey_fn, isCacheValid_fn, loadData_fn, getSlotContent_fn, renderCell_fn, renderCellContent_fn, renderSortIcon_fn, hasHeaderContent_fn, renderHeaderControls_fn, renderColumnHeader_fn, renderActionsHeader_fn, renderSelectableHeader_fn, renderColumnHeaders_fn, renderTableHeader_fn, renderTableCell_fn, renderSelectableCell_fn, renderRowCells_fn, renderActionsCell_fn, renderTableRow_fn, renderCheckbox_fn, renderSkeletonCell_fn, renderSkeletonRow_fn, renderTableBody_fn, renderTable_fn, renderErrorState_fn, renderEmptyState_fn, renderFooter_fn, handleSearch_fn, handleSearchClear_fn, handleSort_fn, handlePageChange_fn, handlePageSizeChange_fn, handleColumnVisibility_fn, handleSelectAll_fn, handleRowSelect_fn, selectAllInternal_fn, clearSelectionInternal_fn, emitSelectionChange_fn, initializeScrollTracking_fn, updateVerticalScrollState_fn, updateHorizontalScrollState_fn;
8
+ var _cache, _cacheDuration, _templateCache, _GdsTable_instances, Density_get, hasSelection_get, isAllSelected_get, isPartialSelection_get, getCacheKey_fn, isCacheValid_fn, loadData_fn, getSlotContent_fn, renderCell_fn, renderCellContent_fn, renderSortIcon_fn, hasHeaderContent_fn, renderHeaderControls_fn, renderColumnHeader_fn, renderActionsHeader_fn, renderSelectableHeader_fn, renderColumnHeaders_fn, renderTableHeader_fn, renderTableCell_fn, renderSelectableCell_fn, renderRowCells_fn, renderActionsCell_fn, renderTableRow_fn, renderCheckbox_fn, renderSkeletonCell_fn, renderSkeletonRow_fn, renderTableBody_fn, renderTable_fn, renderErrorState_fn, renderEmptyState_fn, renderFooter_fn, renderHeadline_fn, handleSearch_fn, handleSearchClear_fn, handleSort_fn, handlePageChange_fn, handlePageSizeChange_fn, handleColumnVisibility_fn, handleSelectAll_fn, handleRowSelect_fn, selectAllInternal_fn, clearSelectionInternal_fn, emitSelectionChange_fn, initializeScrollTracking_fn, updateVerticalScrollState_fn, updateHorizontalScrollState_fn;
9
9
  import { localized, msg } from "@lit/localize";
10
10
  import { property, state } from "lit/decorators.js";
11
11
  import { classMap } from "lit/directives/class-map.js";
@@ -30,6 +30,7 @@ let GdsTable = class extends GdsElement {
30
30
  __privateAdd(this, _cache, {});
31
31
  __privateAdd(this, _cacheDuration, 5 * 60 * 1e3);
32
32
  __privateAdd(this, _templateCache, /* @__PURE__ */ new Map());
33
+ this.headlineTag = "h2";
33
34
  this.options = [5, 10, 20, 50, 100];
34
35
  this.page = 1;
35
36
  this.rows = 10;
@@ -91,6 +92,7 @@ let GdsTable = class extends GdsElement {
91
92
  return html`
92
93
  <div class="${classMap(classes)}">
93
94
  ${[
95
+ __privateMethod(this, _GdsTable_instances, renderHeadline_fn).call(this),
94
96
  __privateMethod(this, _GdsTable_instances, renderHeaderControls_fn).call(this),
95
97
  when(
96
98
  this._error,
@@ -742,7 +744,7 @@ renderTable_fn = function() {
742
744
  loading: this._loading,
743
745
  loaded: !this._loading && !this._loaded
744
746
  });
745
- const caption = `${msg("Data table with")} ${this._total} ${msg("rows")}`;
747
+ const caption = `${this.summary}, ${msg("Data table with")} ${this._total} ${msg("rows")}`;
746
748
  return html`
747
749
  <gds-card
748
750
  variant="${this.variant}"
@@ -817,7 +819,7 @@ renderFooter_fn = function() {
817
819
  if (this.plain || this._total < 1) return null;
818
820
  const start = (this._view.page - 1) * this._view.rows + 1;
819
821
  const end = Math.min(this._view.page * this._view.rows, this._total);
820
- const summaryString = `${start} - ${end} ${msg("of")} ${this._total}`;
822
+ const summaryString = `${start}\u2013${end} ${msg("of")} ${this._total}`;
821
823
  return html`
822
824
  <gds-pagination
823
825
  .page=${this._view.page}
@@ -833,6 +835,36 @@ renderFooter_fn = function() {
833
835
  </gds-pagination>
834
836
  `;
835
837
  };
838
+ renderHeadline_fn = function() {
839
+ if (this.plain) return null;
840
+ if (this.headline || this.summary) {
841
+ return html`
842
+ <gds-flex flex-direction="column" gap="4xs">
843
+ <gds-text
844
+ tag="${this.headlineTag}"
845
+ font="heading-s"
846
+ text-wrap="balance"
847
+ max-width="80ch"
848
+ >
849
+ ${this.headline}
850
+ </gds-text>
851
+ <gds-text
852
+ tag="p"
853
+ font=${this.density === "compact" ? "body-regular-s" : "body-regular-m"}
854
+ text-wrap="balance"
855
+ max-width="80ch"
856
+ >
857
+ ${this.summary}
858
+ </gds-text>
859
+ </gds-flex>
860
+ ${when(
861
+ this.searchable || this.settings,
862
+ () => html`<gds-divider color="subtle-01"></gds-divider>`,
863
+ () => html``
864
+ )}
865
+ `;
866
+ }
867
+ };
836
868
  handleSearch_fn = async function(e) {
837
869
  const input = e.target;
838
870
  this._view = {
@@ -988,6 +1020,19 @@ updateHorizontalScrollState_fn = function(container) {
988
1020
  }
989
1021
  };
990
1022
  GdsTable.styles = Table.Styles;
1023
+ __decorateClass([
1024
+ property()
1025
+ ], GdsTable.prototype, "headline", 2);
1026
+ __decorateClass([
1027
+ property({
1028
+ attribute: "headline-tag",
1029
+ type: String,
1030
+ reflect: true
1031
+ })
1032
+ ], GdsTable.prototype, "headlineTag", 2);
1033
+ __decorateClass([
1034
+ property()
1035
+ ], GdsTable.prototype, "summary", 2);
991
1036
  __decorateClass([
992
1037
  property({ type: Array })
993
1038
  ], GdsTable.prototype, "options", 2);
@@ -1,6 +1,6 @@
1
- import { GdsBadge, GdsButton, GdsContextMenu, GdsDropdown, GdsFlex, GdsImg, GdsInput, GdsLink, GdsMenuItem, IconCrossSmall } from '../../pure';
1
+ import { GdsBadge, GdsButton, GdsContextMenu, GdsDivider, GdsDropdown, GdsFlex, GdsImg, GdsInput, GdsLink, GdsMenuItem, IconCrossSmall } from '../../pure';
2
2
  import { GdsPagination } from '../pagination/pagination.component';
3
3
  export { checkboxToggle as Checkbox } from '../../shared-styles/rbcb-toggle.template';
4
4
  export { accountsFormats as FormatAccount, dateTimeFormats as FormatDate, numberFormats as FormatNumber, } from '../formatted-text/formatters';
5
5
  export declare const Styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
6
- export declare const Dependencies: (typeof GdsMenuItem | typeof GdsButton | typeof IconCrossSmall | typeof GdsFlex | typeof GdsBadge | typeof GdsLink | typeof GdsContextMenu | typeof GdsDropdown | typeof GdsImg | typeof GdsPagination | typeof GdsInput)[];
6
+ export declare const Dependencies: (typeof GdsMenuItem | typeof GdsButton | typeof IconCrossSmall | typeof GdsFlex | typeof GdsBadge | typeof GdsLink | typeof GdsContextMenu | typeof GdsDropdown | typeof GdsDivider | typeof GdsImg | typeof GdsPagination | typeof GdsInput)[];
@@ -4,6 +4,7 @@ import {
4
4
  GdsButton,
5
5
  GdsCard,
6
6
  GdsContextMenu,
7
+ GdsDivider,
7
8
  GdsDropdown,
8
9
  GdsFlex,
9
10
  GdsImg,
@@ -34,6 +35,7 @@ const Styles = [tokens, checkboxStyles, TableStyles];
34
35
  const Dependencies = [
35
36
  GdsButton,
36
37
  GdsCard,
38
+ GdsDivider,
37
39
  GdsImg,
38
40
  GdsContextMenu,
39
41
  GdsMenuItem,
@@ -34,7 +34,7 @@ const TableStyles = css`
34
34
  --table-header-padding-x: var(--gds-sys-space-m);
35
35
  --table-row-min-height: var(--gds-sys-space-4xl);
36
36
  --table-font-size: var(--gds-sys-text-detail-book-s);
37
- --table-gap: var(--gds-sys-space-xl);
37
+ --table-gap: var(--gds-sys-space-l);
38
38
  --table-border-spacing: 0 var(--gds-sys-space-4xs);
39
39
  --table-data-padding: var(--gds-sys-space-3xs) var(--gds-sys-space-2xs);
40
40
  }
@@ -47,7 +47,7 @@ const TableStyles = css`
47
47
  --table-header-padding-x: var(--gds-sys-space-l);
48
48
  --table-row-min-height: var(--gds-sys-space-5xl);
49
49
  --table-font-size: var(--gds-sys-text-detail-book-m);
50
- --table-gap: var(--gds-sys-space-2xl);
50
+ --table-gap: var(--gds-sys-space-xl);
51
51
  --table-border-spacing: 0 var(--gds-sys-space-3xs);
52
52
  --table-data-padding: var(--gds-sys-space-3xs) var(--gds-sys-space-xs);
53
53
  }
@@ -268,7 +268,6 @@ const TableStyles = css`
268
268
 
269
269
  /* Striped */
270
270
  .striped tbody tr:not(.selected, :hover):nth-child(even) td {
271
- /* background-color: var(--gds-sys-color-l2-neutral-01); */
272
271
  background-color: var(--_table-row-striped);
273
272
  }
274
273
 
@@ -277,6 +276,7 @@ const TableStyles = css`
277
276
  }
278
277
 
279
278
  /* Header & Footer Layout */
279
+
280
280
  .header {
281
281
  display: flex;
282
282
  justify-content: space-between;