@kubex/zinc 1.1.78 → 1.1.79
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/dist/custom-elements.json +74 -74
- package/dist/vscode.html-custom-data.json +11 -11
- package/dist/web-types.json +23 -23
- package/dist/zn.min.js +1 -1
- package/docs/pages/components/rating.md +2 -1
- package/package.json +1 -1
- package/src/components/rating/rating.component.ts +10 -1
- package/src/components/rating/rating.scss +6 -9
|
@@ -47,79 +47,6 @@
|
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
-
{
|
|
51
|
-
"kind": "javascript-module",
|
|
52
|
-
"path": "components/action-bar/action-bar.js",
|
|
53
|
-
"declarations": [
|
|
54
|
-
{
|
|
55
|
-
"kind": "class",
|
|
56
|
-
"description": "",
|
|
57
|
-
"name": "ZnActionBar",
|
|
58
|
-
"cssProperties": [
|
|
59
|
-
{
|
|
60
|
-
"description": "An example CSS custom property.",
|
|
61
|
-
"name": "--example"
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"cssParts": [
|
|
65
|
-
{
|
|
66
|
-
"description": "The component's base wrapper.",
|
|
67
|
-
"name": "base"
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
"slots": [
|
|
71
|
-
{
|
|
72
|
-
"description": "The default slot.",
|
|
73
|
-
"name": ""
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"description": "An example slot.",
|
|
77
|
-
"name": "example"
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"members": [
|
|
81
|
-
{
|
|
82
|
-
"kind": "field",
|
|
83
|
-
"name": "localize",
|
|
84
|
-
"privacy": "private",
|
|
85
|
-
"readonly": true,
|
|
86
|
-
"default": "new LocalizeController(this)"
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"events": [
|
|
90
|
-
{
|
|
91
|
-
"description": "Emitted as an example.",
|
|
92
|
-
"name": "zn-event-name"
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
"superclass": {
|
|
96
|
-
"name": "ZincElement",
|
|
97
|
-
"module": "/src/internal/zinc-element"
|
|
98
|
-
},
|
|
99
|
-
"summary": "Short summary of the component's intended use.",
|
|
100
|
-
"tagNameWithoutPrefix": "action-bar",
|
|
101
|
-
"tagName": "zn-action-bar",
|
|
102
|
-
"customElement": true,
|
|
103
|
-
"jsDoc": "/**\n * @summary Short summary of the component's intended use.\n * @documentation https://zinc.style/components/action-bar\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-example\n *\n * @event zn-event-name - Emitted as an example.\n *\n * @slot - The default slot.\n * @slot example - An example slot.\n *\n * @csspart base - The component's base wrapper.\n *\n * @cssproperty --example - An example CSS custom property.\n */",
|
|
104
|
-
"documentation": "https://zinc.style/components/action-bar",
|
|
105
|
-
"status": "experimental",
|
|
106
|
-
"since": "1.0",
|
|
107
|
-
"dependencies": [
|
|
108
|
-
"zn-example"
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
],
|
|
112
|
-
"exports": [
|
|
113
|
-
{
|
|
114
|
-
"kind": "js",
|
|
115
|
-
"name": "default",
|
|
116
|
-
"declaration": {
|
|
117
|
-
"name": "ZnActionBar",
|
|
118
|
-
"module": "components/action-bar/action-bar.js"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
},
|
|
123
50
|
{
|
|
124
51
|
"kind": "javascript-module",
|
|
125
52
|
"path": "components/alert/alert.js",
|
|
@@ -314,6 +241,79 @@
|
|
|
314
241
|
}
|
|
315
242
|
]
|
|
316
243
|
},
|
|
244
|
+
{
|
|
245
|
+
"kind": "javascript-module",
|
|
246
|
+
"path": "components/action-bar/action-bar.js",
|
|
247
|
+
"declarations": [
|
|
248
|
+
{
|
|
249
|
+
"kind": "class",
|
|
250
|
+
"description": "",
|
|
251
|
+
"name": "ZnActionBar",
|
|
252
|
+
"cssProperties": [
|
|
253
|
+
{
|
|
254
|
+
"description": "An example CSS custom property.",
|
|
255
|
+
"name": "--example"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"cssParts": [
|
|
259
|
+
{
|
|
260
|
+
"description": "The component's base wrapper.",
|
|
261
|
+
"name": "base"
|
|
262
|
+
}
|
|
263
|
+
],
|
|
264
|
+
"slots": [
|
|
265
|
+
{
|
|
266
|
+
"description": "The default slot.",
|
|
267
|
+
"name": ""
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"description": "An example slot.",
|
|
271
|
+
"name": "example"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"members": [
|
|
275
|
+
{
|
|
276
|
+
"kind": "field",
|
|
277
|
+
"name": "localize",
|
|
278
|
+
"privacy": "private",
|
|
279
|
+
"readonly": true,
|
|
280
|
+
"default": "new LocalizeController(this)"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"events": [
|
|
284
|
+
{
|
|
285
|
+
"description": "Emitted as an example.",
|
|
286
|
+
"name": "zn-event-name"
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
"superclass": {
|
|
290
|
+
"name": "ZincElement",
|
|
291
|
+
"module": "/src/internal/zinc-element"
|
|
292
|
+
},
|
|
293
|
+
"summary": "Short summary of the component's intended use.",
|
|
294
|
+
"tagNameWithoutPrefix": "action-bar",
|
|
295
|
+
"tagName": "zn-action-bar",
|
|
296
|
+
"customElement": true,
|
|
297
|
+
"jsDoc": "/**\n * @summary Short summary of the component's intended use.\n * @documentation https://zinc.style/components/action-bar\n * @status experimental\n * @since 1.0\n *\n * @dependency zn-example\n *\n * @event zn-event-name - Emitted as an example.\n *\n * @slot - The default slot.\n * @slot example - An example slot.\n *\n * @csspart base - The component's base wrapper.\n *\n * @cssproperty --example - An example CSS custom property.\n */",
|
|
298
|
+
"documentation": "https://zinc.style/components/action-bar",
|
|
299
|
+
"status": "experimental",
|
|
300
|
+
"since": "1.0",
|
|
301
|
+
"dependencies": [
|
|
302
|
+
"zn-example"
|
|
303
|
+
]
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"exports": [
|
|
307
|
+
{
|
|
308
|
+
"kind": "js",
|
|
309
|
+
"name": "default",
|
|
310
|
+
"declaration": {
|
|
311
|
+
"name": "ZnActionBar",
|
|
312
|
+
"module": "components/action-bar/action-bar.js"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
},
|
|
317
317
|
{
|
|
318
318
|
"kind": "javascript-module",
|
|
319
319
|
"path": "components/animated-button/animated-button.js",
|
|
@@ -44468,7 +44468,7 @@
|
|
|
44468
44468
|
"package": {
|
|
44469
44469
|
"name": "@kubex/zinc",
|
|
44470
44470
|
"description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
|
|
44471
|
-
"version": "1.1.
|
|
44471
|
+
"version": "1.1.79",
|
|
44472
44472
|
"author": "",
|
|
44473
44473
|
"license": "MIT"
|
|
44474
44474
|
}
|
|
@@ -13,17 +13,6 @@
|
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
{
|
|
17
|
-
"name": "zn-action-bar",
|
|
18
|
-
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
19
|
-
"attributes": [],
|
|
20
|
-
"references": [
|
|
21
|
-
{
|
|
22
|
-
"name": "Documentation",
|
|
23
|
-
"url": "https://zinc.style/components/action-bar"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
16
|
{
|
|
28
17
|
"name": "zn-alert",
|
|
29
18
|
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
@@ -64,6 +53,17 @@
|
|
|
64
53
|
}
|
|
65
54
|
]
|
|
66
55
|
},
|
|
56
|
+
{
|
|
57
|
+
"name": "zn-action-bar",
|
|
58
|
+
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
59
|
+
"attributes": [],
|
|
60
|
+
"references": [
|
|
61
|
+
{
|
|
62
|
+
"name": "Documentation",
|
|
63
|
+
"url": "https://zinc.style/components/action-bar"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
67
|
{
|
|
68
68
|
"name": "zn-animated-button",
|
|
69
69
|
"description": "\n---\n\n\n### **Methods:**\n - **purchase(): _void_** - Programmatically trigger the purchase flow\n- **setSuccess(): _void_** - Set the button to success state manually\n- **setFailure(message): _void_** - Set the button to failure state manually with optional error message\n- **reset(): _void_** - Reset the button to idle state",
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@kubex/zinc",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.79",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -15,28 +15,6 @@
|
|
|
15
15
|
"events": [],
|
|
16
16
|
"js": { "properties": [], "events": [] }
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
"name": "zn-action-bar",
|
|
20
|
-
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
21
|
-
"doc-url": "",
|
|
22
|
-
"attributes": [],
|
|
23
|
-
"slots": [
|
|
24
|
-
{ "name": "", "description": "The default slot." },
|
|
25
|
-
{ "name": "example", "description": "An example slot." }
|
|
26
|
-
],
|
|
27
|
-
"events": [
|
|
28
|
-
{ "name": "zn-event-name", "description": "Emitted as an example." }
|
|
29
|
-
],
|
|
30
|
-
"js": {
|
|
31
|
-
"properties": [],
|
|
32
|
-
"events": [
|
|
33
|
-
{
|
|
34
|
-
"name": "zn-event-name",
|
|
35
|
-
"description": "Emitted as an example."
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
18
|
{
|
|
41
19
|
"name": "zn-alert",
|
|
42
20
|
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
@@ -105,6 +83,28 @@
|
|
|
105
83
|
]
|
|
106
84
|
}
|
|
107
85
|
},
|
|
86
|
+
{
|
|
87
|
+
"name": "zn-action-bar",
|
|
88
|
+
"description": "Short summary of the component's intended use.\n---\n\n\n### **Events:**\n - **zn-event-name** - Emitted as an example.\n\n### **Slots:**\n - _default_ - The default slot.\n- **example** - An example slot.\n\n### **CSS Properties:**\n - **--example** - An example CSS custom property. _(default: undefined)_\n\n### **CSS Parts:**\n - **base** - The component's base wrapper.",
|
|
89
|
+
"doc-url": "",
|
|
90
|
+
"attributes": [],
|
|
91
|
+
"slots": [
|
|
92
|
+
{ "name": "", "description": "The default slot." },
|
|
93
|
+
{ "name": "example", "description": "An example slot." }
|
|
94
|
+
],
|
|
95
|
+
"events": [
|
|
96
|
+
{ "name": "zn-event-name", "description": "Emitted as an example." }
|
|
97
|
+
],
|
|
98
|
+
"js": {
|
|
99
|
+
"properties": [],
|
|
100
|
+
"events": [
|
|
101
|
+
{
|
|
102
|
+
"name": "zn-event-name",
|
|
103
|
+
"description": "Emitted as an example."
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
108
|
{
|
|
109
109
|
"name": "zn-animated-button",
|
|
110
110
|
"description": "\n---\n\n\n### **Methods:**\n - **purchase(): _void_** - Programmatically trigger the purchase flow\n- **setSuccess(): _void_** - Set the button to success state manually\n- **setFailure(message): _void_** - Set the button to failure state manually with optional error message\n- **reset(): _void_** - Reset the button to idle state",
|
package/dist/zn.min.js
CHANGED
|
@@ -3431,7 +3431,7 @@ ${va(this.code(o,t))}
|
|
|
3431
3431
|
</div>
|
|
3432
3432
|
</label>
|
|
3433
3433
|
</div>
|
|
3434
|
-
`}};Wt.styles=E(Lw),Wt.dependencies={"zn-icon":ct},c([F('input[type="radio"]')],Wt.prototype,"input",2),c([O()],Wt.prototype,"hasFocus",2),c([p()],Wt.prototype,"title",2),c([p()],Wt.prototype,"name",2),c([p()],Wt.prototype,"value",2),c([p({reflect:!0})],Wt.prototype,"size",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"disabled",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"checked",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"contained",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"horizontal",2),c([ee("checked")],Wt.prototype,"defaultChecked",2),c([p({reflect:!0})],Wt.prototype,"form",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"required",2),c([p({attribute:"description"})],Wt.prototype,"description",2),c([p()],Wt.prototype,"label",2),c([p({attribute:"label-tooltip"})],Wt.prototype,"labelTooltip",2),c([K("disabled",{waitUntilFirstUpdate:!0})],Wt.prototype,"handleDisabledChange",1),c([K(["checked"],{waitUntilFirstUpdate:!0})],Wt.prototype,"handleStateChange",1);var lA=Wt;Wt.define("zn-radio");var qw=S`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}.form-control-input{margin:var(--zn-spacing-2x-small) 3px 3px 0}.form-control-input--flush{margin:0}.form-control .form-control__label{display:none}.form-control .form-control__help-text{display:none}.form-control--has-label .form-control__label{display:inline-block;color:var(--zn-input-label-color);font-weight:var(--zn-input-label-font-weight);line-height:var(--zn-input-label-line-height);margin-bottom:var(--zn-spacing-x-small)}.form-control--has-label.form-control--medium .form-control__label{font-size:var(--zn-input-label-font-size-medium)}.form-control--has-label.form-control--large .form-control__label{font-size:var(--zn-input-label-font-size-large)}:host([required]) .form-control--has-label .form-control__label::after{content:var(--zn-input-required-content);margin-inline-start:var(--zn-input-required-content-offset);color:var(--zn-input-required-content-color)}.form-control--has-label.form-control--radio-group .form-control__label,.form-control--has-label.form-control--checkbox-group .form-control__label{margin-bottom:0}.form-control--has-label.form-control--has-label-tooltip .form-control__label{display:inline-flex;align-items:center;gap:var(--zn-spacing-2x-small)}.form-control--has-label.form-control--small .form-control__label{font-size:var(--zn-input-label-font-size-small)}.form-control--label-tooltip{color:var(--zn-color-neutral-700);font-size:var(--zn-font-size-small)}.form-control--label-tooltip zn-icon{--icon-color:var(--zn-color-neutral-700);--icon-size:var(--zn-font-size-small)}.form-control--has-label.form-control--has-context-note{display:flex;justify-content:space-between;flex-wrap:wrap}.form-control__label-context-note{color:var(--zn-input-help-text-color);font-size:var(--zn-font-size-small);margin-bottom:var(--zn-spacing-2x-small)}.form-control--has-label.form-control--has-context-note .form-control-input{width:100%}.form-control--has-help-text .form-control__help-text,.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{display:block;color:var(--zn-input-help-text-color);margin-top:var(--zn-spacing-x-small)}.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{margin-top:0.375rem}.radio--has-selected-content .radio__selected-content,.checkbox--has-selected-content .checkbox__selected-content{display:block;margin-top:var(--zn-spacing-small)}.form-control--has-help-text.form-control--small .form-control__help-text{font-size:var(--zn-input-help-text-font-size-small)}.form-control--has-help-text.form-control--medium .form-control__help-text,.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{font-size:var(--zn-input-help-text-font-size-medium)}.form-control--has-help-text.form-control--large .form-control__help-text{font-size:var(--zn-input-help-text-font-size-large)}.form-control--has-help-text.form-control--radio-group .form-control__help-text,.form-control--has-help-text.form-control--checkbox-group .form-control__help-text{margin-top:var(--zn-spacing-medium)}.form-control--has-help-text .switch .form-control__help-text{margin-top:var(--zn-spacing-3x-small)}.form-control--checkbox-contained-wrapper{height:100%}:host{--symbol-color:rgb(var(--zn-border-color));--symbol-color-active:var(--zn-color-amber-400);--symbol-size:1.2rem;--symbol-spacing:
|
|
3434
|
+
`}};Wt.styles=E(Lw),Wt.dependencies={"zn-icon":ct},c([F('input[type="radio"]')],Wt.prototype,"input",2),c([O()],Wt.prototype,"hasFocus",2),c([p()],Wt.prototype,"title",2),c([p()],Wt.prototype,"name",2),c([p()],Wt.prototype,"value",2),c([p({reflect:!0})],Wt.prototype,"size",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"disabled",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"checked",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"contained",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"horizontal",2),c([ee("checked")],Wt.prototype,"defaultChecked",2),c([p({reflect:!0})],Wt.prototype,"form",2),c([p({type:Boolean,reflect:!0})],Wt.prototype,"required",2),c([p({attribute:"description"})],Wt.prototype,"description",2),c([p()],Wt.prototype,"label",2),c([p({attribute:"label-tooltip"})],Wt.prototype,"labelTooltip",2),c([K("disabled",{waitUntilFirstUpdate:!0})],Wt.prototype,"handleDisabledChange",1),c([K(["checked"],{waitUntilFirstUpdate:!0})],Wt.prototype,"handleStateChange",1);var lA=Wt;Wt.define("zn-radio");var qw=S`@keyframes rotate-gradient{from{--rotate:0deg}to{--rotate:360deg}}:host{text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-transform:none}:host *,:host *::before,:host *::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:rgb(var(--zn-border-color))}[hidden]{display:none !important}.width-container,.form-container,.wide-form-container{height:100%;width:100%;margin:var(--zn-default-margin,0 auto)}.width-container{max-width:var(--zn-container)}.form-container{max-width:var(--zn-container-ph)}.wide-form-container{max-width:var(--zn-container-lg)}.form-control-input{margin:var(--zn-spacing-2x-small) 3px 3px 0}.form-control-input--flush{margin:0}.form-control .form-control__label{display:none}.form-control .form-control__help-text{display:none}.form-control--has-label .form-control__label{display:inline-block;color:var(--zn-input-label-color);font-weight:var(--zn-input-label-font-weight);line-height:var(--zn-input-label-line-height);margin-bottom:var(--zn-spacing-x-small)}.form-control--has-label.form-control--medium .form-control__label{font-size:var(--zn-input-label-font-size-medium)}.form-control--has-label.form-control--large .form-control__label{font-size:var(--zn-input-label-font-size-large)}:host([required]) .form-control--has-label .form-control__label::after{content:var(--zn-input-required-content);margin-inline-start:var(--zn-input-required-content-offset);color:var(--zn-input-required-content-color)}.form-control--has-label.form-control--radio-group .form-control__label,.form-control--has-label.form-control--checkbox-group .form-control__label{margin-bottom:0}.form-control--has-label.form-control--has-label-tooltip .form-control__label{display:inline-flex;align-items:center;gap:var(--zn-spacing-2x-small)}.form-control--has-label.form-control--small .form-control__label{font-size:var(--zn-input-label-font-size-small)}.form-control--label-tooltip{color:var(--zn-color-neutral-700);font-size:var(--zn-font-size-small)}.form-control--label-tooltip zn-icon{--icon-color:var(--zn-color-neutral-700);--icon-size:var(--zn-font-size-small)}.form-control--has-label.form-control--has-context-note{display:flex;justify-content:space-between;flex-wrap:wrap}.form-control__label-context-note{color:var(--zn-input-help-text-color);font-size:var(--zn-font-size-small);margin-bottom:var(--zn-spacing-2x-small)}.form-control--has-label.form-control--has-context-note .form-control-input{width:100%}.form-control--has-help-text .form-control__help-text,.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{display:block;color:var(--zn-input-help-text-color);margin-top:var(--zn-spacing-x-small)}.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{margin-top:0.375rem}.radio--has-selected-content .radio__selected-content,.checkbox--has-selected-content .checkbox__selected-content{display:block;margin-top:var(--zn-spacing-small)}.form-control--has-help-text.form-control--small .form-control__help-text{font-size:var(--zn-input-help-text-font-size-small)}.form-control--has-help-text.form-control--medium .form-control__help-text,.radio--has-description .radio__description,.checkbox--has-description .checkbox__description{font-size:var(--zn-input-help-text-font-size-medium)}.form-control--has-help-text.form-control--large .form-control__help-text{font-size:var(--zn-input-help-text-font-size-large)}.form-control--has-help-text.form-control--radio-group .form-control__help-text,.form-control--has-help-text.form-control--checkbox-group .form-control__help-text{margin-top:var(--zn-spacing-medium)}.form-control--has-help-text .switch .form-control__help-text{margin-top:var(--zn-spacing-3x-small)}.form-control--checkbox-contained-wrapper{height:100%}:host{--symbol-color:rgb(var(--zn-border-color));--symbol-color-active:var(--zn-color-amber-400);--symbol-size:1.2rem;--symbol-spacing:var(--zn-spacing-x-small);--preview-color:rgb(var(--zn-text));--preview-size:0.875rem;display:block}.rating{position:relative;display:inline-flex;align-items:center;border-radius:var(--zn-border-radius);vertical-align:middle}.rating:focus{outline:none}.rating:focus-visible{outline:rgb(var(--zn-primary));outline-offset:2px}.rating__symbols{display:inline-flex;position:relative;gap:var(--symbol-spacing);font-size:var(--symbol-size);line-height:0;color:var(--symbol-color);white-space:nowrap;cursor:pointer}.rating__symbol--active,.rating__partial--filled{color:var(--symbol-color-active)}.rating__partial-symbol-container{position:relative}.rating__partial--filled{position:absolute;top:0;left:0}.rating__symbol{transition:var(--zn-transition-fast) scale;pointer-events:none}.rating__symbol--hover{scale:1.2}.rating__preview{margin-left:var(--symbol-spacing);font-size:var(--preview-size);font-weight:var(--zn-font-weight-semibold);line-height:1;color:var(--preview-color);font-variant-numeric:tabular-nums;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.rating__preview--hover{color:var(--symbol-color-active)}.rating--disabled .rating__symbols,.rating--readonly .rating__symbols{cursor:default}.rating--disabled .rating__symbol--hover,.rating--readonly .rating__symbol--hover{scale:none}.rating--disabled .rating__preview--hover,.rating--readonly .rating__preview--hover{color:var(--preview-color)}.rating--disabled{opacity:0.5}.rating--disabled .rating__symbols{cursor:not-allowed}.rating--small{--symbol-size:1rem;--symbol-spacing:var(--zn-spacing-2x-small)}.rating--medium{--symbol-size:1.2rem}.rating--large{--symbol-size:1.5rem;--symbol-spacing:12px}`;var ve=class extends C{constructor(){super(...arguments);this.formControlController=new ot(this,{assumeInteractionOn:["zn-blur","zn-input"]});this.hasSlotController=new Q(this,"help-text");this.hoverValue=0;this.isHovering=!1;this.helpText="";this.value=0;this.max=5;this.precision=1;this.readonly=!1;this.disabled=!1;this.preview=!1;this.size="medium";this.getSymbol=()=>'<zn-icon src="star" library="material"></zn-icon>'}get validity(){return ge}get validationMessage(){return""}checkValidity(){return!0}getForm(){return this.formControlController.getForm()}reportValidity(){return!0}setCustomValidity(){this.formControlController.updateValidity()}_roundToPrecision(t,r){let n=1/r;return Math.ceil(t*n)/n}_getValueFromXCoordinate(t){let{left:r,width:n}=this.symbols.getBoundingClientRect(),a=parseFloat(getComputedStyle(this.symbols).columnGap)||0,s=(n-a*(this.max-1))/this.max,l=s+a,d=Math.min(Math.max(t-r,0),n),h=Math.min(Math.floor(d/l),this.max-1),m=Math.min((d-h*l)/s,1),f=this._roundToPrecision(h+m,this.precision);return Math.min(Math.max(f,0),this.max)}_formatValue(t){let r=String(this.precision).split(".")[1]?.length??0;return t.toFixed(r)}_getValueFromMousePosition(t){return this._getValueFromXCoordinate(t.clientX)}_getValueFromTouchPosition(t){return this._getValueFromXCoordinate(t.touches[0].clientX)}_setValue(t){this.disabled||this.readonly||(this.value=t===this.value?0:t,this.isHovering=!1)}_handleClick(t){this.readonly||this.disabled||this._setValue(this._getValueFromMousePosition(t))}_handleMouseEnter(t){this.isHovering=!0,this.hoverValue=this._getValueFromMousePosition(t)}_handleMouseMove(t){this.hoverValue=this._getValueFromMousePosition(t)}_handleMouseLeave(){this.isHovering=!1}_handleTouchStart(t){this.isHovering=!0,this.hoverValue=this._getValueFromTouchPosition(t)}_handleTouchMove(t){this.hoverValue=this._getValueFromTouchPosition(t)}_handleTouchEnd(t){this.isHovering=!1,this._setValue(this._getValueFromXCoordinate(t.changedTouches[0].clientX)),t.preventDefault()}render(){let t=Array.from(Array(this.max).keys()),r=this.helpText?!0:this.hasSlotController.test("help-text"),n=0;return this.disabled||this.readonly?n=this.value:n=this.isHovering?this.hoverValue:this.value,u`
|
|
3435
3435
|
<div
|
|
3436
3436
|
part="form-control"
|
|
3437
3437
|
class="${D({"form-control":!0,"form-control--small":this.size==="small","form-control--medium":this.size==="medium","form-control--large":this.size==="large","form-control--has-help-text":r})}">
|
|
@@ -328,7 +328,8 @@ Available CSS custom properties:
|
|
|
328
328
|
- `--symbol-color` - Color of unfilled symbols
|
|
329
329
|
- `--symbol-color-active` - Color of filled/active symbols
|
|
330
330
|
- `--symbol-size` - Size of the symbols
|
|
331
|
-
- `--symbol-spacing` -
|
|
331
|
+
- `--symbol-spacing` - Gap between symbols. The rating adds no padding of its own, so the first symbol sits flush with
|
|
332
|
+
the component's edge and lines up with other form controls.
|
|
332
333
|
- `--preview-color` - Color of the preview value (see [Preview](#preview))
|
|
333
334
|
- `--preview-size` - Font size of the preview value
|
|
334
335
|
|
package/package.json
CHANGED
|
@@ -112,7 +112,16 @@ export default class ZnRating extends ZincElement implements ZincFormControl {
|
|
|
112
112
|
|
|
113
113
|
private _getValueFromXCoordinate(coordinate: number): number {
|
|
114
114
|
const {left, width} = this.symbols.getBoundingClientRect();
|
|
115
|
-
|
|
115
|
+
// Symbols are spaced with a gap rather than padding, so the symbols only cover part of the
|
|
116
|
+
// container and a plain width-to-value ratio would skew fractions within each symbol.
|
|
117
|
+
const gap = parseFloat(getComputedStyle(this.symbols).columnGap) || 0;
|
|
118
|
+
const symbolWidth = (width - gap * (this.max - 1)) / this.max;
|
|
119
|
+
const stride = symbolWidth + gap;
|
|
120
|
+
const position = Math.min(Math.max(coordinate - left, 0), width);
|
|
121
|
+
const index = Math.min(Math.floor(position / stride), this.max - 1);
|
|
122
|
+
// Landing in a gap reads as the preceding symbol being complete.
|
|
123
|
+
const fraction = Math.min((position - index * stride) / symbolWidth, 1);
|
|
124
|
+
const value = this._roundToPrecision(index + fraction, this.precision);
|
|
116
125
|
|
|
117
126
|
return Math.min(Math.max(value, 0), this.max);
|
|
118
127
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--symbol-color: rgb(var(--zn-border-color));
|
|
6
6
|
--symbol-color-active: var(--zn-color-amber-400);
|
|
7
7
|
--symbol-size: 1.2rem;
|
|
8
|
-
--symbol-spacing:
|
|
8
|
+
--symbol-spacing: var(--zn-spacing-x-small);
|
|
9
9
|
--preview-color: rgb(var(--zn-text));
|
|
10
10
|
--preview-size: 0.875rem;
|
|
11
11
|
|
|
@@ -31,15 +31,12 @@
|
|
|
31
31
|
&__symbols {
|
|
32
32
|
display: inline-flex;
|
|
33
33
|
position: relative;
|
|
34
|
+
gap: var(--symbol-spacing);
|
|
34
35
|
font-size: var(--symbol-size);
|
|
35
36
|
line-height: 0;
|
|
36
37
|
color: var(--symbol-color);
|
|
37
38
|
white-space: nowrap;
|
|
38
39
|
cursor: pointer;
|
|
39
|
-
|
|
40
|
-
> * {
|
|
41
|
-
padding: var(--symbol-spacing);
|
|
42
|
-
}
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
&__symbol--active,
|
|
@@ -53,8 +50,8 @@
|
|
|
53
50
|
|
|
54
51
|
&__partial--filled {
|
|
55
52
|
position: absolute;
|
|
56
|
-
top:
|
|
57
|
-
left:
|
|
53
|
+
top: 0;
|
|
54
|
+
left: 0;
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
&__symbol {
|
|
@@ -106,7 +103,7 @@
|
|
|
106
103
|
|
|
107
104
|
&--small {
|
|
108
105
|
--symbol-size: 1rem;
|
|
109
|
-
--symbol-spacing:
|
|
106
|
+
--symbol-spacing: var(--zn-spacing-2x-small);
|
|
110
107
|
}
|
|
111
108
|
|
|
112
109
|
&--medium {
|
|
@@ -115,6 +112,6 @@
|
|
|
115
112
|
|
|
116
113
|
&--large {
|
|
117
114
|
--symbol-size: 1.5rem;
|
|
118
|
-
--symbol-spacing:
|
|
115
|
+
--symbol-spacing: 12px;
|
|
119
116
|
}
|
|
120
117
|
}
|