@purpurds/toggle 7.6.1 → 7.7.0
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/LICENSE.txt +3 -3
- package/dist/toggle.cjs.js +5 -5
- package/dist/toggle.cjs.js.map +1 -1
- package/dist/toggle.d.ts +3 -57
- package/dist/toggle.d.ts.map +1 -1
- package/dist/toggle.es.js +340 -376
- package/dist/toggle.es.js.map +1 -1
- package/package.json +6 -5
- package/src/toggle.tsx +73 -81
package/dist/toggle.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps } from '@purpurds/common-types';
|
|
2
3
|
|
|
3
|
-
export type ToggleProps = Omit<
|
|
4
|
+
export type ToggleProps = Omit<BaseProps<"button">, "onChange" | "children" | "id"> & {
|
|
4
5
|
/**
|
|
5
6
|
* To use when no label is given.
|
|
6
7
|
* */
|
|
@@ -9,7 +10,6 @@ export type ToggleProps = Omit<React.HTMLAttributes<HTMLElement>, "onChange"> &
|
|
|
9
10
|
* To use with custom label (not recommended).
|
|
10
11
|
* */
|
|
11
12
|
["aria-labelledby"]?: string;
|
|
12
|
-
["data-testid"]?: string;
|
|
13
13
|
/**
|
|
14
14
|
* The controlled state of the toggle. Must be used in conjunction with `onChange`.
|
|
15
15
|
* */
|
|
@@ -55,59 +55,5 @@ export type ToggleProps = Omit<React.HTMLAttributes<HTMLElement>, "onChange"> &
|
|
|
55
55
|
* */
|
|
56
56
|
value?: string;
|
|
57
57
|
};
|
|
58
|
-
export declare const Toggle: React.ForwardRefExoticComponent<Omit<
|
|
59
|
-
/**
|
|
60
|
-
* To use when no label is given.
|
|
61
|
-
* */
|
|
62
|
-
"aria-label"?: string;
|
|
63
|
-
/**
|
|
64
|
-
* To use with custom label (not recommended).
|
|
65
|
-
* */
|
|
66
|
-
"aria-labelledby"?: string;
|
|
67
|
-
"data-testid"?: string;
|
|
68
|
-
/**
|
|
69
|
-
* The controlled state of the toggle. Must be used in conjunction with `onChange`.
|
|
70
|
-
* */
|
|
71
|
-
checked?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* The state of the toggle when it is initially rendered. Use when you do not need to control its state.
|
|
74
|
-
* */
|
|
75
|
-
defaultChecked?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* When `true`, prevents the user from interacting with the toggle.
|
|
78
|
-
* */
|
|
79
|
-
disabled?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* When `true`, the toggle isn't draggable.
|
|
82
|
-
* */
|
|
83
|
-
disableDrag?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* ID of the toggle.
|
|
86
|
-
* */
|
|
87
|
-
id: string;
|
|
88
|
-
/**
|
|
89
|
-
* The label of the toggle.
|
|
90
|
-
* */
|
|
91
|
-
label?: string;
|
|
92
|
-
/**
|
|
93
|
-
* Set to decide which side of the toggle the label should be rendered.
|
|
94
|
-
* */
|
|
95
|
-
labelPosition?: "left" | "right";
|
|
96
|
-
/**
|
|
97
|
-
* The name of the toggle. Submitted with its owning form as part of a name/value pair, when wrapped in a form.
|
|
98
|
-
* */
|
|
99
|
-
name?: string;
|
|
100
|
-
/**
|
|
101
|
-
* Event handler called when the toggle is toggled.
|
|
102
|
-
* */
|
|
103
|
-
onChange?: (checked: boolean) => void;
|
|
104
|
-
/**
|
|
105
|
-
* When `true`, indicates that the user must check the toggle before the owning form can be submitted..
|
|
106
|
-
* */
|
|
107
|
-
required?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* The value given as data when wrapped with a form and submitted with a name.
|
|
110
|
-
* */
|
|
111
|
-
value?: string;
|
|
112
|
-
} & React.RefAttributes<HTMLButtonElement>>;
|
|
58
|
+
export declare const Toggle: React.ForwardRefExoticComponent<Omit<ToggleProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
113
59
|
//# sourceMappingURL=toggle.d.ts.map
|
package/dist/toggle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../src/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../src/toggle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYxD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI,CAAC,GAAG;IACpF;;SAEK;IACL,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC;IACxB;;SAEK;IACL,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC;IAC7B;;SAEK;IACL,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;SAEK;IACL,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;SAEK;IACL,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;SAEK;IACL,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;SAEK;IACL,EAAE,EAAE,MAAM,CAAC;IACX;;SAEK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;SAEK;IACL,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC;;SAEK;IACL,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;SAEK;IACL,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;;SAEK;IACL,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;SAEK;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAKF,eAAO,MAAM,MAAM,oGAuElB,CAAC"}
|