@limetech/lime-elements 37.1.0-next.91 → 37.1.0-next.92

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/lime-elements.cjs.js +1 -1
  3. package/dist/cjs/limel-chip.cjs.entry.js +104 -0
  4. package/dist/cjs/limel-chip.cjs.entry.js.map +1 -0
  5. package/dist/cjs/limel-header.cjs.entry.js +3 -2
  6. package/dist/cjs/limel-header.cjs.entry.js.map +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/collection/collection-manifest.json +1 -0
  9. package/dist/collection/components/chip/chip.css +223 -0
  10. package/dist/collection/components/chip/chip.js +357 -0
  11. package/dist/collection/components/chip/chip.js.map +1 -0
  12. package/dist/collection/components/header/header.css +3 -4
  13. package/dist/collection/components/header/header.js +20 -1
  14. package/dist/collection/components/header/header.js.map +1 -1
  15. package/dist/esm/{keycodes-44c01beb.js → keycodes-22fb659d.js} +2 -2
  16. package/dist/esm/{keycodes-44c01beb.js.map → keycodes-22fb659d.js.map} +1 -1
  17. package/dist/esm/lime-elements.js +1 -1
  18. package/dist/esm/limel-breadcrumbs_3.entry.js +1 -1
  19. package/dist/esm/limel-chip-set.entry.js +1 -1
  20. package/dist/esm/limel-chip.entry.js +100 -0
  21. package/dist/esm/limel-chip.entry.js.map +1 -0
  22. package/dist/esm/limel-header.entry.js +3 -2
  23. package/dist/esm/limel-header.entry.js.map +1 -1
  24. package/dist/esm/limel-input-field_3.entry.js +1 -1
  25. package/dist/esm/limel-picker.entry.js +1 -1
  26. package/dist/esm/limel-popover_2.entry.js +1 -1
  27. package/dist/esm/limel-select.entry.js +1 -1
  28. package/dist/esm/loader.js +1 -1
  29. package/dist/lime-elements/lime-elements.esm.js +1 -1
  30. package/dist/lime-elements/lime-elements.esm.js.map +1 -1
  31. package/dist/lime-elements/p-0e3cd73a.entry.js +2 -0
  32. package/dist/lime-elements/{p-919d91a3.entry.js.map → p-0e3cd73a.entry.js.map} +1 -1
  33. package/dist/lime-elements/{p-00403204.entry.js → p-22bc684d.entry.js} +2 -2
  34. package/dist/lime-elements/p-71bf6613.entry.js +2 -0
  35. package/dist/lime-elements/{p-b88e8225.entry.js.map → p-71bf6613.entry.js.map} +1 -1
  36. package/dist/lime-elements/p-8afe01df.entry.js +2 -0
  37. package/dist/lime-elements/p-8afe01df.entry.js.map +1 -0
  38. package/dist/lime-elements/{p-d7801e00.js → p-93c6d561.js} +2 -2
  39. package/dist/lime-elements/{p-5e130783.entry.js → p-95561c5f.entry.js} +2 -2
  40. package/dist/lime-elements/{p-4b51378d.entry.js → p-aa3a72a1.entry.js} +2 -2
  41. package/dist/lime-elements/{p-d3233203.entry.js → p-b8c181ce.entry.js} +2 -2
  42. package/dist/lime-elements/p-de97b8a2.entry.js +2 -0
  43. package/dist/lime-elements/p-de97b8a2.entry.js.map +1 -0
  44. package/dist/types/components/chip/chip.d.ts +113 -0
  45. package/dist/types/components/header/header.d.ts +5 -0
  46. package/dist/types/components.d.ts +253 -0
  47. package/package.json +1 -1
  48. package/dist/lime-elements/p-06cd5f58.entry.js +0 -2
  49. package/dist/lime-elements/p-06cd5f58.entry.js.map +0 -1
  50. package/dist/lime-elements/p-919d91a3.entry.js +0 -2
  51. package/dist/lime-elements/p-b88e8225.entry.js +0 -2
  52. /package/dist/lime-elements/{p-00403204.entry.js.map → p-22bc684d.entry.js.map} +0 -0
  53. /package/dist/lime-elements/{p-d7801e00.js.map → p-93c6d561.js.map} +0 -0
  54. /package/dist/lime-elements/{p-5e130783.entry.js.map → p-95561c5f.entry.js.map} +0 -0
  55. /package/dist/lime-elements/{p-4b51378d.entry.js.map → p-aa3a72a1.entry.js.map} +0 -0
  56. /package/dist/lime-elements/{p-d3233203.entry.js.map → p-b8c181ce.entry.js.map} +0 -0
