wimui 0.19.0 → 0.21.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.
Files changed (95) hide show
  1. package/dist/components/charts/AreaChart/AreaChart.cjs +1 -1
  2. package/dist/components/charts/AreaChart/AreaChart.d.ts +9 -2
  3. package/dist/components/charts/AreaChart/AreaChart.js +13 -29
  4. package/dist/components/charts/AreaChart/area-chart.module.cjs +1 -1
  5. package/dist/components/charts/AreaChart/area-chart.module.js +1 -1
  6. package/dist/components/charts/BarChart/BarChart.cjs +1 -1
  7. package/dist/components/charts/BarChart/BarChart.d.ts +9 -2
  8. package/dist/components/charts/BarChart/BarChart.js +12 -7
  9. package/dist/components/charts/BarChart/bar-chart.module.cjs +1 -1
  10. package/dist/components/charts/BarChart/bar-chart.module.js +1 -1
  11. package/dist/components/charts/FunnelChart/FunnelChart.cjs +1 -1
  12. package/dist/components/charts/FunnelChart/FunnelChart.js +36 -28
  13. package/dist/components/charts/FunnelChart/funnel-chart.module.cjs +1 -1
  14. package/dist/components/charts/FunnelChart/funnel-chart.module.js +1 -1
  15. package/dist/components/charts/GaugeChart/gauge-chart.module.cjs +1 -1
  16. package/dist/components/charts/GaugeChart/gauge-chart.module.js +1 -1
  17. package/dist/components/charts/Heatmap/Heatmap.cjs +1 -1
  18. package/dist/components/charts/Heatmap/Heatmap.js +11 -4
  19. package/dist/components/charts/Heatmap/heatmap.module.cjs +1 -1
  20. package/dist/components/charts/Heatmap/heatmap.module.js +1 -1
  21. package/dist/components/charts/LineChart/LineChart.cjs +1 -1
  22. package/dist/components/charts/LineChart/LineChart.d.ts +9 -2
  23. package/dist/components/charts/LineChart/LineChart.js +5 -3
  24. package/dist/components/charts/LineChart/line-chart.module.cjs +1 -1
  25. package/dist/components/charts/LineChart/line-chart.module.js +1 -1
  26. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  27. package/dist/components/charts/PieChart/PieChart.js +3 -2
  28. package/dist/components/charts/PieChart/pie-chart.module.cjs +1 -1
  29. package/dist/components/charts/PieChart/pie-chart.module.js +1 -1
  30. package/dist/components/charts/RadarChart/RadarChart.cjs +1 -1
  31. package/dist/components/charts/RadarChart/RadarChart.js +6 -2
  32. package/dist/components/charts/RadarChart/radar-chart.module.cjs +1 -1
  33. package/dist/components/charts/RadarChart/radar-chart.module.js +1 -1
  34. package/dist/components/charts/ScatterChart/ScatterChart.cjs +1 -1
  35. package/dist/components/charts/ScatterChart/ScatterChart.d.ts +12 -1
  36. package/dist/components/charts/ScatterChart/ScatterChart.js +10 -7
  37. package/dist/components/charts/ScatterChart/scatter-chart.module.cjs +1 -1
  38. package/dist/components/charts/ScatterChart/scatter-chart.module.js +1 -1
  39. package/dist/components/charts/Sparkline/Sparkline.cjs +1 -1
  40. package/dist/components/charts/Sparkline/Sparkline.js +62 -80
  41. package/dist/components/charts/Sparkline/sparkline.module.cjs +1 -1
  42. package/dist/components/charts/Sparkline/sparkline.module.js +1 -1
  43. package/dist/components/charts/Treemap/Treemap.cjs +1 -1
  44. package/dist/components/charts/Treemap/Treemap.js +87 -59
  45. package/dist/components/form/Button/button.module.cjs +1 -1
  46. package/dist/components/form/Button/button.module.js +2 -2
  47. package/dist/components/form/ColorInput/ColorInput.cjs +1 -1
  48. package/dist/components/form/ColorInput/ColorInput.d.ts +9 -1
  49. package/dist/components/form/ColorInput/ColorInput.js +36 -46
  50. package/dist/components/form/ColorInput/color-input.module.cjs +1 -1
  51. package/dist/components/form/ColorInput/color-input.module.js +4 -7
  52. package/dist/components/form/DateRangePicker/DateRangePicker.cjs +1 -1
  53. package/dist/components/form/DateRangePicker/DateRangePicker.js +36 -37
  54. package/dist/components/form/InputBase/input-base.module.cjs +1 -1
  55. package/dist/components/form/InputBase/input-base.module.js +1 -1
  56. package/dist/components/form/MultiSelect/MultiSelect.cjs +1 -1
  57. package/dist/components/form/MultiSelect/MultiSelect.js +1 -1
  58. package/dist/components/form/QueryBuilder/QueryBuilder.cjs +1 -1
  59. package/dist/components/form/QueryBuilder/QueryBuilder.d.ts +124 -1
  60. package/dist/components/form/QueryBuilder/QueryBuilder.js +87 -84
  61. package/dist/components/form/QueryBuilder/querybuilder.module.cjs +1 -1
  62. package/dist/components/form/QueryBuilder/querybuilder.module.js +1 -1
  63. package/dist/components/form/QueryBuilder/warn-unknown-operator.cjs +2 -0
  64. package/dist/components/form/QueryBuilder/warn-unknown-operator.d.ts +3 -0
  65. package/dist/components/form/QueryBuilder/warn-unknown-operator.js +4 -0
  66. package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
  67. package/dist/components/form/SmartSearchInput/SmartSearchInput.js +4 -0
  68. package/dist/components/form/SmartSearchInput/smart-search-input.module.cjs +1 -1
  69. package/dist/components/form/SmartSearchInput/smart-search-input.module.js +5 -3
  70. package/dist/components/form/TagInput/TagInput.cjs +1 -1
  71. package/dist/components/form/TagInput/TagInput.js +1 -1
  72. package/dist/components/helpers.cjs +1 -1
  73. package/dist/components/helpers.d.ts +9 -0
  74. package/dist/components/helpers.js +2 -11
  75. package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
  76. package/dist/components/layout/Dashboard/Dashboard.d.ts +8 -0
  77. package/dist/components/layout/Dashboard/Dashboard.js +47 -42
  78. package/dist/components/layout/Dashboard/dashboard.module.cjs +1 -1
  79. package/dist/components/layout/Dashboard/dashboard.module.js +13 -13
  80. package/dist/components/layout/Header/header.module.cjs +1 -1
  81. package/dist/components/layout/Header/header.module.js +4 -4
  82. package/dist/i18n/generated/keys.d.ts +1 -1
  83. package/dist/i18n/generated/resources.cjs +1 -1
  84. package/dist/i18n/generated/resources.js +18 -3
  85. package/dist/llms-full.txt +22 -3
  86. package/dist/llms.txt +1 -1
  87. package/dist/locales/en/components.json +19 -2
  88. package/dist/locales/ja/components.json +19 -2
  89. package/dist/locales/pt/components.json +19 -2
  90. package/dist/reset.css +1 -1
  91. package/dist/styles.css +2 -2
  92. package/dist/types/generated-tokens.d.ts +1 -1
  93. package/dist/wimui.umd.css +1 -1
  94. package/dist/wimui.umd.js +5 -5
  95. package/package.json +6 -4
