ds-one 0.2.5-alpha.17 → 0.2.5-alpha.18

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.
@@ -1,4 +1,4 @@
1
- /* version 0.2.5-alpha.17 */
1
+ /* version 0.2.5-alpha.18 */
2
2
 
3
3
  @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@200");
4
4
  @import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@800");
package/DS1/index.ts CHANGED
@@ -30,6 +30,7 @@ export * from "./0-face/theme";
30
30
  // ============================================================================
31
31
 
32
32
  export * from "./2-core/ds-button";
33
+ export * from "./2-core/ds-banner";
33
34
  export * from "./2-core/ds-cycle";
34
35
  export * from "./2-core/ds-gap";
35
36
  export * from "./2-core/ds-icon";
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DS one (0.2.5-alpha.17)
1
+ # DS one (0.2.5-alpha.18)
2
2
 
3
3
  A plug and play design system
4
4
 
@@ -20,7 +20,7 @@ yarn add ds-one@alpha
20
20
 
21
21
  ```
22
22
 
23
- **Note**: Currently published as alpha version `0.2.5-alpha.17`
23
+ **Note**: Currently published as alpha version `0.2.5-alpha.18`
24
24
 
25
25
  ## Quick Start
26
26
 
@@ -2070,6 +2070,162 @@ Button.styles = i4`
2070
2070
  `;
2071
2071
  customElements.define("ds-button", Button);
2072
2072
 
2073
+ // dist/2-core/ds-banner.js
2074
+ var Banner = class extends i6 {
2075
+ constructor() {
2076
+ super(...arguments);
2077
+ this.textKey = "";
2078
+ this.actionKey = "";
2079
+ this.href = "";
2080
+ this.mailto = "";
2081
+ this.subjectKey = "";
2082
+ this.describeKey = "";
2083
+ this.appVersionKey = "";
2084
+ this.variant = "warning";
2085
+ this.version = "";
2086
+ this._showVersion = false;
2087
+ this._boundUpdate = () => this.requestUpdate();
2088
+ }
2089
+ connectedCallback() {
2090
+ super.connectedCallback();
2091
+ window.addEventListener("translations-loaded", this._boundUpdate);
2092
+ window.addEventListener("language-changed", this._boundUpdate);
2093
+ }
2094
+ disconnectedCallback() {
2095
+ super.disconnectedCallback();
2096
+ window.removeEventListener("translations-loaded", this._boundUpdate);
2097
+ window.removeEventListener("language-changed", this._boundUpdate);
2098
+ }
2099
+ _toggleVersion() {
2100
+ if (this.version) {
2101
+ this._showVersion = !this._showVersion;
2102
+ }
2103
+ }
2104
+ _getMailtoHref() {
2105
+ if (this.href && this.href !== "#")
2106
+ return this.href;
2107
+ if (this.mailto) {
2108
+ try {
2109
+ const subject = this.subjectKey ? getText(this.subjectKey) || this.subjectKey : "Issue report";
2110
+ const describe = this.describeKey ? getText(this.describeKey) || this.describeKey : "Describe the issue:";
2111
+ const appVersionLabel = this.appVersionKey ? getText(this.appVersionKey) || this.appVersionKey : "App version:";
2112
+ const body = `${describe}
2113
+
2114
+
2115
+ ${appVersionLabel} ${this.version || ""}`;
2116
+ return `mailto:${this.mailto}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
2117
+ } catch (error) {
2118
+ return `mailto:${this.mailto}?subject=Issue%20report&body=Describe%20the%20issue%3A%0A%0A%0AApp%20version%3A%20${this.version || ""}`;
2119
+ }
2120
+ }
2121
+ return "#";
2122
+ }
2123
+ render() {
2124
+ const mailtoHref = this._getMailtoHref();
2125
+ return x`
2126
+ <div class="text-wrapper" @click=${this._toggleVersion}>
2127
+ ${this._showVersion && this.version ? x`<ds-text default-value=${this.version}></ds-text>` : x`<ds-text key=${this.textKey}><slot></slot></ds-text>`}
2128
+ </div>
2129
+ ${this.actionKey ? x`
2130
+ <div class="action-wrapper">
2131
+ <a href=${mailtoHref}>
2132
+ <ds-text key=${this.actionKey}></ds-text>
2133
+ </a>
2134
+ </div>
2135
+ ` : ""}
2136
+ `;
2137
+ }
2138
+ };
2139
+ Banner.properties = {
2140
+ textKey: { type: String, attribute: "text-key" },
2141
+ actionKey: { type: String, attribute: "action-key" },
2142
+ href: { type: String },
2143
+ mailto: { type: String },
2144
+ subjectKey: { type: String, attribute: "subject-key" },
2145
+ describeKey: { type: String, attribute: "describe-key" },
2146
+ appVersionKey: { type: String, attribute: "app-version-key" },
2147
+ variant: { type: String },
2148
+ version: { type: String },
2149
+ _showVersion: { type: Boolean, state: true }
2150
+ };
2151
+ Banner.styles = i4`
2152
+ :host {
2153
+ display: flex;
2154
+ position: absolute;
2155
+ top: 0;
2156
+ left: 0;
2157
+ right: 0;
2158
+ width: 100%;
2159
+ height: calc(var(--unit) * var(--sf, 1));
2160
+ align-items: center;
2161
+ justify-content: space-between;
2162
+ padding: 0 calc(var(--unit) * var(--sf, 1));
2163
+ box-sizing: border-box;
2164
+ z-index: 9999;
2165
+ }
2166
+
2167
+ :host([variant="warning"]) {
2168
+ background-color: color-mix(in srgb, var(--yellow) 50%, transparent);
2169
+ --banner-text-color: color-mix(in srgb, var(--black) 50%, transparent);
2170
+ --banner-action-color: var(--slate);
2171
+ }
2172
+
2173
+ :host([variant="info"]) {
2174
+ background-color: rgba(var(--sharp-blue-rgb, 0, 122, 255), 0.7);
2175
+ --banner-text-color: var(--white, #fff);
2176
+ --banner-action-color: var(--white, #fff);
2177
+ }
2178
+
2179
+ :host([variant="success"]) {
2180
+ background-color: rgba(var(--apple-green-rgb, 52, 199, 89), 0.7);
2181
+ --banner-text-color: var(--white, #fff);
2182
+ --banner-action-color: var(--white, #fff);
2183
+ }
2184
+
2185
+ :host([variant="error"]) {
2186
+ background-color: rgba(var(--tuned-red-rgb, 255, 59, 48), 0.7);
2187
+ --banner-text-color: var(--white, #fff);
2188
+ --banner-action-color: var(--slate, #1e1e1e);
2189
+ }
2190
+
2191
+ .text-wrapper {
2192
+ flex: 1;
2193
+ cursor: pointer;
2194
+ user-select: none;
2195
+ }
2196
+
2197
+ .text-wrapper ds-text,
2198
+ .text-wrapper .version {
2199
+ color: var(--banner-text-color);
2200
+ }
2201
+
2202
+ .action-wrapper {
2203
+ font-size: calc(12px * var(--sf, 1));
2204
+ }
2205
+
2206
+ .action-wrapper a {
2207
+ color: var(--banner-action-color);
2208
+ text-decoration: none;
2209
+ font-family: var(--typeface-regular);
2210
+ font-size: calc(12px * var(--sf, 1));
2211
+ cursor: pointer;
2212
+ pointer-events: auto;
2213
+ display: inline-block;
2214
+ }
2215
+
2216
+ .action-wrapper a:hover {
2217
+ opacity: 0.8;
2218
+ }
2219
+
2220
+ .action-wrapper ds-text {
2221
+ color: var(--banner-action-color);
2222
+ font-family: var(--typeface-regular);
2223
+ font-size: calc(12px * var(--sf, 1));
2224
+ pointer-events: none;
2225
+ }
2226
+ `;
2227
+ customElements.define("ds-banner", Banner);
2228
+
2073
2229
  // node_modules/lit-html/directives/unsafe-html.js
2074
2230
  var e6 = class extends i2 {
2075
2231
  constructor(i7) {
@@ -3726,6 +3882,7 @@ Layout.styles = i4`
3726
3882
  customElements.define("ds-layout", Layout);
3727
3883
  export {
3728
3884
  Accordion,
3885
+ Banner,
3729
3886
  Button,
3730
3887
  Container,
3731
3888
  Cycle,