@c2n/rate 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.
@@ -0,0 +1 @@
1
+ {"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/rate.ts","declarations":[{"kind":"class","description":"Accessible star rating control with pointer preview, keyboard adjustment and optional half-star values.","name":"Rate","cssProperties":[{"type":{"text":"pixel"},"name":"--c2-rate__icon--size","default":"24px"},{"type":{"text":"pixel"},"name":"--c2-rate__container--gap","default":"4px"},{"type":{"text":"color"},"name":"--c2-rate__icon--color","default":"#e4e4e7"},{"type":{"text":"color"},"name":"--c2-rate__icon__filled--color","default":"#facc15"},{"type":{"text":"color"},"name":"--c2-rate__icon__preview--color","default":"#fbbf24"},{"type":{"text":"number"},"name":"--c2-rate__icon__hover--scale","default":"1.12"},{"type":{"text":"duration"},"name":"--c2-rate__icon--transition-duration","default":"150ms"},{"type":{"text":"outline"},"name":"--c2-rate__container__focus--outline","default":"2px solid rgba(2, 101, 220, 0.4)"},{"type":{"text":"pixel"},"name":"--c2-rate__container__focus--outline-offset","default":"3px"},{"type":{"text":"border-radius"},"name":"--c2-rate__container--border-radius","default":"4px"},{"type":{"text":"opacity"},"name":"--c2-rate__container__disabled--opacity","default":"0.38"}],"members":[{"kind":"field","name":"formAssociated","type":{"text":"boolean"},"static":true,"default":"true"},{"kind":"field","name":"shadowRootOptions","type":{"text":"object"},"static":true,"default":"{ ...LitElement.shadowRootOptions, delegatesFocus: true }"},{"kind":"field","name":"internals","privacy":"private","readonly":true},{"kind":"field","name":"defaultValue","type":{"text":"number"},"privacy":"private","default":"0"},{"kind":"field","name":"defaultValueCaptured","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"customValidityMessage","type":{"text":"string"},"privacy":"private","default":"''"},{"kind":"field","name":"previewValue","type":{"text":"number | null"},"privacy":"private","default":"null"},{"kind":"field","name":"disabledByForm","type":{"text":"boolean"},"privacy":"private","default":"false"},{"kind":"field","name":"value","type":{"text":"number"},"default":"0","description":"Current rating and submitted form value.","attribute":"value","reflects":true},{"kind":"field","name":"max","type":{"text":"number"},"default":"5","description":"Number of rating icons.","attribute":"max","reflects":true},{"kind":"field","name":"allowHalf","type":{"text":"boolean"},"default":"false","description":"Allow values in half-star steps.","attribute":"allow-half","reflects":true},{"kind":"field","name":"clearable","type":{"text":"boolean"},"default":"false","description":"Clicking the committed rating again clears it to zero.","attribute":"clearable","reflects":true},{"kind":"field","name":"readonly","type":{"text":"boolean"},"default":"false","description":"Prevents changes while keeping the rating visually available.","attribute":"readonly","reflects":true},{"kind":"field","name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables interaction and form submission.","attribute":"disabled","reflects":true},{"kind":"field","name":"required","type":{"text":"boolean"},"default":"false","description":"Requires a rating greater than zero for native form validation.","attribute":"required","reflects":true},{"kind":"field","name":"name","type":{"text":"string"},"default":"''","description":"Name used when the rating participates in a form.","attribute":"name"},{"kind":"field","name":"ariaLabel","type":{"text":"string | null"},"default":"null","description":"Accessible name of the rating control.","attribute":"aria-label"},{"kind":"field","name":"form","readonly":true},{"kind":"field","name":"labels","readonly":true},{"kind":"field","name":"validity","readonly":true},{"kind":"field","name":"validationMessage","readonly":true},{"kind":"field","name":"willValidate","readonly":true},{"kind":"method","name":"formResetCallback","return":{"type":{"text":"void"}}},{"kind":"method","name":"formDisabledCallback","return":{"type":{"text":"void"}},"parameters":[{"name":"disabled","type":{"text":"boolean"}}]},{"kind":"method","name":"formStateRestoreCallback","return":{"type":{"text":"void"}},"parameters":[{"name":"state","type":{"text":"string | File | FormData | null"}}]},{"kind":"method","name":"checkValidity","return":{"type":{"text":"boolean"}}},{"kind":"method","name":"reportValidity","return":{"type":{"text":"boolean"}}},{"kind":"method","name":"setCustomValidity","return":{"type":{"text":"void"}},"parameters":[{"name":"message","type":{"text":"string"}}]},{"kind":"field","name":"effectiveDisabled","type":{"text":"boolean"},"privacy":"private","readonly":true},{"kind":"field","name":"step","type":{"text":"number"},"privacy":"private","readonly":true},{"kind":"method","name":"normalizeValue","privacy":"private","return":{"type":{"text":"number"}},"parameters":[{"name":"value","type":{"text":"number"}}]},{"kind":"method","name":"valueFromPointer","privacy":"private","return":{"type":{"text":"number"}},"parameters":[{"name":"event","type":{"text":"PointerEvent"}},{"name":"index","type":{"text":"number"}}]},{"kind":"method","name":"handlePointerMove","privacy":"private","return":{"type":{"text":"void"}},"parameters":[{"name":"event","type":{"text":"PointerEvent"}},{"name":"index","type":{"text":"number"}}]},{"kind":"method","name":"handleClick","privacy":"private","return":{"type":{"text":"void"}},"parameters":[{"name":"event","type":{"text":"PointerEvent"}},{"name":"index","type":{"text":"number"}}]},{"kind":"method","name":"handleKeydown","privacy":"private","return":{"type":{"text":"void"}},"parameters":[{"name":"event","type":{"text":"KeyboardEvent"}}]},{"kind":"method","name":"commit","privacy":"private","return":{"type":{"text":"void"}},"parameters":[{"name":"value","type":{"text":"number"}}]},{"kind":"method","name":"syncFormState","privacy":"private","return":{"type":{"text":"void"}}},{"kind":"method","name":"fillFor","privacy":"private","return":{"type":{"text":"number"}},"parameters":[{"name":"index","type":{"text":"number"}}]},{"kind":"method","name":"renderStar","privacy":"private","parameters":[{"name":"className","type":{"text":"string"}}]}],"events":[{"name":"rate-change","type":{"text":"CustomEvent<RateChangeEventDetail>"},"description":"Fired after the user commits a rating. `detail.value` is the new value."},{"name":"input","type":{"text":"Event"},"description":"Fired with `rate-change` for form and framework bindings."},{"name":"change","type":{"text":"Event"},"description":"Fired with `rate-change` after the value is committed."}],"attributes":[{"name":"value","type":{"text":"number"},"default":"0","description":"Current rating and submitted form value.","fieldName":"value"},{"name":"max","type":{"text":"number"},"default":"5","description":"Number of rating icons.","fieldName":"max"},{"name":"allow-half","type":{"text":"boolean"},"default":"false","description":"Allow values in half-star steps.","fieldName":"allowHalf"},{"name":"clearable","type":{"text":"boolean"},"default":"false","description":"Clicking the committed rating again clears it to zero.","fieldName":"clearable"},{"name":"readonly","type":{"text":"boolean"},"default":"false","description":"Prevents changes while keeping the rating visually available.","fieldName":"readonly"},{"name":"disabled","type":{"text":"boolean"},"default":"false","description":"Disables interaction and form submission.","fieldName":"disabled"},{"name":"required","type":{"text":"boolean"},"default":"false","description":"Requires a rating greater than zero for native form validation.","fieldName":"required"},{"name":"name","type":{"text":"string"},"default":"''","description":"Name used when the rating participates in a form.","fieldName":"name"},{"name":"aria-label","type":{"text":"string | null"},"default":"null","description":"Accessible name of the rating control.","fieldName":"ariaLabel"}],"superclass":{"name":"LitElement","package":"lit"},"tagName":"c2-rate","customElement":true}],"exports":[{"kind":"js","name":"Rate","declaration":{"name":"Rate","module":"src/rate.ts"}},{"kind":"custom-element-definition","name":"c2-rate","declaration":{"name":"Rate","module":"src/rate.ts"}}]}]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c2n/rate",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "main": "dist/rate.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.11",
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": "bf962fba5e49a0ac7555a082584e262949d323a5"
73
+ "gitHead": "aa19b641f64fbc54c36b7649a8171d7a686abbdd"
73
74
  }
package/react.d.ts CHANGED
@@ -6,17 +6,26 @@
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 { Rate } from '@c2n/rate'
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 {
18
24
  interface IntrinsicElements {
19
- 'c2-rate': C2Props<Rate>
25
+ 'c2-rate': C2Props<Rate> & {
26
+ 'allow-half'?: Attribute
27
+ 'aria-label'?: Attribute
28
+ }
20
29
  }
21
30
  }
22
31
  }