@@ -1,4 +1,5 @@
1
1
  import { default as React } from 'react';
2
+ import { ChartAxisDomain } from '../../helpers';
2
3
  export type ScatterChartProps = {
3
4
  /**
4
5
  * Points to plot. `z` optionally controls the point size.
@@ -19,6 +20,16 @@ export type ScatterChartProps = {
19
20
  * @default "Y"
20
21
  */
21
22
  yAxisName?: string;
23
+ /**
24
+ * Range of the X axis.
25
+ * @default ["auto", "auto"]
26
+ */
27
+ xDomain?: ChartAxisDomain;
28
+ /**
29
+ * Range of the Y axis.
30
+ * @default ["auto", "auto"]
31
+ */
32
+ yDomain?: ChartAxisDomain;
22
33
  /**
23
34
  * The height of the chart in pixels.
24
35
  * @default 300
@@ -39,4 +50,4 @@ export type ScatterChartProps = {
39
50
  */
40
51
  animated?: boolean;
41
52
  };
42
- export declare const ScatterChart: ({ data, xAxisName, yAxisName, height, width, title, animated, }: ScatterChartProps) => React.JSX.Element;
53
+ export declare const ScatterChart: ({ data, xAxisName, yAxisName, xDomain, yDomain, height, width, title, animated, }: ScatterChartProps) => React.JSX.Element;
@@ -6,17 +6,17 @@ import "react";
6
6
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
7
  import { CartesianGrid as o, Legend as s, ResponsiveContainer as c, Scatter as l, ScatterChart as u, Tooltip as d, XAxis as f, YAxis as p, ZAxis as m } from "recharts";
8
8
  //#region src/components/charts/ScatterChart/ScatterChart.tsx
