@trops/dash-core 0.1.571 → 0.1.572

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.esm.js CHANGED
@@ -36933,13 +36933,26 @@ var CustomHexColorPane = function CustomHexColorPane(_ref) {
36933
36933
  var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
36934
36934
  var onSelect = _ref.onSelect,
36935
36935
  _ref$selectedHex = _ref.selectedHex,
36936
- selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex;
36936
+ selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex,
36937
+ _ref$cols = _ref.cols,
36938
+ cols = _ref$cols === void 0 ? 6 : _ref$cols;
36937
36939
  var families = getColorFamilies();
36938
36940
  var _useState = useState(families[0]),
36939
36941
  _useState2 = _slicedToArray(_useState, 2),
36940
36942
  activeFamily = _useState2[0],
36941
36943
  setActiveFamily = _useState2[1];
36942
36944
  var colors = getCuratedColorGrid(activeFamily);
36945
+
36946
+ // Map the `cols` prop to a Tailwind class. The pattern set is in
36947
+ // the dash-electron safelist already (grid-cols-1..12).
36948
+ var gridColsClass = {
36949
+ 4: "grid-cols-4",
36950
+ 6: "grid-cols-6",
36951
+ 8: "grid-cols-8",
36952
+ 9: "grid-cols-9",
36953
+ 10: "grid-cols-10",
36954
+ 12: "grid-cols-12"
36955
+ }[cols] || "grid-cols-6";
36943
36956
  return /*#__PURE__*/jsxs("div", {
36944
36957
  className: "flex flex-col gap-3 p-3",
36945
36958
  children: [/*#__PURE__*/jsx("div", {
@@ -36956,7 +36969,7 @@ var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
36956
36969
  }, family);
36957
36970
  })
36958
36971
  }), /*#__PURE__*/jsx("div", {
36959
- className: "grid grid-cols-6 gap-1",
36972
+ className: "grid ".concat(gridColsClass, " gap-1"),
36960
36973
  children: colors.map(function (hex) {
36961
36974
  var isSelected = selectedHex && hex.toLowerCase() === selectedHex.toLowerCase();
36962
36975
  return /*#__PURE__*/jsx("button", {
@@ -37036,24 +37049,33 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
37036
37049
  });
37037
37050
  });
37038
37051
  }
37039
- return (
37040
- /*#__PURE__*/
37041
- // <LayoutContainer
37042
- // direction="col"
37043
- // scrollable={false}
37044
- // className="space-y-1"
37045
- // height={"h-full"}
37046
- // >
37047
- jsxs(DashPanel, {
37052
+
37053
+ // The picker renders inside a modal so it has room for the full
37054
+ // categorized grid without the user having to scroll within a
37055
+ // cramped left-column. Mount/unmount of this component is driven
37056
+ // by the parent (ThemeMenuPane) based on `selectedColor` state —
37057
+ // so `isOpen` is effectively always `true` while mounted, and
37058
+ // closing the modal triggers `onCancel` to unmount.
37059
+ var isMain = shade !== null;
37060
+ var title = isMain ? "Pick ".concat(capitalizeFirstLetter(colorType || "color"), " color") : "Available Colors";
37061
+ return /*#__PURE__*/jsx(Modal, {
37062
+ isOpen: true,
37063
+ setIsOpen: function setIsOpen() {
37064
+ return handleCancel();
37065
+ },
37066
+ width: "w-3/4",
37067
+ height: "h-3/4",
37068
+ children: /*#__PURE__*/jsxs(DashPanel, {
37048
37069
  height: "h-full",
37049
37070
  scrollable: true,
37050
37071
  children: [/*#__PURE__*/jsx(DashPanel.Header, {
37051
- title: "AvailableColors"
37072
+ title: title
37052
37073
  }), /*#__PURE__*/jsx(DashPanel.Body, {
37053
37074
  scrollable: true,
37054
37075
  space: true,
37055
- children: shade !== null ? /*#__PURE__*/jsxs(Fragment, {
37076
+ children: isMain ? /*#__PURE__*/jsxs(Fragment, {
37056
37077
  children: [/*#__PURE__*/jsx(CategorizedColorGrid, {
37078
+ cols: 12,
37057
37079
  onSelect: function onSelect(hex) {
37058
37080
  return handleChooseColor({
37059
37081
  colorName: hex,
@@ -37085,8 +37107,7 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
37085
37107
  })
37086
37108
  })]
37087
37109
  })
37088
- // </LayoutContainer>
37089
- );
37110
+ });
37090
37111
  };
37091
37112
 
37092
37113
  var ThemeMenuPane = function ThemeMenuPane(_ref) {