@molecule/app-color-picker-react 4.0.0 → 4.0.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../src/ColorPicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA8KtC"}
1
+ {"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../src/ColorPicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,SAAS,EACT,SAAS,GACV,EAAE,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA4KtC"}
@@ -81,9 +81,16 @@ export function ColorPicker({ value, onChange, dataMolId, className, }) {
81
81
  cursor: 'pointer',
82
82
  };
83
83
  const wrapperClass = cm.cn(cm.flex({ direction: 'col', gap: 'sm' }), className);
84
+ // Literal keys per channel — every key a `t` call can produce must be a
85
+ // literal the i18n gate can see, so the three channels are spelled out.
86
+ const channelLabels = {
87
+ r: t('colorPicker.r', {}, { defaultValue: 'Red' }),
88
+ g: t('colorPicker.g', {}, { defaultValue: 'Green' }),
89
+ b: t('colorPicker.b', {}, { defaultValue: 'Blue' }),
90
+ };
84
91
  return (_jsxs("div", { className: wrapperClass, "data-mol-id": dataMolId ?? 'color-picker', role: "group", "aria-label": t('colorPicker.group', {}, { defaultValue: 'Color picker' }), children: [_jsxs("div", { className: cm.flex({ align: 'center', gap: 'sm' }), children: [_jsx("span", { "aria-hidden": true, style: swatchStyle, "data-mol-id": "color-picker-swatch" }), _jsx("input", { type: "text", value: hexShown, onChange: (e) => setHexDraft(e.target.value), onBlur: (e) => commitHex(e.target.value), onKeyDown: (e) => {
85
92
  if (e.key === 'Enter') {
86
93
  commitHex(e.target.value);
87
94
  }
88
- }, "aria-label": t('colorPicker.hex', {}, { defaultValue: 'HEX color' }), "data-mol-id": "color-picker-hex", spellCheck: false, maxLength: 7, style: { fontFamily: 'monospace', padding: '0.3rem 0.5rem' } })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.hue', {}, { defaultValue: 'Hue' }) }), _jsx("input", { type: "range", min: 0, max: 360, step: 1, value: Math.round(hsv.h), onChange: (e) => emitFromHsv({ h: Number(e.target.value) }), "aria-label": t('colorPicker.hue', {}, { defaultValue: 'Hue' }), "data-mol-id": "color-picker-hue", style: { ...sliderBase, background: hueGradient } })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }) }), _jsx("input", { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.s * 100), onChange: (e) => emitFromHsv({ s: Number(e.target.value) / 100 }), "aria-label": t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }), "data-mol-id": "color-picker-saturation", style: sliderBase })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.value', {}, { defaultValue: 'Value' }) }), _jsx("input", { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.v * 100), onChange: (e) => emitFromHsv({ v: Number(e.target.value) / 100 }), "aria-label": t('colorPicker.value', {}, { defaultValue: 'Value' }), "data-mol-id": "color-picker-value", style: sliderBase })] }), _jsx("div", { className: cm.flex({ gap: 'sm' }), children: ['r', 'g', 'b'].map((channel) => (_jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), style: { flex: 1 }, children: [_jsx("span", { children: t(`colorPicker.${channel}`, {}, { defaultValue: channel === 'r' ? 'Red' : channel === 'g' ? 'Green' : 'Blue' }) }), _jsx("input", { type: "number", min: 0, max: 255, step: 1, value: rgb[channel], onChange: (e) => emitFromRgb({ [channel]: Number(e.target.value) }), "aria-label": t(`colorPicker.${channel}`, {}, { defaultValue: channel === 'r' ? 'Red' : channel === 'g' ? 'Green' : 'Blue' }), "data-mol-id": `color-picker-${channel}`, style: { padding: '0.3rem 0.5rem' } })] }, channel))) })] }));
95
+ }, "aria-label": t('colorPicker.hex', {}, { defaultValue: 'HEX color' }), "data-mol-id": "color-picker-hex", spellCheck: false, maxLength: 7, style: { fontFamily: 'monospace', padding: '0.3rem 0.5rem' } })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.hue', {}, { defaultValue: 'Hue' }) }), _jsx("input", { type: "range", min: 0, max: 360, step: 1, value: Math.round(hsv.h), onChange: (e) => emitFromHsv({ h: Number(e.target.value) }), "aria-label": t('colorPicker.hue', {}, { defaultValue: 'Hue' }), "data-mol-id": "color-picker-hue", style: { ...sliderBase, background: hueGradient } })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }) }), _jsx("input", { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.s * 100), onChange: (e) => emitFromHsv({ s: Number(e.target.value) / 100 }), "aria-label": t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }), "data-mol-id": "color-picker-saturation", style: sliderBase })] }), _jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx("span", { children: t('colorPicker.value', {}, { defaultValue: 'Value' }) }), _jsx("input", { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.v * 100), onChange: (e) => emitFromHsv({ v: Number(e.target.value) / 100 }), "aria-label": t('colorPicker.value', {}, { defaultValue: 'Value' }), "data-mol-id": "color-picker-value", style: sliderBase })] }), _jsx("div", { className: cm.flex({ gap: 'sm' }), children: ['r', 'g', 'b'].map((channel) => (_jsxs("label", { className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), style: { flex: 1 }, children: [_jsx("span", { children: channelLabels[channel] }), _jsx("input", { type: "number", min: 0, max: 255, step: 1, value: rgb[channel], onChange: (e) => emitFromRgb({ [channel]: Number(e.target.value) }), "aria-label": channelLabels[channel], "data-mol-id": `color-picker-${channel}`, style: { padding: '0.3rem 0.5rem' } })] }, channel))) })] }));
89
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-color-picker-react",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "HSV slider + RGB sliders + HEX input — controlled color picker for design canvases, photo editors, animation tools",
5
5
  "homepage": "https://www.molecule.dev/packages/app-color-picker-react",
6
6
  "type": "module",
@@ -42,10 +42,10 @@
42
42
  "react": "^18.0.0 || ^19.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@molecule/app-i18n": "1.1.2",
46
- "@molecule/app-react": "4.0.0",
47
- "@molecule/app-ui": "1.3.9",
48
- "@molecule/app-ui-tailwind": "1.2.9",
45
+ "@molecule/app-i18n": "1.2.2",
46
+ "@molecule/app-react": "4.7.1",
47
+ "@molecule/app-ui": "1.4.0",
48
+ "@molecule/app-ui-tailwind": "1.3.0",
49
49
  "@testing-library/dom": "10.4.2",
50
50
  "@testing-library/react": "16.3.3",
51
51
  "@types/node": "26.6.5",