@atom-learning/components 6.6.0-beta.5 → 6.7.0

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 CHANGED
@@ -1171,19 +1171,26 @@ var avatarRootStyles = [
1171
1171
  "rounded-full",
1172
1172
  "border-2",
1173
1173
  "border-grey-200",
1174
- "bg-white",
1174
+ "bg-(--bg-color)",
1175
1175
  "overflow-hidden"
1176
1176
  ];
1177
1177
  var StyledDiv = styled("div", {
1178
1178
  base: avatarRootStyles,
1179
- variants: { size: {
1180
- xs: ["size-6"],
1181
- sm: ["size-8"],
1182
- md: ["size-10"],
1183
- lg: ["size-12"],
1184
- xl: ["size-16"],
1185
- xxl: ["size-24"]
1186
- } }
1179
+ variants: {
1180
+ size: {
1181
+ xs: ["size-6"],
1182
+ sm: ["size-8"],
1183
+ md: ["size-10"],
1184
+ lg: ["size-12"],
1185
+ xl: ["size-16"],
1186
+ xxl: ["size-24"]
1187
+ },
1188
+ emphasis: {
1189
+ bold: ["border-0", "[&>p]:text-white"],
1190
+ subtle: ["border-0"],
1191
+ white: []
1192
+ }
1193
+ }
1187
1194
  });
