@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 +36 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36951,13 +36951,26 @@ var CustomHexColorPane = function CustomHexColorPane(_ref) {
|
|
|
36951
36951
|
var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
|
|
36952
36952
|
var onSelect = _ref.onSelect,
|
|
36953
36953
|
_ref$selectedHex = _ref.selectedHex,
|
|
36954
|
-
selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex
|
|
36954
|
+
selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex,
|
|
36955
|
+
_ref$cols = _ref.cols,
|
|
36956
|
+
cols = _ref$cols === void 0 ? 6 : _ref$cols;
|
|
36955
36957
|
var families = DashReact.getColorFamilies();
|
|
36956
36958
|
var _useState = React.useState(families[0]),
|
|
36957
36959
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36958
36960
|
activeFamily = _useState2[0],
|
|
36959
36961
|
setActiveFamily = _useState2[1];
|
|
36960
36962
|
var colors = DashReact.getCuratedColorGrid(activeFamily);
|
|
36963
|
+
|
|
36964
|
+
// Map the `cols` prop to a Tailwind class. The pattern set is in
|
|
36965
|
+
// the dash-electron safelist already (grid-cols-1..12).
|
|
36966
|
+
var gridColsClass = {
|
|
36967
|
+
4: "grid-cols-4",
|
|
36968
|
+
6: "grid-cols-6",
|
|
36969
|
+
8: "grid-cols-8",
|
|
36970
|
+
9: "grid-cols-9",
|
|
36971
|
+
10: "grid-cols-10",
|
|
36972
|
+
12: "grid-cols-12"
|
|
36973
|
+
}[cols] || "grid-cols-6";
|
|
36961
36974
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36962
36975
|
className: "flex flex-col gap-3 p-3",
|
|
36963
36976
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -36974,7 +36987,7 @@ var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
|
|
|
36974
36987
|
}, family);
|
|
36975
36988
|
})
|
|
36976
36989
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36977
|
-
className: "grid
|
|
36990
|
+
className: "grid ".concat(gridColsClass, " gap-1"),
|
|
36978
36991
|
children: colors.map(function (hex) {
|
|
36979
36992
|
var isSelected = selectedHex && hex.toLowerCase() === selectedHex.toLowerCase();
|
|
36980
36993
|
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
@@ -37054,24 +37067,33 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
|
37054
37067
|
});
|
|
37055
37068
|
});
|
|
37056
37069
|
}
|
|
37057
|
-
|
|
37058
|
-
|
|
37059
|
-
|
|
37060
|
-
|
|
37061
|
-
|
|
37062
|
-
|
|
37063
|
-
|
|
37064
|
-
|
|
37065
|
-
|
|
37070
|
+
|
|
37071
|
+
// The picker renders inside a modal so it has room for the full
|
|
37072
|
+
// categorized grid without the user having to scroll within a
|
|
37073
|
+
// cramped left-column. Mount/unmount of this component is driven
|
|
37074
|
+
// by the parent (ThemeMenuPane) based on `selectedColor` state —
|
|
37075
|
+
// so `isOpen` is effectively always `true` while mounted, and
|
|
37076
|
+
// closing the modal triggers `onCancel` to unmount.
|
|
37077
|
+
var isMain = shade !== null;
|
|
37078
|
+
var title = isMain ? "Pick ".concat(DashReact.capitalizeFirstLetter(colorType || "color"), " color") : "Available Colors";
|
|
37079
|
+
return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
|
|
37080
|
+
isOpen: true,
|
|
37081
|
+
setIsOpen: function setIsOpen() {
|
|
37082
|
+
return handleCancel();
|
|
37083
|
+
},
|
|
37084
|
+
width: "w-3/4",
|
|
37085
|
+
height: "h-3/4",
|
|
37086
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(DashReact.DashPanel, {
|
|
37066
37087
|
height: "h-full",
|
|
37067
37088
|
scrollable: true,
|
|
37068
37089
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Header, {
|
|
37069
|
-
title:
|
|
37090
|
+
title: title
|
|
37070
37091
|
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Body, {
|
|
37071
37092
|
scrollable: true,
|
|
37072
37093
|
space: true,
|
|
37073
|
-
children:
|
|
37094
|
+
children: isMain ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
37074
37095
|
children: [/*#__PURE__*/jsxRuntime.jsx(CategorizedColorGrid, {
|
|
37096
|
+
cols: 12,
|
|
37075
37097
|
onSelect: function onSelect(hex) {
|
|
37076
37098
|
return handleChooseColor({
|
|
37077
37099
|
colorName: hex,
|
|
@@ -37103,8 +37125,7 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
|
37103
37125
|
})
|
|
37104
37126
|
})]
|
|
37105
37127
|
})
|
|
37106
|
-
|
|
37107
|
-
);
|
|
37128
|
+
});
|
|
37108
37129
|
};
|
|
37109
37130
|
|
|
37110
37131
|
var ThemeMenuPane = function ThemeMenuPane(_ref) {
|