@nysds/nys-label 1.18.3 → 1.19.1
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/nys-label.js +16 -14
- package/dist/nys-label.js.map +1 -1
- package/package.json +3 -3
package/dist/nys-label.js
CHANGED
|
@@ -5,16 +5,16 @@ import { property as l } from "lit/decorators.js";
|
|
|
5
5
|
* █ █ █ █▄▄▄█ ▀▀▀▄▄ █ █ ▀▀▀▄▄
|
|
6
6
|
* █ ▀█ █ █▄▄▄█ █▄▄▀ █▄▄▄█
|
|
7
7
|
*
|
|
8
|
-
* Label Component v1.
|
|
8
|
+
* Label Component v1.19.1
|
|
9
9
|
* Part of the New York State Design System
|
|
10
10
|
* Repository: https://github.com/its-hcd/nysds
|
|
11
11
|
* License: MIT
|
|
12
12
|
*/
|
|
13
13
|
const d = ':host{--_nys-label-font-family: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-label-font-weight: var(--nys-font-weight-semibold, 600);--_nys-label-font-size: var(--nys-font-size-ui-md, 16px);--_nys-label-line-height: var(--nys-font-lineheight-ui-md, 24px);--_nys-label-letter-spacing: var(--nys-font-letterspacing-ui-md, .044px);--_nys-label-color: var(--nys-color-text, #1b1b1b);--_nys-label-cursor: normal;--_nys-description-font-weight: var(--nys-font-weight-regular, 400);--_nys-description-font-style: normal;--_nys-description-font-color: var(--nys-color-text-weak, #4a4d4f);--_nys-required-font-color: var(--nys-color-danger, #b52c2c);--_nys-optional-font-weight: var(--nys-font-weight-regular, 400);--_nys-optional-font-color: var(--nys-color-text-weak, #4a4d4f);--_nys-label-gap: var(--nys-space-4px, 4px)}p{margin:0}.nys-label{display:flex;flex-direction:column;align-items:flex-start;font-family:var(--_nys-label-font-family);font-size:var(--_nys-label-font-size);line-height:var(--_nys-label-line-height);letter-spacing:var(--_nys-label-letter-spacing)}.nys-label *{cursor:var(--_nys-label-cursor)}.nys-label__label{display:flex;gap:var(--_nys-label-gap);text-align:left;font-weight:var(--_nys-label-font-weight);color:var(--_nys-label-color)}.nys-label__description{text-align:left;font-weight:var(--_nys-description-font-weight);font-style:var(--_nys-description-font-style);color:var(--_nys-description-font-color)}.nys-label__required{display:contents;font-weight:var(--_nys-label-font-weight);color:var(--_nys-required-font-color)}.nys-label__optional{display:contents;font-weight:var(--_nys-optional-font-weight);color:var(--_nys-optional-font-color)}.nys-label__tooltip-wrapper{display:flex;gap:2px;align-items:center}.nys-label.invert .nys-label__label,.nys-label.invert .nys-label__description,.nys-label.invert .nys-label__optional{color:var(--nys-color-text-reverse, #ffffff)}.nys-label.invert .nys-label__tooltip-icon{color:var(--nys-color-ink-reverse, #ffffff)}';
|
|
14
14
|
var b = Object.defineProperty, n = (a, r, y, v) => {
|
|
15
|
-
for (var
|
|
16
|
-
(p = a[o]) && (
|
|
17
|
-
return
|
|
15
|
+
for (var t = void 0, o = a.length - 1, p; o >= 0; o--)
|
|
16
|
+
(p = a[o]) && (t = p(r, y, t) || t);
|
|
17
|
+
return t && b(r, y, t), t;
|
|
18
18
|
};
|
|
19
19
|
let _ = 0;
|
|
20
20
|
const s = class s extends c {
|
|
@@ -43,7 +43,9 @@ const s = class s extends c {
|
|
|
43
43
|
<div class="nys-label__tooltip-wrapper">
|
|
44
44
|
<label class="nys-label__label" @click=${this._dispatchLabelClick}
|
|
45
45
|
>${this.label}
|
|
46
|
-
${this.flag === "required" ? i`<div class="nys-label__required"
|
|
46
|
+
${this.flag === "required" ? i`<div class="nys-label__required" aria-hidden="true">
|
|
47
|
+
*
|
|
48
|
+
</div>` : ""}
|
|
47
49
|
${this.flag === "optional" ? i`<div class="nys-label__optional">(Optional)</div>` : ""}</label
|
|
48
50
|
>
|
|
49
51
|
${this.tooltip ? i`<nys-tooltip
|
|
@@ -68,27 +70,27 @@ const s = class s extends c {
|
|
|
68
70
|
}
|
|
69
71
|
};
|
|
70
72
|
s.styles = f(d);
|
|
71
|
-
let
|
|
73
|
+
let e = s;
|
|
72
74
|
n([
|
|
73
75
|
l({ type: String, reflect: !0 })
|
|
74
|
-
],
|
|
76
|
+
], e.prototype, "id");
|
|
75
77
|
n([
|
|
76
78
|
l({ type: String })
|
|
77
|
-
],
|
|
79
|
+
], e.prototype, "label");
|
|
78
80
|
n([
|
|
79
81
|
l({ type: String })
|
|
80
|
-
],
|
|
82
|
+
], e.prototype, "description");
|
|
81
83
|
n([
|
|
82
84
|
l({ type: String })
|
|
83
|
-
],
|
|
85
|
+
], e.prototype, "flag");
|
|
84
86
|
n([
|
|
85
87
|
l({ type: Boolean, reflect: !0 })
|
|
86
|
-
],
|
|
88
|
+
], e.prototype, "inverted");
|
|
87
89
|
n([
|
|
88
90
|
l({ type: String })
|
|
89
|
-
],
|
|
90
|
-
customElements.get("nys-label") || customElements.define("nys-label",
|
|
91
|
+
], e.prototype, "tooltip");
|
|
92
|
+
customElements.get("nys-label") || customElements.define("nys-label", e);
|
|
91
93
|
export {
|
|
92
|
-
|
|
94
|
+
e as NysLabel
|
|
93
95
|
};
|
|
94
96
|
//# sourceMappingURL=nys-label.js.map
|
package/dist/nys-label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nys-label.js","sources":["../src/nys-label.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-label.scss?inline\";\n\nlet labelIdCounter = 0;\n\n/**\n * **Internal component.** Renders form labels with description, required/optional flag, and tooltip.\n *\n * Used internally by form components (textinput, select, checkbox, etc.). Not intended for direct use.\n * Handles label association via `for`, displays asterisk for required fields, and integrates tooltips.\n *\n * @summary Internal label component for form fields with flag and tooltip support.\n * @element nys-label\n *\n * @slot description - Custom HTML description content below the label.\n */\nexport class NysLabel extends LitElement {\n static styles = unsafeCSS(styles);\n\n /** The ID of the label. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Label text displayed above the form field. */\n @property({ type: String }) label = \"\";\n\n /** Helper text displayed below the label. */\n @property({ type: String }) description = \"\";\n\n /** Flag type: `required` shows asterisk, `optional` shows \"(Optional)\". */\n @property({ type: String }) flag = \"\";\n\n /** Adjusts colors for dark backgrounds. */\n @property({ type: Boolean, reflect: true }) inverted = false;\n /** Tooltip text shown on hover/focus of info icon next to label. */\n @property({ type: String }) tooltip = \"\";\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-label-${Date.now()}-${labelIdCounter++}`;\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n /**\n * While most components don't need to listen for this event.\n * Special components like \"nys-fileinput\" and \"nys-toggle\" need to listen for label to execute their specific functionalities.\n */\n private _dispatchLabelClick() {\n this.dispatchEvent(\n new CustomEvent(\"nys-label-click\", { bubbles: true, composed: true }),\n );\n }\n\n render() {\n return html`\n <div class=\"nys-label ${this.inverted ? \"invert\" : \"\"}\">\n <div class=\"nys-label__tooltip-wrapper\">\n <label class=\"nys-label__label\" @click=${this._dispatchLabelClick}\n >${this.label}\n ${this.flag === \"required\"\n ? html`<div class=\"nys-label__required\"
|
|
1
|
+
{"version":3,"file":"nys-label.js","sources":["../src/nys-label.ts"],"sourcesContent":["import { LitElement, html, unsafeCSS } from \"lit\";\nimport { property } from \"lit/decorators.js\";\n// @ts-ignore: SCSS module imported via bundler as inline\nimport styles from \"./nys-label.scss?inline\";\n\nlet labelIdCounter = 0;\n\n/**\n * **Internal component.** Renders form labels with description, required/optional flag, and tooltip.\n *\n * Used internally by form components (textinput, select, checkbox, etc.). Not intended for direct use.\n * Handles label association via `for`, displays asterisk for required fields, and integrates tooltips.\n *\n * @summary Internal label component for form fields with flag and tooltip support.\n * @element nys-label\n *\n * @slot description - Custom HTML description content below the label.\n */\nexport class NysLabel extends LitElement {\n static styles = unsafeCSS(styles);\n\n /** The ID of the label. */\n @property({ type: String, reflect: true }) id = \"\";\n\n /** Label text displayed above the form field. */\n @property({ type: String }) label = \"\";\n\n /** Helper text displayed below the label. */\n @property({ type: String }) description = \"\";\n\n /** Flag type: `required` shows asterisk, `optional` shows \"(Optional)\". */\n @property({ type: String }) flag = \"\";\n\n /** Adjusts colors for dark backgrounds. */\n @property({ type: Boolean, reflect: true }) inverted = false;\n /** Tooltip text shown on hover/focus of info icon next to label. */\n @property({ type: String }) tooltip = \"\";\n\n connectedCallback() {\n super.connectedCallback();\n if (!this.id) {\n this.id = `nys-label-${Date.now()}-${labelIdCounter++}`;\n }\n }\n\n /**\n * Event Handlers\n * --------------------------------------------------------------------------\n */\n\n /**\n * While most components don't need to listen for this event.\n * Special components like \"nys-fileinput\" and \"nys-toggle\" need to listen for label to execute their specific functionalities.\n */\n private _dispatchLabelClick() {\n this.dispatchEvent(\n new CustomEvent(\"nys-label-click\", { bubbles: true, composed: true }),\n );\n }\n\n render() {\n return html`\n <div class=\"nys-label ${this.inverted ? \"invert\" : \"\"}\">\n <div class=\"nys-label__tooltip-wrapper\">\n <label class=\"nys-label__label\" @click=${this._dispatchLabelClick}\n >${this.label}\n ${this.flag === \"required\"\n ? html`<div class=\"nys-label__required\" aria-hidden=\"true\">\n *\n </div>`\n : \"\"}\n ${this.flag === \"optional\"\n ? html`<div class=\"nys-label__optional\">(Optional)</div>`\n : \"\"}</label\n >\n ${this.tooltip\n ? html`<nys-tooltip\n text=\"${this.tooltip}\"\n position=\"top\"\n focusable\n ?inverted=${this.inverted}\n for=\"tooltip-icon-${this.id}\"\n >\n </nys-tooltip>\n <nys-icon\n id=\"tooltip-icon-${this.id}\"\n name=\"info\"\n size=\"3xl\"\n ></nys-icon> `\n : \"\"}\n </div>\n <p class=\"nys-label__description\" @click=${this._dispatchLabelClick}>\n <slot name=\"description\">${this.description}</slot>\n </p>\n </div>\n `;\n }\n}\n\nif (!customElements.get(\"nys-label\")) {\n customElements.define(\"nys-label\", NysLabel);\n}\n"],"names":["labelIdCounter","_NysLabel","LitElement","html","unsafeCSS","styles","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AA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAPfF,EAOiB,WAAA,OAAA;AAGAC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAVfF,EAUiB,WAAA,aAAA;AAGAC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAbfF,EAaiB,WAAA,MAAA;AAGgBC,EAAA;AAAA,EAA3CC,EAAS,EAAE,MAAM,SAAS,SAAS,IAAM;AAAA,GAhB/BF,EAgBiC,WAAA,UAAA;AAEhBC,EAAA;AAAA,EAA3BC,EAAS,EAAE,MAAM,OAAA,CAAQ;AAAA,GAlBfF,EAkBiB,WAAA,SAAA;AA+DzB,eAAe,IAAI,WAAW,KACjC,eAAe,OAAO,aAAaA,CAAQ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/nys-label",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "The Label component from the NYS Design System.",
|
|
5
5
|
"module": "dist/nys-label.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"lit-analyze": "lit-analyzer '**/*.ts'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@nysds/nys-icon": "^1.
|
|
27
|
-
"@nysds/nys-tooltip": "^1.
|
|
26
|
+
"@nysds/nys-icon": "^1.19.1",
|
|
27
|
+
"@nysds/nys-tooltip": "^1.19.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"lit": "^3.3.1",
|