1188
1195
  var StyledButton$4 = styled("button", {
1189
1196
  base: [
@@ -1200,14 +1207,21 @@ var StyledButton$4 = styled("button", {
1200
1207
  "disabled:cursor-not-allowed",
1201
1208
  "disabled:opacity-30"
1202
1209
  ],
1203
- variants: { size: {
1204
- xs: ["size-6"],
1205
- sm: ["size-8"],
1206
- md: ["size-10"],
1207
- lg: ["size-12"],
1208
- xl: ["size-16"],
1209
- xxl: ["size-24"]
1210
- } }
1210
+ variants: {
1211
+ size: {
1212
+ xs: ["size-6"],
1213
+ sm: ["size-8"],
1214
+ md: ["size-10"],
1215
+ lg: ["size-12"],
1216
+ xl: ["size-16"],
1217
+ xxl: ["size-24"]
1218
+ },
1219
+ emphasis: {
1220
+ bold: ["border-0", "[&>p]:text-white"],
1221
+ subtle: ["border-0"],
1222
+ white: []
1223
+ }
1224
+ }
1211
1225
  });
1212
1226
  var AvatarRootProvider = ({ children, name, size }) => {
1213
1227
  const value = react.useMemo(() => ({
@@ -1216,15 +1230,46 @@ var AvatarRootProvider = ({ children, name, size }) => {
1216
1230
  }), [name, size]);
1217
1231
  return /* @__PURE__ */ react.createElement(AvatarRootContext.Provider, { value }, children);
1218
1232
  };
1219
- var AvatarRoot = ({ children, size = "lg", name, disabled = false, onClick }) => /* @__PURE__ */ react.createElement(AvatarRootProvider, {
1220
- name,
1221
- size
1222
- }, onClick ? /* @__PURE__ */ react.createElement(StyledButton$4, {
1223
- size,
1224
- disabled,
1225
- onClick: disabled ? void 0 : onClick,
1226
- className: disabled ? "cursor-auto" : "cursor-pointer"
1227
- }, children) : /* @__PURE__ */ react.createElement(StyledDiv, { size }, children));
1233
+ var DS_COLORS = [
1234
+ "maroon",
1235
+ "red",
1236
+ "magenta",
1237
+ "pink",
1238
+ "purple",
1239
+ "lapis",
1240
+ "blue",
1241
+ "cyan",
1242
+ "teal",
1243
+ "green",
1244
+ "lime",
1245
+ "yellow",
1246
+ "orange"
1247
+ ];
1248
+ var getBackgroundColor = ({ emphasis, name }) => {
1249
+ if (emphasis === "white" || !name) return "white";
1250
+ return `var(--color-${DS_COLORS[name.toLocaleUpperCase().charCodeAt(0) % DS_COLORS.length]}-${emphasis === "bold" ? 700 : 300})`;
1251
+ };
1252
+ var AvatarRoot = ({ children, size = "lg", name, emphasis = "white", disabled = false, onClick }) => {
1253
+ const backgroundColor = getBackgroundColor({
1254
+ emphasis,
1255
+ name
1256
+ });
1257
+ return /* @__PURE__ */ react.createElement(AvatarRootProvider, {
1258
+ name,
1259
+ size
1260
+ }, onClick ? /* @__PURE__ */ react.createElement(StyledButton$4, {
1261
+ size,
1262
+ style: { "--bg-color": backgroundColor },
1263
+ disabled,
1264
+ onClick: disabled ? void 0 : onClick,
1265
+ className: (0, clsx.default)(disabled ? "cursor-auto" : "cursor-pointer"),
1266
+ emphasis
1267
+ }, children) : /* @__PURE__ */ react.createElement(StyledDiv, {
1268
+ size,
1269
+ style: { "--bg-color": backgroundColor },
1270
+ emphasis
1271
+ }, children));
1272
+ };
1228
1273
  var Avatar = Object.assign(AvatarRoot, {
1229
1274
  Image: AvatarImage,
1230
1275
  Initial: AvatarInitial,
@@ -2858,26 +2903,36 @@ var StyledRoot$4 = styled("div", {
2858
2903
  "disabled:opacity-30",
2859
2904
  "disabled:pointer-events-none"
2860
2905
  ],
2861
- variants: { size: {
2862
- sm: [
2863
- "h-6",
2864
- "text-sm",
2865
- "leading-[1.53]",
2866
- "capsize-[0.4056]"
2867
- ],
2868
- md: [
2869
- "h-8",
2870
- "text-sm",
2871
- "leading-[1.53]",
2872
- "capsize-[0.4056]"
2873
- ],
2874
- lg: [
2875
- "h-10",
2876
- "text-md",
2877
- "leading-normal",
2878
- "capsize-[0.3864]"
2879
- ]
2880
- } }
2906
+ variants: {
2907
+ size: {
2908
+ sm: [
2909
+ "h-6",
2910
+ "text-sm",
2911
+ "leading-[1.53]",
2912
+ "capsize-[0.4056]"
2913
+ ],
2914
+ md: [
2915
+ "h-8",
2916
+ "text-sm",
2917
+ "leading-[1.53]",
2918
+ "capsize-[0.4056]"
2919
+ ],
2920
+ lg: [
2921
+ "h-10",
2922
+ "text-md",
2923
+ "leading-normal",
2924
+ "capsize-[0.3864]"
2925
+ ]
2926
+ },
2927
+ appearance: {
2928
+ standard: [],
2929
+ modern: [
2930
+ "border-grey-900",
2931
+ "text-grey-900",
2932
+ "bg-grey-100"
2933
+ ]
2934
+ }
2935
+ }
2881
2936
  });
2882
2937
  var ChipRootContext = react.createContext({});
2883
2938
  var ChipRootProvider = ({ size, children }) => {
@@ -2966,29 +3021,45 @@ ChipDismissibleGroup.displayName = "ChipDismissibleGroup";
2966
3021
  //#endregion
2967
3022
  //#region src/components/chip-toggle-group/ChipToggleGroupItem.tsx
2968
3023
  var StyledChipToggleIcon = styled(Icon, { base: ["hidden"] });
2969
- var StyledChipToggleGroupItem = styled(Chip, { base: [
2970
- "flex",
2971
- "not-disabled:cursor-pointer",
2972
- "not-disabled:data-[state=on]:hover:bg-white",
2973
- "not-disabled:data-[state=on]:hover:text-primary-1000",
2974
- "not-disabled:focus-visible:outline-none",
2975
- "not-disabled:focus-visible:relative",
2976
- "not-disabled:focus-visible:shadow-[var(--color-primary-800)_0px_0px_0px_4px]",
2977
- "not-disabled:focus-visible:shadow-[white_0px_0px_0px_2px]",
2978
- "not-disabled:focus-visible:z-1",
2979
- "not-disabled:hover:bg-grey-200",
2980
- "not-disabled:hover:border-current",
2981
- "not-disabled:hover:text-grey-1000",
2982
- "data-[state=off]:bg-white",
2983
- "data-[state=off]:border-grey-600",
2984
- "data-[state=off]:text-grey-800",
2985
- "data-[state=on]:[&_svg]:block"
2986
- ] });
2987
- var ChipToggleGroupItem = ({ size = "md", children, ...rest }) => {
3024
+ var StyledChipToggleGroupItem = styled(Chip, {
3025
+ base: [
3026
+ "flex",
3027
+ "not-disabled:cursor-pointer",
3028
+ "not-disabled:data-[state=on]:hover:bg-white",
3029
+ "not-disabled:data-[state=on]:hover:text-primary-1000",
3030
+ "not-disabled:focus-visible:outline-none",
3031
+ "not-disabled:focus-visible:relative",
3032
+ "not-disabled:focus-visible:shadow-[var(--color-primary-800)_0px_0px_0px_4px]",
3033
+ "not-disabled:focus-visible:shadow-[white_0px_0px_0px_2px]",
3034
+ "not-disabled:focus-visible:z-1",
3035
+ "not-disabled:hover:bg-grey-200",
3036
+ "not-disabled:hover:border-current",
3037
+ "not-disabled:hover:text-grey-1000",
3038
+ "data-[state=off]:bg-white",
3039
+ "data-[state=off]:border-grey-600",
3040
+ "data-[state=off]:text-grey-800",
3041
+ "data-[state=on]:[&_svg]:block"
3042
+ ],
3043
+ variants: { appearance: {
3044
+ standard: [],
3045
+ modern: [
3046
+ "data-[state=off]:bg-grey-100",
3047
+ "data-[state=off]:border-transparent",
3048
+ "data-[state=on]:border-grey-900",
3049
+ "data-[state=on]:text-grey-900",
3050
+ "data-[state=on]:bg-white",
3051
+ "data-[state=on]:font-bold"
3052
+ ]
3053
+ } }
3054
+ });
3055
+ var ChipToggleGroupItem = ({ size = "md", appearance, children, ...rest }) => {
2988
3056
  return /* @__PURE__ */ react.createElement(_radix_ui_react_toggle_group.Item, {
2989
3057
  ...rest,
2990
3058
  asChild: true
2991
- }, /* @__PURE__ */ react.createElement(StyledChipToggleGroupItem, { as: "button" }, /* @__PURE__ */ react.createElement(StyledChipToggleIcon, {
3059
+ }, /* @__PURE__ */ react.createElement(StyledChipToggleGroupItem, {
3060
+ as: "button",
3061
+ appearance
3062
+ }, /* @__PURE__ */ react.createElement(StyledChipToggleIcon, {
2992
3063
  is: _atom_learning_icons.Ok,
2993
3064
  size: size === "lg" ? "md" : "sm"
2994
3065
  }), /* @__PURE__ */ react.createElement(Chip.Content, null, children)));