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

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/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-12T04:40:04.873Z
6
+ Generated: 2026-11-25T09:54:54.493Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-color-picker-react
@@ -33,7 +33,7 @@ function StrokeColorField() {
33
33
  ## Installation
34
34
 
35
35
  ```bash
36
- npm install @molecule/app-color-picker-react @molecule/app-i18n @molecule/app-react @molecule/app-ui react
36
+ npm install @molecule/app-color-picker-react @molecule/app-i18n @molecule/app-react @molecule/app-ui @molecule/app-ui-react react
37
37
  npm install -D @types/react
38
38
  ```
39
39
 
@@ -195,7 +195,8 @@ Peer dependencies:
195
195
 
196
196
  - `@molecule/app-i18n` ^1.0.1
197
197
  - `@molecule/app-react` ^4.0.0
198
- - `@molecule/app-ui` ^1.0.1
198
+ - `@molecule/app-ui` ^1.9.0
199
+ - `@molecule/app-ui-react` ^4.7.0
199
200
  - `react` ^18.0.0 || ^19.0.0
200
201
 
201
202
  ### Runtime Dependencies
@@ -203,6 +204,7 @@ Peer dependencies:
203
204
  - `@molecule/app-i18n`
204
205
  - `@molecule/app-react`
205
206
  - `@molecule/app-ui`
207
+ - `@molecule/app-ui-react`
206
208
  - `react`
207
209
 
208
210
  ## Translations
@@ -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,CA4KtC"}
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,CAyLtC"}
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { useTranslation } from '@molecule/app-react';
4
4
  import { getClassMap } from '@molecule/app-ui';
5
+ import { Box, RangeField, Text, TextField } from '@molecule/app-ui-react/elements';
5
6
  import { hexToRgb, hsvToRgb, isValidHex, rgbToHex, rgbToHsv } from './conversions.js';
6
7
  /**
7
8
  * Controlled color picker — HSV (hue + saturation + value) sliders, RGB
@@ -88,9 +89,9 @@ export function ColorPicker({ value, onChange, dataMolId, className, }) {
88
89
  g: t('colorPicker.g', {}, { defaultValue: 'Green' }),
89
90
  b: t('colorPicker.b', {}, { defaultValue: 'Blue' }),
90
91
  };
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) => {
92
+ return (_jsxs(Box, { as: "div", className: wrapperClass, "data-mol-id": dataMolId ?? 'color-picker', role: "group", "aria-label": t('colorPicker.group', {}, { defaultValue: 'Color picker' }), children: [_jsxs(Box, { as: "div", className: cm.flex({ align: 'center', gap: 'sm' }), children: [_jsx(Box, { as: "span", "aria-hidden": true, webStyle: swatchStyle, "data-mol-id": "color-picker-swatch" }), _jsx(TextField, { as: "input", type: "text", value: hexShown, onValueChange: setHexDraft, onBlur: () => commitHex(hexShown), onKeyDown: (e) => {
92
93
  if (e.key === 'Enter') {
93
- commitHex(e.target.value);
94
+ commitHex(hexShown);
94
95
  }
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))) })] }));
96
+ }, "aria-label": t('colorPicker.hex', {}, { defaultValue: 'HEX color' }), "data-mol-id": "color-picker-hex", spellCheck: false, maxLength: 7, webStyle: { fontFamily: 'monospace', padding: '0.3rem 0.5rem' } })] }), _jsxs(Box, { as: "label", className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx(Text, { as: "span", children: t('colorPicker.hue', {}, { defaultValue: 'Hue' }) }), _jsx(RangeField, { type: "range", min: 0, max: 360, step: 1, value: Math.round(hsv.h), onValueChange: (h) => emitFromHsv({ h }), "aria-label": t('colorPicker.hue', {}, { defaultValue: 'Hue' }), "data-mol-id": "color-picker-hue", webStyle: { ...sliderBase, background: hueGradient } })] }), _jsxs(Box, { as: "label", className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx(Text, { as: "span", children: t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }) }), _jsx(RangeField, { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.s * 100), onValueChange: (s) => emitFromHsv({ s: s / 100 }), "aria-label": t('colorPicker.saturation', {}, { defaultValue: 'Saturation' }), "data-mol-id": "color-picker-saturation", webStyle: sliderBase })] }), _jsxs(Box, { as: "label", className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), children: [_jsx(Text, { as: "span", children: t('colorPicker.value', {}, { defaultValue: 'Value' }) }), _jsx(RangeField, { type: "range", min: 0, max: 100, step: 1, value: Math.round(hsv.v * 100), onValueChange: (v) => emitFromHsv({ v: v / 100 }), "aria-label": t('colorPicker.value', {}, { defaultValue: 'Value' }), "data-mol-id": "color-picker-value", webStyle: sliderBase })] }), _jsx(Box, { as: "div", className: cm.flex({ gap: 'sm' }), children: ['r', 'g', 'b'].map((channel) => (_jsxs(Box, { as: "label", className: cm.cn(cm.textSize('xs'), cm.flex({ direction: 'col', gap: 'xs' })), webStyle: { flex: 1 }, children: [_jsx(Text, { as: "span", children: channelLabels[channel] }), _jsx(TextField, { as: "input", type: "number", min: 0, max: 255, step: 1, value: String(rgb[channel]), onValueChange: (text) => emitFromRgb({ [channel]: Number(text) }), "aria-label": channelLabels[channel], "data-mol-id": `color-picker-${channel}`, webStyle: { padding: '0.3rem 0.5rem' } })] }, channel))) })] }));
96
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-color-picker-react",
3
- "version": "4.0.1",
3
+ "version": "4.1.0",
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",
@@ -38,20 +38,22 @@
38
38
  "peerDependencies": {
39
39
  "@molecule/app-i18n": "^1.0.1",
40
40
  "@molecule/app-react": "^4.0.0",
41
- "@molecule/app-ui": "^1.0.1",
41
+ "@molecule/app-ui": "^1.9.0",
42
+ "@molecule/app-ui-react": "^4.7.0",
42
43
  "react": "^18.0.0 || ^19.0.0"
43
44
  },
44
45
  "devDependencies": {
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",
46
+ "@molecule/app-i18n": "1.3.0",
47
+ "@molecule/app-react": "4.17.0",
48
+ "@molecule/app-ui": "1.13.0",
49
+ "@molecule/app-ui-react": "4.11.0",
50
+ "@molecule/app-ui-tailwind": "1.5.1",
49
51
  "@testing-library/dom": "10.4.2",
50
52
  "@testing-library/react": "16.3.3",
51
53
  "@types/node": "26.6.5",
52
54
  "@types/react": "19.3.0",
53
55
  "@types/react-dom": "19.3.0",
54
- "jsdom": "30.1.3",
56
+ "jsdom": "31.0.1",
55
57
  "react": "19.3.1",
56
58
  "react-dom": "19.3.1",
57
59
  "typescript": "6.0.3",