@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.esm.js +49 -32
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +49 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -35284,24 +35284,20 @@ var ColorTile = function ColorTile(_ref) {
|
|
|
35284
35284
|
level: colorLevelName
|
|
35285
35285
|
}, rest));
|
|
35286
35286
|
|
|
35287
|
-
//
|
|
35288
|
-
|
|
35289
|
-
//
|
|
35290
|
-
//
|
|
35291
|
-
|
|
35292
|
-
//
|
|
35293
|
-
|
|
35294
|
-
|
|
35295
|
-
|
|
35296
|
-
|
|
35297
|
-
|
|
35298
|
-
// shade: shade !== null ? shade : colorFromTheme !== null && derivedShade,
|
|
35299
|
-
// stringColor,
|
|
35300
|
-
// ...rest
|
|
35301
|
-
// };
|
|
35302
|
-
|
|
35287
|
+
// If the channel value is a hex (custom-color theme — PRD
|
|
35288
|
+
// arbitrary-color-themes.md), `c.class` becomes `bg-#xxx-500`
|
|
35289
|
+
// which isn't a valid Tailwind class and renders as nothing
|
|
35290
|
+
// (the dark page background bleeds through, looking black).
|
|
35291
|
+
// Use inline style for hex backgrounds; named colors continue
|
|
35292
|
+
// through the className path so existing themes are unchanged.
|
|
35293
|
+
var colorIsHex = isHexColor(colorName);
|
|
35294
|
+
var inlineStyle = colorIsHex ? {
|
|
35295
|
+
backgroundColor: colorName
|
|
35296
|
+
} : undefined;
|
|
35297
|
+
var bgClass = colorIsHex ? "" : c["class"];
|
|
35303
35298
|
return /*#__PURE__*/jsx("div", {
|
|
35304
|
-
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(
|
|
35299
|
+
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),
|
|
35300
|
+
style: inlineStyle,
|
|
35305
35301
|
onClick: function onClick() {
|
|
35306
35302
|
return _onClick !== null ? _onClick(_objectSpread$F(_objectSpread$F({}, c), rest)) : null;
|
|
35307
35303
|
},
|
|
@@ -36933,13 +36929,26 @@ var CustomHexColorPane = function CustomHexColorPane(_ref) {
|
|
|
36933
36929
|
var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
|
|
36934
36930
|
var onSelect = _ref.onSelect,
|
|
36935
36931
|
_ref$selectedHex = _ref.selectedHex,
|
|
36936
|
-
selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex
|
|
36932
|
+
selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex,
|
|
36933
|
+
_ref$cols = _ref.cols,
|
|
36934
|
+
cols = _ref$cols === void 0 ? 6 : _ref$cols;
|
|
36937
36935
|
var families = getColorFamilies();
|
|
36938
36936
|
var _useState = useState(families[0]),
|
|
36939
36937
|
_useState2 = _slicedToArray(_useState, 2),
|
|
36940
36938
|
activeFamily = _useState2[0],
|
|
36941
36939
|
setActiveFamily = _useState2[1];
|
|
36942
36940
|
var colors = getCuratedColorGrid(activeFamily);
|
|
36941
|
+
|
|
36942
|
+
// Map the `cols` prop to a Tailwind class. The pattern set is in
|
|
36943
|
+
// the dash-electron safelist already (grid-cols-1..12).
|
|
36944
|
+
var gridColsClass = {
|
|
36945
|
+
4: "grid-cols-4",
|
|
36946
|
+
6: "grid-cols-6",
|
|
36947
|
+
8: "grid-cols-8",
|
|
36948
|
+
9: "grid-cols-9",
|
|
36949
|
+
10: "grid-cols-10",
|
|
36950
|
+
12: "grid-cols-12"
|
|
36951
|
+
}[cols] || "grid-cols-6";
|
|
36943
36952
|
return /*#__PURE__*/jsxs("div", {
|
|
36944
36953
|
className: "flex flex-col gap-3 p-3",
|
|
36945
36954
|
children: [/*#__PURE__*/jsx("div", {
|
|
@@ -36956,7 +36965,7 @@ var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
|
|
|
36956
36965
|
}, family);
|
|
36957
36966
|
})
|
|
36958
36967
|
}), /*#__PURE__*/jsx("div", {
|
|
36959
|
-
className: "grid
|
|
36968
|
+
className: "grid ".concat(gridColsClass, " gap-1"),
|
|
36960
36969
|
children: colors.map(function (hex) {
|
|
36961
36970
|
var isSelected = selectedHex && hex.toLowerCase() === selectedHex.toLowerCase();
|
|
36962
36971
|
return /*#__PURE__*/jsx("button", {
|
|
@@ -37036,24 +37045,33 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
|
37036
37045
|
});
|
|
37037
37046
|
});
|
|
37038
37047
|
}
|
|
37039
|
-
|
|
37040
|
-
|
|
37041
|
-
|
|
37042
|
-
|
|
37043
|
-
|
|
37044
|
-
|
|
37045
|
-
|
|
37046
|
-
|
|
37047
|
-
|
|
37048
|
+
|
|
37049
|
+
// The picker renders inside a modal so it has room for the full
|
|
37050
|
+
// categorized grid without the user having to scroll within a
|
|
37051
|
+
// cramped left-column. Mount/unmount of this component is driven
|
|
37052
|
+
// by the parent (ThemeMenuPane) based on `selectedColor` state —
|
|
37053
|
+
// so `isOpen` is effectively always `true` while mounted, and
|
|
37054
|
+
// closing the modal triggers `onCancel` to unmount.
|
|
37055
|
+
var isMain = shade !== null;
|
|
37056
|
+
var title = isMain ? "Pick ".concat(capitalizeFirstLetter(colorType || "color"), " color") : "Available Colors";
|
|
37057
|
+
return /*#__PURE__*/jsx(Modal, {
|
|
37058
|
+
isOpen: true,
|
|
37059
|
+
setIsOpen: function setIsOpen() {
|
|
37060
|
+
return handleCancel();
|
|
37061
|
+
},
|
|
37062
|
+
width: "w-3/4",
|
|
37063
|
+
height: "h-3/4",
|
|
37064
|
+
children: /*#__PURE__*/jsxs(DashPanel, {
|
|
37048
37065
|
height: "h-full",
|
|
37049
37066
|
scrollable: true,
|
|
37050
37067
|
children: [/*#__PURE__*/jsx(DashPanel.Header, {
|
|
37051
|
-
title:
|
|
37068
|
+
title: title
|
|
37052
37069
|
}), /*#__PURE__*/jsx(DashPanel.Body, {
|
|
37053
37070
|
scrollable: true,
|
|
37054
37071
|
space: true,
|
|
37055
|
-
children:
|
|
37072
|
+
children: isMain ? /*#__PURE__*/jsxs(Fragment, {
|
|
37056
37073
|
children: [/*#__PURE__*/jsx(CategorizedColorGrid, {
|
|
37074
|
+
cols: 12,
|
|
37057
37075
|
onSelect: function onSelect(hex) {
|
|
37058
37076
|
return handleChooseColor({
|
|
37059
37077
|
colorName: hex,
|
|
@@ -37085,8 +37103,7 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
|
37085
37103
|
})
|
|
37086
37104
|
})]
|
|
37087
37105
|
})
|
|
37088
|
-
|
|
37089
|
-
);
|
|
37106
|
+
});
|
|
37090
37107
|
};
|
|
37091
37108
|
|
|
37092
37109
|
var ThemeMenuPane = function ThemeMenuPane(_ref) {
|