@c2n/switch 0.0.12 → 0.0.13
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/custom-elements.json +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/switch.ts","declarations":[{"kind":"class","description":"On/off toggle built on a native `<input type=\"checkbox\" role=\"switch\">`, so keyboard activation (Space), form value\nand the `switch` role come from the browser. The thumb can also be dragged: it follows the pointer and the side it is\nreleased on decides the state. The whole row is the label: text in the default slot and an optional `description`\nsit beside the track, and clicking them toggles it. Icons for either state can ride inside the thumb.","name":"Switch","cssProperties":[{"type":{"text":"pixel"},"description":"Space between the track and the text.","name":"--c2-switch__container--gap","default":"8px"},{"type":{"text":"flex-direction-row"},"description":"`row-reverse` puts the text before the track.","name":"--c2-switch__container--flex-direction","default":"row"},{"type":{"text":"justify-content"},"description":"`space-between` with a fixed width pushes the track to the far edge.","name":"--c2-switch__container--justify-content","default":"flex-start"},{"type":{"text":"opacity"},"name":"--c2-switch__container__disabled--opacity","default":"0.38"},{"type":{"text":"pixel"},"name":"--c2-switch__track--width","default":"36px"},{"type":{"text":"pixel"},"name":"--c2-switch__track--height","default":"20px"},{"type":{"text":"border-radius"},"name":"--c2-switch__track--border-radius","default":"999px"},{"type":{"text":"border"},"description":"Set a colour for an outlined switch.","name":"--c2-switch__track--border","default":"1px solid transparent"},{"type":{"text":"color"},"description":"Track fill while off.","name":"--c2-switch__track--color","default":"#e4e4e7"},{"type":{"text":"color"},"name":"--c2-switch__track__hover--color","default":"#d4d4d8"},{"type":{"text":"color"},"description":"Track fill while on.","name":"--c2-switch__track__checked--color","default":"#0265dc"},{"type":{"text":"color"},"name":"--c2-switch__track__checked__hover--color","default":"#0154b8"},{"type":{"text":"border"},"name":"--c2-switch__track__checked--border"},{"type":{"text":"outline"},"name":"--c2-switch__track__focus--outline","default":"2px solid rgba(2, 101, 220, 0.4)"},{"type":{"text":"pixel"},"name":"--c2-switch__track__focus--outline-offset","default":"2px"},{"type":{"text":"pixel"},"name":"--c2-switch__thumb--size","default":"16px"},{"type":{"text":"pixel"},"description":"Gap between the thumb and the track edge.","name":"--c2-switch__thumb--offset","default":"2px"},{"type":{"text":"border-radius"},"name":"--c2-switch__thumb--border-radius","default":"999px"},{"type":{"text":"color"},"name":"--c2-switch__thumb--color","default":"#ffffff"},{"type":{"text":"color"},"description":"Thumb fill while on; falls back to the off colour.","name":"--c2-switch__thumb__checked--color"},{"type":{"text":"box-shadow"},"name":"--c2-switch__thumb--box-shadow","default":"0 1px 2px rgba(0, 0, 0, 0.2)"},{"type":{"text":"pixel"},"description":"Extra thumb width while pressed, for a squishy feel; `0px` disables it.","name":"--c2-switch__thumb__active--stretch","default":"4px"},{"type":{"text":"pixel"},"name":"--c2-switch__icon--size","default":"10px"},{"type":{"text":"color"},"description":"Colour of the `unchecked-icon`.","name":"--c2-switch__icon--color","default":"#71717a"},{"type":{"text":"color"},"description":"Colour of the `checked-icon`.","name":"--c2-switch__icon__checked--color","default":"#0265dc"},{"type":{"text":"color"},"name":"--c2-switch__label--color","default":"inherit"},{"type":{"text":"font-size"},"name":"--c2-switch__label--font-size","default":"inherit"},{"type":{"text":"font-weight"},"name":"--c2-switch__label--font-weight","default":"inherit"},{"type":{"text":"line-height"},"name":"--c2-switch__label--line-height","default":"inherit"},{"type":{"text":"color"},"name":"--c2-switch__description--color","default":"#71717a"},{"type":{"text":"font-size"},"name":"--c2-switch__description--font-size","default":"12px"},{"type":{"text":"pixel"},"name":"--c2-switch__description--margin-top","default":"2px"},{"type":{"text":"time"},"description":"Thumb slide and colour change.","name":"--c2-switch--transition-duration","default":"200ms"}],"cssParts":[{"name":"control","description":"Shadow DOM styling hook for the control element."},{"name":"track","description":"Shadow DOM styling hook for the track element."},{"name":"thumb","description":"Shadow DOM styling hook for the thumb element."},{"name":"unchecked-icon","description":"Shadow DOM styling hook for the unchecked icon element."},{"name":"checked-icon","description":"Shadow DOM styling hook for the checked icon element."},{"name":"label","description":"Shadow DOM styling hook for the label element."},{"name":"description","description":"Shadow DOM styling hook for the description element."}],"slots":[{"description":"Label text. Falls back to the `label` attribute.","name":""},{"description":"Supporting text shown under the label.","name":"description"},{"description":"Small icon shown inside the thumb while on (an inline SVG, a `c2-feather-*` icon or a `c2-mat-icon`).","name":"checked-icon"},{"description":"Small icon shown inside the thumb while off.","name":"unchecked-icon"}],"members":[{"kind":"field","name":"formAssociated","type":{"text":"boolean"},"static":true,"default":"true"},{"kind":"field","name":"internals","privacy":"private","readonly":true},{"kind":"field","name":"customValidityMessage","type":{"text":"string"},"privacy":"private","default":"''"},{"kind":"field","name":"disabledByForm","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"defaultChecked","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"defaultCheckedCaptured","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"formElement","type":{"text":"HTMLInputElement"},"privacy":"protected"},{"kind":"field","name":"trackElement","type":{"text":"HTMLElement"},"privacy":"private"},{"kind":"field","name":"thumbElement","type":{"text":"HTMLElement"},"privacy":"private"},{"kind":"field","name":"checked","type":{"text":"boolean"},"default":"false","description":"Whether the switch is on.","attribute":"checked","reflects":true},{"kind":"field","name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables the control: it no longer toggles and is rendered dimmed.","attribute":"disabled","reflects":true},{"kind":"field","name":"name","type":{"text":"string"},"default":"''","description":"Form field name forwarded to the inner input.","attribute":"name"},{"kind":"field","name":"value","type":{"text":"string"},"default":"'on'","description":"Form value submitted while on. Defaults to `on`, like a native checkbox.","attribute":"value"},{"kind":"field","name":"required","type":{"text":"boolean"},"default":"false","description":"Requires the switch to be on for the form to be valid.","attribute":"required","reflects":true},{"kind":"field","name":"label","type":{"text":"string"},"default":"''","description":"Label text when the default slot is empty.","attribute":"label"},{"kind":"field","name":"ariaLabel","type":{"text":"string"},"description":"Accessible name used when no visible label names the switch.","attribute":"aria-label"},{"kind":"field","name":"ariaLabelledBy","type":{"text":"undefined | string"},"description":"Id of the element that labels the switch.","attribute":"aria-labelledby"},{"kind":"field","name":"ariaDescribedBy","type":{"text":"undefined | string"},"description":"Id of the element that describes the switch.","attribute":"aria-describedby"},{"kind":"field","name":"hasDescription","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"dragging","type":{"text":"boolean"},"privacy":"private","default":"false","description":"True while the thumb follows the pointer; disables the slide transition."},{"kind":"field","name":"drag","type":{"text":"{ pointerId: number; startX: number; startPosition: number; travel: number; position: number; moved: boolean } | undefined"},"privacy":"private"},{"kind":"field","name":"suppressClick","type":{"text":"boolean"},"privacy":"private","default":"false","description":"The click that follows a drag must not toggle the input again."},{"kind":"field","name":"form","description":"The containing form, when this control is associated with one.","readonly":true},{"kind":"field","name":"labels","description":"Labels associated with this form control.","readonly":true},{"kind":"field","name":"validity","readonly":true},{"kind":"field","name":"validationMessage","readonly":true},{"kind":"field","name":"willValidate","readonly":true},{"kind":"method","name":"formResetCallback"},{"kind":"method","name":"formDisabledCallback","parameters":[{"name":"disabled","type":{"text":"boolean"}}]},{"kind":"method","name":"formStateRestoreCallback","parameters":[{"name":"state","type":{"text":"string | File | FormData | null"}}]},{"kind":"method","name":"checkValidity"},{"kind":"method","name":"reportValidity"},{"kind":"method","name":"setCustomValidity","parameters":[{"name":"message","type":{"text":"string"}}]},{"kind":"method","name":"focus","parameters":[{"name":"options","optional":true,"type":{"text":"FocusOptions"}}]},{"kind":"method","name":"toggle","parameters":[{"name":"force","optional":true,"type":{"text":"boolean"}}],"description":"Flips the state (or forces it) and fires `change`, as a click would."},{"kind":"field","name":"effectiveDisabled","privacy":"private","readonly":true},{"kind":"method","name":"handleDescriptionChange","privacy":"private","parameters":[{"name":"event","type":{"text":"Event"}}]},{"kind":"method","name":"updateDescription","privacy":"private","parameters":[{"name":"slot","type":{"text":"HTMLSlotElement"}}]},{"kind":"method","name":"handleChange","privacy":"private","parameters":[{"name":"event","type":{"text":"Event"}}]},{"kind":"field","name":"rtl","type":{"text":"boolean"},"privacy":"private","readonly":true},{"kind":"method","name":"handlePointerDown","privacy":"private","parameters":[{"name":"event","type":{"text":"PointerEvent"}}]},{"kind":"method","name":"handlePointerMove","privacy":"private","parameters":[{"name":"event","type":{"text":"PointerEvent"}}]},{"kind":"method","name":"handlePointerUp","privacy":"private","parameters":[{"name":"event","type":{"text":"PointerEvent"}}]},{"kind":"method","name":"handlePointerCancel","privacy":"private","parameters":[{"name":"event","type":{"text":"PointerEvent"}}]},{"kind":"method","name":"endDrag","privacy":"private"},{"kind":"method","name":"handleClick","privacy":"private","parameters":[{"name":"event","type":{"text":"Event"}}]}],"events":[{"name":"change","type":{"text":"Event"},"description":"Re-dispatched from the inner input when the state changes."}],"attributes":[{"name":"checked","type":{"text":"boolean"},"default":"false","description":"Whether the switch is on.","fieldName":"checked"},{"name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables the control: it no longer toggles and is rendered dimmed.","fieldName":"disabled"},{"name":"name","type":{"text":"string"},"default":"''","description":"Form field name forwarded to the inner input.","fieldName":"name"},{"name":"value","type":{"text":"string"},"default":"'on'","description":"Form value submitted while on. Defaults to `on`, like a native checkbox.","fieldName":"value"},{"name":"required","type":{"text":"boolean"},"default":"false","description":"Requires the switch to be on for the form to be valid.","fieldName":"required"},{"name":"label","type":{"text":"string"},"default":"''","description":"Label text when the default slot is empty.","fieldName":"label"},{"name":"aria-label","type":{"text":"string"},"description":"Accessible name used when no visible label names the switch.","fieldName":"ariaLabel"},{"name":"aria-labelledby","type":{"text":"undefined | string"},"description":"Id of the element that labels the switch.","fieldName":"ariaLabelledBy"},{"name":"aria-describedby","type":{"text":"undefined | string"},"description":"Id of the element that describes the switch.","fieldName":"ariaDescribedBy"}],"superclass":{"name":"LitElement","package":"lit"},"tagName":"c2-switch","customElement":true}],"exports":[{"kind":"js","name":"Switch","declaration":{"name":"Switch","module":"src/switch.ts"}},{"kind":"custom-element-definition","name":"c2-switch","declaration":{"name":"Switch","module":"src/switch.ts"}}]}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/switch",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/switch.js",
|
|
6
6
|
"exports": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
23
|
"types",
|
|
24
|
+
"custom-elements.json",
|
|
24
25
|
"react.d.ts",
|
|
25
26
|
"react.js",
|
|
26
27
|
"vue.d.ts",
|
|
@@ -62,12 +63,12 @@
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@c2n/core": "0.0.
|
|
66
|
+
"@c2n/core": "0.0.13",
|
|
66
67
|
"lit": "3.3.3"
|
|
67
68
|
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@c2n/config": "*"
|
|
70
71
|
},
|
|
71
72
|
"customElements": "custom-elements.json",
|
|
72
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "aa19b641f64fbc54c36b7649a8171d7a686abbdd"
|
|
73
74
|
}
|