@andreagiugni/tailwind-dashboard-ui 1.0.23 → 1.0.24

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
@@ -182,7 +182,7 @@ Legend: **(+native)** = also extends the element's native HTML attributes.
182
182
  | `Code` | `color` (primary/success/error/warning/info/default), `size` (sm/md), (+native code) (+override) |
183
183
  | `Snippet` | `code` (string \| string[]), `symbol?`, `hideCopyButton?`, `hideSymbol?`, `size`, (+override) |
184
184
  | `Progress` | `value`, `maxValue?`, `color`, `size` (sm/md/lg), `label?`, `showValueLabel?`, `isIndeterminate?` |
185
- | `PollResults` | `options` (`{ label, value?, series? }[]`), `maxValue?`, `size` (sm/md/lg), `color`, `trackColor?`, `showValueLabel?`, `showSeriesLabels?`, `valueFormatter?`, (+native div) (+override) |
185
+ | `PollResults` | `options` (`{ label, value?, series? }[]`), `maxValue?`, `size` (sm/md/lg), `color`, `trackColor?`, `showValueLabel?`, `showSeriesLabels?`, `valueFormatter?`, `labelTextSize?`/`labelTextColor?`/`labelTextWeight?`, `valueTextSize?`/`valueTextColor?`/`valueTextWeight?`, `seriesLabelTextSize?`/`seriesLabelTextColor?`/`seriesLabelTextWeight?`, `seriesValueTextSize?`/`seriesValueTextColor?`/`seriesValueTextWeight?`, (+native div) (+override) |
186
186
  | `Spinner` | `size` (sm/md/lg), `color`, `label?` |
187
187
  | `Skeleton` | `isLoaded`, `width?`, `height?`, `className`, `children?` |
188
188
  | `Toast` | `variant` (success/danger/warning/info), `title`, `message?`, `icon?`, `hideIcon?`, `showCloseButton?`, `onClose?`, `hideAccentBar?`, (+native div) (+override) |
package/dist/index.cjs CHANGED
@@ -1914,6 +1914,15 @@ var nodeToLabel = (node) => {
1914
1914
  return void 0;
1915
1915
  };
1916
1916
  var defaultValueFormatter = (_value, percent) => `${percent}%`;
1917
+ var textStyle = ({
1918
+ size,
1919
+ color,
1920
+ weight
1921
+ }) => ({
1922
+ ...size ? { fontSize: size } : {},
1923
+ ...color ? { color } : {},
1924
+ ...weight ? { fontWeight: weight } : {}
1925
+ });
1917
1926
  var PollResults = ({
1918
1927
  options,
1919
1928
  maxValue = 100,
@@ -1923,6 +1932,18 @@ var PollResults = ({
1923
1932
  showValueLabel = true,
1924
1933
  showSeriesLabels = true,
1925
1934
  valueFormatter = defaultValueFormatter,
1935
+ labelTextSize,
1936
+ labelTextColor,
1937
+ labelTextWeight,
1938
+ valueTextSize,
1939
+ valueTextColor,
1940
+ valueTextWeight,
1941
+ seriesLabelTextSize,
1942
+ seriesLabelTextColor,
1943
+ seriesLabelTextWeight,
1944
+ seriesValueTextSize,
1945
+ seriesValueTextColor,
1946
+ seriesValueTextWeight,
1926
1947
  className,
1927
1948
  bgColor,
1928
1949
  textColor,
@@ -1931,6 +1952,26 @@ var PollResults = ({
1931
1952
  ...rest
1932
1953
  }) => {
1933
1954
  const safeMax = maxValue <= 0 ? 100 : maxValue;
1955
+ const optionLabelStyle = textStyle({
1956
+ size: labelTextSize,
1957
+ color: labelTextColor,
1958
+ weight: labelTextWeight
1959
+ });
1960
+ const optionValueStyle = textStyle({
1961
+ size: valueTextSize,
1962
+ color: valueTextColor,
1963
+ weight: valueTextWeight
1964
+ });
1965
+ const groupedLabelStyle = textStyle({
1966
+ size: seriesLabelTextSize,
1967
+ color: seriesLabelTextColor,
1968
+ weight: seriesLabelTextWeight
1969
+ });
1970
+ const groupedValueStyle = textStyle({
1971
+ size: seriesValueTextSize ?? valueTextSize,
1972
+ color: seriesValueTextColor ?? valueTextColor,
1973
+ weight: seriesValueTextWeight ?? valueTextWeight
1974
+ });
1934
1975
  return /* @__PURE__ */ jsxRuntime.jsx(
1935
1976
  "div",
1936
1977
  {
@@ -1951,8 +1992,22 @@ var PollResults = ({
1951
1992
  const singlePercent = toPercent(series[0]?.value ?? 0, safeMax);
1952
1993
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1953
1994
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-3 flex items-center justify-between gap-4", children: [
1954
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words text-xl font-semibold leading-snug text-gray-800 dark:text-white/90", children: option.label }),
1955
- !isGrouped && showValueLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xl font-semibold leading-snug text-gray-600 dark:text-gray-300", children: valueFormatter(series[0]?.value ?? 0, singlePercent) })
1995
+ /* @__PURE__ */ jsxRuntime.jsx(
1996
+ "span",
1997
+ {
1998
+ className: "min-w-0 break-words text-xl font-semibold leading-snug text-gray-800 dark:text-white/90",
1999
+ style: optionLabelStyle,
2000
+ children: option.label
2001
+ }
2002
+ ),
2003
+ !isGrouped && showValueLabel && /* @__PURE__ */ jsxRuntime.jsx(
2004
+ "span",
2005
+ {
2006
+ className: "shrink-0 text-xl font-semibold leading-snug text-gray-600 dark:text-gray-300",
2007
+ style: optionValueStyle,
2008
+ children: valueFormatter(series[0]?.value ?? 0, singlePercent)
2009
+ }
2010
+ )
1956
2011
  ] }),
1957
2012
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkYERNSNT4_cjs.cn("flex flex-col", isGrouped ? "gap-3" : "gap-0"), children: series.map((entry, seriesIndex) => {
1958
2013
  const percent = toPercent(entry.value, safeMax);
@@ -1962,8 +2017,22 @@ var PollResults = ({
1962
2017
  const ariaLabel = entry.ariaLabel ?? [optionText, isGrouped ? entryLabel : void 0].filter(Boolean).join(" ");
1963
2018
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1964
2019
  isGrouped && (showSeriesLabels || showValueLabel) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1.5 flex items-center justify-between gap-3", children: [
1965
- showSeriesLabels ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words text-xs font-medium text-gray-500 dark:text-gray-400", children: entry.label }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
1966
- showValueLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-xs font-semibold text-gray-600 dark:text-gray-300", children: valueFormatter(entry.value, percent) })
2020
+ showSeriesLabels ? /* @__PURE__ */ jsxRuntime.jsx(
2021
+ "span",
2022
+ {
2023
+ className: "min-w-0 break-words text-xs font-medium text-gray-500 dark:text-gray-400",
2024
+ style: groupedLabelStyle,
2025
+ children: entry.label
2026
+ }
2027
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
2028
+ showValueLabel && /* @__PURE__ */ jsxRuntime.jsx(
2029
+ "span",
2030
+ {
2031
+ className: "shrink-0 text-xs font-semibold text-gray-600 dark:text-gray-300",
2032
+ style: groupedValueStyle,
2033
+ children: valueFormatter(entry.value, percent)
2034
+ }
2035
+ )
1967
2036
  ] }),
1968
2037
  /* @__PURE__ */ jsxRuntime.jsx(
1969
2038
  "div",