@commmerce/ui 1.5.0 → 1.5.2

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.
@@ -207,6 +207,8 @@ CmAppFrame.styles = [
207
207
  box-sizing: border-box; margin: var(--_gutter); min-block-size: calc(var(--cm-app-frame-height, 100dvh) - var(--_header) - 2 * var(--_gutter));
208
208
  border: var(--cm-border-1) solid var(--cm-border-subtle); border-radius: var(--cm-radius-lg);
209
209
  }
210
+ /* Inherited, so a cm-page inside a wrapper element (not slotted directly) is transparent too. */
211
+ :host([panel]) { --cm-page-background: transparent; }
210
212
  :host([panel]) ::slotted(cm-page) { background: transparent; }
211
213
  main:focus { outline: none; }
212
214
  .bottom { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 40; }
@@ -342,7 +342,12 @@ export declare class CmCalendar extends CmLocalizedElement {
342
342
  disconnectedCallback(): void;
343
343
  protected willUpdate(changed: PropertyValues): void;
344
344
  protected firstUpdated(): void;
345
- protected updated(): void;
345
+ /**
346
+ * Scrolls the week or day view so `hour` (0–23) is at the top. Useful after loading events, e.g. to open at the first one.
347
+ * Does nothing in the month view.
348
+ */
349
+ scrollToHour(hour: number): void;
350
+ protected updated(changed: Map<PropertyKey, unknown>): void;
346
351
  /** Shows the previous month, week (three days when narrow) or day. */
347
352
  previous(): void;
348
353
  /** Shows the next month, week (three days when narrow) or day. */
@@ -499,7 +499,21 @@ export class CmCalendar extends CmLocalizedElement {
499
499
  firstUpdated() {
500
500
  this.renderRoot.appendChild(__classPrivateFieldGet(this, _CmCalendar_announcer, "f").element);
501
501
  }
502
- updated() {
502
+ /**
503
+ * Scrolls the week or day view so `hour` (0–23) is at the top. Useful after loading events, e.g. to open at the first one.
504
+ * Does nothing in the month view.
505
+ */
506
+ scrollToHour(hour) {
507
+ const tg = this.renderRoot.querySelector('.tg');
508
+ const cell = tg?.querySelector('.tcell');
509
+ if (!tg || !cell)
510
+ return;
511
+ tg.scrollTop = cell.offsetHeight * Math.max(0, Math.min(23, Math.trunc(Number(hour)) || 0));
512
+ }
513
+ updated(changed) {
514
+ // A day-start changed after the first render (e.g. set once events have loaded) scrolls again.
515
+ if (changed.has('dayStart') && changed.get('dayStart') !== undefined)
516
+ __classPrivateFieldSet(this, _CmCalendar_scrollToStart, true, "f");
503
517
  __classPrivateFieldGet(this, _CmCalendar_instances, "m", _CmCalendar_syncTabStops).call(this);
504
518
  if (__classPrivateFieldGet(this, _CmCalendar_pendingFocus, "f")) {
505
519
  const el = __classPrivateFieldGet(this, _CmCalendar_instances, "m", _CmCalendar_find).call(this, __classPrivateFieldGet(this, _CmCalendar_pendingFocus, "f").key);
@@ -8,7 +8,8 @@ import { LitElement } from 'lit';
8
8
  * Page anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.
9
9
  * Pick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for
10
10
  * one record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.
11
- * The background is `bg-page`; inside `cm-app-frame panel` it is transparent, so the page sits on the white panel.
11
+ * The background is `bg-page`; inside `cm-app-frame panel` (at any depth) it is transparent, so the page sits on the white panel.
12
+ * @cssprop --cm-page-background - The page background. Default `bg-page`; `cm-app-frame panel` sets it to `transparent`.
12
13
  * @element cm-page
13
14
  * @slot header - A `cm-page-header`. Runs edge to edge.
14
15
  * @slot - The page content, usually a `cm-layout`.
@@ -9,7 +9,8 @@ import { base, define } from '../base.js';
9
9
  * Page anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.
10
10
  * Pick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for
11
11
  * one record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.
12
- * The background is `bg-page`; inside `cm-app-frame panel` it is transparent, so the page sits on the white panel.
12
+ * The background is `bg-page`; inside `cm-app-frame panel` (at any depth) it is transparent, so the page sits on the white panel.
13
+ * @cssprop --cm-page-background - The page background. Default `bg-page`; `cm-app-frame panel` sets it to `transparent`.
13
14
  * @element cm-page
14
15
  * @slot header - A `cm-page-header`. Runs edge to edge.
15
16
  * @slot - The page content, usually a `cm-layout`.
@@ -40,7 +41,7 @@ CmPage.properties = {
40
41
  CmPage.styles = [
41
42
  base,
42
43
  css `
43
- :host { display: block; container: cm-page / inline-size; background: var(--cm-bg-page); min-block-size: 100%; }
44
+ :host { display: block; container: cm-page / inline-size; background: var(--cm-page-background, var(--cm-bg-page)); min-block-size: 100%; }
44
45
  .content {
45
46
  box-sizing: content-box; max-inline-size: 1600px; margin-inline: auto;
46
47
  padding: var(--cm-space-24);
@@ -5990,6 +5990,19 @@
5990
5990
  "name": "#measure",
5991
5991
  "privacy": "private"
5992
5992
  },
5993
+ {
5994
+ "kind": "method",
5995
+ "name": "scrollToHour",
5996
+ "parameters": [
5997
+ {
5998
+ "name": "hour",
5999
+ "type": {
6000
+ "text": "number"
6001
+ }
6002
+ }
6003
+ ],
6004
+ "description": "Scrolls the week or day view so `hour` (0–23) is at the top. Useful after loading events, e.g. to open at the first one.\nDoes nothing in the month view."
6005
+ },
5993
6006
  {
5994
6007
  "kind": "method",
5995
6008
  "name": "#shift",
@@ -20525,8 +20538,14 @@
20525
20538
  "declarations": [
20526
20539
  {
20527
20540
  "kind": "class",
20528
- "description": "A whole admin page: the page header across the top, then the content with the page padding (`space-24`, or\n`space-16` when the page is 640px wide or less; the same side padding as `cm-page-header`, so titles and content\nline up), centred at a width that suits the page.\n`<cm-page><cm-page-header slot=\"header\" heading=\"Orders\"></cm-page-header><cm-layout>…</cm-layout></cm-page>`\n\nPage anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.\nPick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for\none record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.\nThe background is `bg-page`; inside `cm-app-frame panel` it is transparent, so the page sits on the white panel.",
20541
+ "description": "A whole admin page: the page header across the top, then the content with the page padding (`space-24`, or\n`space-16` when the page is 640px wide or less; the same side padding as `cm-page-header`, so titles and content\nline up), centred at a width that suits the page.\n`<cm-page><cm-page-header slot=\"header\" heading=\"Orders\"></cm-page-header><cm-layout>…</cm-layout></cm-page>`\n\nPage anatomy: the header (title, primary action at the end), then a filter or toolbar row, then the content.\nPick the width by what the page holds: `form` (640px) for settings and single-column forms, `detail` (1040px) for\none record (an order, a customer), the default (1600px) for lists and dashboards, `full` for wide tables and reports.\nThe background is `bg-page`; inside `cm-app-frame panel` (at any depth) it is transparent, so the page sits on the white panel.",
20529
20542
  "name": "CmPage",
20543
+ "cssProperties": [
20544
+ {
20545
+ "description": "The page background. Default `bg-page`; `cm-app-frame panel` sets it to `transparent`.",
20546
+ "name": "--cm-page-background"
20547
+ }
20548
+ ],
20530
20549
  "slots": [
20531
20550
  {
20532
20551
  "description": "A `cm-page-header`. Runs edge to edge.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commmerce/ui",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Commmerce UI web components: build apps that feel native to the Commmerce admin. Works in plain HTML, React, Vue and server-rendered pages.",
5
5
  "keywords": [
6
6
  "web-components",
@@ -50,8 +50,8 @@
50
50
  "test": "vitest run"
51
51
  },
52
52
  "dependencies": {
53
- "@commmerce/icons": "1.5.0",
54
- "@commmerce/tokens": "1.5.0",
53
+ "@commmerce/icons": "1.5.2",
54
+ "@commmerce/tokens": "1.5.2",
55
55
  "lit": "3.2.1"
56
56
  },
57
57
  "devDependencies": {