@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.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { default as Avatar } from '@mui/material/Avatar';
|
|
|
10
10
|
import { default as Backdrop } from '@mui/material/Backdrop';
|
|
11
11
|
import { default as Badge } from '@mui/material/Badge';
|
|
12
12
|
import { default as Box } from '@mui/material/Box';
|
|
13
|
+
import { BoxProps } from '@mui/material';
|
|
13
14
|
import { default as Breadcrumbs } from '@mui/material/Breadcrumbs';
|
|
14
15
|
import { ButtonProps } from '@mui/material/Button';
|
|
15
16
|
import { default as Card } from '@mui/material/Card';
|
|
@@ -212,19 +213,26 @@ export { ClickAwayListener }
|
|
|
212
213
|
|
|
213
214
|
export { Collapse }
|
|
214
215
|
|
|
216
|
+
export declare type ColorOption = {
|
|
217
|
+
color: string;
|
|
218
|
+
showBorder?: boolean;
|
|
219
|
+
};
|
|
220
|
+
|
|
215
221
|
export declare const ColorPicker: FC<ColorPickerProps>;
|
|
216
222
|
|
|
217
223
|
export declare type ColorPickerProps = {
|
|
218
224
|
value: HexaColor;
|
|
219
225
|
disabled?: boolean;
|
|
220
|
-
options?: string[];
|
|
226
|
+
options?: string[] | ColorOption[];
|
|
221
227
|
slotProps?: ColorPickerSlotProps;
|
|
222
228
|
onChange: (value: HexaColor) => void;
|
|
229
|
+
useCheckmarkSwatch?: boolean;
|
|
223
230
|
};
|
|
224
231
|
|
|
225
232
|
export declare type ColorPickerSlotProps = {
|
|
226
233
|
clickAwayListener?: Omit<ClickAwayListenerProps, "onClickAway" | "children">;
|
|
227
234
|
circlePicker?: Omit<CirclePickerProps, "colors" | "color" | "onChange">;
|
|
235
|
+
circlePickerBox?: BoxProps;
|
|
228
236
|
};
|
|
229
237
|
|
|
230
238
|
export declare type ColorVariant = "primary" | "secondary";
|
|
@@ -258,6 +266,8 @@ export declare type DatePickerProps = {
|
|
|
258
266
|
adapterLocale?: string;
|
|
259
267
|
} & DatePickerProps_2;
|
|
260
268
|
|
|
269
|
+
export declare const DEFAULT_COLOR_OPTIONS: ColorOption[];
|
|
270
|
+
|
|
261
271
|
export declare const Dialog: React.FunctionComponent<DialogProps>;
|
|
262
272
|
|
|
263
273
|
export { DialogActions }
|
|
@@ -532,6 +542,11 @@ export { StepLabel }
|
|
|
532
542
|
|
|
533
543
|
export { Stepper }
|
|
534
544
|
|
|
545
|
+
export declare interface StyledSwatchBoxProps {
|
|
546
|
+
showBorder?: boolean;
|
|
547
|
+
backgroundColor?: string;
|
|
548
|
+
}
|
|
549
|
+
|
|
535
550
|
export declare interface StyledToggleButtonGroupProps {
|
|
536
551
|
colorvariant: ColorVariant;
|
|
537
552
|
}
|
|
@@ -542,6 +557,13 @@ export declare interface StyledToggleButtonProps {
|
|
|
542
557
|
|
|
543
558
|
export { SvgIcon }
|
|
544
559
|
|
|
560
|
+
export declare type SwatchProps = {
|
|
561
|
+
color: string;
|
|
562
|
+
onClick: () => void;
|
|
563
|
+
active: boolean;
|
|
564
|
+
showBorder?: boolean;
|
|
565
|
+
};
|
|
566
|
+
|
|
545
567
|
export { Switch }
|
|
546
568
|
|
|
547
569
|
export { Tab }
|
package/dist/index.es.js
CHANGED
|
@@ -42949,6 +42949,89 @@ const ButtonGroup = ({
|
|
|
42949
42949
|
}
|
|
42950
42950
|
);
|
|
42951
42951
|
};
|
|
42952
|
+
const CheckRoundedIcon = createSvgIcon(/* @__PURE__ */ jsx("path", {
|
|
42953
|
+
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"
|
|
42954
|
+
}), "CheckRounded");
|
|
42955
|
+
const PickerBackgroundBox = styled$3(Box$1)(
|
|
42956
|
+
({ disabled }) => ({
|
|
42957
|
+
width: "4.4rem",
|
|
42958
|
+
height: "4.4rem",
|
|
42959
|
+
position: "relative",
|
|
42960
|
+
borderRadius: "50%",
|
|
42961
|
+
pointerEvents: disabled ? "none" : "auto",
|
|
42962
|
+
"&:hover, :focus, :focus-visible": {
|
|
42963
|
+
backgroundColor: disabled ? "transparent" : "#F8F9F9",
|
|
42964
|
+
outline: "none"
|
|
42965
|
+
}
|
|
42966
|
+
})
|
|
42967
|
+
);
|
|
42968
|
+
const circlePickerStyle = {
|
|
42969
|
+
position: "absolute",
|
|
42970
|
+
bottom: "5rem",
|
|
42971
|
+
right: "-2rem",
|
|
42972
|
+
backgroundColor: "white",
|
|
42973
|
+
zIndex: 1e3,
|
|
42974
|
+
padding: "1rem",
|
|
42975
|
+
borderRadius: "1rem",
|
|
42976
|
+
display: "flex",
|
|
42977
|
+
boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.1)"
|
|
42978
|
+
};
|
|
42979
|
+
const checkmarkSwatchBox = {
|
|
42980
|
+
display: "flex",
|
|
42981
|
+
flexWrap: "wrap",
|
|
42982
|
+
gap: "5px",
|
|
42983
|
+
width: "15rem"
|
|
42984
|
+
};
|
|
42985
|
+
const StyledSwatchBox = styled$3(Box$1)(
|
|
42986
|
+
({ showBorder = false, backgroundColor: backgroundColor2 }) => ({
|
|
42987
|
+
width: 20,
|
|
42988
|
+
height: 20,
|
|
42989
|
+
borderRadius: "50%",
|
|
42990
|
+
cursor: "pointer",
|
|
42991
|
+
position: "relative",
|
|
42992
|
+
display: "flex",
|
|
42993
|
+
alignItems: "center",
|
|
42994
|
+
justifyContent: "center",
|
|
42995
|
+
transition: "transform 0.2s",
|
|
42996
|
+
backgroundColor: backgroundColor2,
|
|
42997
|
+
boxSizing: "border-box",
|
|
42998
|
+
border: showBorder ? "2px solid black" : "none",
|
|
42999
|
+
"&:hover": {
|
|
43000
|
+
transform: "scale(1.1)"
|
|
43001
|
+
}
|
|
43002
|
+
})
|
|
43003
|
+
);
|
|
43004
|
+
const CheckmarkSwatch = ({
|
|
43005
|
+
color: color2,
|
|
43006
|
+
onClick,
|
|
43007
|
+
active,
|
|
43008
|
+
showBorder = false
|
|
43009
|
+
}) => {
|
|
43010
|
+
const getContrastingColor = (hexColor) => {
|
|
43011
|
+
const r2 = parseInt(hexColor.slice(1, 3), 16);
|
|
43012
|
+
const g = parseInt(hexColor.slice(3, 5), 16);
|
|
43013
|
+
const b = parseInt(hexColor.slice(5, 7), 16);
|
|
43014
|
+
const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b) / 255;
|
|
43015
|
+
return luminance > 0.5 ? "#000000" : "#ffffff";
|
|
43016
|
+
};
|
|
43017
|
+
return /* @__PURE__ */ jsx(
|
|
43018
|
+
StyledSwatchBox,
|
|
43019
|
+
{
|
|
43020
|
+
onClick,
|
|
43021
|
+
showBorder,
|
|
43022
|
+
backgroundColor: color2,
|
|
43023
|
+
children: active && /* @__PURE__ */ jsx(
|
|
43024
|
+
CheckRoundedIcon,
|
|
43025
|
+
{
|
|
43026
|
+
sx: {
|
|
43027
|
+
fontSize: 14,
|
|
43028
|
+
color: getContrastingColor(color2)
|
|
43029
|
+
}
|
|
43030
|
+
}
|
|
43031
|
+
)
|
|
43032
|
+
}
|
|
43033
|
+
);
|
|
43034
|
+
};
|
|
42952
43035
|
const ColorPickerIcon = ({
|
|
42953
43036
|
fill,
|
|
42954
43037
|
onClick
|
|
@@ -43003,37 +43086,35 @@ const ColorPickerIcon = ({
|
|
|
43003
43086
|
]
|
|
43004
43087
|
}
|
|
43005
43088
|
);
|
|
43006
|
-
const
|
|
43007
|
-
|
|
43008
|
-
|
|
43009
|
-
|
|
43010
|
-
|
|
43011
|
-
|
|
43012
|
-
|
|
43013
|
-
|
|
43014
|
-
|
|
43015
|
-
|
|
43016
|
-
|
|
43017
|
-
}
|
|
43018
|
-
|
|
43019
|
-
|
|
43020
|
-
|
|
43021
|
-
|
|
43022
|
-
|
|
43023
|
-
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
borderRadius: "1rem",
|
|
43027
|
-
display: "flex",
|
|
43028
|
-
boxShadow: "0px 0px 10px 0px rgba(0,0,0,0.1)"
|
|
43029
|
-
};
|
|
43089
|
+
const DEFAULT_COLOR_OPTIONS = [
|
|
43090
|
+
{ color: "#F44336", showBorder: false },
|
|
43091
|
+
{ color: "#E91E63", showBorder: false },
|
|
43092
|
+
{ color: "#9C27B0", showBorder: false },
|
|
43093
|
+
{ color: "#673AB7", showBorder: false },
|
|
43094
|
+
{ color: "#3F51B5", showBorder: false },
|
|
43095
|
+
{ color: "#2196F3", showBorder: false },
|
|
43096
|
+
{ color: "#03A9F4", showBorder: false },
|
|
43097
|
+
{ color: "#00BCD4", showBorder: false },
|
|
43098
|
+
{ color: "#009688", showBorder: false },
|
|
43099
|
+
{ color: "#4CAF50", showBorder: false },
|
|
43100
|
+
{ color: "#8BC34a", showBorder: false },
|
|
43101
|
+
{ color: "#CDDC39", showBorder: false },
|
|
43102
|
+
{ color: "#FFEB3B", showBorder: false },
|
|
43103
|
+
{ color: "#FFC107", showBorder: false },
|
|
43104
|
+
{ color: "#FF9800", showBorder: false },
|
|
43105
|
+
{ color: "#FF5722", showBorder: false },
|
|
43106
|
+
{ color: "#795548", showBorder: false },
|
|
43107
|
+
{ color: "#607D8B", showBorder: false }
|
|
43108
|
+
];
|
|
43030
43109
|
const ColorPicker = ({
|
|
43031
43110
|
disabled = false,
|
|
43032
43111
|
options,
|
|
43033
43112
|
value,
|
|
43034
43113
|
onChange,
|
|
43035
|
-
slotProps
|
|
43114
|
+
slotProps,
|
|
43115
|
+
useCheckmarkSwatch = false
|
|
43036
43116
|
}) => {
|
|
43117
|
+
var _a;
|
|
43037
43118
|
const [isCirclePickerVisible, setIsCirclePickerVisible] = useState(false);
|
|
43038
43119
|
const handlePickerToggle = () => {
|
|
43039
43120
|
if (disabled) return;
|
|
@@ -43047,31 +43128,64 @@ const ColorPicker = ({
|
|
|
43047
43128
|
handlePickerToggle();
|
|
43048
43129
|
}
|
|
43049
43130
|
};
|
|
43050
|
-
|
|
43051
|
-
|
|
43131
|
+
const normalizedOptions = options ? options.map(
|
|
43132
|
+
(option) => typeof option === "string" ? { color: option, showBorder: false } : { ...option, showBorder: option.showBorder ?? false }
|
|
43133
|
+
) : DEFAULT_COLOR_OPTIONS;
|
|
43134
|
+
const colorStrings = normalizedOptions.map((opt) => opt.color);
|
|
43135
|
+
return /* @__PURE__ */ jsx(
|
|
43136
|
+
ClickAwayListener$1,
|
|
43052
43137
|
{
|
|
43053
|
-
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
|
|
43057
|
-
|
|
43058
|
-
|
|
43059
|
-
|
|
43060
|
-
|
|
43061
|
-
|
|
43062
|
-
|
|
43063
|
-
|
|
43064
|
-
|
|
43065
|
-
|
|
43066
|
-
|
|
43067
|
-
|
|
43068
|
-
|
|
43069
|
-
|
|
43070
|
-
|
|
43071
|
-
|
|
43072
|
-
|
|
43138
|
+
onClickAway: handleClose,
|
|
43139
|
+
...slotProps == null ? void 0 : slotProps.clickAwayListener,
|
|
43140
|
+
children: /* @__PURE__ */ jsxs(
|
|
43141
|
+
PickerBackgroundBox,
|
|
43142
|
+
{
|
|
43143
|
+
disabled,
|
|
43144
|
+
tabIndex: 0,
|
|
43145
|
+
onKeyDown: handleKeyDown,
|
|
43146
|
+
children: [
|
|
43147
|
+
/* @__PURE__ */ jsx(ColorPickerIcon, { onClick: handlePickerToggle, fill: value }),
|
|
43148
|
+
isCirclePickerVisible && /* @__PURE__ */ jsx(
|
|
43149
|
+
Box$1,
|
|
43150
|
+
{
|
|
43151
|
+
sx: {
|
|
43152
|
+
...circlePickerStyle,
|
|
43153
|
+
...((_a = slotProps == null ? void 0 : slotProps.circlePickerBox) == null ? void 0 : _a.sx) || {}
|
|
43154
|
+
},
|
|
43155
|
+
children: useCheckmarkSwatch ? /* @__PURE__ */ jsx(Box$1, { sx: checkmarkSwatchBox, children: normalizedOptions.map((option) => /* @__PURE__ */ jsx(
|
|
43156
|
+
CheckmarkSwatch,
|
|
43157
|
+
{
|
|
43158
|
+
color: option.color,
|
|
43159
|
+
active: option.color === value,
|
|
43160
|
+
onClick: () => {
|
|
43161
|
+
onChange(option.color);
|
|
43162
|
+
handleClose();
|
|
43163
|
+
},
|
|
43164
|
+
showBorder: option.showBorder
|
|
43165
|
+
},
|
|
43166
|
+
option.color
|
|
43167
|
+
)) }) : /* @__PURE__ */ jsx(
|
|
43168
|
+
CirclePicker,
|
|
43169
|
+
{
|
|
43170
|
+
colors: colorStrings,
|
|
43171
|
+
color: value,
|
|
43172
|
+
onChange: (newColor) => {
|
|
43173
|
+
onChange(newColor.hex);
|
|
43174
|
+
handleClose();
|
|
43175
|
+
},
|
|
43176
|
+
circleSize: 20,
|
|
43177
|
+
circleSpacing: 5,
|
|
43178
|
+
width: "15rem",
|
|
43179
|
+
...slotProps == null ? void 0 : slotProps.circlePicker
|
|
43180
|
+
}
|
|
43181
|
+
)
|
|
43182
|
+
}
|
|
43183
|
+
)
|
|
43184
|
+
]
|
|
43185
|
+
}
|
|
43186
|
+
)
|
|
43073
43187
|
}
|
|
43074
|
-
)
|
|
43188
|
+
);
|
|
43075
43189
|
};
|
|
43076
43190
|
var weekOfYear$1 = { exports: {} };
|
|
43077
43191
|
var weekOfYear = weekOfYear$1.exports;
|
|
@@ -62697,6 +62811,7 @@ export {
|
|
|
62697
62811
|
ColorPicker,
|
|
62698
62812
|
Container,
|
|
62699
62813
|
CssVarsProvider,
|
|
62814
|
+
DEFAULT_COLOR_OPTIONS,
|
|
62700
62815
|
DatePicker2 as DatePicker,
|
|
62701
62816
|
Dialog2 as Dialog,
|
|
62702
62817
|
DialogActions,
|