@molecule/app-rating-form-react 1.0.1 → 1.0.3
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/RatingForm.d.ts.map +1 -1
- package/dist/RatingForm.js +11 -3
- package/package.json +6 -5
package/dist/RatingForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RatingForm.d.ts","sourceRoot":"","sources":["../src/RatingForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtD,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,GAAO,EACP,aAAiB,EACjB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,SAAS,GACV,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"RatingForm.d.ts","sourceRoot":"","sources":["../src/RatingForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtD,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,2DAA2D;IAC3D,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACnE,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,wDAAwD;IACxD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,oBAAoB;IACpB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,2BAA2B;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,GAAO,EACP,aAAiB,EACjB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,SAAS,GACV,EAAE,eAAe,GAAG,GAAG,CAAC,OAAO,CAkF/B"}
|
package/dist/RatingForm.js
CHANGED
|
@@ -34,12 +34,20 @@ export function RatingForm({ onSubmit, max = 5, defaultRating = 0, requireCommen
|
|
|
34
34
|
setSubmitting(false);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
return (_jsxs("form", { onSubmit: handle, className: cm.cn(cm.stack(3), className), children: [title && _jsx("h3", { className: cm.cn(cm.textSize('base'), cm.fontWeight('semibold')), children: title }), _jsx("div", { role: "radiogroup", "aria-label": t('rating.label', {}, { defaultValue: 'Rating' }), className: cm.flex({ align: 'center', gap: 'xs' }), onMouseLeave: () => setHover(0), children: Array.from({ length: max }, (_, i) => i + 1).map((n) => (_jsx("button", { type: "button", role: "radio", "aria-checked": rating === n, "aria-label":
|
|
37
|
+
return (_jsxs("form", { onSubmit: handle, className: cm.cn(cm.stack(3), className), children: [title && _jsx("h3", { className: cm.cn(cm.textSize('base'), cm.fontWeight('semibold')), children: title }), _jsx("div", { role: "radiogroup", "aria-label": t('rating.label', {}, { defaultValue: 'Rating' }), className: cm.flex({ align: 'center', gap: 'xs' }), onMouseLeave: () => setHover(0), children: Array.from({ length: max }, (_, i) => i + 1).map((n) => (_jsx("button", { type: "button", role: "radio", "data-mol-id": "rating-form-star", "aria-checked": rating === n, "aria-label": t('rating.star', { n, max }, { defaultValue: '{{n}} of {{max}}' }), onClick: () => setRating(n), onMouseEnter: () => setHover(n),
|
|
38
|
+
/* mol-bespoke-button: icon-only 28px star glyph, no label and no
|
|
39
|
+
button surface — the star IS the control, so the inline
|
|
40
|
+
background/border are native resets. Fill colour is a theme
|
|
41
|
+
token now (`#facc15` / `rgba(0,0,0,0.2)` ignored the theme and
|
|
42
|
+
the empty star vanished on a dark surface); 44px touch floor
|
|
43
|
+
from the ClassMap. */
|
|
44
|
+
className: cm.cn(cm.cursorPointer, cm.touchTarget), style: {
|
|
38
45
|
background: 'none',
|
|
39
46
|
border: 'none',
|
|
40
|
-
cursor: 'pointer',
|
|
41
47
|
fontSize: 28,
|
|
42
|
-
color: n <= display
|
|
48
|
+
color: n <= display
|
|
49
|
+
? 'var(--mol-color-warning, #facc15)'
|
|
50
|
+
: 'var(--mol-color-border, rgba(128,128,128,0.4))',
|
|
43
51
|
}, children: "\u2605" }, n))) }), _jsx(Textarea, { value: comment, onChange: (e) => setComment(e.target.value), placeholder: commentPlaceholder ??
|
|
44
52
|
t('rating.commentPlaceholder', {}, { defaultValue: 'Share your thoughts (optional)' }), rows: 4, "aria-label": "Comment" }), _jsx(Button, { type: "submit", variant: "solid", color: "primary", disabled: submitting || !rating, children: submitting
|
|
45
53
|
? t('rating.submitting', {}, { defaultValue: 'Submitting…' })
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-rating-form-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Interactive star rating + textarea + submit form for collecting reviews",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-rating-form-react",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
@@ -38,15 +39,15 @@
|
|
|
38
39
|
"react": "^18.0.0 || ^19.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@molecule/app-react": "1.0
|
|
42
|
-
"@molecule/app-ui": "1.
|
|
43
|
-
"@molecule/app-ui-react": "1.0.
|
|
42
|
+
"@molecule/app-react": "1.6.0",
|
|
43
|
+
"@molecule/app-ui": "1.1.1",
|
|
44
|
+
"@molecule/app-ui-react": "1.0.2",
|
|
44
45
|
"@types/node": "26.1.2",
|
|
45
46
|
"@types/react": "19.2.17",
|
|
46
47
|
"@types/react-dom": "19.2.3",
|
|
47
48
|
"react": "19.2.8",
|
|
48
49
|
"react-dom": "19.2.8",
|
|
49
50
|
"typescript": "6.0.3",
|
|
50
|
-
"vitest": "4.1.
|
|
51
|
+
"vitest": "4.1.11"
|
|
51
52
|
}
|
|
52
53
|
}
|