@@ -0,0 +1,223 @@
1
+ @charset "UTF-8";
2
+ /**
3
+ * Note! This file is exported to `dist/scss/` in the published
4
+ * node module, for consumer projects to import.
5
+ * That means this file cannot import from any file that isn't
6
+ * also exported, keeping the same relative path.
7
+ *
8
+ * Or, just don't import anything, that works too.
9
+ */
10
+ /**
11
+ * This can be used on a trigger element that opens a dropdown menu or a popover.
12
+ */
13
+ /**
14
+ * This mixin will mask out the content that is close to
15
+ * the edges of a scrollable area.
16
+ * - If the scrollable content has `overflow-y`, use `vertically`
17
+ * as an argument for `$direction`.
18
+ - If the scrollable content has `overflow-x`, use `horizontally`
19
+ * as an argument for `$direction`.
20
+ *
21
+ * For the visual effect to work smoothly, we need to make sure that
22
+ * the size of the fade-out edge effect is the same as the
23
+ * internal paddings of the scrollable area. Otherwise, content of a
24
+ * scrollable area that does not have a padding will fade out before
25
+ * any scrolling has been done.
26
+ * This is why this mixin already adds paddings, which automatically
27
+ * default to the size of the fade-out effect.
28
+ * This size defaults to `1rem`, but to override the size use
29
+ * `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
30
+ * when `vertically` argument is set, and use
31
+ * `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
32
+ * when `horizontally` argument is set.
33
+ * Of course you can also programmatically increase and decrease the
34
+ * size of these variables for each edge, based on the amount of
35
+ * scrolling that has been done by the user. In this case, make sure
36
+ * to add a custom padding where the mixin is used, to override
37
+ * the paddings that are automatically added by the mixin in the
38
+ * compiled CSS code.
39
+ */
40
+ /**
41
+ * This mixin will add an animated underline to the bottom of an `a` elements.
42
+ * Note that you may need to add `all: unset;` –depending on your use case–
43
+ * before using this mixin.
44
+ */
45
+ /**
46
+ * This mixin creates a cross-browser font stack.
47
+ * - `sans-serif` can be used for the UI of the components.
48
+ * - `monospace` can be used for code.
49
+ *
50
+ * ⚠️ If we change the font stacks, we need to update
51
+ * 1. the consumer documentation in `README.md`, and
52
+ * 2. the CSS variables of `--kompendium-example-font-family`
53
+ * in the `<style>` tag of `index.html`.
54
+ */
55
+ /**
56
+ * @prop --chip-max-width: Maximum width of the chip. Defaults to `10rem`. Keep in mind that the chips should not appear too big.
57
+ */
58
+ :host(limel-chip) {
59
+ --limel-chip-height: 1.75rem;
60
+ --limel-chip-gap: 0.5rem;
61
+ isolation: isolate;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ }
65
+
66
+ * {
67
+ box-sizing: border-box;
68
+ }
69
+
70
+ .chip {
71
+ all: unset;
72
+ position: relative;
73
+ display: inline-flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ gap: 0.25rem;
77
+ max-width: var(--chip-max-width, 10rem);
78
+ height: var(--limel-chip-height);
79
+ border-radius: var(--limel-chip-height);
80
+ font-size: 0.875rem;
81
+ padding: 0 0.125rem;
82
+ }
83
+ .chip:has(limel-icon) .text {
84
+ padding-left: 0.25rem;
85
+ }
86
+ .chip:not([disabled]) {
87
+ transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
88
+ cursor: pointer;
89
+ color: var(--mdc-theme-on-surface);
90
+ background-color: var(--lime-elevated-surface-background-color);
91
+ box-shadow: var(--button-shadow-normal);
92
+ }
93
+ .chip:not([disabled]):focus {
94
+ outline: none;
95
+ }
96
+ .chip:not([disabled]):focus-visible {
97
+ outline: none;
98
+ box-shadow: var(--shadow-depth-8-focused);
99
+ }
100
+ .chip:not([disabled]):hover {
101
+ color: var(--mdc-theme-on-surface);
102
+ background-color: var(--lime-elevated-surface-background-color);
103
+ box-shadow: var(--button-shadow-hovered);
104
+ }
105
+ .chip:not([disabled]):active {
106
+ background-color: var(--mdc-theme-surface);
107
+ box-shadow: var(--button-shadow-inset-pressed);
108
+ transform: translate3d(0, 0.05rem, 0);
109
+ }
110
+ .chip:has(limel-badge) {
111
+ padding-right: 0.375rem;
112
+ }
113
+ .chip:has(limel-badge) .text {
114
+ padding-right: 0;
115
+ }
116
+ .chip:has(+ .remove-button:hover) {
117
+ box-shadow: var(--shadow-depth-8-error);
118
+ }
119
+
120
+ :host(limel-chip[disabled]) .chip {
121
+ color: rgba(var(--contrast-1600), 0.37);
122
+ background-color: rgba(var(--contrast-1600), 0.1);
123
+ box-shadow: none;
124
+ }
125
+
126
+ :host(limel-chip[readonly]) .chip {
127
+ box-shadow: 0 0 0 1px rgba(var(--contrast-800), 0.5);
128
+ }
129
+
130
+ :host(limel-chip[selected]) .chip {
131
+ box-shadow: var(--button-shadow-inset);
132
+ }
133
+ :host(limel-chip[selected]) .chip:focus-visible {
134
+ box-shadow: var(--button-shadow-inset), var(--shadow-depth-8-focused);
135
+ }
136
+ :host(limel-chip[selected]) .chip:active {
137
+ box-shadow: var(--button-shadow-inset-pressed);
138
+ }
139
+ :host(limel-chip[selected]) .text {
140
+ color: var(--mdc-theme-primary);
141
+ }
142
+
143
+ :host(limel-chip[removable]) .chip:not([disabled]) {
144
+ padding-right: calc(var(--limel-chip-height) + 0.125rem);
145
+ }
146
+ :host(limel-chip[removable]) .chip:not([disabled]) .text {
147
+ padding-right: 0;
148
+ }
149
+
150
+ :host(limel-chip[type=filter]) .chip {
151
+ border-top-left-radius: 0.5rem;
152
+ border-bottom-left-radius: 0.5rem;
153
+ }
154
+ :host(limel-chip[type=filter]) .chip:after {
155
+ content: "";
156
+ transition: background-color 0.4s ease 0.2s, box-shadow 0.6s ease 0.2s;
157
+ box-sizing: border-box;
158
+ position: absolute;
159
+ bottom: 0.125rem;
160
+ left: 0.125rem;
161
+ width: 0.5rem;
162
+ height: 0.5rem;
163
+ border-radius: 50%;
164
+ background-color: rgb(var(--contrast-800), 0.8);
165
+ box-shadow: 0 0 0 1px rgb(var(--color-white)) inset;
166
+ }
167
+
168
+ :host(limel-chip[type=filter][selected]) .chip:after {
169
+ background-color: rgb(var(--color-green-default));
170
+ box-shadow: 0 0 0.375rem 0 rgb(var(--color-green-light)), 0 0 0 1px rgb(var(--color-white)) inset;
171
+ }
172
+
173
+ limel-icon {
174
+ flex-shrink: 0;
175
+ width: calc(var(--limel-chip-height) - 0.25rem);
176
+ height: calc(var(--limel-chip-height) - 0.25rem);
177
+ padding: 0.0625rem;
178
+ }
179
+
180
+ limel-badge {
181
+ pointer-events: none;
182
+ }
183
+
184
+ .text {
185
+ overflow: hidden;
186
+ white-space: nowrap;
187
+ text-overflow: ellipsis;
188
+ line-height: 1.2;
189
+ padding: 0 0.5rem;
190
+ }
191
+
192
+ .trailing-button {
193
+ all: unset;
194
+ transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
195
+ cursor: pointer;
196
+ color: var(--mdc-theme-on-surface);
197
+ background-color: transparent;
198
+ z-index: 1;
199
+ display: flex;
200
+ align-items: center;
201
+ justify-content: center;
202
+ margin-left: calc(var(--limel-chip-height) * -1 + 0.125rem);
203
+ margin-right: 0.125rem;
204
+ width: calc(var(--limel-chip-height) - 0.25rem);
205
+ height: calc(var(--limel-chip-height) - 0.25rem);
206
+ border-radius: 50%;
207
+ }
208
+ .trailing-button:hover {
209
+ color: rgb(var(--color-red-dark));
210
+ background-color: var(--lime-elevated-surface-background-color);
211
+ box-shadow: var(--button-shadow-hovered);
212
+ }
213
+ .trailing-button:active {
214
+ box-shadow: var(--button-shadow-pressed);
215
+ transform: translate3d(0, 0.08rem, 0);
216
+ }
217
+ .trailing-button svg {
218
+ transition: color 0.2s ease, transform 0.2s ease;
219
+ width: 1.25rem;
220
+ }
221
+ .trailing-button:hover svg {
222
+ transform: scale(0.8);
223
+ }
@@ -0,0 +1,357 @@
1
+ import { h, Host, } from '@stencil/core';
2
+ import { getIconName } from '../icon/get-icon-props';
3
+ import { makeEnterClickable, removeEnterClickable, } from '../../util/make-enter-clickable';
4
+ import translate from '../../global/translations';
5
+ import { BACKSPACE, BACKSPACE_KEY_CODE, DELETE, DELETE_KEY_CODE, } from '../../util/keycodes';
6
+ /**
7
+ * Chips and buttons are both interactive elements in UI design,
8
+ * but they serve different purposes and are used in different contexts.
9
+ *
10
+ * :::warning
11
+ * Do not use the chip component carelessly, as an alternative for
12
+ * [`limel-button`](#/component/limel-button/) in the UI design!
13
+ *
14
+ * **Buttons:**
15
+ * Buttons are used to trigger actions. They are typically used to
16
+ * submit forms, open dialogs, initiate a process, or perform any action
17
+ * that changes the state of the application.
18
+ * Buttons' labels usually contain action words, in other words, the labels is
19
+ * a _verb in imperative mood_ such as "Submit" or "Delete".
20
+ * Buttons are placed in areas where it's clear they will initiate
21
+ * an action when clicked.
22
+ *
23
+ * **Chips:**
24
+ * Chips however are elements which may look like buttons, but they are
25
+ * representing choices, filters, or tags, in a small block
26
+ * or clearly bundled into a group. Chips are rarely used alone in the
27
+ * user interface.
28
+ * They are often used in a so called "chip-set", or placed together in
29
+ * a section of the UI, where the user can expect more than one chip to be present.
30
+ *
31
+ * For example, a chip may represent a filter in a filter bar, or a tag in a tag list,
32
+ * or an item in a shopping list.
33
+ * Clicking a chip can also trigger an action, for example toggling a filter ON or OFF,
34
+ * or opening a page with all posts tagged with the tag represented by the chip,
35
+ * or navigating to a page with more information about the item in the shopping list.
36
+ * :::
37
+ *
38
+ * @private
39
+ * @exampleComponent limel-example-chip-button
40
+ * @exampleComponent limel-example-chip-link
41
+ * @exampleComponent limel-example-chip-icon-colors
42
+ * @exampleComponent limel-example-chip-badge
43
+ * @exampleComponent limel-example-chip-filter
44
+ * @exampleComponent limel-example-chip-removable
45
+ * @exampleComponent limel-example-chip-aria-role
46
+ */
47
+ export class Chip {
48
+ constructor() {
49
+ this.renderAsButton = () => {
50
+ return [
51
+ h("button", { class: "chip", role: "button", disabled: this.disabled || this.readonly, onKeyDown: this.handleDeleteKeyDown }, this.renderIcon(), this.renderLabel(), this.renderBadge()),
52
+ this.renderRemoveButton(),
53
+ ];
54
+ };
55
+ this.renderAsLink = () => {
56
+ return [
57
+ h("a", { class: "chip", href: this.link.href, title: this.link.title, target: this.link.target, "aria-disabled": this.disabled || this.readonly, tabindex: this.disabled || this.readonly ? -1 : 0, onKeyDown: this.handleDeleteKeyDown }, this.renderIcon(), this.renderLabel(), this.renderBadge()),
58
+ this.renderRemoveButton(),
59
+ ];
60
+ };
61
+ this.renderLabel = () => {
62
+ return h("span", { class: "text" }, this.text);
63
+ };
64
+ this.filterClickWhenDisabled = (e) => {
65
+ if (this.disabled || this.readonly) {
66
+ e.preventDefault();
67
+ }
68
+ };
69
+ this.handleRemoveClick = (event) => {
70
+ event.stopPropagation();
71
+ this.remove.emit();
72
+ };
73
+ this.handleDeleteKeyDown = (event) => {
74
+ if (!this.removable) {
75
+ return;
76
+ }
77
+ const keys = [DELETE, BACKSPACE];
78
+ const keycodes = [DELETE_KEY_CODE, BACKSPACE_KEY_CODE];
79
+ if (keys.includes(event.key) || keycodes.includes(event.keyCode)) {
80
+ this.handleRemoveClick(event);
81
+ }
82
+ };
83
+ this.removeChipLabel = () => {
84
+ return translate.get('chip-set.remove-chip', this.language);
85
+ };
86
+ this.language = 'en';
87
+ this.text = undefined;
88
+ this.icon = undefined;
89
+ this.link = undefined;
90
+ this.badge = undefined;
91
+ this.disabled = false;
92
+ this.readonly = false;
93
+ this.selected = false;
94
+ this.removable = false;
95
+ this.type = undefined;
96
+ }
97
+ componentWillLoad() {
98
+ makeEnterClickable(this.host);
99
+ }
100
+ disconnectedCallback() {
101
+ removeEnterClickable(this.host);
102
+ }
103
+ render() {
104
+ return (h(Host, { onClick: this.filterClickWhenDisabled }, this.link ? this.renderAsLink() : this.renderAsButton()));
105
+ }
106
+ renderIcon() {
107
+ var _a, _b;
108
+ const icon = getIconName(this.icon);
109
+ if (!icon) {
110
+ return;
111
+ }
112
+ return (h("limel-icon", { badge: true, name: icon, style: {
113
+ color: `${(_a = this.icon) === null || _a === void 0 ? void 0 : _a.color}`,
114
+ 'background-color': `${(_b = this.icon) === null || _b === void 0 ? void 0 : _b.backgroundColor}`,
115
+ } }));
116
+ }
117
+ renderBadge() {
118
+ if (!this.badge) {
119
+ return;
120
+ }
121
+ return h("limel-badge", { label: this.badge });
122
+ }
123
+ renderRemoveButton() {
124
+ if (!this.removable || this.readonly || this.disabled) {
125
+ return;
126
+ }
127
+ const svgData = '<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><path fill="none" stroke="currentColor" stroke-width="2" d="m8 8 16 16M24 8 8 24"/></svg>';
128
+ return (h("button", { class: "trailing-button remove-button", tabIndex: -1, "aria-label": this.removeChipLabel, innerHTML: svgData, onClick: this.handleRemoveClick }));
129
+ }
130
+ static get is() { return "limel-chip"; }
131
+ static get encapsulation() { return "shadow"; }
132
+ static get originalStyleUrls() {
133
+ return {
134
+ "$": ["chip.scss"]
135
+ };
136
+ }
137
+ static get styleUrls() {
138
+ return {
139
+ "$": ["chip.css"]
140
+ };
141
+ }
142
+ static get properties() {
143
+ return {
144
+ "language": {
145
+ "type": "string",
146
+ "mutable": false,
147
+ "complexType": {
148
+ "original": "Languages",
149
+ "resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
150
+ "references": {
151
+ "Languages": {
152
+ "location": "import",
153
+ "path": "../../interface"
154
+ }
155
+ }
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [],
161
+ "text": "Defines the language for translations.\nWill translate the translatable strings on the components."
162
+ },
163
+ "attribute": "language",
164
+ "reflect": true,
165
+ "defaultValue": "'en'"
166
+ },
167
+ "text": {
168
+ "type": "string",
169
+ "mutable": false,
170
+ "complexType": {
171
+ "original": "string",
172
+ "resolved": "string",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": false,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": "Label displayed on the chip"
180
+ },
181
+ "attribute": "text",
182
+ "reflect": true
183
+ },
184
+ "icon": {
185
+ "type": "string",
186
+ "mutable": false,
187
+ "complexType": {
188
+ "original": "string | Icon",
189
+ "resolved": "Icon | string",
190
+ "references": {
191
+ "Icon": {
192
+ "location": "import",
193
+ "path": "../../interface"
194
+ }
195
+ }
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "Icon of the chip."
202
+ },
203
+ "attribute": "icon",
204
+ "reflect": false
205
+ },
206
+ "link": {
207
+ "type": "unknown",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "Omit<Link, 'text'>",
211
+ "resolved": "{ title?: string; target?: string; href: string; }",
212
+ "references": {
213
+ "Omit": {
214
+ "location": "global"
215
+ },
216
+ "Link": {
217
+ "location": "import",
218
+ "path": "../../interface"
219
+ }
220
+ }
221
+ },
222
+ "required": false,
223
+ "optional": true,
224
+ "docs": {
225
+ "tags": [],
226
+ "text": "If supplied, the chip will become a clickable link."
227
+ }
228
+ },
229
+ "badge": {
230
+ "type": "any",
231
+ "mutable": false,
232
+ "complexType": {
233
+ "original": "string | number",
234
+ "resolved": "number | string",
235
+ "references": {}
236
+ },
237
+ "required": false,
238
+ "optional": true,
239
+ "docs": {
240
+ "tags": [],
241
+ "text": "The value of the badge, displayed on the chip."
242
+ },
243
+ "attribute": "badge",
244
+ "reflect": true
245
+ },
246
+ "disabled": {
247
+ "type": "boolean",
248
+ "mutable": false,
249
+ "complexType": {
250
+ "original": "boolean",
251
+ "resolved": "boolean",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Set to `true` to disable the chip."
259
+ },
260
+ "attribute": "disabled",
261
+ "reflect": true,
262
+ "defaultValue": "false"
263
+ },
264
+ "readonly": {
265
+ "type": "boolean",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "boolean",
269
+ "resolved": "boolean",
270
+ "references": {}
271
+ },
272
+ "required": false,
273
+ "optional": false,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": "Set to `true` to render the chip as a static UI element.\nUseful when the parent component has a `readonly` state."
277
+ },
278
+ "attribute": "readonly",
279
+ "reflect": true,
280
+ "defaultValue": "false"
281
+ },
282
+ "selected": {
283
+ "type": "boolean",
284
+ "mutable": false,
285
+ "complexType": {
286
+ "original": "boolean",
287
+ "resolved": "boolean",
288
+ "references": {}
289
+ },
290
+ "required": false,
291
+ "optional": false,
292
+ "docs": {
293
+ "tags": [],
294
+ "text": "Set to `true` to visualize the chip in a \"selected\" state.\nThis is typically used when the chip is used in a chip-set\nalong with other chips."
295
+ },
296
+ "attribute": "selected",
297
+ "reflect": true,
298
+ "defaultValue": "false"
299
+ },
300
+ "removable": {
301
+ "type": "boolean",
302
+ "mutable": false,
303
+ "complexType": {
304
+ "original": "boolean",
305
+ "resolved": "boolean",
306
+ "references": {}
307
+ },
308
+ "required": false,
309
+ "optional": false,
310
+ "docs": {
311
+ "tags": [],
312
+ "text": "Set to `true` to render a remove button on the chip."
313
+ },
314
+ "attribute": "removable",
315
+ "reflect": true,
316
+ "defaultValue": "false"
317
+ },
318
+ "type": {
319
+ "type": "string",
320
+ "mutable": false,
321
+ "complexType": {
322
+ "original": "'filter'",
323
+ "resolved": "\"filter\"",
324
+ "references": {}
325
+ },
326
+ "required": false,
327
+ "optional": false,
328
+ "docs": {
329
+ "tags": [],
330
+ "text": "Set to `filter` to render the chip with a distinct style\nsuitable for visualizing filters."
331
+ },
332
+ "attribute": "type",
333
+ "reflect": true
334
+ }
335
+ };
336
+ }
337
+ static get events() {
338
+ return [{
339
+ "method": "remove",
340
+ "name": "remove",
341
+ "bubbles": true,
342
+ "cancelable": true,
343
+ "composed": true,
344
+ "docs": {
345
+ "tags": [],
346
+ "text": "Fired when clicking on the remove button of a `removable` chip."
347
+ },
348
+ "complexType": {
349
+ "original": "void",
350
+ "resolved": "void",
351
+ "references": {}
352
+ }
353
+ }];
354
+ }
355
+ static get elementRef() { return "host"; }
356
+ }
357
+ //# sourceMappingURL=chip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chip.js","sourceRoot":"","sources":["../../../src/components/chip/chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,IAAI,GACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BJ","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n} from '@stencil/core';\nimport { Icon, Languages, Link } from '../../interface';\nimport { getIconName } from '../icon/get-icon-props';\nimport {\n makeEnterClickable,\n removeEnterClickable,\n} from '../../util/make-enter-clickable';\nimport translate from '../../global/translations';\nimport {\n BACKSPACE,\n BACKSPACE_KEY_CODE,\n DELETE,\n DELETE_KEY_CODE,\n} from '../../util/keycodes';\nimport { Chip as OldChipInterface } from '../chip-set/chip.types';\n\ninterface ChipInterface extends Omit<OldChipInterface, 'id' | 'badge'> {\n badge?: string | number;\n}\n\n/**\n * Chips and buttons are both interactive elements in UI design,\n * but they serve different purposes and are used in different contexts.\n *\n * :::warning\n * Do not use the chip component carelessly, as an alternative for\n * [`limel-button`](#/component/limel-button/) in the UI design!\n *\n * **Buttons:**\n * Buttons are used to trigger actions. They are typically used to\n * submit forms, open dialogs, initiate a process, or perform any action\n * that changes the state of the application.\n * Buttons' labels usually contain action words, in other words, the labels is\n * a _verb in imperative mood_ such as \"Submit\" or \"Delete\".\n * Buttons are placed in areas where it's clear they will initiate\n * an action when clicked.\n *\n * **Chips:**\n * Chips however are elements which may look like buttons, but they are\n * representing choices, filters, or tags, in a small block\n * or clearly bundled into a group. Chips are rarely used alone in the\n * user interface.\n * They are often used in a so called \"chip-set\", or placed together in\n * a section of the UI, where the user can expect more than one chip to be present.\n *\n * For example, a chip may represent a filter in a filter bar, or a tag in a tag list,\n * or an item in a shopping list.\n * Clicking a chip can also trigger an action, for example toggling a filter ON or OFF,\n * or opening a page with all posts tagged with the tag represented by the chip,\n * or navigating to a page with more information about the item in the shopping list.\n * :::\n *\n * @private\n * @exampleComponent limel-example-chip-button\n * @exampleComponent limel-example-chip-link\n * @exampleComponent limel-example-chip-icon-colors\n * @exampleComponent limel-example-chip-badge\n * @exampleComponent limel-example-chip-filter\n * @exampleComponent limel-example-chip-removable\n * @exampleComponent limel-example-chip-aria-role\n */\n@Component({\n tag: 'limel-chip',\n shadow: true,\n styleUrl: 'chip.scss',\n})\nexport class Chip implements ChipInterface {\n /**\n * Defines the language for translations.\n * Will translate the translatable strings on the components.\n */\n @Prop({ reflect: true })\n public language: Languages = 'en';\n\n /**\n * Label displayed on the chip\n */\n @Prop({ reflect: true })\n public text: string;\n\n /**\n * Icon of the chip.\n */\n @Prop()\n public icon: string | Icon;\n\n /**\n * If supplied, the chip will become a clickable link.\n */\n @Prop()\n public link?: Omit<Link, 'text'>;\n\n /**\n * The value of the badge, displayed on the chip.\n */\n @Prop({ reflect: true })\n public badge?: string | number;\n\n /**\n * Set to `true` to disable the chip.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Set to `true` to render the chip as a static UI element.\n * Useful when the parent component has a `readonly` state.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to visualize the chip in a \"selected\" state.\n * This is typically used when the chip is used in a chip-set\n * along with other chips.\n */\n @Prop({ reflect: true })\n public selected = false;\n\n /**\n * Set to `true` to render a remove button on the chip.\n */\n @Prop({ reflect: true })\n public removable = false;\n\n /**\n * Set to `filter` to render the chip with a distinct style\n * suitable for visualizing filters.\n */\n @Prop({ reflect: true })\n public type: 'filter';\n\n /**\n * Fired when clicking on the remove button of a `removable` chip.\n */\n @Event()\n public remove: EventEmitter<void>;\n\n @Element()\n private host: HTMLLimelChipElement;\n\n public componentWillLoad() {\n makeEnterClickable(this.host);\n }\n\n public disconnectedCallback() {\n removeEnterClickable(this.host);\n }\n\n public render() {\n return (\n <Host onClick={this.filterClickWhenDisabled}>\n {this.link ? this.renderAsLink() : this.renderAsButton()}\n </Host>\n );\n }\n\n private renderAsButton = () => {\n return [\n <button\n class=\"chip\"\n role=\"button\"\n disabled={this.disabled || this.readonly}\n onKeyDown={this.handleDeleteKeyDown}\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderBadge()}\n </button>,\n this.renderRemoveButton(),\n ];\n };\n\n private renderAsLink = () => {\n return [\n <a\n class=\"chip\"\n href={this.link.href}\n title={this.link.title}\n target={this.link.target}\n aria-disabled={this.disabled || this.readonly}\n tabindex={this.disabled || this.readonly ? -1 : 0}\n onKeyDown={this.handleDeleteKeyDown}\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderBadge()}\n </a>,\n this.renderRemoveButton(),\n ];\n };\n\n private renderLabel = () => {\n return <span class=\"text\">{this.text}</span>;\n };\n\n private renderIcon() {\n const icon = getIconName(this.icon);\n\n if (!icon) {\n return;\n }\n\n return (\n <limel-icon\n badge={true}\n name={icon}\n style={{\n color: `${(this.icon as Icon)?.color}`,\n 'background-color': `${\n (this.icon as Icon)?.backgroundColor\n }`,\n }}\n />\n );\n }\n\n private renderBadge() {\n if (!this.badge) {\n return;\n }\n\n return <limel-badge label={this.badge} />;\n }\n\n private renderRemoveButton() {\n if (!this.removable || this.readonly || this.disabled) {\n return;\n }\n\n const svgData =\n '<svg viewBox=\"0 0 32 32\" xmlns=\"http://www.w3.org/2000/svg\"><path fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" d=\"m8 8 16 16M24 8 8 24\"/></svg>';\n\n return (\n <button\n class=\"trailing-button remove-button\"\n tabIndex={-1}\n aria-label={this.removeChipLabel}\n innerHTML={svgData}\n onClick={this.handleRemoveClick}\n />\n );\n }\n\n private filterClickWhenDisabled = (e) => {\n if (this.disabled || this.readonly) {\n e.preventDefault();\n }\n };\n\n private handleRemoveClick = (event: MouseEvent | KeyboardEvent) => {\n event.stopPropagation();\n this.remove.emit();\n };\n\n private handleDeleteKeyDown = (event: KeyboardEvent) => {\n if (!this.removable) {\n return;\n }\n\n const keys = [DELETE, BACKSPACE];\n const keycodes = [DELETE_KEY_CODE, BACKSPACE_KEY_CODE];\n\n if (keys.includes(event.key) || keycodes.includes(event.keyCode)) {\n this.handleRemoveClick(event);\n }\n };\n\n private removeChipLabel = (): string => {\n return translate.get('chip-set.remove-chip', this.language);\n };\n}\n"]}
@@ -110,13 +110,13 @@
110
110
 
