@iyulab/desktop-patterns 0.8.0 → 0.9.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.
@@ -16,6 +16,12 @@ export declare class DpListDetail extends LitElement {
16
16
  static styles: import('lit').CSSResult;
17
17
  /** Below desktop width, show the picked item instead of the list. Above it both are always shown. */
18
18
  detailOpen: boolean;
19
+ /**
20
+ * At desktop width, fold the list away and give the item the whole width — for reading a wide item. The
21
+ * consumer owns it, with a control that brings the list back. Below desktop width it changes nothing:
22
+ * `detail-open` already picks the one pane shown.
23
+ */
24
+ listCollapsed: boolean;
19
25
  render(): import('lit-html').TemplateResult<1>;
20
26
  }
21
27
  declare global {
@@ -5,7 +5,7 @@ import { customElement as a, property as o } from "lit/decorators.js";
5
5
  //#region src/components/list-detail/dp-list-detail.ts
6
6
  var s = class extends n {
7
7
  constructor(...e) {
8
- super(...e), this.detailOpen = !1;
8
+ super(...e), this.detailOpen = !1, this.listCollapsed = !1;
9
9
  }
10
10
  static {
11
11
  this.styles = r`
@@ -46,6 +46,11 @@ var s = class extends n {
46
46
  .detail {
47
47
  display: block;
48
48
  }
49
+ /* Folded away: the item takes the whole width until the list is wanted again. */
50
+ :host([list-collapsed]) .list,
51
+ :host([list-collapsed][detail-open]) .list {
52
+ display: none;
53
+ }
49
54
  }
50
55
  /* On paper only the item picked is printed, at its full length. */
51
56
  @media print {
@@ -75,6 +80,10 @@ t([o({
75
80
  type: Boolean,
76
81
  reflect: !0,
77
82
  attribute: "detail-open"
78
- })], s.prototype, "detailOpen", void 0), s = t([a("dp-list-detail")], s);
83
+ })], s.prototype, "detailOpen", void 0), t([o({
84
+ type: Boolean,
85
+ reflect: !0,
86
+ attribute: "list-collapsed"
87
+ })], s.prototype, "listCollapsed", void 0), s = t([a("dp-list-detail")], s);
79
88
  //#endregion
80
89
  export { s as DpListDetail };
package/dist/sidebar.js CHANGED
@@ -105,10 +105,19 @@ var c = (e) => Array.isArray(e.items), l = class extends Event {
105
105
  justify-content: center;
106
106
  padding: var(--dc-space-3, 12px) 0;
107
107
  }
108
- /* Items inside an open group sit one step in, so the group reads as a set. */
109
- :host(:not([collapsed])) .group-items .item {
108
+ /* A group with an icon is a parent item: its items sit one step in, so it reads as a set. */
109
+ :host(:not([collapsed])) .group:not(.heading) .group-items .item {
110
110
  padding-left: calc(var(--dc-space-3, 12px) * 2);
111
111
  }
112
+ /* A group without one is a heading over its items: smaller and quieter than they are, its label flush
113
+ with their icons, and the items at the rail's own indent - the heading, not an indent, makes the set. */
114
+ .group.heading > .group-toggle {
115
+ padding-top: var(--dc-space-3, 12px);
116
+ padding-bottom: var(--dc-space-1, 4px);
117
+ font-size: var(--dp-sidebar-group-size, var(--dc-font-size-xs, 11px));
118
+ font-weight: var(--dc-font-weight-semibold, 600);
119
+ color: var(--dc-color-text-muted, #6b6b73);
120
+ }
112
121
  /* In the collapsed rail a group has no label to show; a rule marks where it starts. */
113
122
  :host([collapsed]) .group + .group,
114
123
  :host([collapsed]) .item + .group,
@@ -175,16 +184,16 @@ var c = (e) => Array.isArray(e.items), l = class extends Event {
175
184
  `;
176
185
  }
177
186
  #e(e) {
178
- let t = e.items.some((e) => e.id === this.activeId), n = e.collapsed === !0, a = this.collapsed || t || n === this.toggledGroups.has(e.id), o = `group-${e.id}`;
187
+ let t = e.items.some((e) => e.id === this.activeId), n = e.collapsed === !0, a = this.collapsed || t || n === this.toggledGroups.has(e.id), o = `group-${e.id}`, s = !e.icon;
179
188
  return r`
180
- <div class="group">
189
+ <div class=${s ? "group heading" : "group"}>
181
190
  ${this.collapsed ? i : r`<button
182
191
  class="item group-toggle"
183
192
  aria-expanded=${a ? "true" : "false"}
184
193
  aria-controls=${o}
185
194
  @click=${() => this.#a(e.id)}
186
195
  >
187
- ${this.#r(e.id, e.icon ?? "")}
196
+ ${s ? i : this.#r(e.id, e.icon ?? "")}
188
197
  <span class="label">${e.label}</span>
189
198
  <span class="caret" aria-hidden="true">▾</span>
190
199
  </button>`}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iyulab/desktop-patterns",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -82,10 +82,10 @@
82
82
  "lit": "^3.3.3"
83
83
  },
84
84
  "peerDependencies": {
85
- "@iyulab/desktop-compact": "^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0"
85
+ "@iyulab/desktop-compact": "^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0"
86
86
  },
87
87
  "devDependencies": {
88
- "@iyulab/desktop-compact": "^0.11.0",
88
+ "@iyulab/desktop-compact": "^0.12.0",
89
89
  "@open-wc/testing": "^5.0.0",
90
90
  "@storybook/web-components": "^10.6.0",
91
91
  "@storybook/web-components-vite": "^10.6.0",
package/tokens.css CHANGED
@@ -22,6 +22,11 @@
22
22
  syntax: '*';
23
23
  inherits: true;
24
24
  }
25
+ /* dp-sidebar's heading size for a group without an icon. Unset, the sidebar uses var(--dc-font-size-xs, 11px). */
26
+ @property --dp-sidebar-group-size {
27
+ syntax: '*';
28
+ inherits: true;
29
+ }
25
30
  :root {
26
31
  --dp-sidebar-width: 220px;
27
32
  --dp-sidebar-width-collapsed: 52px;