@daikin-oss/design-system-web-components 2.0.1-next.1 → 2.1.0-next.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.
- package/CHANGELOG.md +21 -0
- package/custom-elements.json +229 -42
- package/dist/cjs/base/dds-element.cjs +1 -1
- package/dist/cjs/components/carousel/daikin-carousel.cjs +298 -57
- package/dist/cjs/components/carousel/daikin-carousel.d.cts +50 -7
- package/dist/cjs/components/carousel-item/daikin-carousel-item.cjs +18 -2
- package/dist/cjs/components/carousel-item/daikin-carousel-item.d.cts +1 -5
- package/dist/cjs/components/chip/daikin-chip.cjs +24 -6
- package/dist/cjs/components/chip/daikin-chip.d.cts +2 -0
- package/dist/cjs/components/combobox/daikin-combobox.cjs +14 -4
- package/dist/cjs/components/combobox/daikin-combobox.d.cts +8 -0
- package/dist/cjs/components/icon-button/daikin-icon-button.cjs +42 -7
- package/dist/cjs/components/tag/daikin-tag.cjs +3 -1
- package/dist/cjs/components/text-field/daikin-text-field.cjs +12 -12
- package/dist/cjs/controllers/click-outside.cjs +5 -7
- package/dist/cjs/controllers/click-outside.d.cts +3 -3
- package/dist/cjs/tailwind.css.cjs +1 -1
- package/dist/cjs-dev/base/dds-element.cjs +1 -1
- package/dist/cjs-dev/components/carousel/daikin-carousel.cjs +300 -59
- package/dist/cjs-dev/components/carousel/daikin-carousel.d.cts +50 -7
- package/dist/cjs-dev/components/carousel-item/daikin-carousel-item.cjs +18 -2
- package/dist/cjs-dev/components/carousel-item/daikin-carousel-item.d.cts +1 -5
- package/dist/cjs-dev/components/chip/daikin-chip.cjs +24 -6
- package/dist/cjs-dev/components/chip/daikin-chip.d.cts +2 -0
- package/dist/cjs-dev/components/combobox/daikin-combobox.cjs +14 -4
- package/dist/cjs-dev/components/combobox/daikin-combobox.d.cts +8 -0
- package/dist/cjs-dev/components/icon-button/daikin-icon-button.cjs +42 -7
- package/dist/cjs-dev/components/tag/daikin-tag.cjs +3 -1
- package/dist/cjs-dev/components/text-field/daikin-text-field.cjs +12 -12
- package/dist/cjs-dev/controllers/click-outside.cjs +5 -7
- package/dist/cjs-dev/controllers/click-outside.d.cts +3 -3
- package/dist/cjs-dev/tailwind.css.cjs +1 -1
- package/dist/es/base/dds-element.js +1 -1
- package/dist/es/components/carousel/daikin-carousel.d.ts +50 -7
- package/dist/es/components/carousel/daikin-carousel.js +297 -58
- package/dist/es/components/carousel-item/daikin-carousel-item.d.ts +1 -5
- package/dist/es/components/carousel-item/daikin-carousel-item.js +18 -2
- package/dist/es/components/chip/daikin-chip.d.ts +2 -0
- package/dist/es/components/chip/daikin-chip.js +25 -7
- package/dist/es/components/combobox/daikin-combobox.d.ts +8 -0
- package/dist/es/components/combobox/daikin-combobox.js +14 -4
- package/dist/es/components/icon-button/daikin-icon-button.js +42 -7
- package/dist/es/components/tag/daikin-tag.js +3 -1
- package/dist/es/components/text-field/daikin-text-field.js +12 -12
- package/dist/es/controllers/click-outside.d.ts +3 -3
- package/dist/es/controllers/click-outside.js +5 -7
- package/dist/es/tailwind.css.js +1 -1
- package/dist/es-dev/base/dds-element.js +1 -1
- package/dist/es-dev/components/carousel/daikin-carousel.d.ts +50 -7
- package/dist/es-dev/components/carousel/daikin-carousel.js +299 -60
- package/dist/es-dev/components/carousel-item/daikin-carousel-item.d.ts +1 -5
- package/dist/es-dev/components/carousel-item/daikin-carousel-item.js +18 -2
- package/dist/es-dev/components/chip/daikin-chip.d.ts +2 -0
- package/dist/es-dev/components/chip/daikin-chip.js +25 -7
- package/dist/es-dev/components/combobox/daikin-combobox.d.ts +8 -0
- package/dist/es-dev/components/combobox/daikin-combobox.js +14 -4
- package/dist/es-dev/components/icon-button/daikin-icon-button.js +42 -7
- package/dist/es-dev/components/tag/daikin-tag.js +3 -1
- package/dist/es-dev/components/text-field/daikin-text-field.js +12 -12
- package/dist/es-dev/controllers/click-outside.d.ts +3 -3
- package/dist/es-dev/controllers/click-outside.js +5 -7
- package/dist/es-dev/tailwind.css.js +1 -1
- package/package.json +2 -1
|
@@ -71,6 +71,8 @@ export declare class DaikinChip extends DDSElement {
|
|
|
71
71
|
*/
|
|
72
72
|
chipAriaLabel: string | null;
|
|
73
73
|
private _focusableElement;
|
|
74
|
+
private _hasLeftIcon;
|
|
75
|
+
private _handleLeftIconSlotChange;
|
|
74
76
|
private _handleRemoveClick;
|
|
75
77
|
/**
|
|
76
78
|
* Emits `before-select` event if necessary and returns whether we should proceed.
|
|
@@ -171,6 +171,7 @@ var DaikinCombobox = class DaikinCombobox extends require_dds_form_element.DDSFo
|
|
|
171
171
|
this._hasLeftIcon = false;
|
|
172
172
|
this._autoUpdateController = new require_floating_ui_auto_update.FloatingUIAutoUpdateController(this);
|
|
173
173
|
this._clickOutsideController = new require_click_outside.ClickOutsideController(this, this._onClickOutside);
|
|
174
|
+
this._shouldRestoreFocusOnClose = false;
|
|
174
175
|
}
|
|
175
176
|
static {
|
|
176
177
|
this.styles = lit.css`
|
|
@@ -255,8 +256,10 @@ var DaikinCombobox = class DaikinCombobox extends require_dds_form_element.DDSFo
|
|
|
255
256
|
_handleFocusOut(event) {
|
|
256
257
|
if (this.open && (!event.relatedTarget || !this.renderRoot.contains(event.relatedTarget))) this._closePopup();
|
|
257
258
|
}
|
|
258
|
-
_handleClick() {
|
|
259
|
-
if (this.disabled
|
|
259
|
+
_handleClick(shouldFocusInput = false) {
|
|
260
|
+
if (this.disabled) return;
|
|
261
|
+
if (shouldFocusInput) this.focus();
|
|
262
|
+
if (this.readonly) return;
|
|
260
263
|
this._autoUpdateController.setTriggerContext({ trigger: "mouse" });
|
|
261
264
|
this._synchronizeShowItems();
|
|
262
265
|
this.open = !this.open;
|
|
@@ -266,12 +269,16 @@ var DaikinCombobox = class DaikinCombobox extends require_dds_form_element.DDSFo
|
|
|
266
269
|
event.preventDefault();
|
|
267
270
|
event.stopPropagation();
|
|
268
271
|
event.stopImmediatePropagation();
|
|
272
|
+
setTimeout(() => {
|
|
273
|
+
this.focus();
|
|
274
|
+
}, 0);
|
|
269
275
|
this._handleClick();
|
|
270
276
|
}
|
|
271
277
|
_handleClickItem(item) {
|
|
272
278
|
if (this.disabled || this.readonly) return;
|
|
273
279
|
const value = getItemValue(item);
|
|
274
280
|
this.value = value;
|
|
281
|
+
this._shouldRestoreFocusOnClose = true;
|
|
275
282
|
this.open = false;
|
|
276
283
|
this._currentFocusItemIndex = null;
|
|
277
284
|
this.dispatchEvent(new Event("input", {
|
|
@@ -413,7 +420,7 @@ var DaikinCombobox = class DaikinCombobox extends require_dds_form_element.DDSFo
|
|
|
413
420
|
aria-activedescendant=${this._currentFocusItemIndex !== null ? `combobox-item-${this._currentFocusItemIndex}` : lit.nothing}
|
|
414
421
|
@input=${this._handleInput}
|
|
415
422
|
@change=${this._handleChange}
|
|
416
|
-
@click=${this._handleClick}
|
|
423
|
+
@click=${() => this._handleClick(true)}
|
|
417
424
|
@focusout=${this._handleFocusOut}
|
|
418
425
|
${this._autoUpdateController.refReference()}
|
|
419
426
|
/>
|
|
@@ -502,7 +509,10 @@ var DaikinCombobox = class DaikinCombobox extends require_dds_form_element.DDSFo
|
|
|
502
509
|
if (changedProperties.has("value")) this._updateFormValue();
|
|
503
510
|
if (changedProperties.has("open") || changedProperties.has("disabled") || changedProperties.has("readonly")) {
|
|
504
511
|
this._autoUpdateController.floatingElement?.togglePopover(this._isPopupOpen);
|
|
505
|
-
if (changedProperties.get("open") && !this.open && !this.disabled)
|
|
512
|
+
if (changedProperties.get("open") && !this.open && !this.disabled) {
|
|
513
|
+
if (this._shouldRestoreFocusOnClose) this.focus();
|
|
514
|
+
this._shouldRestoreFocusOnClose = false;
|
|
515
|
+
}
|
|
506
516
|
}
|
|
507
517
|
if (changedProperties.has("open")) {
|
|
508
518
|
const wasOpen = changedProperties.get("open");
|
|
@@ -100,6 +100,14 @@ export declare class DaikinCombobox extends DDSFormElement {
|
|
|
100
100
|
private _moveFocusByKeydown;
|
|
101
101
|
private _updateFormValue;
|
|
102
102
|
private _closePopup;
|
|
103
|
+
/**
|
|
104
|
+
* Whether focus should be restored to the input the next time the popup closes.
|
|
105
|
+
* This is only `true` right before selecting an option, where hiding the popover blurs the
|
|
106
|
+
* clicked option button to `document.body`. It must stay `false` for closes caused by the
|
|
107
|
+
* focus/click moving to something else (outside click, focusout), otherwise we would steal
|
|
108
|
+
* focus back from whatever the user actually clicked.
|
|
109
|
+
*/
|
|
110
|
+
private _shouldRestoreFocusOnClose;
|
|
103
111
|
private _handleLeftIconSlotChange;
|
|
104
112
|
private _handleFocusOut;
|
|
105
113
|
private _handleClick;
|
|
@@ -24,30 +24,34 @@ var cvaIconButton = (0, class_variance_authority.cva)([
|
|
|
24
24
|
"focus-visible:outline-offset-2",
|
|
25
25
|
"focus-visible:outline-ddt-color-common-border-focus",
|
|
26
26
|
"[--color-secondary:transparent]",
|
|
27
|
-
"link-disabled:[--color-primary:var(--
|
|
27
|
+
"link-disabled:[--color-primary:var(--ddc-color-common-disabled)]",
|
|
28
|
+
"link-disabled:[--color-secondary:var(--ddc-color-common-surface-disabled)]"
|
|
28
29
|
], {
|
|
29
30
|
variants: {
|
|
30
31
|
color: {
|
|
31
32
|
default: [
|
|
32
33
|
"link-enabled:[--color-primary:var(--dds-color-common-brand-default)]",
|
|
34
|
+
"link-enabled:[--color-secondary:var(--ddc-color-common-surface-brand-default)]",
|
|
33
35
|
"hover:link-enabled:[--color-primary:var(--dds-color-common-brand-hover)]",
|
|
34
|
-
"hover:link-enabled:[--color-secondary:var(--
|
|
36
|
+
"hover:link-enabled:[--color-secondary:var(--ddc-color-common-surface-brand-hover)]",
|
|
35
37
|
"active:link-enabled:[--color-primary:var(--dds-color-common-brand-press)]",
|
|
36
|
-
"active:link-enabled:[--color-secondary:var(--
|
|
38
|
+
"active:link-enabled:[--color-secondary:var(--ddc-color-common-surface-brand-press)]"
|
|
37
39
|
],
|
|
38
40
|
neutral: [
|
|
39
41
|
"link-enabled:[--color-primary:var(--dds-color-common-neutral-default)]",
|
|
42
|
+
"link-enabled:[--color-secondary:var(--ddc-color-common-surface-neutral-default)]",
|
|
40
43
|
"hover:link-enabled:[--color-primary:var(--dds-color-common-neutral-hover)]",
|
|
41
|
-
"hover:link-enabled:[--color-secondary:var(--
|
|
44
|
+
"hover:link-enabled:[--color-secondary:var(--ddc-color-common-surface-neutral-hover)]",
|
|
42
45
|
"active:link-enabled:[--color-primary:var(--dds-color-common-neutral-press)]",
|
|
43
|
-
"active:link-enabled:[--color-secondary:var(--
|
|
46
|
+
"active:link-enabled:[--color-secondary:var(--ddc-color-common-surface-neutral-press)]"
|
|
44
47
|
],
|
|
45
48
|
danger: [
|
|
46
49
|
"link-enabled:[--color-primary:var(--dds-color-common-danger-default)]",
|
|
50
|
+
"link-enabled:[--color-secondary:var(--ddc-color-common-surface-danger-default)]",
|
|
47
51
|
"hover:link-enabled:[--color-primary:var(--dds-color-common-danger-hover)]",
|
|
48
|
-
"hover:link-enabled:[--color-secondary:var(--
|
|
52
|
+
"hover:link-enabled:[--color-secondary:var(--ddc-color-common-surface-danger-hover)]",
|
|
49
53
|
"active:link-enabled:[--color-primary:var(--dds-color-common-danger-press)]",
|
|
50
|
-
"active:link-enabled:[--color-secondary:var(--
|
|
54
|
+
"active:link-enabled:[--color-secondary:var(--ddc-color-common-surface-danger-press)]"
|
|
51
55
|
]
|
|
52
56
|
},
|
|
53
57
|
variant: {
|
|
@@ -107,6 +111,8 @@ var DaikinIconButton = class DaikinIconButton extends require_dds_form_element.D
|
|
|
107
111
|
display: inline-block;
|
|
108
112
|
width: var(--ddc-icon-button-size, 2rem);
|
|
109
113
|
height: var(--ddc-icon-button-size, 2rem);
|
|
114
|
+
--ddc-color-common-disabled: var(--dds-color-common-disabled);
|
|
115
|
+
--ddc-color-common-surface-disabled: transparent;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
118
|
:host([size="s"]) {
|
|
@@ -116,6 +122,35 @@ var DaikinIconButton = class DaikinIconButton extends require_dds_form_element.D
|
|
|
116
122
|
:host([size="m"]) {
|
|
117
123
|
--ddc-icon-button-size: 3rem; /* 48px */
|
|
118
124
|
}
|
|
125
|
+
|
|
126
|
+
:host(:not([color])),
|
|
127
|
+
:host([color="default"]) {
|
|
128
|
+
--ddc-color-common-surface-brand-default: none;
|
|
129
|
+
--ddc-color-common-surface-brand-hover: var(
|
|
130
|
+
--dds-color-common-surface-brand-hover
|
|
131
|
+
);
|
|
132
|
+
--ddc-color-common-surface-brand-press: var(
|
|
133
|
+
--dds-color-common-surface-brand-press
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
:host([color="neutral"]) {
|
|
137
|
+
--ddc-color-common-surface-neutral-default: none;
|
|
138
|
+
--ddc-color-common-surface-neutral-hover: var(
|
|
139
|
+
--dds-color-common-surface-neutral-hover
|
|
140
|
+
);
|
|
141
|
+
--ddc-color-common-surface-neutral-press: var(
|
|
142
|
+
--dds-color-common-surface-neutral-press
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
:host([color="danger"]) {
|
|
146
|
+
--ddc-color-common-surface-danger-default: none;
|
|
147
|
+
--ddc-color-common-surface-danger-hover: var(
|
|
148
|
+
--dds-color-common-surface-danger-hover
|
|
149
|
+
);
|
|
150
|
+
--ddc-color-common-surface-danger-press: var(
|
|
151
|
+
--dds-color-common-surface-danger-press
|
|
152
|
+
);
|
|
153
|
+
}
|
|
119
154
|
`;
|
|
120
155
|
}
|
|
121
156
|
constructor() {
|
|
@@ -17,7 +17,9 @@ var cvaWrapper = (0, class_variance_authority.cva)([
|
|
|
17
17
|
"overflow-hidden",
|
|
18
18
|
"size-full",
|
|
19
19
|
"gap-1",
|
|
20
|
-
"bg-(--bg-color-base)"
|
|
20
|
+
"bg-(--bg-color-base)",
|
|
21
|
+
"min-h-[2.125rem]",
|
|
22
|
+
"min-w-12"
|
|
21
23
|
], { variants: { elevated: {
|
|
22
24
|
true: ["shadow-[0px_1px_2px_1px_var(--dds-color-common-background-overlay)]"],
|
|
23
25
|
false: []
|
|
@@ -296,18 +296,18 @@ var DaikinTextField = class DaikinTextField extends require_dds_form_element.DDS
|
|
|
296
296
|
></span>
|
|
297
297
|
</daikin-icon-button>
|
|
298
298
|
</span>`}`;
|
|
299
|
-
case "password": return lit.html`${leftIconSlot}${
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
299
|
+
case "password": return lit.html`${leftIconSlot}${lit.html`<daikin-icon-button
|
|
300
|
+
color="neutral"
|
|
301
|
+
variant="ghost"
|
|
302
|
+
?disabled=${this.disabled}
|
|
303
|
+
button-aria-label=${this.showPassword ? "Hide password" : "Show password"}
|
|
304
|
+
class="absolute right-(--dds-padding-20) size-(--dds-icon-button)"
|
|
305
|
+
@click=${this._handleShowPasswordClick}
|
|
306
|
+
>
|
|
307
|
+
<span
|
|
308
|
+
class=${cvaShowPasswordIcon({ showPassword: this.showPassword })}
|
|
309
|
+
></span>
|
|
310
|
+
</daikin-icon-button>`}`;
|
|
311
311
|
case "search": return lit.html`<span
|
|
312
312
|
class=${cvaIcon({
|
|
313
313
|
icon: "left",
|
|
@@ -2,7 +2,7 @@ const require_controller_directive = require("./helpers/controller-directive.cjs
|
|
|
2
2
|
let lit = require("lit");
|
|
3
3
|
//#region src/controllers/click-outside.ts
|
|
4
4
|
/**
|
|
5
|
-
* An async directive that listens for outside
|
|
5
|
+
* An async directive that listens for pointer presses outside an element.
|
|
6
6
|
* This directive takes the target HTMLElement and a callback function as arguments.
|
|
7
7
|
* When the directive is connected to the DOM, an event listener is registered, and when it is disconnected from or removed from the DOM, the event listener will be unregistered.
|
|
8
8
|
* Also, when the directive arguments are updated, the event listener is re-registered.
|
|
@@ -12,11 +12,9 @@ var clickOutsideDirective = require_controller_directive.createControllerDirecti
|
|
|
12
12
|
if (!event.target || element.contains(event.target)) return;
|
|
13
13
|
callback.call(element, event);
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
window.addEventListener("click", listener);
|
|
17
|
-
}, 0);
|
|
15
|
+
window.addEventListener("pointerdown", listener, true);
|
|
18
16
|
return () => {
|
|
19
|
-
window.removeEventListener("
|
|
17
|
+
window.removeEventListener("pointerdown", listener, true);
|
|
20
18
|
};
|
|
21
19
|
});
|
|
22
20
|
/**
|
|
@@ -33,8 +31,8 @@ var clickOutsideDirective = require_controller_directive.createControllerDirecti
|
|
|
33
31
|
* this._onClickOutside
|
|
34
32
|
* );
|
|
35
33
|
*
|
|
36
|
-
* private _onClickOutside(event:
|
|
37
|
-
* console.debug("
|
|
34
|
+
* private _onClickOutside(event: PointerEvent): void {
|
|
35
|
+
* console.debug("Pointer outside", event);
|
|
38
36
|
* this.open = false;
|
|
39
37
|
* }
|
|
40
38
|
*
|
|
@@ -13,8 +13,8 @@ import { ReactiveControllerHost } from 'lit';
|
|
|
13
13
|
* this._onClickOutside
|
|
14
14
|
* );
|
|
15
15
|
*
|
|
16
|
-
* private _onClickOutside(event:
|
|
17
|
-
* console.debug("
|
|
16
|
+
* private _onClickOutside(event: PointerEvent): void {
|
|
17
|
+
* console.debug("Pointer outside", event);
|
|
18
18
|
* this.open = false;
|
|
19
19
|
* }
|
|
20
20
|
*
|
|
@@ -32,6 +32,6 @@ import { ReactiveControllerHost } from 'lit';
|
|
|
32
32
|
export declare class ClickOutsideController<T extends ReactiveControllerHost & HTMLElement> {
|
|
33
33
|
private readonly _host;
|
|
34
34
|
private readonly _callback;
|
|
35
|
-
constructor(_host: T, _callback: (this: T, event:
|
|
35
|
+
constructor(_host: T, _callback: (this: T, event: PointerEvent) => void);
|
|
36
36
|
directive(enabled?: boolean): import('lit-html/directive.js').DirectiveResult<import('lit-html/directive.js').DirectiveClass>;
|
|
37
37
|
}
|