9
- var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, width: y = "100%", title: b, animated: x = !1 }) => /* @__PURE__ */ a("div", {
9
+ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", xDomain: v = ["auto", "auto"], yDomain: y = ["auto", "auto"], height: b = 300, width: x = "100%", title: S, animated: C = !1 }) => /* @__PURE__ */ a("div", {
10
10
  className: `wim-scatter-chart ${r.root}`,
11
- style: { width: y },
12
- children: [b && /* @__PURE__ */ i(e, {
11
+ style: { width: x },
12
+ children: [S && /* @__PURE__ */ i(e, {
13
13
  tag: "h3",
14
14
  size: "md",
15
15
  style: { marginBottom: "var(--wim-spacing-md)" },
16
- children: b
16
+ children: S
17
17
  }), /* @__PURE__ */ i("div", {
18
18
  className: r.container,
19
- style: { height: v },
19
+ style: { height: b },
20
20
  children: /* @__PURE__ */ i(c, {
21
21
  width: "100%",
22
22
  height: "100%",
@@ -25,7 +25,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
25
25
  top: 20,
26
26
  right: 20,
27
27
  bottom: 20,
28
- left: 20
28
+ left: 0
29
29
  },
30
30
  children: [
31
31
  /* @__PURE__ */ i(o, { ...n.grid }),
@@ -34,6 +34,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
34
34
  dataKey: "x",
35
35
  name: g,
36
36
  unit: "",
37
+ domain: v,
37
38
  ...n.axis
38
39
  }),
39
40
  /* @__PURE__ */ i(p, {
@@ -41,6 +42,8 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
41
42
  dataKey: "y",
42
43
  name: _,
43
44
  unit: "",
45
+ domain: y,
46
+ width: 44,
44
47
  ...n.axis
45
48
  }),
46
49
  /* @__PURE__ */ i(m, {
@@ -60,7 +63,7 @@ var h = ({ data: h, xAxisName: g = "X", yAxisName: _ = "Y", height: v = 300, wid
60
63
  name: "Data Points",
61
64
  data: h,
62
65
  fill: t[0],
63
- isAnimationActive: x
66
+ isAnimationActive: C
64
67
  })
65
68
  ]
66
69
  })
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_12ucx_4`,t=`_container_12ucx_9`,n={root:e,container:t};exports.container=t,exports.default=n,exports.root=e;
2
+ var e=`_root_pxnwr_4`,t=`_container_pxnwr_9`,n={root:e,container:t};exports.container=t,exports.default=n,exports.root=e;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/charts/ScatterChart/scatter-chart.module.scss
3
- var e = "_root_12ucx_4", t = "_container_12ucx_9", n = {
3
+ var e = "_root_pxnwr_4", t = "_container_pxnwr_9", n = {
4
4
  root: e,
5
5
  container: t
6
6
  };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./sparkline.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("classnames");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("recharts");var o=`var(--wim-color-chart-primary)`,s=({data:e,type:s=`line`,width:c=100,height:l=24,color:u=o,strokeWidth:d=2,showLastDot:f=!1,min:p,max:m,ariaLabel:h,className:g})=>{let _=(0,n.useId)().replace(/:/g,``),v=e.map((e,t)=>({index:t,value:e})),y=[p??`auto`,m??`auto`],b=e.length-1,x=typeof window<`u`&&!!window.__VRT__,S=typeof c==`number`?c:100,C=l??24,w=e=>{let{cx:t,cy:n,index:r}=e;return!f||r!==b||t==null||n==null?(0,i.jsx)(`g`,{},r):(0,i.jsx)(`circle`,{cx:t,cy:n,r:d+1,fill:u},r)},T=x?{width:S,height:C}:{},E={accessibilityLayer:!1,tabIndex:-1},D=()=>s===`bar`?(0,i.jsxs)(a.BarChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Bar,{dataKey:`value`,fill:u,radius:[2,2,0,0],isAnimationActive:!1})]}):s===`area`?(0,i.jsxs)(a.AreaChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(`defs`,{children:(0,i.jsxs)(`linearGradient`,{id:_,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:u,stopOpacity:.35}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:u,stopOpacity:0})]})}),(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Area,{type:`monotone`,dataKey:`value`,stroke:u,strokeWidth:d,fill:`url(#${_})`,dot:f?w:!1,isAnimationActive:!1})]}):(0,i.jsxs)(a.LineChart,{...T,...E,data:v,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:y}),(0,i.jsx)(a.Line,{type:`monotone`,dataKey:`value`,stroke:u,strokeWidth:d,dot:f?w:!1,isAnimationActive:!1})]});return(0,i.jsx)(`div`,{className:(0,r.default)(`wim-sparkline`,t.default.root,g),style:{width:c,height:l},role:h?`img`:void 0,"aria-label":h,"aria-hidden":h?void 0:!0,children:x?D():(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:D()})})};s.displayName=`Sparkline`,exports.Sparkline=s;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./sparkline.module.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("classnames");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("recharts");var o=`var(--wim-color-chart-primary)`,s=({data:e,type:n=`line`,width:s=`100%`,height:c=24,color:l=o,strokeWidth:u=2,showLastDot:d=!1,min:f,max:p,ariaLabel:m,className:h})=>{let g=e.map((e,t)=>({index:t,value:e})),_=[f??`auto`,p??`auto`],v=e.length-1,y=typeof window<`u`&&!!window.__VRT__,b=typeof s==`number`?s:null,x=c??24,S=e=>{let{cx:t,cy:n,index:r}=e;return!d||r!==v||t==null||n==null?(0,i.jsx)(`g`,{},r):(0,i.jsx)(`circle`,{cx:t,cy:n,r:u+1,fill:l},r)},C=y&&b!==null?{width:b,height:x}:{},w={accessibilityLayer:!1,tabIndex:-1},T=()=>n===`bar`?(0,i.jsxs)(a.BarChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Bar,{dataKey:`value`,fill:l,radius:[2,2,0,0],isAnimationActive:!1})]}):n===`area`?(0,i.jsxs)(a.AreaChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Area,{type:`monotone`,dataKey:`value`,stroke:l,strokeWidth:u,fill:l,fillOpacity:.15,dot:d?S:!1,isAnimationActive:!1})]}):(0,i.jsxs)(a.LineChart,{...C,...w,data:g,margin:{top:2,right:2,bottom:2,left:2},children:[(0,i.jsx)(a.YAxis,{hide:!0,domain:_}),(0,i.jsx)(a.Line,{type:`monotone`,dataKey:`value`,stroke:l,strokeWidth:u,dot:d?S:!1,isAnimationActive:!1})]});return(0,i.jsx)(`div`,{className:(0,r.default)(`wim-sparkline`,t.default.root,h),style:{width:s,height:c},role:m?`img`:void 0,"aria-label":m,"aria-hidden":m?void 0:!0,children:y&&b!==null?T():(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:T()})})};s.displayName=`Sparkline`,exports.Sparkline=s;
@@ -1,44 +1,44 @@
1
1
  "use client";
2
2
  import e from "./sparkline.module.js";
3
- import { useId as t } from "react";
4
- import n from "classnames";
5
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
- import { Area as a, AreaChart as o, Bar as s, BarChart as c, Line as l, LineChart as u, ResponsiveContainer as d, YAxis as f } from "recharts";
3
+ import "react";
4
+ import t from "classnames";
5
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
+ import { Area as i, AreaChart as a, Bar as o, BarChart as s, Line as c, LineChart as l, ResponsiveContainer as u, YAxis as d } from "recharts";
7
7
  //#region src/components/charts/Sparkline/Sparkline.tsx
8
- var p = "var(--wim-color-chart-primary)", m = ({ data: m, type: h = "line", width: g = 100, height: _ = 24, color: v = p, strokeWidth: y = 2, showLastDot: b = !1, min: x, max: S, ariaLabel: C, className: w }) => {
9
- let T = t().replace(/:/g, ""), E = m.map((e, t) => ({
8
+ var f = "var(--wim-color-chart-primary)", p = ({ data: p, type: m = "line", width: h = "100%", height: g = 24, color: _ = f, strokeWidth: v = 2, showLastDot: y = !1, min: b, max: x, ariaLabel: S, className: C }) => {
9
+ let w = p.map((e, t) => ({
10
10
  index: t,
11
11
  value: e
12
- })), D = [x ?? "auto", S ?? "auto"], O = m.length - 1, k = typeof window < "u" && !!window.__VRT__, A = typeof g == "number" ? g : 100, j = _ ?? 24, M = (e) => {
13
- let { cx: t, cy: n, index: i } = e;
14
- return !b || i !== O || t == null || n == null ? /* @__PURE__ */ r("g", {}, i) : /* @__PURE__ */ r("circle", {
12
+ })), T = [b ?? "auto", x ?? "auto"], E = p.length - 1, D = typeof window < "u" && !!window.__VRT__, O = typeof h == "number" ? h : null, k = g ?? 24, A = (e) => {
13
+ let { cx: t, cy: r, index: i } = e;
14
+ return !y || i !== E || t == null || r == null ? /* @__PURE__ */ n("g", {}, i) : /* @__PURE__ */ n("circle", {
15
15
  cx: t,
16
- cy: n,
17
- r: y + 1,
18
- fill: v
16
+ cy: r,
17
+ r: v + 1,
18
+ fill: _
19
19
  }, i);
20
- }, N = k ? {
21
- width: A,
22
- height: j
23
- } : {}, P = {
20
+ }, j = D && O !== null ? {
21
+ width: O,
22
+ height: k
23
+ } : {}, M = {
24
24
  accessibilityLayer: !1,
25
25
  tabIndex: -1
26
- }, F = () => h === "bar" ? /* @__PURE__ */ i(c, {
27
- ...N,
28
- ...P,
29
- data: E,
26
+ }, N = () => m === "bar" ? /* @__PURE__ */ r(s, {
27
+ ...j,
28
+ ...M,
29
+ data: w,
30
30
  margin: {
31
31
  top: 2,
32
32
  right: 2,
33
33
  bottom: 2,
34
34
  left: 2
35
35
  },
36
- children: [/* @__PURE__ */ r(f, {
36
+ children: [/* @__PURE__ */ n(d, {
37
37
  hide: !0,
38
- domain: D
39
- }), /* @__PURE__ */ r(s, {
38
+ domain: T
39
+ }), /* @__PURE__ */ n(o, {
40
40
  dataKey: "value",
41
- fill: v,
41
+ fill: _,
42
42
  radius: [
43
43
  2,
44
44
  2,
@@ -47,85 +47,67 @@ var p = "var(--wim-color-chart-primary)", m = ({ data: m, type: h = "line", widt
47
47
  ],
48
48
  isAnimationActive: !1
49
49
  })]
50
- }) : h === "area" ? /* @__PURE__ */ i(o, {
51
- ...N,
52
- ...P,
53
- data: E,
50
+ }) : m === "area" ? /* @__PURE__ */ r(a, {
51
+ ...j,
52
+ ...M,
53
+ data: w,
54
54
  margin: {
55
55
  top: 2,
56
56
  right: 2,
57
57
  bottom: 2,
58
58
  left: 2
59
59
  },
60
- children: [
61
- /* @__PURE__ */ r("defs", { children: /* @__PURE__ */ i("linearGradient", {
62
- id: T,
63
- x1: "0",
64
- y1: "0",
65
- x2: "0",
66
- y2: "1",
67
- children: [/* @__PURE__ */ r("stop", {
68
- offset: "0%",
69
- stopColor: v,
70
- stopOpacity: .35
71
- }), /* @__PURE__ */ r("stop", {
72
- offset: "100%",
73
- stopColor: v,
74
- stopOpacity: 0
75
- })]
76
- }) }),
77
- /* @__PURE__ */ r(f, {
78
- hide: !0,
79
- domain: D
80
- }),
81
- /* @__PURE__ */ r(a, {
82
- type: "monotone",
83
- dataKey: "value",
84
- stroke: v,
85
- strokeWidth: y,
86
- fill: `url(#${T})`,
87
- dot: b ? M : !1,
88
- isAnimationActive: !1
89
- })
90
- ]
91
- }) : /* @__PURE__ */ i(u, {
92
- ...N,
93
- ...P,
94
- data: E,
60
+ children: [/* @__PURE__ */ n(d, {
61
+ hide: !0,
62
+ domain: T
63
+ }), /* @__PURE__ */ n(i, {
64
+ type: "monotone",
65
+ dataKey: "value",
66
+ stroke: _,
67
+ strokeWidth: v,
68
+ fill: _,
69
+ fillOpacity: .15,
70
+ dot: y ? A : !1,
71
+ isAnimationActive: !1
72
+ })]
73
+ }) : /* @__PURE__ */ r(l, {
74
+ ...j,
75
+ ...M,
76
+ data: w,
95
77
  margin: {
96
78
  top: 2,
97
79
  right: 2,
98
80
  bottom: 2,
99
81
  left: 2
100
82
  },
101
- children: [/* @__PURE__ */ r(f, {
83
+ children: [/* @__PURE__ */ n(d, {
102
84
  hide: !0,
103
- domain: D
104
- }), /* @__PURE__ */ r(l, {
85
+ domain: T
86
+ }), /* @__PURE__ */ n(c, {
105
87
  type: "monotone",
106
88
  dataKey: "value",
107
- stroke: v,
108
- strokeWidth: y,
109
- dot: b ? M : !1,
89
+ stroke: _,
90
+ strokeWidth: v,
91
+ dot: y ? A : !1,
110
92
  isAnimationActive: !1
111
93
  })]
112
94
  });
113
- return /* @__PURE__ */ r("div", {
114
- className: n("wim-sparkline", e.root, w),
95
+ return /* @__PURE__ */ n("div", {
96
+ className: t("wim-sparkline", e.root, C),
115
97
  style: {
116
- width: g,
117
- height: _
98
+ width: h,
99
+ height: g
118
100
  },
119
- role: C ? "img" : void 0,
120
- "aria-label": C,
121
- "aria-hidden": C ? void 0 : !0,
122
- children: k ? F() : /* @__PURE__ */ r(d, {
101
+ role: S ? "img" : void 0,
102
+ "aria-label": S,
103
+ "aria-hidden": S ? void 0 : !0,
104
+ children: D && O !== null ? N() : /* @__PURE__ */ n(u, {
123
105
  width: "100%",
124
106
  height: "100%",
125
- children: F()
107
+ children: N()
126
108
  })
127
109
  });
128
110
  };
129
- m.displayName = "Sparkline";
111
+ p.displayName = "Sparkline";
130
112
  //#endregion
131
- export { m as Sparkline };
113
+ export { p as Sparkline };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_15zk0_4`,t={root:e};exports.default=t,exports.root=e;
2
+ var e=`_root_1p9uf_4`,t={root:e};exports.default=t,exports.root=e;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
2
  //#region src/components/charts/Sparkline/sparkline.module.scss
3
- var e = "_root_15zk0_4", t = { root: e };
3
+ var e = "_root_1p9uf_4", t = { root: e };
4
4
  //#endregion
5
5
  export { t as default, e as root };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("./treemap.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("recharts");var s=({x:e,y:t,width:r,height:i,index:o,name:s})=>(0,a.jsxs)(`g`,{children:[(0,a.jsx)(`rect`,{x:e,y:t,width:r,height:i,style:{fill:n.CHART_COLORS[o%n.CHART_COLORS.length],stroke:`none`}}),r>30&&i>20&&(0,a.jsx)(`text`,{x:e+r/2,y:t+i/2,textAnchor:`middle`,dominantBaseline:`central`,style:{fill:n.CHART_TEXT_COLORS[o%n.CHART_TEXT_COLORS.length],fontSize:`var(--wim-font-size-lg)`,fontWeight:`var(--wim-font-weight-bold)`,stroke:`none`,strokeWidth:0,pointerEvents:`none`,userSelect:`none`},children:s})]}),c=({data:e,dataKey:i,aspectRatio:c=4/3,height:l=300,width:u=`100%`,title:d})=>!e||e.length===0?null:(0,a.jsxs)(`div`,{className:`wim-treemap ${r.default.root} wim-treemap__root`,style:{width:u},children:[d&&(0,a.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:d}),(0,a.jsx)(`div`,{className:`${r.default.container} wim-treemap__container`,style:{height:l,minWidth:0,minHeight:0},children:(0,a.jsx)(o.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,a.jsx)(o.Treemap,{data:e,dataKey:i,aspectRatio:c,stroke:`none`,content:s,isAnimationActive:!1,children:(0,a.jsx)(o.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,formatter:(e,t)=>[e,t]})})})})]});exports.Treemap=c;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../typography/Title/Title.cjs"),n=require("../../helpers.cjs"),r=require("./treemap.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("recharts");var s=2,c=8,l=(e,t,n)=>{let r=n-t,i=r===0?1:Math.min(1,Math.max(0,(e-t)/r));return`color-mix(in oklch, var(--wim-color-chart-primary) ${20+Math.round(i*40)}%, var(--wim-color-surface))`},u=(0,i.createContext)({min:0,max:1}),d=({x:e,y:t,width:n,height:r,name:o,value:d,depth:f,children:p})=>{let{min:m,max:h}=(0,i.useContext)(u),[g,_]=(0,i.useState)(!0),v=(0,i.useCallback)(e=>{e&&_(e.getComputedTextLength()+c*2<=n)},[n]);return f===0||Array.isArray(p)&&p.length>0?(0,a.jsx)(`g`,{}):(0,a.jsxs)(`g`,{children:[(0,a.jsx)(`rect`,{x:e+s/2,y:t+s/2,width:Math.max(0,n-s),height:Math.max(0,r-s),style:{fill:l(d,m,h),stroke:`none`}}),n>30&&r>20&&(0,a.jsx)(`text`,{ref:v,x:e+n/2,y:t+r/2,textAnchor:`middle`,dominantBaseline:`central`,style:{fill:`var(--wim-color-text-primary)`,fontSize:`var(--wim-font-size-lg)`,fontWeight:`var(--wim-font-weight-bold)`,stroke:`none`,strokeWidth:0,pointerEvents:`none`,userSelect:`none`,visibility:g?void 0:`hidden`},children:o})]})},f=({data:e,dataKey:s,aspectRatio:c=4/3,height:l=300,width:f=`100%`,title:p})=>{let m=(0,i.useMemo)(()=>{let t=e=>e.flatMap(e=>Array.isArray(e.children)?t(e.children):[e]),n=t(e??[]).map(e=>Number(e[s])||0);return n.length?{min:Math.min(...n),max:Math.max(...n)}:{min:0,max:1}},[e,s]);return!e||e.length===0?null:(0,a.jsx)(u.Provider,{value:m,children:(0,a.jsxs)(`div`,{className:`wim-treemap ${r.default.root} wim-treemap__root`,style:{width:f},children:[p&&(0,a.jsx)(t.Title,{tag:`h3`,size:`md`,style:{marginBottom:`var(--wim-spacing-md)`},children:p}),(0,a.jsx)(`div`,{className:`${r.default.container} wim-treemap__container`,style:{height:l,minWidth:0,minHeight:0},children:(0,a.jsx)(o.ResponsiveContainer,{width:`100%`,height:`100%`,children:(0,a.jsx)(o.Treemap,{data:e,dataKey:s,aspectRatio:c,stroke:`none`,content:d,isAnimationActive:!1,children:(0,a.jsx)(o.Tooltip,{contentStyle:n.CHART_THEME.tooltip.contentStyle,formatter:(e,t)=>[e,t]})})})})]})})};exports.Treemap=f;
@@ -1,67 +1,95 @@
1
1
  "use client";
2
2
  import { Title as e } from "../../typography/Title/Title.js";
3
- import { CHART_COLORS as t, CHART_TEXT_COLORS as n, CHART_THEME as r } from "../../helpers.js";
4
- import i from "./treemap.module.js";
5
- import "react";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
- import { ResponsiveContainer as s, Tooltip as c, Treemap as l } from "recharts";
3
+ import { CHART_THEME as t } from "../../helpers.js";
4
+ import n from "./treemap.module.js";
5
+ import { createContext as r, useCallback as i, useContext as a, useMemo as o, useState as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { ResponsiveContainer as u, Tooltip as d, Treemap as f } from "recharts";
8
8
  //#region src/components/charts/Treemap/Treemap.tsx
9
- var u = ({ x: e, y: r, width: i, height: s, index: c, name: l }) => /* @__PURE__ */ o("g", { children: [/* @__PURE__ */ a("rect", {
10
- x: e,
11
- y: r,
12
- width: i,
13
- height: s,
14
- style: {
15
- fill: t[c % t.length],
16
- stroke: "none"
17
- }
18
- }), i > 30 && s > 20 && /* @__PURE__ */ a("text", {
19
- x: e + i / 2,
20
- y: r + s / 2,
21
- textAnchor: "middle",
22
- dominantBaseline: "central",
23
- style: {
24
- fill: n[c % n.length],
25
- fontSize: "var(--wim-font-size-lg)",
26
- fontWeight: "var(--wim-font-weight-bold)",
27
- stroke: "none",
28
- strokeWidth: 0,
29
- pointerEvents: "none",
30
- userSelect: "none"
31
- },
32
- children: l
33
- })] }), d = ({ data: t, dataKey: n, aspectRatio: d = 4 / 3, height: f = 300, width: p = "100%", title: m }) => !t || t.length === 0 ? null : /* @__PURE__ */ o("div", {
34
- className: `wim-treemap ${i.root} wim-treemap__root`,
35
- style: { width: p },
36
- children: [m && /* @__PURE__ */ a(e, {
37
- tag: "h3",
38
- size: "md",
39
- style: { marginBottom: "var(--wim-spacing-md)" },
40
- children: m
41
- }), /* @__PURE__ */ a("div", {
42
- className: `${i.container} wim-treemap__container`,
9
+ var p = 2, m = 8, h = (e, t, n) => {
10
+ let r = n - t, i = r === 0 ? 1 : Math.min(1, Math.max(0, (e - t) / r));
11
+ return `color-mix(in oklch, var(--wim-color-chart-primary) ${20 + Math.round(i * 40)}%, var(--wim-color-surface))`;
12
+ }, g = r({
13
+ min: 0,
14
+ max: 1
15
+ }), _ = ({ x: e, y: t, width: n, height: r, name: o, value: u, depth: d, children: f }) => {
16
+ let { min: _, max: v } = a(g), [y, b] = s(!0), x = i((e) => {
17
+ e && b(e.getComputedTextLength() + m * 2 <= n);
18
+ }, [n]);
19
+ return d === 0 || Array.isArray(f) && f.length > 0 ? /* @__PURE__ */ c("g", {}) : /* @__PURE__ */ l("g", { children: [/* @__PURE__ */ c("rect", {
20
+ x: e + p / 2,
21
+ y: t + p / 2,
22
+ width: Math.max(0, n - p),
23
+ height: Math.max(0, r - p),
43
24
  style: {
44
- height: f,
45
- minWidth: 0,
46
- minHeight: 0
25
+ fill: h(u, _, v),
26
+ stroke: "none"
27
+ }
28
+ }), n > 30 && r > 20 && /* @__PURE__ */ c("text", {
29
+ ref: x,
30
+ x: e + n / 2,
31
+ y: t + r / 2,
32
+ textAnchor: "middle",
33
+ dominantBaseline: "central",
34
+ style: {
35
+ fill: "var(--wim-color-text-primary)",
36
+ fontSize: "var(--wim-font-size-lg)",
37
+ fontWeight: "var(--wim-font-weight-bold)",
38
+ stroke: "none",
39
+ strokeWidth: 0,
40
+ pointerEvents: "none",
41
+ userSelect: "none",
42
+ visibility: y ? void 0 : "hidden"
47
43
  },
48
- children: /* @__PURE__ */ a(s, {
49
- width: "100%",
50
- height: "100%",
51
- children: /* @__PURE__ */ a(l, {
52
- data: t,
53
- dataKey: n,
54
- aspectRatio: d,
55
- stroke: "none",
56
- content: u,
57
- isAnimationActive: !1,
58
- children: /* @__PURE__ */ a(c, {
59
- contentStyle: r.tooltip.contentStyle,
60
- formatter: (e, t) => [e, t]
44
+ children: o
45
+ })] });
46
+ }, v = ({ data: r, dataKey: i, aspectRatio: a = 4 / 3, height: s = 300, width: p = "100%", title: m }) => {
47
+ let h = o(() => {
48
+ let e = (t) => t.flatMap((t) => Array.isArray(t.children) ? e(t.children) : [t]), t = e(r ?? []).map((e) => Number(e[i]) || 0);
49
+ return t.length ? {
50
+ min: Math.min(...t),
51
+ max: Math.max(...t)
52
+ } : {
53
+ min: 0,
54
+ max: 1
55
+ };
56
+ }, [r, i]);
57
+ return !r || r.length === 0 ? null : /* @__PURE__ */ c(g.Provider, {
58
+ value: h,
59
+ children: /* @__PURE__ */ l("div", {
60
+ className: `wim-treemap ${n.root} wim-treemap__root`,
61
+ style: { width: p },
62
+ children: [m && /* @__PURE__ */ c(e, {
63
+ tag: "h3",
64
+ size: "md",
65
+ style: { marginBottom: "var(--wim-spacing-md)" },
66
+ children: m
67
+ }), /* @__PURE__ */ c("div", {
68
+ className: `${n.container} wim-treemap__container`,
69
+ style: {
70
+ height: s,
71
+ minWidth: 0,
72
+ minHeight: 0
73
+ },
74
+ children: /* @__PURE__ */ c(u, {
75
+ width: "100%",
76
+ height: "100%",
77
+ children: /* @__PURE__ */ c(f, {
78
+ data: r,
79
+ dataKey: i,
80
+ aspectRatio: a,
81
+ stroke: "none",
82
+ content: _,
83
+ isAnimationActive: !1,
84
+ children: /* @__PURE__ */ c(d, {
85
+ contentStyle: t.tooltip.contentStyle,
86
+ formatter: (e, t) => [e, t]
87
+ })
88
+ })
61
89
  })
62
- })
90
+ })]
63
91
  })
64
- })]
65
- });
92
+ });
93
+ };
66
94
  //#endregion
67
- export { d as Treemap };
95
+ export { v as Treemap };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- var e=`_root_perg7_3`,t=`_fullWidth_perg7_30`,n=`_inner_perg7_38`,r=`_loader_perg7_41`,i=`_label_perg7_48`,a=`_lg_perg7_58`,o=`_md_perg7_67`,s=`_sm_perg7_76`,c=`_solid_perg7_86`,l=`_danger_perg7_96`,u=`_success_perg7_101`,d=`_outline_perg7_125`,f=`_ghost_perg7_162`,p=`_iconOnly_perg7_204`,m=`_content_perg7_214`,h=`_loading_perg7_224`,g=`_animatedWidth_perg7_233`,_={root:e,fullWidth:t,inner:n,loader:r,label:i,lg:a,md:o,sm:s,solid:c,default:`_default_perg7_91`,danger:l,success:u,outline:d,ghost:f,iconOnly:p,content:m,loading:h,animatedWidth:g};exports.animatedWidth=g,exports.content=m,exports.danger=l,exports.default=_,exports.fullWidth=t,exports.ghost=f,exports.iconOnly=p,exports.inner=n,exports.label=i,exports.lg=a,exports.loader=r,exports.loading=h,exports.md=o,exports.outline=d,exports.root=e,exports.sm=s,exports.solid=c,exports.success=u;
2
+ var e=`_root_11ol0_3`,t=`_fullWidth_11ol0_30`,n=`_inner_11ol0_38`,r=`_loader_11ol0_41`,i=`_label_11ol0_48`,a=`_lg_11ol0_58`,o=`_md_11ol0_67`,s=`_sm_11ol0_76`,c=`_solid_11ol0_86`,l=`_danger_11ol0_96`,u=`_success_11ol0_101`,d=`_outline_11ol0_125`,f=`_ghost_11ol0_162`,p=`_iconOnly_11ol0_213`,m=`_content_11ol0_223`,h=`_loading_11ol0_233`,g=`_animatedWidth_11ol0_242`,_={root:e,fullWidth:t,inner:n,loader:r,label:i,lg:a,md:o,sm:s,solid:c,default:`_default_11ol0_91`,danger:l,success:u,outline:d,ghost:f,iconOnly:p,content:m,loading:h,animatedWidth:g};exports.animatedWidth=g,exports.content=m,exports.danger=l,exports.default=_,exports.fullWidth=t,exports.ghost=f,exports.iconOnly=p,exports.inner=n,exports.label=i,exports.lg=a,exports.loader=r,exports.loading=h,exports.md=o,exports.outline=d,exports.root=e,exports.sm=s,exports.solid=c,exports.success=u;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  //#region src/components/form/Button/button.module.scss
3
- var e = "_root_perg7_3", t = "_fullWidth_perg7_30", n = "_inner_perg7_38", r = "_loader_perg7_41", i = "_label_perg7_48", a = "_lg_perg7_58", o = "_md_perg7_67", s = "_sm_perg7_76", c = "_solid_perg7_86", l = "_danger_perg7_96", u = "_success_perg7_101", d = "_outline_perg7_125", f = "_ghost_perg7_162", p = "_iconOnly_perg7_204", m = "_content_perg7_214", h = "_loading_perg7_224", g = "_animatedWidth_perg7_233", _ = {
3
+ var e = "_root_11ol0_3", t = "_fullWidth_11ol0_30", n = "_inner_11ol0_38", r = "_loader_11ol0_41", i = "_label_11ol0_48", a = "_lg_11ol0_58", o = "_md_11ol0_67", s = "_sm_11ol0_76", c = "_solid_11ol0_86", l = "_danger_11ol0_96", u = "_success_11ol0_101", d = "_outline_11ol0_125", f = "_ghost_11ol0_162", p = "_iconOnly_11ol0_213", m = "_content_11ol0_223", h = "_loading_11ol0_233", g = "_animatedWidth_11ol0_242", _ = {
4
4
  root: e,
5
5
  fullWidth: t,
6
6
  inner: n,
@@ -10,7 +10,7 @@ var e = "_root_perg7_3", t = "_fullWidth_perg7_30", n = "_inner_perg7_38", r = "
10
10
  md: o,
11
11
  sm: s,
12
12
  solid: c,
13
- default: "_default_perg7_91",
13
+ default: "_default_11ol0_91",
14
14
  danger: l,
15
15
  success: u,
16
16
  outline: d,
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../Input/Input.cjs"),n=require("./color-input.module.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("classnames");i=e.__toESM(i,1);let a=require("react/jsx-runtime");function o(e){let t=e.replace(`#`,``);if(t.length!==6&&t.length!==3)return null;let n=t.length===3?t.split(``).map(e=>e+e).join(``):t,r=parseInt(n,16);return isNaN(r)?null:{r:r>>16&255,g:r>>8&255,b:r&255}}function s(e,t,n){let[r,i,a]=[e,t,n].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function c(e){let t=o(e);return t?s(t.r,t.g,t.b)<.4:!1}var l=({className:e,value:o,defaultValue:s,onChange:l,style:u,...d})=>{let[f,p]=(0,r.useState)(()=>s??`#000000`),m=o!==void 0,h=m?o:f,g=(0,r.useCallback)(e=>{m||p(e.target.value),l?.(e)},[m,l]),_=(0,r.useMemo)(()=>c(h),[h]);return(0,a.jsx)(t.Input,{type:`color`,className:(0,i.default)(`wim-color-input`,n.default.root,_&&n.default.dark,e),value:h,onChange:g,style:u,styles:{root:n.default.inputBase,icon:n.default.inputIcon,icons:n.default.inputIcons},inputClassName:n.default.input,...d})};exports.ColorInput=l;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../Input/Input.cjs"),r=require("./color-input.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,c=e=>e.length===4?`#${e.slice(1).split(``).map(e=>e+e).join(``)}`:e,l=({className:e,value:l,defaultValue:u,onChange:d,style:f,...p})=>{let{t:m}=t.useWimTranslation(`components`),[h,g]=(0,i.useState)(()=>u??`#000000`),_=l!==void 0,v=_?l:h,[y,b]=(0,i.useState)(v),[x,S]=(0,i.useState)(v);v!==x&&(S(v),b(v));let C=(0,i.useCallback)((e,t)=>{_||g(e),d?.(t)},[_,d]),w=(0,i.useCallback)(e=>{let t=e.target.value;b(t),s.test(t.trim())&&C(t.trim(),e)},[C]),T=(0,i.useCallback)(e=>{b(e.target.value),C(e.target.value,e)},[C]),E=s.test(v)?c(v).toLowerCase():`#000000`;return(0,o.jsx)(n.Input,{type:`text`,className:(0,a.default)(`wim-color-input`,r.default.root,e),value:y,onChange:w,style:f,spellCheck:!1,autoCapitalize:`none`,autoCorrect:`off`,inputClassName:r.default.input,suffix:(0,o.jsx)(`input`,{type:`color`,className:r.default.swatch,value:E,onChange:T,disabled:p.disabled,"aria-label":m(`colorinput.swatch`),tabIndex:-1}),...p})};exports.ColorInput=l;
@@ -1,6 +1,14 @@
1
1
  import { default as React } from 'react';
2
2
  import { Input } from '../../form/Input/Input';
3
3
  /**
4
- * カラー選択に特化した入力コンポーネント。
4
+ * 色を**文字で入れる**ための入力。`#f3ece1` のような値をそのまま打てて、
5
+ * 右の見本から選ぶこともできる。
6
+ *
7
+ * **以前は `<Input type="color">` を出すだけ**で、テキスト欄が無かった。
8
+ * `ColorPicker` と同じ見た目・同じ操作で、docs が言う「正確な値を文字で入れる」
9
+ * ができない状態だった(T122)。役割分担はこう:
10
+ *
11
+ * - `ColorInput` — 値が決まっている(ブランド色・デザイン指定)ときに**打ち込む**
12
+ * - `ColorPicker` — 値が決まっていないときに**見て選ぶ**
5
13
  */
6
14
  export declare const ColorInput: ({ className, value, defaultValue, onChange, style, ...props }: React.ComponentProps<typeof Input>) => React.JSX.Element;
@@ -1,53 +1,43 @@
1
1
  "use client";
2
- import { Input as e } from "../Input/Input.js";
3
- import t from "./color-input.module.js";
4
- import { useCallback as n, useMemo as r, useState as i } from "react";
2
+ import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
3
+ import { Input as t } from "../Input/Input.js";
4
+ import n from "./color-input.module.js";
5
+ import { useCallback as r, useState as i } from "react";
5
6
  import a from "classnames";
6
7
  import { jsx as o } from "react/jsx-runtime";
7
8
  //#region src/components/form/ColorInput/ColorInput.tsx
8
- function s(e) {
9
- let t = e.replace("#", "");
10
- if (t.length !== 6 && t.length !== 3) return null;
11
- let n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n, 16);
12
- return isNaN(r) ? null : {
13
- r: r >> 16 & 255,
14
- g: r >> 8 & 255,
15
- b: r & 255
16
- };
17
- }
18
- function c(e, t, n) {
19
- let [r, i, a] = [
20
- e,
21
- t,
22
- n
23
- ].map((e) => {
24
- let t = e / 255;
25
- return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
26
- });
27
- return .2126 * r + .7152 * i + .0722 * a;
28
- }
29
- function l(e) {
30
- let t = s(e);
31
- return t ? c(t.r, t.g, t.b) < .4 : !1;
32
- }
33
- var u = ({ className: s, value: c, defaultValue: u, onChange: d, style: f, ...p }) => {
34
- let [m, h] = i(() => u ?? "#000000"), g = c !== void 0, _ = g ? c : m, v = n((e) => {
35
- g || h(e.target.value), d?.(e);
36
- }, [g, d]), y = r(() => l(_), [_]);
37
- return /* @__PURE__ */ o(e, {
38
- type: "color",
39
- className: a("wim-color-input", t.root, y && t.dark, s),
40
- value: _,
41
- onChange: v,
42
- style: f,
43
- styles: {
44
- root: t.inputBase,
45
- icon: t.inputIcon,
46
- icons: t.inputIcons
47
- },
48
- inputClassName: t.input,
49
- ...p
9
+ var s = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i, c = (e) => e.length === 4 ? `#${e.slice(1).split("").map((e) => e + e).join("")}` : e, l = ({ className: l, value: u, defaultValue: d, onChange: f, style: p, ...m }) => {
10
+ let { t: h } = e("components"), [g, _] = i(() => d ?? "#000000"), v = u !== void 0, y = v ? u : g, [b, x] = i(y), [S, C] = i(y);
11
+ y !== S && (C(y), x(y));
12
+ let w = r((e, t) => {
13
+ v || _(e), f?.(t);
14
+ }, [v, f]), T = r((e) => {
15
+ let t = e.target.value;
16
+ x(t), s.test(t.trim()) && w(t.trim(), e);
17
+ }, [w]), E = r((e) => {
18
+ x(e.target.value), w(e.target.value, e);
19
+ }, [w]), D = s.test(y) ? c(y).toLowerCase() : "#000000";
20
+ return /* @__PURE__ */ o(t, {
21
+ type: "text",
22
+ className: a("wim-color-input", n.root, l),
23
+ value: b,
24
+ onChange: T,
25
+ style: p,
26
+ spellCheck: !1,
27
+ autoCapitalize: "none",
28
+ autoCorrect: "off",
29
+ inputClassName: n.input,
30
+ suffix: /* @__PURE__ */ o("input", {
31
+ type: "color",
32
+ className: n.swatch,
33
+ value: D,
34
+ onChange: E,
35
+ disabled: m.disabled,
36
+ "aria-label": h("colorinput.swatch"),
37
+ tabIndex: -1
38
+ }),
39
+ ...m
50
40
  });
51
41
  };
52
42
  //#endregion
53
- export { u as ColorInput };
43
+ export { l as ColorInput };