@trops/dash-core 0.1.570 → 0.1.571
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 +71 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +70 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36948,6 +36948,52 @@ var CustomHexColorPane = function CustomHexColorPane(_ref) {
|
|
|
36948
36948
|
});
|
|
36949
36949
|
};
|
|
36950
36950
|
|
|
36951
|
+
var CategorizedColorGrid = function CategorizedColorGrid(_ref) {
|
|
36952
|
+
var onSelect = _ref.onSelect,
|
|
36953
|
+
_ref$selectedHex = _ref.selectedHex,
|
|
36954
|
+
selectedHex = _ref$selectedHex === void 0 ? null : _ref$selectedHex;
|
|
36955
|
+
var families = DashReact.getColorFamilies();
|
|
36956
|
+
var _useState = React.useState(families[0]),
|
|
36957
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36958
|
+
activeFamily = _useState2[0],
|
|
36959
|
+
setActiveFamily = _useState2[1];
|
|
36960
|
+
var colors = DashReact.getCuratedColorGrid(activeFamily);
|
|
36961
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
36962
|
+
className: "flex flex-col gap-3 p-3",
|
|
36963
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36964
|
+
className: "flex flex-row gap-2 flex-wrap",
|
|
36965
|
+
children: families.map(function (family) {
|
|
36966
|
+
var isActive = activeFamily === family;
|
|
36967
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
36968
|
+
type: "button",
|
|
36969
|
+
onClick: function onClick() {
|
|
36970
|
+
return setActiveFamily(family);
|
|
36971
|
+
},
|
|
36972
|
+
className: "px-3 py-1 rounded-full text-xs font-medium transition-colors ".concat(isActive ? "bg-blue-600 text-white" : "bg-gray-700 text-gray-300 hover:bg-gray-600"),
|
|
36973
|
+
children: family
|
|
36974
|
+
}, family);
|
|
36975
|
+
})
|
|
36976
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36977
|
+
className: "grid grid-cols-6 gap-1",
|
|
36978
|
+
children: colors.map(function (hex) {
|
|
36979
|
+
var isSelected = selectedHex && hex.toLowerCase() === selectedHex.toLowerCase();
|
|
36980
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
36981
|
+
type: "button",
|
|
36982
|
+
onClick: function onClick() {
|
|
36983
|
+
return onSelect(hex);
|
|
36984
|
+
},
|
|
36985
|
+
title: hex,
|
|
36986
|
+
className: "aspect-square rounded transition-transform hover:scale-110 focus:scale-110 focus:outline-none ".concat(isSelected ? "ring-2 ring-white scale-110" : ""),
|
|
36987
|
+
style: {
|
|
36988
|
+
backgroundColor: hex
|
|
36989
|
+
},
|
|
36990
|
+
"aria-label": "Select color ".concat(hex)
|
|
36991
|
+
}, hex);
|
|
36992
|
+
})
|
|
36993
|
+
})]
|
|
36994
|
+
});
|
|
36995
|
+
};
|
|
36996
|
+
|
|
36951
36997
|
var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
36952
36998
|
var _ref$currentColor = _ref.currentColor,
|
|
36953
36999
|
currentColor = _ref$currentColor === void 0 ? null : _ref$currentColor,
|
|
@@ -37021,23 +37067,34 @@ var AvailableColorsGridPane = function AvailableColorsGridPane(_ref) {
|
|
|
37021
37067
|
scrollable: true,
|
|
37022
37068
|
children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Header, {
|
|
37023
37069
|
title: "AvailableColors"
|
|
37024
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
37070
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Body, {
|
|
37025
37071
|
scrollable: true,
|
|
37026
37072
|
space: true,
|
|
37027
|
-
children:
|
|
37073
|
+
children: shade !== null ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
37074
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CategorizedColorGrid, {
|
|
37075
|
+
onSelect: function onSelect(hex) {
|
|
37076
|
+
return handleChooseColor({
|
|
37077
|
+
colorName: hex,
|
|
37078
|
+
colorType: colorType,
|
|
37079
|
+
shade: shade || 500,
|
|
37080
|
+
panelType: "main"
|
|
37081
|
+
});
|
|
37082
|
+
}
|
|
37083
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CustomHexColorPane, {
|
|
37084
|
+
onApply: function onApply(hex) {
|
|
37085
|
+
return handleChooseColor({
|
|
37086
|
+
colorName: hex,
|
|
37087
|
+
colorType: colorType,
|
|
37088
|
+
shade: shade || 500,
|
|
37089
|
+
panelType: "main"
|
|
37090
|
+
});
|
|
37091
|
+
},
|
|
37092
|
+
label: "Custom hex for ".concat(colorType || "channel")
|
|
37093
|
+
})]
|
|
37094
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
37028
37095
|
className: "flex flex-col space-y-1",
|
|
37029
37096
|
children: renderAvailableColors()
|
|
37030
|
-
})
|
|
37031
|
-
onApply: function onApply(hex) {
|
|
37032
|
-
return handleChooseColor({
|
|
37033
|
-
colorName: hex,
|
|
37034
|
-
colorType: colorType,
|
|
37035
|
-
shade: shade || 500,
|
|
37036
|
-
panelType: "main"
|
|
37037
|
-
});
|
|
37038
|
-
},
|
|
37039
|
-
label: "Custom hex for ".concat(colorType || "channel")
|
|
37040
|
-
})]
|
|
37097
|
+
})
|
|
37041
37098
|
}), onCancel && /*#__PURE__*/jsxRuntime.jsx(DashReact.DashPanel.Footer, {
|
|
37042
37099
|
children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
|
|
37043
37100
|
title: "Cancel",
|