@trops/dash-core 0.1.571 → 0.1.573

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/dist/index.js CHANGED
@@ -35302,24 +35302,20 @@ var ColorTile = function ColorTile(_ref) {
35302
35302
  level: colorLevelName
35303
35303
  }, rest));
35304
35304
 
35305
- // console.log("Color Model Tile ", c);
35306
-
35307
- // const stringColor = colorFromTheme === null ? `bg-${colorName}${shade !== null ? `-${shade}` : ''}` : colorFromTheme;
35308
- // const parts = colorFromTheme !== null ? colorFromTheme.split('-') : null;
35309
-
35310
- // const derivedShade = parts !== null ? parts[parts.length -1] : null;
35311
- // const derivedColorName = parts !== null ? parts[parts.length - 2] : null;
35312
-
35313
- // const stringThemeColorName = '';
35314
- // const objToSend = {
35315
- // colorName: colorName !== null ? colorName : colorFromTheme !== null && derivedColorName,
35316
- // shade: shade !== null ? shade : colorFromTheme !== null && derivedShade,
35317
- // stringColor,
35318
- // ...rest
35319
- // };
35320
-
35305
+ // If the channel value is a hex (custom-color theme — PRD
35306
+ // arbitrary-color-themes.md), `c.class` becomes `bg-#xxx-500`
35307
+ // which isn't a valid Tailwind class and renders as nothing
35308
+ // (the dark page background bleeds through, looking black).
35309
+ // Use inline style for hex backgrounds; named colors continue
35310
+ // through the className path so existing themes are unchanged.
35311
+ var colorIsHex = DashReact.isHexColor(colorName);
35312
+ var inlineStyle = colorIsHex ? {
35313
+ backgroundColor: colorName
35314
+ } : undefined;
35315
+ var bgClass = colorIsHex ? "" : c["class"];
35321
35316
  return /*#__PURE__*/jsxRuntime.jsx("div", {
35322
- className: "flex flex-col rounded-lg cursor-pointer items-center justify-center border-2 text-xs ".concat(selected === true ? "border-yellow-500" : "border-gray-800", " hover:border-yellow-500 border-gray-800 ").concat(c["class"], " ").concat(width, " ").concat(height),
35317
+ className: "flex flex-col rounded-lg cursor-pointer items-center justify-center border-2 text-xs ".concat(selected === true ? "border-yellow-500" : "border-gray-800", " hover:border-yellow-500 border-gray-800 ").concat(bgClass, " ").concat(width, " ").concat(height),
35318
+ style: inlineStyle,
35323
35319
  onClick: function onClick() {
35324
35320
  return _onClick !== null ? _onClick(_objectSpread$F(_objectSpread$F({}, c), rest)) : null;
35325
35321
  },
@@ -36951,13 +36947,26 @@ var CustomHexColorPane = function CustomHexColorPane(_ref) {
36951
36947
  var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
36952
36948
  var onSelect = _ref.onSelect,
36953
36949
  _ref$selectedHex = _ref.selectedHex,
36954
- selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex;
36950
+ selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex,
36951
+ _ref$cols = _ref.cols,
36952
+ cols = _ref$cols === void 0 ? 6 : _ref$cols;
36955
36953
  var families = DashReact.getColorFamilies();
36956
36954
  var _useState = React.useState(families[0]),
36957
36955
  _useState2 = _slicedToArray(_useState, 2),
36958
36956
  activeFamily = _useState2[0],
36959
36957
  setActiveFamily = _useState2[1];
36960
36958
  var colors = DashReact.getCuratedColorGrid(activeFamily);
36959
+
36960
+ // Map the `cols` prop to a Tailwind class. The pattern set is in
36961
+ // the dash-electron safelist already (grid-cols-1..12).
36962
+ var gridColsClass = {
36963
+ 4: "grid-cols-4",
36964
+ 6: "grid-cols-6",
36965
+ 8: "grid-cols-8",
36966
+ 9: "grid-cols-9",
36967
+ 10: "grid-cols-10",
36968
+ 12: "grid-cols-12"
36969
+ }[cols] || "grid-cols-6";
36961
36970
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
36962
36971
  className: "flex flex-col gap-3 p-3",
36963
36972
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -36974,7 +36983,7 @@ var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
36974
36983
  }, family);
36975
36984
  })
36976
36985
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
36977
- className: "grid grid-cols-6 gap-1",
36986
+ className: "grid ".concat(gridColsClass, " gap-1"),
36978
36987
  children: colors.map(function (hex) {
36979
36988
  var isSelected = selectedHex && hex.toLowerCase() === selectedHex.toLowerCase();
36980
36989
  return /*#__PURE__*/jsxRuntime.jsx("button", {
@@ -37054,24 +37063,33 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
37054
37063
  });
37055
37064
  });
37056
37065
  }
37057
- return (
37058
- /*#__PURE__*/
37059
- // <LayoutContainer
37060
- // direction="col"
37061
- // scrollable={false}
37062
- // className="space-y-1"
37063
- // height={"h-full"}
37064
- // >
37065
- jsxRuntime.jsxs(DashReact.DashPanel, {
37066
+
37067
+ // The picker renders inside a modal so it has room for the full
37068
+ // categorized grid without the user having to scroll within a
37069
+ // cramped left-column. Mount/unmount of this component is driven
37070
+ // by the parent (ThemeMenuPane) based on `selectedColor` state —
37071
+ // so `isOpen` is effectively always `true` while mounted, and
37072
+ // closing the modal triggers `onCancel` to unmount.
37073
+ var isMain = shade !== null;
37074
+ var title = isMain ? "Pick ".concat(DashReact.capitalizeFirstLetter(colorType || "color"), " color") : "Available Colors";
37075
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
37076
+ isOpen: true,
37077
+ setIsOpen: function setIsOpen() {
37078
+ return handleCancel();
37079
+ },
37080
+ width: "w-3/4",
37081
+ height: "h-3/4",
37082
+ children: /*#__PURE__*/jsxRuntime.jsxs(DashReact.DashPanel, {
37066
37083
  height: "h-full",
37067
37084
  scrollable: true,
37068
37085
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Header, {
37069
- title: "AvailableColors"
37086
+ title: title
37070
37087
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Body, {
37071
37088
  scrollable: true,
37072
37089
  space: true,
37073
- children: shade !== null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
37090
+ children: isMain ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
37074
37091
  children: [/*#__PURE__*/jsxRuntime.jsx(CategorizedColorGrid, {
37092
+ cols: 12,
37075
37093
  onSelect: function onSelect(hex) {
37076
37094
  return handleChooseColor({
37077
37095
  colorName: hex,
@@ -37103,8 +37121,7 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
37103
37121
  })
37104
37122
  })]
37105
37123
  })
37106
- // </LayoutContainer>
37107
- );
37124
+ });
37108
37125
  };
37109
37126
 
37110
37127
  var ThemeMenuPane = function ThemeMenuPane(_ref) {