@c2n/label 0.0.11 → 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
- package/react.d.ts +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/label.ts","declarations":[{"kind":"class","description":"Caption for a form control. Clicking it activates the element referenced by `for`: native checkboxes and radios\n(also the ones inside a component's shadow root, such as `c2-checkbox`) are toggled, anything else is focused.\nIt also names that element for assistive technology by setting `aria-labelledby` when the target has none.\nTypography inherits from the surrounding text until a `--c2-label__container--*` variable is set.","name":"Label","cssProperties":[{"type":{"text":"pixel"},"name":"--c2-label__container--gap","default":"4px"},{"type":{"text":"color"},"name":"--c2-label__container--color","default":"inherit"},{"type":{"text":"font-family"},"name":"--c2-label__container--font-family","default":"inherit"},{"type":{"text":"pixel"},"name":"--c2-label__container--font-size","default":"inherit"},{"type":{"text":"font-weight"},"name":"--c2-label__container--font-weight","default":"inherit"},{"type":{"text":"line-height"},"name":"--c2-label__container--line-height","default":"inherit"},{"type":{"text":"pixel"},"name":"--c2-label__container--letter-spacing","default":"inherit"},{"type":{"text":"text-transform"},"name":"--c2-label__container--text-transform","default":"inherit"},{"type":{"text":"color"},"name":"--c2-label__container__hover--color"},{"type":{"text":"opacity"},"name":"--c2-label__container__disabled--opacity","default":"0.38"},{"type":{"text":"color"},"name":"--c2-label__required-indicator--color","default":"rgb(211, 21, 16)"},{"type":{"text":"pixel"},"name":"--c2-label__required-indicator--font-size","default":"inherit"},{"type":{"text":"font-weight"},"name":"--c2-label__required-indicator--font-weight","default":"inherit"}],"cssParts":[{"name":"label","description":"Shadow DOM styling hook for the label element."},{"name":"required-indicator","description":"Shadow DOM styling hook for the required indicator element."}],"slots":[{"description":"Label text.","name":"default"},{"description":"Marker shown after the text when `required` is set. Defaults to an asterisk.","name":"required-indicator"}],"members":[{"kind":"field","name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables the label: clicks no longer reach the control and the text is dimmed.","attribute":"disabled","reflects":true},{"kind":"field","name":"required","type":{"text":"boolean"},"default":"false","description":"Shows the required indicator after the text.","attribute":"required","reflects":true},{"kind":"field","name":"for","type":{"text":"string"},"default":"''","description":"`id` of the control this label describes. It is looked up in the label's own root, then among its siblings.","attribute":"for","reflects":true},{"kind":"field","name":"linkedTarget","type":{"text":"HTMLElement | null"},"privacy":"private","default":"null"},{"kind":"method","name":"resolveTarget","privacy":"private","return":{"type":{"text":"HTMLElement | null"}}},{"kind":"method","name":"linkTarget","privacy":"private","return":{"type":{"text":"void"}},"description":"Points the target's `aria-labelledby` at this label (unless it already has one) so the label names the control."},{"kind":"method","name":"unlinkTarget","privacy":"private","return":{"type":{"text":"void"}}},{"kind":"field","name":"handleClick","privacy":"private"}],"attributes":[{"name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables the label: clicks no longer reach the control and the text is dimmed.","fieldName":"disabled"},{"name":"required","type":{"text":"boolean"},"default":"false","description":"Shows the required indicator after the text.","fieldName":"required"},{"name":"for","type":{"text":"string"},"default":"''","description":"`id` of the control this label describes. It is looked up in the label's own root, then among its siblings.","fieldName":"for"}],"superclass":{"name":"LitElement","package":"lit"},"tagName":"c2-label","customElement":true}],"exports":[{"kind":"js","name":"Label","declaration":{"name":"Label","module":"src/label.ts"}},{"kind":"custom-element-definition","name":"c2-label","declaration":{"name":"Label","module":"src/label.ts"}}]}]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/label",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/label.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",
|
|
@@ -60,12 +61,12 @@
|
|
|
60
61
|
}
|
|
61
62
|
},
|
|
62
63
|
"dependencies": {
|
|
63
|
-
"@c2n/core": "0.0.
|
|
64
|
+
"@c2n/core": "0.0.13",
|
|
64
65
|
"lit": "3.3.3"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
68
|
"@c2n/config": "*"
|
|
68
69
|
},
|
|
69
70
|
"customElements": "custom-elements.json",
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "aa19b641f64fbc54c36b7649a8171d7a686abbdd"
|
|
71
72
|
}
|
package/react.d.ts
CHANGED
|
@@ -6,12 +6,18 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Register the elements at module scope before React renders, or React writes an object prop as an
|
|
8
8
|
// attribute and it stringifies.
|
|
9
|
+
//
|
|
10
|
+
// On a server-rendered page (Next.js, React Router SSR) write a camelCase property by its kebab-case attribute
|
|
11
|
+
// name ('row-key', not rowKey): the server emits props verbatim, HTML lowercases them, and hydration does not
|
|
12
|
+
// set properties. Those names are listed next to the properties below.
|
|
9
13
|
|
|
10
14
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
11
15
|
import type { Label } from '@c2n/label'
|
|
12
16
|
|
|
13
17
|
/** Standard React host-element attributes plus the element's own public properties. */
|
|
14
18
|
type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
|
|
19
|
+
/** What React writes to a custom element's attribute: true becomes the empty string, false removes it. */
|
|
20
|
+
type Attribute = string | number | boolean
|
|
15
21
|
|
|
16
22
|
declare module 'react' {
|
|
17
23
|
namespace JSX {
|