@moises.ai/design-system 4.20.9 → 4.20.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/design-system",
3
- "version": "4.20.9",
3
+ "version": "4.20.10",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -23,6 +23,7 @@ export const PanControl = ({
23
23
  minValue = -0.65,
24
24
  maxValue = 0.65,
25
25
  showTooltip = true,
26
+ tooltipValueMode = 'normalized',
26
27
  tooltipDelayDuration = 0,
27
28
  tooltipCloseDelay = 500,
28
29
  }) => {
@@ -293,13 +294,21 @@ export const PanControl = ({
293
294
  }, [value, disabled, minValue, maxValue])
294
295
 
295
296
  const panValueText = useMemo(() => {
296
- const actual = denormalize(value, minValue, maxValue)
297
- const pct = Math.round(actual * 100)
297
+ const display =
298
+ tooltipValueMode === 'mapped'
299
+ ? denormalize(value, minValue, maxValue)
300
+ : clampNorm(value)
301
+ const pct = Math.round(display * 100)
298
302
  return `Pan: ${Math.abs(pct) < 1 ? 0 : pct}`
299
- }, [value, minValue, maxValue])
300
-
301
- const displayNorm = clampNorm(denormalize(value, minValue, maxValue))
302
- const ariaPanPct = Math.round(displayNorm * 100)
303
+ }, [value, minValue, maxValue, tooltipValueMode])
304
+
305
+ const ariaPanPct = useMemo(() => {
306
+ const display =
307
+ tooltipValueMode === 'mapped'
308
+ ? denormalize(value, minValue, maxValue)
309
+ : clampNorm(value)
310
+ return Math.round(display * 100)
311
+ }, [value, minValue, maxValue, tooltipValueMode])
303
312
 
304
313
  const handlePointerEnter = () => {
305
314
  if (disabled) return
@@ -71,7 +71,7 @@ export default {
71
71
  minValue: {
72
72
  control: { type: 'number', step: 0.01 },
73
73
  description:
74
- 'Minimum mapped value (normalized -1 corresponds to this value)',
74
+ 'Minimum mapped value for the visual arc (normalized -1 maps to this). Also used by tooltip when tooltipValueMode is "mapped".',
75
75
  table: {
76
76
  type: { summary: 'number' },
77
77
  defaultValue: { summary: -0.65 },
@@ -80,12 +80,22 @@ export default {
80
80
  maxValue: {
81
81
  control: { type: 'number', step: 0.01 },
82
82
  description:
83
- 'Maximum mapped value (normalized 1 corresponds to this value)',
83
+ 'Maximum mapped value for the visual arc (normalized 1 maps to this). Also used by tooltip when tooltipValueMode is "mapped".',
84
84
  table: {
85
85
  type: { summary: 'number' },
86
86
  defaultValue: { summary: 0.65 },
87
87
  },
88
88
  },
89
+ tooltipValueMode: {
90
+ control: 'select',
91
+ options: ['normalized', 'mapped'],
92
+ description:
93
+ 'Tooltip/aria scale: "normalized" shows -100..100 from the control position; "mapped" shows the minValue/maxValue scale (e.g. ±65).',
94
+ table: {
95
+ type: { summary: "'normalized' | 'mapped'" },
96
+ defaultValue: { summary: 'normalized' },
97
+ },
98
+ },
89
99
  showTooltip: {
90
100
  control: 'boolean',
91
101
  description: 'Shows the pan value tooltip on hover/focus/drag',