@deepfuture/dui-components 0.0.20 → 0.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepfuture/dui-components",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "DUI unstyled web components — structural CSS only, themed via applyTheme()",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -194,7 +194,7 @@
194
194
  "README.md"
195
195
  ],
196
196
  "dependencies": {
197
- "@deepfuture/dui-core": "0.0.20",
197
+ "@deepfuture/dui-core": "0.0.21",
198
198
  "lit": "^3.3.2",
199
199
  "@lit/context": "^1.1.3"
200
200
  },
@@ -142,6 +142,7 @@ let DuiPreviewCardPopup = (() => {
142
142
  offset: 8,
143
143
  styles: portalPopupStyles,
144
144
  contentContainer: ".PreviewCardContent",
145
+ forwardProperties: ["--preview-card-popup-padding"],
145
146
  onPosition: ({ placement }) => {
146
147
  const actualSide = placement.split("-")[0];
147
148
  if (actualSide !== this.#side) {
@@ -11,7 +11,7 @@ type ScrollAreaOrientation = "vertical" | "horizontal" | "both";
11
11
  *
12
12
  * @cssprop [--scroll-area-max-height] - Max-height constraint.
13
13
  * @cssprop [--scroll-area-thumb-color] - Scrollbar thumb color.
14
- * @cssprop [--scroll-fade-color] - Fade overlay color.
14
+ * @cssprop [--scroll-fade-size] - Distance over which the top fade goes from transparent to opaque (default: 1.5rem).
15
15
  */
16
16
  export declare class DuiScrollArea extends LitElement {
17
17
  #private;
@@ -69,14 +69,9 @@ const styles = css `
69
69
  }
70
70
  }
71
71
 
72
- .ScrollFade {
73
- position: absolute;
74
- top: 0;
75
- left: 0;
76
- right: 0;
77
- height: 0;
78
- pointer-events: none;
79
- z-index: 1;
72
+ :host([fade]) .Viewport[data-scrolled] {
73
+ -webkit-mask-image: linear-gradient(to bottom, transparent, black var(--scroll-fade-size, 1.5rem));
74
+ mask-image: linear-gradient(to bottom, transparent, black var(--scroll-fade-size, 1.5rem));
80
75
  }
81
76
 
82
77
  .Scrollbar {
@@ -147,7 +142,7 @@ const styles = css `
147
142
  *
148
143
  * @cssprop [--scroll-area-max-height] - Max-height constraint.
149
144
  * @cssprop [--scroll-area-thumb-color] - Scrollbar thumb color.
150
- * @cssprop [--scroll-fade-color] - Fade overlay color.
145
+ * @cssprop [--scroll-fade-size] - Distance over which the top fade goes from transparent to opaque (default: 1.5rem).
151
146
  */
152
147
  let DuiScrollArea = (() => {
153
148
  var _a;
@@ -541,13 +536,7 @@ let DuiScrollArea = (() => {
541
536
  ?data-has-overflow-y="${this.#hasOverflowY}"
542
537
  ?data-scrolling="${this.#scrolling}"
543
538
  >
544
- ${this.fade
545
- ? html `<div
546
- class="ScrollFade"
547
- ?data-scrolled="${!this.#isAtTop}"
548
- ></div>`
549
- : nothing}
550
- <div class="Viewport" part="viewport" @scroll="${this.#onScroll}">
539
+ <div class="Viewport" part="viewport" ?data-scrolled="${!this.#isAtTop}" @scroll="${this.#onScroll}">
551
540
  <slot></slot>
552
541
  </div>
553
542
  ${this.#renderVerticalScrollbar()} ${this.#renderHorizontalScrollbar()}
@@ -32,6 +32,8 @@ export declare class DuiSelect extends LitElement {
32
32
  accessor placeholder: string;
33
33
  /** Whether the select is disabled. */
34
34
  accessor disabled: boolean;
35
+ /** Position the popup so the selected item overlays the trigger (macOS-style). */
36
+ accessor alignItemToTrigger: boolean;
35
37
  /** Name for form submission. */
36
38
  accessor name: string;
37
39
  willUpdate(): void;
package/select/select.js CHANGED
@@ -141,6 +141,9 @@ let DuiSelect = (() => {
141
141
  let _disabled_decorators;
142
142
  let _disabled_initializers = [];
143
143
  let _disabled_extraInitializers = [];
144
+ let _alignItemToTrigger_decorators;
145
+ let _alignItemToTrigger_initializers = [];
146
+ let _alignItemToTrigger_extraInitializers = [];
144
147
  let _name_decorators;
145
148
  let _name_initializers = [];
146
149
  let _name_extraInitializers = [];
@@ -155,12 +158,14 @@ let DuiSelect = (() => {
155
158
  _value_decorators = [property({ type: String })];
156
159
  _placeholder_decorators = [property({ type: String })];
157
160
  _disabled_decorators = [property({ type: Boolean, reflect: true })];
161
+ _alignItemToTrigger_decorators = [property({ type: Boolean, attribute: "align-item-to-trigger", reflect: true })];
158
162
  _name_decorators = [property({ type: String })];
159
163
  _private_highlightedIndex_decorators = [state()];
160
164
  __esDecorate(this, null, _options_decorators, { kind: "accessor", name: "options", static: false, private: false, access: { has: obj => "options" in obj, get: obj => obj.options, set: (obj, value) => { obj.options = value; } }, metadata: _metadata }, _options_initializers, _options_extraInitializers);
161
165
  __esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
162
166
  __esDecorate(this, null, _placeholder_decorators, { kind: "accessor", name: "placeholder", static: false, private: false, access: { has: obj => "placeholder" in obj, get: obj => obj.placeholder, set: (obj, value) => { obj.placeholder = value; } }, metadata: _metadata }, _placeholder_initializers, _placeholder_extraInitializers);
163
167
  __esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
168
+ __esDecorate(this, null, _alignItemToTrigger_decorators, { kind: "accessor", name: "alignItemToTrigger", static: false, private: false, access: { has: obj => "alignItemToTrigger" in obj, get: obj => obj.alignItemToTrigger, set: (obj, value) => { obj.alignItemToTrigger = value; } }, metadata: _metadata }, _alignItemToTrigger_initializers, _alignItemToTrigger_extraInitializers);
164
169
  __esDecorate(this, null, _name_decorators, { kind: "accessor", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
165
170
  __esDecorate(this, _private_highlightedIndex_descriptor = { get: __setFunctionName(function () { return this.#highlightedIndex_accessor_storage; }, "#highlightedIndex", "get"), set: __setFunctionName(function (value) { this.#highlightedIndex_accessor_storage = value; }, "#highlightedIndex", "set") }, _private_highlightedIndex_decorators, { kind: "accessor", name: "#highlightedIndex", static: false, private: true, access: { has: obj => #highlightedIndex in obj, get: obj => obj.#highlightedIndex, set: (obj, value) => { obj.#highlightedIndex = value; } }, metadata: _metadata }, _private_highlightedIndex_initializers, _private_highlightedIndex_extraInitializers);
166
171
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
@@ -189,7 +194,11 @@ let DuiSelect = (() => {
189
194
  /** Whether the select is disabled. */
190
195
  get disabled() { return this.#disabled_accessor_storage; }
191
196
  set disabled(value) { this.#disabled_accessor_storage = value; }
192
- #name_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _name_initializers, ""));
197
+ #alignItemToTrigger_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, _alignItemToTrigger_initializers, true));
198
+ /** Position the popup so the selected item overlays the trigger (macOS-style). */
199
+ get alignItemToTrigger() { return this.#alignItemToTrigger_accessor_storage; }
200
+ set alignItemToTrigger(value) { this.#alignItemToTrigger_accessor_storage = value; }
201
+ #name_accessor_storage = (__runInitializers(this, _alignItemToTrigger_extraInitializers), __runInitializers(this, _name_initializers, ""));
193
202
  /** Name for form submission. */
194
203
  get name() { return this.#name_accessor_storage; }
195
204
  set name(value) { this.#name_accessor_storage = value; }
@@ -203,6 +212,18 @@ let DuiSelect = (() => {
203
212
  matchWidth: false,
204
213
  minMatchWidth: true,
205
214
  styles: portalPopupStyles,
215
+ alignToInner: () => {
216
+ if (!this.alignItemToTrigger)
217
+ return null;
218
+ const root = this.#popup.renderRoot;
219
+ const selectedItem = root?.querySelector("[data-selected]");
220
+ return selectedItem?.querySelector(".ItemText") ?? selectedItem ?? null;
221
+ },
222
+ alignToInnerReference: () => {
223
+ if (!this.alignItemToTrigger)
224
+ return null;
225
+ return this.shadowRoot?.querySelector(".Value") ?? null;
226
+ },
206
227
  onOpen: () => {
207
228
  this.#highlightedIndex = this.#selectedIndex;
208
229
  },
@@ -213,6 +234,7 @@ let DuiSelect = (() => {
213
234
  return html `
214
235
  <div
215
236
  class="Popup"
237
+ ?data-align-inner="${this.alignItemToTrigger && this.value !== ""}"
216
238
  ?data-starting-style="${portal.isStarting}"
217
239
  ?data-ending-style="${portal.isEnding}"
218
240
  >
@@ -44,6 +44,7 @@ const styles = css `
44
44
  :host([orientation="vertical"]) {
45
45
  display: inline-block;
46
46
  align-self: stretch;
47
+ height: 100%;
47
48
  }
48
49
 
49
50
  [part="root"] {
@@ -26,6 +26,8 @@ export declare class DuiSplitButton extends LitElement {
26
26
  accessor appearance: string;
27
27
  /** Size — mapped to theme styles (e.g. xs, sm, md, lg). */
28
28
  accessor size: string;
29
+ /** Sets `min-width` on the popup panel (e.g. `"200px"`). Defaults to `"var(--space-28)"`. */
30
+ accessor popupMinWidth: string;
29
31
  /** Whether the entire split button is disabled. */
30
32
  accessor disabled: boolean;
31
33
  protected updated(): void;
@@ -136,6 +136,9 @@ let DuiSplitButton = (() => {
136
136
  let _size_decorators;
137
137
  let _size_initializers = [];
138
138
  let _size_extraInitializers = [];
139
+ let _popupMinWidth_decorators;
140
+ let _popupMinWidth_initializers = [];
141
+ let _popupMinWidth_extraInitializers = [];
139
142
  let _disabled_decorators;
140
143
  let _disabled_initializers = [];
141
144
  let _disabled_extraInitializers = [];
@@ -149,11 +152,13 @@ let DuiSplitButton = (() => {
149
152
  _variant_decorators = [property({ reflect: true })];
150
153
  _appearance_decorators = [property({ reflect: true })];
151
154
  _size_decorators = [property({ reflect: true })];
155
+ _popupMinWidth_decorators = [property({ attribute: "popup-min-width" })];
152
156
  _disabled_decorators = [property({ type: Boolean, reflect: true })];
153
157
  _private_highlightedIndex_decorators = [state()];
154
158
  __esDecorate(this, null, _variant_decorators, { kind: "accessor", name: "variant", static: false, private: false, access: { has: obj => "variant" in obj, get: obj => obj.variant, set: (obj, value) => { obj.variant = value; } }, metadata: _metadata }, _variant_initializers, _variant_extraInitializers);
155
159
  __esDecorate(this, null, _appearance_decorators, { kind: "accessor", name: "appearance", static: false, private: false, access: { has: obj => "appearance" in obj, get: obj => obj.appearance, set: (obj, value) => { obj.appearance = value; } }, metadata: _metadata }, _appearance_initializers, _appearance_extraInitializers);
156
160
  __esDecorate(this, null, _size_decorators, { kind: "accessor", name: "size", static: false, private: false, access: { has: obj => "size" in obj, get: obj => obj.size, set: (obj, value) => { obj.size = value; } }, metadata: _metadata }, _size_initializers, _size_extraInitializers);
161
+ __esDecorate(this, null, _popupMinWidth_decorators, { kind: "accessor", name: "popupMinWidth", static: false, private: false, access: { has: obj => "popupMinWidth" in obj, get: obj => obj.popupMinWidth, set: (obj, value) => { obj.popupMinWidth = value; } }, metadata: _metadata }, _popupMinWidth_initializers, _popupMinWidth_extraInitializers);
157
162
  __esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
158
163
  __esDecorate(this, _private_highlightedIndex_descriptor = { get: __setFunctionName(function () { return this.#highlightedIndex_accessor_storage; }, "#highlightedIndex", "get"), set: __setFunctionName(function (value) { this.#highlightedIndex_accessor_storage = value; }, "#highlightedIndex", "set") }, _private_highlightedIndex_decorators, { kind: "accessor", name: "#highlightedIndex", static: false, private: true, access: { has: obj => #highlightedIndex in obj, get: obj => obj.#highlightedIndex, set: (obj, value) => { obj.#highlightedIndex = value; } }, metadata: _metadata }, _private_highlightedIndex_initializers, _private_highlightedIndex_extraInitializers);
159
164
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
@@ -172,7 +177,11 @@ let DuiSplitButton = (() => {
172
177
  /** Size — mapped to theme styles (e.g. xs, sm, md, lg). */
173
178
  get size() { return this.#size_accessor_storage; }
174
179
  set size(value) { this.#size_accessor_storage = value; }
175
- #disabled_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _disabled_initializers, false));
180
+ #popupMinWidth_accessor_storage = (__runInitializers(this, _size_extraInitializers), __runInitializers(this, _popupMinWidth_initializers, "var(--space-28)"));
181
+ /** Sets `min-width` on the popup panel (e.g. `"200px"`). Defaults to `"var(--space-28)"`. */
182
+ get popupMinWidth() { return this.#popupMinWidth_accessor_storage; }
183
+ set popupMinWidth(value) { this.#popupMinWidth_accessor_storage = value; }
184
+ #disabled_accessor_storage = (__runInitializers(this, _popupMinWidth_extraInitializers), __runInitializers(this, _disabled_initializers, false));
176
185
  /** Whether the entire split button is disabled. */
177
186
  get disabled() { return this.#disabled_accessor_storage; }
178
187
  set disabled(value) { this.#disabled_accessor_storage = value; }
@@ -195,6 +204,7 @@ let DuiSplitButton = (() => {
195
204
  renderPopup: (portal) => html `
196
205
  <div
197
206
  class="Popup"
207
+ style="${this.popupMinWidth ? `min-width:${this.popupMinWidth}` : ""}"
198
208
  ?data-starting-style="${portal.isStarting}"
199
209
  ?data-ending-style="${portal.isEnding}"
200
210
  >