@daikin-oss/design-system-web-components 0.3.1 → 0.3.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 +44 -0
- package/dist/cjs/components/accordion/daikin-accordion.d.ts +0 -1
- package/dist/cjs/components/accordion-item/daikin-accordion-item.d.ts +0 -1
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.cjs +124 -0
- package/dist/cjs/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/cjs/components/breadcrumb/index.cjs +7 -0
- package/dist/cjs/components/breadcrumb/index.d.ts +1 -0
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.cjs +116 -0
- package/dist/cjs/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/cjs/components/breadcrumb-item/index.cjs +7 -0
- package/dist/cjs/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/cjs/components/button/daikin-button.d.ts +0 -1
- package/dist/cjs/components/checkbox/daikin-checkbox.d.ts +0 -1
- package/dist/cjs/components/icon/daikin-icon.d.ts +0 -1
- package/dist/cjs/components/index.cjs +20 -0
- package/dist/cjs/components/index.d.ts +4 -0
- package/dist/cjs/components/input-group/daikin-input-group.cjs +1 -1
- package/dist/cjs/components/input-group/daikin-input-group.d.ts +0 -1
- package/dist/cjs/components/notification/daikin-notification.d.ts +0 -1
- package/dist/cjs/components/panel-switcher/daikin-panel-switcher.d.ts +0 -1
- package/dist/cjs/components/progress-bar/daikin-progress-bar.cjs +137 -0
- package/dist/cjs/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/cjs/components/progress-bar/index.cjs +7 -0
- package/dist/cjs/components/progress-bar/index.d.ts +1 -0
- package/dist/cjs/components/radio/daikin-radio.d.ts +0 -1
- package/dist/cjs/components/tab/daikin-tab.d.ts +0 -1
- package/dist/cjs/components/tab-group/daikin-tab-group.d.ts +0 -1
- package/dist/cjs/components/text-input/daikin-text-input.d.ts +0 -1
- package/dist/cjs/components/textarea/daikin-textarea.d.ts +0 -1
- package/dist/cjs/components/toggle/daikin-toggle.d.ts +0 -1
- package/dist/cjs/components/tooltip/daikin-tooltip.cjs +223 -0
- package/dist/cjs/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/cjs/components/tooltip/index.cjs +7 -0
- package/dist/cjs/components/tooltip/index.d.ts +1 -0
- package/dist/cjs/index.cjs +20 -0
- package/dist/cjs/is-client.cjs +5 -0
- package/dist/cjs/is-client.d.ts +1 -0
- package/dist/cjs/tailwind.css.cjs +2 -2
- package/dist/cjs/type-utils.d.ts +0 -1
- package/dist/cjs-dev/components/accordion/daikin-accordion.d.ts +0 -1
- package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.d.ts +0 -1
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.cjs +124 -0
- package/dist/cjs-dev/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/cjs-dev/components/breadcrumb/index.cjs +7 -0
- package/dist/cjs-dev/components/breadcrumb/index.d.ts +1 -0
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.cjs +116 -0
- package/dist/cjs-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/cjs-dev/components/breadcrumb-item/index.cjs +7 -0
- package/dist/cjs-dev/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/cjs-dev/components/button/daikin-button.d.ts +0 -1
- package/dist/cjs-dev/components/checkbox/daikin-checkbox.d.ts +0 -1
- package/dist/cjs-dev/components/icon/daikin-icon.d.ts +0 -1
- package/dist/cjs-dev/components/index.cjs +20 -0
- package/dist/cjs-dev/components/index.d.ts +4 -0
- package/dist/cjs-dev/components/input-group/daikin-input-group.cjs +1 -1
- package/dist/cjs-dev/components/input-group/daikin-input-group.d.ts +0 -1
- package/dist/cjs-dev/components/notification/daikin-notification.d.ts +0 -1
- package/dist/cjs-dev/components/panel-switcher/daikin-panel-switcher.d.ts +0 -1
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.cjs +152 -0
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/cjs-dev/components/progress-bar/index.cjs +7 -0
- package/dist/cjs-dev/components/progress-bar/index.d.ts +1 -0
- package/dist/cjs-dev/components/radio/daikin-radio.d.ts +0 -1
- package/dist/cjs-dev/components/tab/daikin-tab.d.ts +0 -1
- package/dist/cjs-dev/components/tab-group/daikin-tab-group.d.ts +0 -1
- package/dist/cjs-dev/components/text-input/daikin-text-input.d.ts +0 -1
- package/dist/cjs-dev/components/textarea/daikin-textarea.d.ts +0 -1
- package/dist/cjs-dev/components/toggle/daikin-toggle.d.ts +0 -1
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.cjs +223 -0
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/cjs-dev/components/tooltip/index.cjs +7 -0
- package/dist/cjs-dev/components/tooltip/index.d.ts +1 -0
- package/dist/cjs-dev/index.cjs +20 -0
- package/dist/cjs-dev/is-client.cjs +5 -0
- package/dist/cjs-dev/is-client.d.ts +1 -0
- package/dist/cjs-dev/tailwind.css.cjs +2 -2
- package/dist/cjs-dev/type-utils.d.ts +0 -1
- package/dist/es/components/accordion/daikin-accordion.d.ts +0 -1
- package/dist/es/components/accordion-item/daikin-accordion-item.d.ts +0 -1
- package/dist/es/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/es/components/breadcrumb/daikin-breadcrumb.js +125 -0
- package/dist/es/components/breadcrumb/index.d.ts +1 -0
- package/dist/es/components/breadcrumb/index.js +4 -0
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/es/components/breadcrumb-item/daikin-breadcrumb-item.js +117 -0
- package/dist/es/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/es/components/breadcrumb-item/index.js +4 -0
- package/dist/es/components/button/daikin-button.d.ts +0 -1
- package/dist/es/components/checkbox/daikin-checkbox.d.ts +0 -1
- package/dist/es/components/icon/daikin-icon.d.ts +0 -1
- package/dist/es/components/index.d.ts +4 -0
- package/dist/es/components/index.js +8 -0
- package/dist/es/components/input-group/daikin-input-group.d.ts +0 -1
- package/dist/es/components/input-group/daikin-input-group.js +1 -1
- package/dist/es/components/notification/daikin-notification.d.ts +0 -1
- package/dist/es/components/panel-switcher/daikin-panel-switcher.d.ts +0 -1
- package/dist/es/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/es/components/progress-bar/daikin-progress-bar.js +138 -0
- package/dist/es/components/progress-bar/index.d.ts +1 -0
- package/dist/es/components/progress-bar/index.js +4 -0
- package/dist/es/components/radio/daikin-radio.d.ts +0 -1
- package/dist/es/components/tab/daikin-tab.d.ts +0 -1
- package/dist/es/components/tab-group/daikin-tab-group.d.ts +0 -1
- package/dist/es/components/text-input/daikin-text-input.d.ts +0 -1
- package/dist/es/components/textarea/daikin-textarea.d.ts +0 -1
- package/dist/es/components/toggle/daikin-toggle.d.ts +0 -1
- package/dist/es/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/es/components/tooltip/daikin-tooltip.js +224 -0
- package/dist/es/components/tooltip/index.d.ts +1 -0
- package/dist/es/components/tooltip/index.js +4 -0
- package/dist/es/index.js +8 -0
- package/dist/es/is-client.d.ts +1 -0
- package/dist/es/is-client.js +5 -0
- package/dist/es/tailwind.css.js +2 -2
- package/dist/es/type-utils.d.ts +0 -1
- package/dist/es-dev/components/accordion/daikin-accordion.d.ts +0 -1
- package/dist/es-dev/components/accordion-item/daikin-accordion-item.d.ts +0 -1
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.d.ts +52 -0
- package/dist/es-dev/components/breadcrumb/daikin-breadcrumb.js +125 -0
- package/dist/es-dev/components/breadcrumb/index.d.ts +1 -0
- package/dist/es-dev/components/breadcrumb/index.js +4 -0
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.d.ts +62 -0
- package/dist/es-dev/components/breadcrumb-item/daikin-breadcrumb-item.js +117 -0
- package/dist/es-dev/components/breadcrumb-item/index.d.ts +1 -0
- package/dist/es-dev/components/breadcrumb-item/index.js +4 -0
- package/dist/es-dev/components/button/daikin-button.d.ts +0 -1
- package/dist/es-dev/components/checkbox/daikin-checkbox.d.ts +0 -1
- package/dist/es-dev/components/icon/daikin-icon.d.ts +0 -1
- package/dist/es-dev/components/index.d.ts +4 -0
- package/dist/es-dev/components/index.js +8 -0
- package/dist/es-dev/components/input-group/daikin-input-group.d.ts +0 -1
- package/dist/es-dev/components/input-group/daikin-input-group.js +1 -1
- package/dist/es-dev/components/notification/daikin-notification.d.ts +0 -1
- package/dist/es-dev/components/panel-switcher/daikin-panel-switcher.d.ts +0 -1
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.d.ts +47 -0
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.js +153 -0
- package/dist/es-dev/components/progress-bar/index.d.ts +1 -0
- package/dist/es-dev/components/progress-bar/index.js +4 -0
- package/dist/es-dev/components/radio/daikin-radio.d.ts +0 -1
- package/dist/es-dev/components/tab/daikin-tab.d.ts +0 -1
- package/dist/es-dev/components/tab-group/daikin-tab-group.d.ts +0 -1
- package/dist/es-dev/components/text-input/daikin-text-input.d.ts +0 -1
- package/dist/es-dev/components/textarea/daikin-textarea.d.ts +0 -1
- package/dist/es-dev/components/toggle/daikin-toggle.d.ts +0 -1
- package/dist/es-dev/components/tooltip/daikin-tooltip.d.ts +76 -0
- package/dist/es-dev/components/tooltip/daikin-tooltip.js +224 -0
- package/dist/es-dev/components/tooltip/index.d.ts +1 -0
- package/dist/es-dev/components/tooltip/index.js +4 -0
- package/dist/es-dev/index.js +8 -0
- package/dist/es-dev/is-client.d.ts +1 -0
- package/dist/es-dev/is-client.js +5 -0
- package/dist/es-dev/tailwind.css.js +2 -2
- package/dist/es-dev/type-utils.d.ts +0 -1
- package/icons/status-positive.svg +15 -0
- package/package.json +46 -44
- /package/icons/{input-group-error.svg → status-negative.svg} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const variables_js = require("@daikin-oss/dds-tokens/js/daikin/Light/variables.js");
|
|
4
|
+
const classVarianceAuthority = require("class-variance-authority");
|
|
5
|
+
const lit = require("lit");
|
|
6
|
+
const decorators_js = require("lit/decorators.js");
|
|
7
|
+
const tailwind = require("../../tailwind.css.cjs");
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
10
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
11
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
12
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
13
|
+
if (decorator = decorators[i])
|
|
14
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
15
|
+
if (kind && result) __defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
const cvaBar = classVarianceAuthority.cva(
|
|
19
|
+
[
|
|
20
|
+
"w-full",
|
|
21
|
+
"h-1",
|
|
22
|
+
"bg-daikinNeutral-200",
|
|
23
|
+
"overflow-hidden",
|
|
24
|
+
"relative",
|
|
25
|
+
"after:block",
|
|
26
|
+
"after:h-full",
|
|
27
|
+
"after:absolute",
|
|
28
|
+
"after:left-0"
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
variant: {
|
|
33
|
+
inprogress: ["after:w-[--bar-width]", "after:bg-daikinBlue-500"],
|
|
34
|
+
completed: ["after:w-full", "after:bg-[--colorFeedbackPositive]"],
|
|
35
|
+
indeterminate: [
|
|
36
|
+
"after:w-1/2",
|
|
37
|
+
"after:bg-daikinBlue-500",
|
|
38
|
+
"after:animate-[progress-bar-indeterminate_1200ms_linear_infinite]"
|
|
39
|
+
],
|
|
40
|
+
error: ["after:w-full", "after:bg-[--colorFeedbackNegative]"]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const cvaIcon = classVarianceAuthority.cva(["size-4"], {
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
inprogress: ["none"],
|
|
49
|
+
completed: ["i-daikin-status-positive"],
|
|
50
|
+
indeterminate: [],
|
|
51
|
+
error: ["i-daikin-status-negative"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const cvaHelper = classVarianceAuthority.cva(["text-xs", "mt-2"], {
|
|
56
|
+
variants: {
|
|
57
|
+
variant: {
|
|
58
|
+
inprogress: [],
|
|
59
|
+
completed: [],
|
|
60
|
+
indeterminate: [],
|
|
61
|
+
error: ["text-[--colorFeedbackNegative]"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
exports.DaikinProgressBar = class DaikinProgressBar extends lit.LitElement {
|
|
66
|
+
constructor() {
|
|
67
|
+
super(...arguments);
|
|
68
|
+
this.value = 0;
|
|
69
|
+
this.variant = "inprogress";
|
|
70
|
+
this.max = 100;
|
|
71
|
+
this.helper = "";
|
|
72
|
+
}
|
|
73
|
+
// Validate the 'value' and 'max' properties to ensure they are valid
|
|
74
|
+
_validateProperties() {
|
|
75
|
+
if (typeof this.value !== "number" || this.value < 0) {
|
|
76
|
+
this.value = 0;
|
|
77
|
+
}
|
|
78
|
+
if (typeof this.max !== "number" || this.max <= 0) {
|
|
79
|
+
this.max = 100;
|
|
80
|
+
}
|
|
81
|
+
if (this.value > this.max) {
|
|
82
|
+
this.value = this.max;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
const progressRatio = Math.min(Math.max(this.value / this.max, 0), 1);
|
|
87
|
+
return lit.html`<div class="flex flex-col w-full font-daikinSerif">
|
|
88
|
+
<div class="flex justify-between items-center mb-2.5">
|
|
89
|
+
<span class="text-sm leading-[22px] font-medium"><slot></slot></span>
|
|
90
|
+
<span class=${cvaIcon({ variant: this.variant })}></span>
|
|
91
|
+
</div>
|
|
92
|
+
<div
|
|
93
|
+
class=${cvaBar({ variant: this.variant })}
|
|
94
|
+
role="progressbar"
|
|
95
|
+
aria-label=${this.textContent ?? ""}
|
|
96
|
+
aria-valuenow=${this.value}
|
|
97
|
+
aria-valuemin="0"
|
|
98
|
+
aria-valuemax=${this.max}
|
|
99
|
+
style=${`--bar-width:${progressRatio * 100}%`}
|
|
100
|
+
></div>
|
|
101
|
+
${this.helper ? lit.html`<span class=${cvaHelper({ variant: this.variant })}
|
|
102
|
+
>${this.helper}</span
|
|
103
|
+
>` : null}
|
|
104
|
+
</div>`;
|
|
105
|
+
}
|
|
106
|
+
updated(changedProperties) {
|
|
107
|
+
if (changedProperties.has("value") || changedProperties.has("max")) {
|
|
108
|
+
this._validateProperties();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
exports.DaikinProgressBar.styles = lit.css`
|
|
113
|
+
${lit.unsafeCSS(tailwind.default)}
|
|
114
|
+
|
|
115
|
+
:host {
|
|
116
|
+
--colorFeedbackPositive: ${lit.unsafeCSS(variables_js.colorFeedbackPositive)};
|
|
117
|
+
--colorFeedbackNegative: ${lit.unsafeCSS(variables_js.colorFeedbackNegative)};
|
|
118
|
+
|
|
119
|
+
display: block;
|
|
120
|
+
width: 100%;
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
__decorateClass([
|
|
124
|
+
decorators_js.property({ type: Number })
|
|
125
|
+
], exports.DaikinProgressBar.prototype, "value", 2);
|
|
126
|
+
__decorateClass([
|
|
127
|
+
decorators_js.property({ type: String })
|
|
128
|
+
], exports.DaikinProgressBar.prototype, "variant", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
decorators_js.property({ type: Number })
|
|
131
|
+
], exports.DaikinProgressBar.prototype, "max", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
decorators_js.property({ type: String })
|
|
134
|
+
], exports.DaikinProgressBar.prototype, "helper", 2);
|
|
135
|
+
exports.DaikinProgressBar = __decorateClass([
|
|
136
|
+
decorators_js.customElement("daikin-progress-bar")
|
|
137
|
+
], exports.DaikinProgressBar);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* The progress bar component is used to visually convey the progress to the user.
|
|
4
|
+
*
|
|
5
|
+
* There are four variants of the progress bar:
|
|
6
|
+
*
|
|
7
|
+
* - "inprogress": The default variant. Use this when you know the exact progress. The length of the bar is the ratio of `value` to `max`.
|
|
8
|
+
* - "indeterminate": Use this variant when you don't know the exact progress. In this variant, the `value` is ignored and the bar always animates from left to right with a constant length.
|
|
9
|
+
* - "completed": In addition to "inprogress", a completed icon is added. In this variant, the `value` is ignored and the bar always expands to the full width.
|
|
10
|
+
* - "error": In addition to "inprogress", an error icon is added and the color becomes red. In this variant, the `value` is ignored and the bar always expands to the full width.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <daikin-progress-bar value="40" helper="Progress bar helper">
|
|
16
|
+
* Progress bar label
|
|
17
|
+
* </daikin-progress-bar>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare class DaikinProgressBar extends LitElement {
|
|
21
|
+
static readonly styles: import('lit').CSSResult;
|
|
22
|
+
/**
|
|
23
|
+
* Value of the progress bar
|
|
24
|
+
*/
|
|
25
|
+
value: number;
|
|
26
|
+
/**
|
|
27
|
+
* Variant of the progress bar
|
|
28
|
+
*/
|
|
29
|
+
variant: "inprogress" | "completed" | "indeterminate" | "error";
|
|
30
|
+
/**
|
|
31
|
+
* The max value of the progress bar
|
|
32
|
+
*/
|
|
33
|
+
max: number;
|
|
34
|
+
/**
|
|
35
|
+
* Helper text
|
|
36
|
+
*/
|
|
37
|
+
helper: string;
|
|
38
|
+
private _validateProperties;
|
|
39
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
40
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
"daikin-progress-bar": DaikinProgressBar;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export default DaikinProgressBar;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const daikinProgressBar = require("./daikin-progress-bar.cjs");
|
|
4
|
+
Object.defineProperty(exports, "DaikinProgressBar", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: () => daikinProgressBar.DaikinProgressBar
|
|
7
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-progress-bar';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* The tab component is a child element within the `daikin-tab-group` component, representing a clickable button or label that users interact with to switch between different panels of content.
|
|
5
4
|
* Each tab corresponds to a specific panel and is typically labeled to indicate the content it reveals.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* The tab group component manages a group of tabs and switches the content displayed using the panel switcher component.
|
|
5
4
|
* It allows users to navigate between different sections of content by clicking on individual tabs.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* The text input component is a UI element that allows users to input single-line text data.
|
|
5
4
|
* It functions similarly to the HTML `<input type="text">` tag, providing a simple and efficient way for users to enter and edit short pieces of texts, such as names, email addresses, or search queries.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* The textarea component is designed for multiline text input, similar to the HTML `<textarea>` tag.
|
|
5
4
|
* It is ideal for situations where users need to enter longer pieces of text, such as comments, descriptions, or messages.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from 'lit';
|
|
2
2
|
import { MergeVariantProps } from '../../type-utils';
|
|
3
|
-
|
|
4
3
|
declare const cvaToggle: (props?: ({
|
|
5
4
|
size?: "default" | "small" | null | undefined;
|
|
6
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dom = require("@floating-ui/dom");
|
|
4
|
+
const classVarianceAuthority = require("class-variance-authority");
|
|
5
|
+
const lit = require("lit");
|
|
6
|
+
const decorators_js = require("lit/decorators.js");
|
|
7
|
+
const ref_js = require("lit/directives/ref.js");
|
|
8
|
+
const isClient = require("../../is-client.cjs");
|
|
9
|
+
const tailwind = require("../../tailwind.css.cjs");
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
17
|
+
if (kind && result) __defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
const cvaTooltip = classVarianceAuthority.cva(
|
|
21
|
+
[
|
|
22
|
+
"absolute",
|
|
23
|
+
"p-3",
|
|
24
|
+
"justify-center",
|
|
25
|
+
"items-center",
|
|
26
|
+
"rounded",
|
|
27
|
+
"w-max",
|
|
28
|
+
"top-0",
|
|
29
|
+
"left-0",
|
|
30
|
+
"max-w-[312px]",
|
|
31
|
+
"text-sm",
|
|
32
|
+
"font-daikinSerif",
|
|
33
|
+
"font-normal",
|
|
34
|
+
"not-italic",
|
|
35
|
+
"leading-5"
|
|
36
|
+
],
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
variant: {
|
|
40
|
+
light: [
|
|
41
|
+
"border",
|
|
42
|
+
"border-solid",
|
|
43
|
+
"border-daikinNeutral-800",
|
|
44
|
+
"bg-white/90",
|
|
45
|
+
"text-black"
|
|
46
|
+
],
|
|
47
|
+
dark: ["bg-daikinNeutral-800/90", "text-white"]
|
|
48
|
+
},
|
|
49
|
+
open: {
|
|
50
|
+
true: ["visible", "opacity-100"],
|
|
51
|
+
false: ["invisible", "opacity-0"]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
const DEFAULT_TOOLTIP_SPACING = "20px";
|
|
57
|
+
exports.DaikinTooltip = class DaikinTooltip extends lit.LitElement {
|
|
58
|
+
constructor() {
|
|
59
|
+
super(...arguments);
|
|
60
|
+
this.placement = "bottom";
|
|
61
|
+
this.variant = "light";
|
|
62
|
+
this.open = false;
|
|
63
|
+
this.description = "";
|
|
64
|
+
this.closeOnClick = false;
|
|
65
|
+
this.trigger = "hover";
|
|
66
|
+
this._tooltipRef = ref_js.createRef();
|
|
67
|
+
this._triggerRef = ref_js.createRef();
|
|
68
|
+
this._autoUpdateCleanup = null;
|
|
69
|
+
this._hostStyles = isClient.isClient ? window.getComputedStyle(this) : null;
|
|
70
|
+
}
|
|
71
|
+
static registerCSSCustomProperties() {
|
|
72
|
+
if (!isClient.isClient) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
window.CSS.registerProperty({
|
|
76
|
+
name: "--dds-tooltip-spacing",
|
|
77
|
+
syntax: "<length>",
|
|
78
|
+
inherits: true,
|
|
79
|
+
initialValue: "0px"
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
_startAutoUpdate() {
|
|
83
|
+
var _a;
|
|
84
|
+
if (!isClient.isClient) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const reference = this._triggerRef.value;
|
|
88
|
+
const float = this._tooltipRef.value;
|
|
89
|
+
if (!reference || !float) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
93
|
+
this._autoUpdateCleanup = dom.autoUpdate(reference, float, () => {
|
|
94
|
+
var _a2;
|
|
95
|
+
const spacing = parseInt(
|
|
96
|
+
((_a2 = this._hostStyles) == null ? void 0 : _a2.getPropertyValue("--dds-tooltip-spacing")) || DEFAULT_TOOLTIP_SPACING,
|
|
97
|
+
10
|
|
98
|
+
);
|
|
99
|
+
dom.computePosition(reference, float, {
|
|
100
|
+
placement: this.placement,
|
|
101
|
+
middleware: [dom.offset({ mainAxis: spacing }), dom.flip(), dom.shift()]
|
|
102
|
+
}).then(({ x, y }) => {
|
|
103
|
+
Object.assign(float.style, {
|
|
104
|
+
left: `${x}px`,
|
|
105
|
+
top: `${y}px`
|
|
106
|
+
});
|
|
107
|
+
}).catch((e) => console.error(e));
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
_uninstallAutoUpdate() {
|
|
111
|
+
var _a;
|
|
112
|
+
this.open = false;
|
|
113
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
114
|
+
this._autoUpdateCleanup = null;
|
|
115
|
+
}
|
|
116
|
+
_changeOpenState(state) {
|
|
117
|
+
if (this.open === state) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!this.dispatchEvent(
|
|
121
|
+
new CustomEvent("beforetoggle", {
|
|
122
|
+
detail: { open: this.open },
|
|
123
|
+
bubbles: true,
|
|
124
|
+
composed: true,
|
|
125
|
+
cancelable: true
|
|
126
|
+
})
|
|
127
|
+
)) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.open = state;
|
|
131
|
+
}
|
|
132
|
+
_handleClick() {
|
|
133
|
+
if (this.closeOnClick) {
|
|
134
|
+
this._changeOpenState(false);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_handleMouseLeave() {
|
|
138
|
+
if (this.trigger === "hover") {
|
|
139
|
+
this._changeOpenState(false);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
_handleMouseEnter() {
|
|
143
|
+
if (this.trigger === "hover") {
|
|
144
|
+
this._changeOpenState(true);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
render() {
|
|
148
|
+
const tooltipClassName = cvaTooltip({
|
|
149
|
+
variant: this.variant,
|
|
150
|
+
open: this.open
|
|
151
|
+
});
|
|
152
|
+
return lit.html`<div class="relative inline-block">
|
|
153
|
+
<div
|
|
154
|
+
${ref_js.ref(this._triggerRef)}
|
|
155
|
+
part="trigger"
|
|
156
|
+
@click=${this._handleClick}
|
|
157
|
+
@keydown=${this._handleClick}
|
|
158
|
+
@mouseleave=${this._handleMouseLeave}
|
|
159
|
+
@mouseenter=${this._handleMouseEnter}
|
|
160
|
+
>
|
|
161
|
+
<slot></slot>
|
|
162
|
+
</div>
|
|
163
|
+
<span ${ref_js.ref(this._tooltipRef)} part="tooltip" class=${tooltipClassName}>
|
|
164
|
+
<slot name="tooltip">
|
|
165
|
+
<span class="whitespace-pre-line">${this.description}</span>
|
|
166
|
+
</slot>
|
|
167
|
+
</span>
|
|
168
|
+
</div>`;
|
|
169
|
+
}
|
|
170
|
+
updated(changedProperties) {
|
|
171
|
+
var _a;
|
|
172
|
+
if (changedProperties.has("open")) {
|
|
173
|
+
if (this.open) {
|
|
174
|
+
this._startAutoUpdate();
|
|
175
|
+
} else {
|
|
176
|
+
(_a = this._autoUpdateCleanup) == null ? void 0 : _a.call(this);
|
|
177
|
+
this._autoUpdateCleanup = null;
|
|
178
|
+
}
|
|
179
|
+
this.dispatchEvent(
|
|
180
|
+
new CustomEvent("toggle", {
|
|
181
|
+
detail: { open: this.open },
|
|
182
|
+
bubbles: true,
|
|
183
|
+
composed: true,
|
|
184
|
+
cancelable: false
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
disconnectedCallback() {
|
|
190
|
+
this._uninstallAutoUpdate();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
exports.DaikinTooltip.styles = lit.css`
|
|
194
|
+
${lit.unsafeCSS(tailwind.default)}
|
|
195
|
+
|
|
196
|
+
:host {
|
|
197
|
+
display: inline-block;
|
|
198
|
+
|
|
199
|
+
--dds-tooltip-spacing: ${lit.unsafeCSS(DEFAULT_TOOLTIP_SPACING)};
|
|
200
|
+
}
|
|
201
|
+
`;
|
|
202
|
+
__decorateClass([
|
|
203
|
+
decorators_js.property({ reflect: true, type: String })
|
|
204
|
+
], exports.DaikinTooltip.prototype, "placement", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
decorators_js.property({ reflect: true, type: String })
|
|
207
|
+
], exports.DaikinTooltip.prototype, "variant", 2);
|
|
208
|
+
__decorateClass([
|
|
209
|
+
decorators_js.property({ reflect: true, type: Boolean })
|
|
210
|
+
], exports.DaikinTooltip.prototype, "open", 2);
|
|
211
|
+
__decorateClass([
|
|
212
|
+
decorators_js.property({ type: String })
|
|
213
|
+
], exports.DaikinTooltip.prototype, "description", 2);
|
|
214
|
+
__decorateClass([
|
|
215
|
+
decorators_js.property({ reflect: true, type: Boolean })
|
|
216
|
+
], exports.DaikinTooltip.prototype, "closeOnClick", 2);
|
|
217
|
+
__decorateClass([
|
|
218
|
+
decorators_js.property({ reflect: true, type: String })
|
|
219
|
+
], exports.DaikinTooltip.prototype, "trigger", 2);
|
|
220
|
+
exports.DaikinTooltip = __decorateClass([
|
|
221
|
+
decorators_js.customElement("daikin-tooltip")
|
|
222
|
+
], exports.DaikinTooltip);
|
|
223
|
+
exports.DaikinTooltip.registerCSSCustomProperties();
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* A tooltip component is used to show brief information when a user interacts with an element.
|
|
4
|
+
*
|
|
5
|
+
* @fires beforetoggle - _Cancellable._ A custom event emitted when the tooltip is about to be opened or closed by user interaction.
|
|
6
|
+
* @fires toggle - A custom event emitted when the tooltip is opened or closed.
|
|
7
|
+
*
|
|
8
|
+
* @slot - A slot for the element to which the tooltip is attached (the trigger element).
|
|
9
|
+
* @slot tooltip - A slot for the tooltip content.
|
|
10
|
+
*
|
|
11
|
+
* @cssprop [--dds-tooltip-spacing=20px] - Spacing between the tooltip and the trigger
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* ```html
|
|
16
|
+
* </daikin-tooltip>
|
|
17
|
+
* <span slot="tooltip">This is a message</span>
|
|
18
|
+
* <span>hover me</span>
|
|
19
|
+
* </daikin-tooltip>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* ```html
|
|
23
|
+
* </daikin-tooltip description="This is a message">
|
|
24
|
+
* <span>hover me</span>
|
|
25
|
+
* </daikin-tooltip>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare class DaikinTooltip extends LitElement {
|
|
29
|
+
static registerCSSCustomProperties(): void;
|
|
30
|
+
static readonly styles: import('lit').CSSResult;
|
|
31
|
+
/**
|
|
32
|
+
* Specifies the position of the tooltip relative to the trigger.
|
|
33
|
+
*/
|
|
34
|
+
placement: "top" | "bottom" | "left" | "right";
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the tooltip theme.
|
|
37
|
+
*/
|
|
38
|
+
variant: "light" | "dark";
|
|
39
|
+
/**
|
|
40
|
+
* Whether the tooltip is open.
|
|
41
|
+
*/
|
|
42
|
+
open: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Specifies the content of the tooltip.
|
|
45
|
+
* Ignored if the `tooltip` slot exists.
|
|
46
|
+
*/
|
|
47
|
+
description: string;
|
|
48
|
+
/**
|
|
49
|
+
* if true, the tooltip will hide on click.
|
|
50
|
+
*/
|
|
51
|
+
closeOnClick: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* How the tooltip is controlled.
|
|
54
|
+
* - "hover": The tooltip is displayed when the mouse hovers over the trigger element, and hidden when the mouse is no longer hovering. (default)
|
|
55
|
+
* - "manual": The tooltip does not respond to user interaction. Use this to control the tooltip programmatically.
|
|
56
|
+
*/
|
|
57
|
+
trigger: "hover" | "manual";
|
|
58
|
+
private _tooltipRef;
|
|
59
|
+
private _triggerRef;
|
|
60
|
+
private _autoUpdateCleanup;
|
|
61
|
+
private _hostStyles;
|
|
62
|
+
private _startAutoUpdate;
|
|
63
|
+
private _uninstallAutoUpdate;
|
|
64
|
+
private _changeOpenState;
|
|
65
|
+
private _handleClick;
|
|
66
|
+
private _handleMouseLeave;
|
|
67
|
+
private _handleMouseEnter;
|
|
68
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
69
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
70
|
+
disconnectedCallback(): void;
|
|
71
|
+
}
|
|
72
|
+
declare global {
|
|
73
|
+
interface HTMLElementTagNameMap {
|
|
74
|
+
"daikin-tooltip": DaikinTooltip;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './daikin-tooltip';
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -3,18 +3,22 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const colors = require("./colors.cjs");
|
|
4
4
|
const daikinAccordion = require("./components/accordion/daikin-accordion.cjs");
|
|
5
5
|
const daikinAccordionItem = require("./components/accordion-item/daikin-accordion-item.cjs");
|
|
6
|
+
const daikinBreadcrumb = require("./components/breadcrumb/daikin-breadcrumb.cjs");
|
|
7
|
+
const daikinBreadcrumbItem = require("./components/breadcrumb-item/daikin-breadcrumb-item.cjs");
|
|
6
8
|
const daikinButton = require("./components/button/daikin-button.cjs");
|
|
7
9
|
const daikinCheckbox = require("./components/checkbox/daikin-checkbox.cjs");
|
|
8
10
|
const daikinIcon = require("./components/icon/daikin-icon.cjs");
|
|
9
11
|
const daikinInputGroup = require("./components/input-group/daikin-input-group.cjs");
|
|
10
12
|
const daikinNotification = require("./components/notification/daikin-notification.cjs");
|
|
11
13
|
const daikinPanelSwitcher = require("./components/panel-switcher/daikin-panel-switcher.cjs");
|
|
14
|
+
const daikinProgressBar = require("./components/progress-bar/daikin-progress-bar.cjs");
|
|
12
15
|
const daikinRadio = require("./components/radio/daikin-radio.cjs");
|
|
13
16
|
const daikinTab = require("./components/tab/daikin-tab.cjs");
|
|
14
17
|
const daikinTabGroup = require("./components/tab-group/daikin-tab-group.cjs");
|
|
15
18
|
const daikinTextInput = require("./components/text-input/daikin-text-input.cjs");
|
|
16
19
|
const daikinTextarea = require("./components/textarea/daikin-textarea.cjs");
|
|
17
20
|
const daikinToggle = require("./components/toggle/daikin-toggle.cjs");
|
|
21
|
+
const daikinTooltip = require("./components/tooltip/daikin-tooltip.cjs");
|
|
18
22
|
exports.colors = colors.colors;
|
|
19
23
|
Object.defineProperty(exports, "DaikinAccordion", {
|
|
20
24
|
enumerable: true,
|
|
@@ -24,6 +28,14 @@ Object.defineProperty(exports, "DaikinAccordionItem", {
|
|
|
24
28
|
enumerable: true,
|
|
25
29
|
get: () => daikinAccordionItem.DaikinAccordionItem
|
|
26
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "DaikinBreadcrumb", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: () => daikinBreadcrumb.DaikinBreadcrumb
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "DaikinBreadcrumbItem", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: () => daikinBreadcrumbItem.DaikinBreadcrumbItem
|
|
38
|
+
});
|
|
27
39
|
Object.defineProperty(exports, "DaikinButton", {
|
|
28
40
|
enumerable: true,
|
|
29
41
|
get: () => daikinButton.DaikinButton
|
|
@@ -49,6 +61,10 @@ Object.defineProperty(exports, "DaikinPanelSwitcher", {
|
|
|
49
61
|
enumerable: true,
|
|
50
62
|
get: () => daikinPanelSwitcher.DaikinPanelSwitcher
|
|
51
63
|
});
|
|
64
|
+
Object.defineProperty(exports, "DaikinProgressBar", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: () => daikinProgressBar.DaikinProgressBar
|
|
67
|
+
});
|
|
52
68
|
Object.defineProperty(exports, "DaikinRadio", {
|
|
53
69
|
enumerable: true,
|
|
54
70
|
get: () => daikinRadio.DaikinRadio
|
|
@@ -73,3 +89,7 @@ Object.defineProperty(exports, "DaikinToggle", {
|
|
|
73
89
|
enumerable: true,
|
|
74
90
|
get: () => daikinToggle.DaikinToggle
|
|
75
91
|
});
|
|
92
|
+
Object.defineProperty(exports, "DaikinTooltip", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: () => daikinTooltip.DaikinTooltip
|
|
95
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isClient: boolean;
|