@cgi-learning-hub/ui 1.9.0-dev.1760351621 → 1.9.0-dev.1760444330
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.cjs.js +163 -48
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.es.js +163 -48
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -42966,6 +42966,89 @@ const ButtonGroup = ({
|
|
|
42966
42966
|
}
|
|
42967
42967
|
);
|
|
42968
42968
|
};
|
|
42969
|
+
const CheckRoundedIcon = createSvgIcon(/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
42970
|
+
d: "M9 16.17 5.53 12.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0z"
|
|
42971
|
+
}), "CheckRounded");
|
|
42972
|
+
const PickerBackgroundBox = material.styled(material.Box)(
|
|
42973
|
+
({ disabled }) => ({
|
|
42974
|
+
width: "4.4rem",
|
|
42975
|
+
height: "4.4rem",
|
|
42976
|
+
position: "relative",
|
|
42977
|
+
borderRadius: "50%",
|
|
42978
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
42979
|
+
"&:hover, :focus, :focus-visible": {
|
|
42980
|
+
backgroundColor: disabled ? "transparent" : "#F8F9F9",
|
|
42981
|
+
outline: "none"
|
|
42982
|
+
}
|
|
42983
|
+
})
|
|
42984
|
+
);
|
|
42985
|
+
const circlePickerStyle = {
|
|
42986
|
+
position: "absolute",
|
|
42987
|
+
bottom: "5rem",
|
|
42988
|
+
right: "-2rem",
|
|
42989
|
+
backgroundColor: "white",
|
|
42990
|
+
zIndex: 1e3,
|
|
42991
|
+
padding: "1rem",
|
|
42992
|
+
borderRadius: "1rem",
|
|
42993
|
+
display: "flex",
|
|
42994
|
+
boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.1)"
|
|
42995
|
+
};
|
|
42996
|
+
const checkmarkSwatchBox = {
|
|
42997
|
+
display: "flex",
|
|
42998
|
+
flexWrap: "wrap",
|
|
42999
|
+
gap: "5px",
|
|
43000
|
+
width: "15rem"
|
|
43001
|
+
};
|
|
43002
|
+
const StyledSwatchBox = material.styled(material.Box)(
|
|
43003
|
+
({ showBorder = false, backgroundColor: backgroundColor2 }) => ({
|
|
43004
|
+
width: 20,
|
|
43005
|
+
height: 20,
|
|
43006
|
+
borderRadius: "50%",
|
|
43007
|
+
cursor: "pointer",
|
|
43008
|
+
position: "relative",
|
|
43009
|
+
display: "flex",
|
|
43010
|
+
alignItems: "center",
|
|
43011
|
+
justifyContent: "center",
|
|
43012
|
+
transition: "transform 0.2s",
|
|
43013
|
+
backgroundColor: backgroundColor2,
|
|
43014
|
+
boxSizing: "border-box",
|
|
43015
|
+
border: showBorder ? "2px solid black" : "none",
|
|
43016
|
+
"&:hover": {
|
|
43017
|
+
transform: "scale(1.1)"
|
|
43018
|
+
}
|
|
43019
|
+
})
|
|
43020
|
+
);
|
|
43021
|
+
const CheckmarkSwatch = ({
|
|
43022
|
+
color: color2,
|
|
43023
|
+
onClick,
|
|
43024
|
+
active,
|
|
43025
|
+
showBorder = false
|
|
43026
|
+
}) => {
|
|
43027
|
+
const getContrastingColor = (hexColor) => {
|
|
43028
|
+
const r2 = parseInt(hexColor.slice(1, 3), 16);
|
|
43029
|
+
const g = parseInt(hexColor.slice(3, 5), 16);
|
|
43030
|
+
const b = parseInt(hexColor.slice(5, 7), 16);
|
|
43031
|
+
const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b) / 255;
|
|
43032
|
+
return luminance > 0.5 ? "#000000" : "#ffffff";
|
|
43033
|
+
};
|
|
43034
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
43035
|
+
StyledSwatchBox,
|
|
43036
|
+
{
|
|
43037
|
+
onClick,
|
|
43038
|
+
showBorder,
|
|
43039
|
+
backgroundColor: color2,
|
|
43040
|
+
children: active && /* @__PURE__ */ jsxRuntime.jsx(
|
|
43041
|
+
CheckRoundedIcon,
|
|
43042
|
+
{
|
|
43043
|
+
sx: {
|
|
43044
|
+
fontSize: 14,
|
|
43045
|
+
color: getContrastingColor(color2)
|
|
43046
|
+
}
|
|
43047
|
+
}
|
|
43048
|
+
)
|
|
43049
|
+
}
|
|
43050
|
+
);
|
|
43051
|
+
};
|
|
42969
43052
|
const ColorPickerIcon = ({
|
|
42970
43053
|
fill,
|
|
42971
43054
|
onClick
|
|
@@ -43020,37 +43103,35 @@ const ColorPickerIcon = ({
|
|
|
43020
43103
|
]
|
|
43021
43104
|
}
|
|
43022
43105
|
);
|
|
43023
|
-
const
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
|
|
43027
|
-
|
|
43028
|
-
|
|
43029
|
-
|
|
43030
|
-
|
|
43031
|
-
|
|
43032
|
-
|
|
43033
|
-
|
|
43034
|
-
}
|
|
43035
|
-
|
|
43036
|
-
|
|
43037
|
-
|
|
43038
|
-
|
|
43039
|
-
|
|
43040
|
-
|
|
43041
|
-
|
|
43042
|
-
|
|
43043
|
-
borderRadius: "1rem",
|
|
43044
|
-
display: "flex",
|
|
43045
|
-
boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.1)"
|
|
43046
|
-
};
|
|
43106
|
+
const DEFAULT_COLOR_OPTIONS = [
|
|
43107
|
+
{ color: "#F44336", showBorder: false },
|
|
43108
|
+
{ color: "#E91E63", showBorder: false },
|
|
43109
|
+
{ color: "#9C27B0", showBorder: false },
|
|
43110
|
+
{ color: "#673AB7", showBorder: false },
|
|
43111
|
+
{ color: "#3F51B5", showBorder: false },
|
|
43112
|
+
{ color: "#2196F3", showBorder: false },
|
|
43113
|
+
{ color: "#03A9F4", showBorder: false },
|
|
43114
|
+
{ color: "#00BCD4", showBorder: false },
|
|
43115
|
+
{ color: "#009688", showBorder: false },
|
|
43116
|
+
{ color: "#4CAF50", showBorder: false },
|
|
43117
|
+
{ color: "#8BC34a", showBorder: false },
|
|
43118
|
+
{ color: "#CDDC39", showBorder: false },
|
|
43119
|
+
{ color: "#FFEB3B", showBorder: false },
|
|
43120
|
+
{ color: "#FFC107", showBorder: false },
|
|
43121
|
+
{ color: "#FF9800", showBorder: false },
|
|
43122
|
+
{ color: "#FF5722", showBorder: false },
|
|
43123
|
+
{ color: "#795548", showBorder: false },
|
|
43124
|
+
{ color: "#607D8B", showBorder: false }
|
|
43125
|
+
];
|
|
43047
43126
|
const ColorPicker = ({
|
|
43048
43127
|
disabled = false,
|
|
43049
43128
|
options,
|
|
43050
43129
|
value,
|
|
43051
43130
|
onChange,
|
|
43052
|
-
slotProps
|
|
43131
|
+
slotProps,
|
|
43132
|
+
useCheckmarkSwatch = false
|
|
43053
43133
|
}) => {
|
|
43134
|
+
var _a;
|
|
43054
43135
|
const [isCirclePickerVisible, setIsCirclePickerVisible] = React.useState(false);
|
|
43055
43136
|
const handlePickerToggle = () => {
|
|
43056
43137
|
if (disabled) return;
|
|
@@ -43064,31 +43145,64 @@ const ColorPicker = ({
|
|
|
43064
43145
|
handlePickerToggle();
|
|
43065
43146
|
}
|
|
43066
43147
|
};
|
|
43067
|
-
|
|
43068
|
-
|
|
43148
|
+
const normalizedOptions = options ? options.map(
|
|
43149
|
+
(option) => typeof option === "string" ? { color: option, showBorder: false } : { ...option, showBorder: option.showBorder ?? false }
|
|
43150
|
+
) : DEFAULT_COLOR_OPTIONS;
|
|
43151
|
+
const colorStrings = normalizedOptions.map((opt) => opt.color);
|
|
43152
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
43153
|
+
material.ClickAwayListener,
|
|
43069
43154
|
{
|
|
43070
|
-
|
|
43071
|
-
|
|
43072
|
-
|
|
43073
|
-
|
|
43074
|
-
|
|
43075
|
-
|
|
43076
|
-
|
|
43077
|
-
|
|
43078
|
-
|
|
43079
|
-
|
|
43080
|
-
|
|
43081
|
-
|
|
43082
|
-
|
|
43083
|
-
|
|
43084
|
-
|
|
43085
|
-
|
|
43086
|
-
|
|
43087
|
-
|
|
43088
|
-
|
|
43089
|
-
|
|
43155
|
+
onClickAway: handleClose,
|
|
43156
|
+
...slotProps == null ? void 0 : slotProps.clickAwayListener,
|
|
43157
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43158
|
+
PickerBackgroundBox,
|
|
43159
|
+
{
|
|
43160
|
+
disabled,
|
|
43161
|
+
tabIndex: 0,
|
|
43162
|
+
onKeyDown: handleKeyDown,
|
|
43163
|
+
children: [
|
|
43164
|
+
/* @__PURE__ */ jsxRuntime.jsx(ColorPickerIcon, { onClick: handlePickerToggle, fill: value }),
|
|
43165
|
+
isCirclePickerVisible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
43166
|
+
material.Box,
|
|
43167
|
+
{
|
|
43168
|
+
sx: {
|
|
43169
|
+
...circlePickerStyle,
|
|
43170
|
+
...((_a = slotProps == null ? void 0 : slotProps.circlePickerBox) == null ? void 0 : _a.sx) || {}
|
|
43171
|
+
},
|
|
43172
|
+
children: useCheckmarkSwatch ? /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: checkmarkSwatchBox, children: normalizedOptions.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
43173
|
+
CheckmarkSwatch,
|
|
43174
|
+
{
|
|
43175
|
+
color: option.color,
|
|
43176
|
+
active: option.color === value,
|
|
43177
|
+
onClick: () => {
|
|
43178
|
+
onChange(option.color);
|
|
43179
|
+
handleClose();
|
|
43180
|
+
},
|
|
43181
|
+
showBorder: option.showBorder
|
|
43182
|
+
},
|
|
43183
|
+
option.color
|
|
43184
|
+
)) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
43185
|
+
reactColor.CirclePicker,
|
|
43186
|
+
{
|
|
43187
|
+
colors: colorStrings,
|
|
43188
|
+
color: value,
|
|
43189
|
+
onChange: (newColor) => {
|
|
43190
|
+
onChange(newColor.hex);
|
|
43191
|
+
handleClose();
|
|
43192
|
+
},
|
|
43193
|
+
circleSize: 20,
|
|
43194
|
+
circleSpacing: 5,
|
|
43195
|
+
width: "15rem",
|
|
43196
|
+
...slotProps == null ? void 0 : slotProps.circlePicker
|
|
43197
|
+
}
|
|
43198
|
+
)
|
|
43199
|
+
}
|
|
43200
|
+
)
|
|
43201
|
+
]
|
|
43202
|
+
}
|
|
43203
|
+
)
|
|
43090
43204
|
}
|
|
43091
|
-
)
|
|
43205
|
+
);
|
|
43092
43206
|
};
|
|
43093
43207
|
var weekOfYear$1 = { exports: {} };
|
|
43094
43208
|
var weekOfYear = weekOfYear$1.exports;
|
|
@@ -62721,6 +62835,7 @@ exports.Collapse = Collapse;
|
|
|
62721
62835
|
exports.ColorPicker = ColorPicker;
|
|
62722
62836
|
exports.Container = Container;
|
|
62723
62837
|
exports.CssVarsProvider = CssVarsProvider;
|
|
62838
|
+
exports.DEFAULT_COLOR_OPTIONS = DEFAULT_COLOR_OPTIONS;
|
|
62724
62839
|
exports.DatePicker = DatePicker2;
|
|
62725
62840
|
exports.Dialog = Dialog2;
|
|
62726
62841
|
exports.DialogActions = DialogActions;
|