111
111
  .heading {
112
112
  color: var(--header-heading-color, rgb(var(--contrast-1100)));
113
- font-size: 1.0625rem;
113
+ font-size: 1rem;
114
114
  font-weight: 500;
115
115
  }
116
116
 
117
117
  .subheading {
118
118
  color: var(--header-subheading-color, rgb(var(--contrast-900)));
119
- font-size: 0.875rem;
119
+ font-size: 0.8125rem;
120
120
  font-weight: 400;
121
121
  }
122
122
 
@@ -124,8 +124,7 @@
124
124
  color: var(--header-supporting-text-color, var(--header-subheading-color));
125
125
  }
126
126
  .subheading__supporting-text span {
127
- margin: 0 0.5rem;
128
- font-weight: bold;
127
+ margin: 0 0.125rem;
129
128
  }
130
129
 
131
130
  slot[name=actions] {
@@ -57,6 +57,7 @@ export class Header {
57
57
  this.heading = undefined;
58
58
  this.subheading = undefined;
59
59
  this.supportingText = undefined;
60
+ this.subheadingDivider = '·';
60
61
  }
61
62
  render() {
62
63
  return [
@@ -75,7 +76,7 @@ export class Header {
75
76
  if (!this.supportingText) {
76
77
  return;
77
78
  }
78
- return (h("span", { class: "information__headings__subheading__supporting-text" }, h("span", null, "\u00B7"), " ", this.supportingText));
79
+ return (h("span", { class: "subheading__supporting-text" }, h("span", null, this.subheadingDivider), this.supportingText));
79
80
  }
80
81
  static get is() { return "limel-header"; }
81
82
  static get encapsulation() { return "shadow"; }
@@ -163,6 +164,24 @@ export class Header {
163
164
  },
164
165
  "attribute": "supporting-text",
165
166
  "reflect": false
167
+ },
168
+ "subheadingDivider": {
169
+ "type": "string",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "string",
173
+ "resolved": "string",
174
+ "references": {}
175
+ },
176
+ "required": false,
177
+ "optional": false,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": "The visual divider that separates the `subheading` and the `supportingText`.\nIt must be a single character such as `-` or `,`."
181
+ },
182
+ "attribute": "subheading-divider",
183
+ "reflect": false,
184
+ "defaultValue": "'\u00B7'"
166
185
  }
167
186
  };
168
187
  }