@nysds/nys-toggle 1.19.1 → 1.19.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/dist/nys-toggle.d.ts +87 -0
- package/dist/nys-toggle.js +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* A toggle switch for binary settings with immediate effect. Form-associated via ElementInternals.
|
|
4
|
+
*
|
|
5
|
+
* Use when changing a setting takes effect immediately (e.g., dark mode, notifications).
|
|
6
|
+
* For binary choices in forms that submit later, use `nys-checkbox` instead.
|
|
7
|
+
*
|
|
8
|
+
* @summary Toggle switch for binary settings with immediate effect.
|
|
9
|
+
* @element nys-toggle
|
|
10
|
+
*
|
|
11
|
+
* @slot description - Custom HTML description content.
|
|
12
|
+
*
|
|
13
|
+
* @fires nys-change - Fired when toggle state changes. Detail: `{id, checked}`.
|
|
14
|
+
* @fires nys-focus - Fired when toggle gains focus.
|
|
15
|
+
* @fires nys-blur - Fired when toggle loses focus.
|
|
16
|
+
*
|
|
17
|
+
* @example Basic toggle
|
|
18
|
+
* ```html
|
|
19
|
+
* <nys-toggle label="Enable notifications" name="notifications"></nys-toggle>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example Dark mode toggle
|
|
23
|
+
* ```html
|
|
24
|
+
* <nys-toggle label="Dark mode" description="Adjust display for low light" checked></nys-toggle>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class NysToggle extends LitElement {
|
|
28
|
+
static styles: import("lit").CSSResult;
|
|
29
|
+
static shadowRootOptions: {
|
|
30
|
+
delegatesFocus: boolean;
|
|
31
|
+
clonable?: boolean;
|
|
32
|
+
customElementRegistry?: CustomElementRegistry;
|
|
33
|
+
mode: ShadowRootMode;
|
|
34
|
+
serializable?: boolean;
|
|
35
|
+
slotAssignment?: SlotAssignmentMode;
|
|
36
|
+
};
|
|
37
|
+
/** Unique identifier. Auto-generated if not provided. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Name for form submission. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Value submitted when toggle is on. */
|
|
42
|
+
value: string;
|
|
43
|
+
/** Visible label text. */
|
|
44
|
+
label: string;
|
|
45
|
+
/** Helper text below label. Use slot for custom HTML. */
|
|
46
|
+
description: string;
|
|
47
|
+
/** Form `id` to associate with. */
|
|
48
|
+
form: string | null;
|
|
49
|
+
/** Whether toggle is on. */
|
|
50
|
+
checked: boolean;
|
|
51
|
+
/** Prevents interaction. */
|
|
52
|
+
disabled: boolean;
|
|
53
|
+
/** Hides check/close icon inside toggle knob. */
|
|
54
|
+
noIcon: boolean;
|
|
55
|
+
/** Adjusts colors for dark backgrounds. */
|
|
56
|
+
inverted: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Toggle size: `sm` or `md` (default).
|
|
59
|
+
* @default "md"
|
|
60
|
+
*/
|
|
61
|
+
size: "sm" | "md";
|
|
62
|
+
private _internals;
|
|
63
|
+
/**
|
|
64
|
+
* Lifecycle methods
|
|
65
|
+
* --------------------------------------------------------------------------
|
|
66
|
+
*/
|
|
67
|
+
static formAssociated: boolean;
|
|
68
|
+
constructor();
|
|
69
|
+
connectedCallback(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Form Integration
|
|
72
|
+
* --------------------------------------------------------------------------
|
|
73
|
+
*/
|
|
74
|
+
updated(changedProperties: Map<string, any>): void;
|
|
75
|
+
formResetCallback(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Event Handlers
|
|
78
|
+
* --------------------------------------------------------------------------
|
|
79
|
+
*/
|
|
80
|
+
private _emitChangeEvent;
|
|
81
|
+
private _handleFocus;
|
|
82
|
+
private _handleBlur;
|
|
83
|
+
private _handleClick;
|
|
84
|
+
private _handleSliderClick;
|
|
85
|
+
private _handleKeyDown;
|
|
86
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
87
|
+
}
|
package/dist/nys-toggle.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ifDefined as g } from "lit/directives/if-defined.js";
|
|
|
6
6
|
* █ █ █ █▄▄▄█ ▀▀▀▄▄ █ █ ▀▀▀▄▄
|
|
7
7
|
* █ ▀█ █ █▄▄▄█ █▄▄▀ █▄▄▄█
|
|
8
8
|
*
|
|
9
|
-
* Toggle Component v1.19.
|
|
9
|
+
* Toggle Component v1.19.2
|
|
10
10
|
* Part of the New York State Design System
|
|
11
11
|
* Repository: https://github.com/its-hcd/nysds
|
|
12
12
|
* License: MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nysds/nys-toggle",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"description": "The Toggle component from the NYS Design System.",
|
|
5
5
|
"module": "dist/nys-toggle.js",
|
|
6
6
|
"exports": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lit-analyze": "lit-analyzer '**/*.ts'"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@nysds/nys-icon": "^1.19.
|
|
25
|
+
"@nysds/nys-icon": "^1.19.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"lit": "^3.3.1",
|
|
@@ -40,5 +40,6 @@
|
|
|
40
40
|
"forms"
|
|
41
41
|
],
|
|
42
42
|
"author": "New York State Design System Team",
|
|
43
|
-
"license": "MIT"
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"sideEffects": true
|
|
44
45
|
}
|