@cambly/syntax-core 9.8.0 → 10.0.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/Avatar/Avatar.css +17 -16
- package/dist/Avatar/Avatar.css.map +1 -1
- package/dist/Avatar/Avatar.d.ts +3 -2
- package/dist/Avatar/Avatar.js +3 -2
- package/dist/Avatar/Avatar.mjs +2 -1
- package/dist/AvatarGroup/AvatarGroup.css +0 -28
- package/dist/AvatarGroup/AvatarGroup.css.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +42 -12
- package/dist/AvatarGroup/AvatarGroup.js +4 -4
- package/dist/AvatarGroup/AvatarGroup.mjs +5 -5
- package/dist/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/dist/Checkbox/Checkbox.d.ts +1 -1
- package/dist/RadioButton/RadioButton.d.ts +1 -1
- package/dist/SelectList/SelectList.js +2 -2
- package/dist/SelectList/SelectList.mjs +1 -1
- package/dist/__chunks/F7PM3X2U.mjs +42 -0
- package/dist/__chunks/F7PM3X2U.mjs.map +1 -0
- package/dist/__chunks/{U35WIBLZ.mjs → H3DNC3QP.mjs} +1 -1
- package/dist/__chunks/{U35WIBLZ.mjs.map → H3DNC3QP.mjs.map} +1 -1
- package/dist/__chunks/JD6Q4NMG.mjs +118 -0
- package/dist/__chunks/JD6Q4NMG.mjs.map +1 -0
- package/dist/__chunks/MMHLD5IF.js +118 -0
- package/dist/__chunks/MMHLD5IF.js.map +1 -0
- package/dist/__chunks/SSXWBCF3.js +42 -0
- package/dist/__chunks/SSXWBCF3.js.map +1 -0
- package/dist/__chunks/{5KKBFAX4.js → TUACMS2V.js} +1 -1
- package/dist/__chunks/{5KKBFAX4.js.map → TUACMS2V.js.map} +1 -1
- package/dist/index.css +17 -16
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +4 -5
- package/dist/index.mjs +5 -6
- package/package.json +3 -3
- package/dist/AvatarGroup/AvatarGroupAvatar.css +0 -1811
- package/dist/AvatarGroup/AvatarGroupAvatar.css.map +0 -1
- package/dist/AvatarGroup/AvatarGroupAvatar.d.ts +0 -38
- package/dist/AvatarGroup/AvatarGroupAvatar.js +0 -13
- package/dist/AvatarGroup/AvatarGroupAvatar.js.map +0 -1
- package/dist/AvatarGroup/AvatarGroupAvatar.mjs +0 -13
- package/dist/AvatarGroup/AvatarGroupAvatar.mjs.map +0 -1
- package/dist/__chunks/5FTIZFPF.js +0 -34
- package/dist/__chunks/5FTIZFPF.js.map +0 -1
- package/dist/__chunks/I4H3F6ZC.mjs +0 -61
- package/dist/__chunks/I4H3F6ZC.mjs.map +0 -1
- package/dist/__chunks/L34SSETB.mjs +0 -58
- package/dist/__chunks/L34SSETB.mjs.map +0 -1
- package/dist/__chunks/X55E7W4C.mjs +0 -34
- package/dist/__chunks/X55E7W4C.mjs.map +0 -1
- package/dist/__chunks/YHHO5POQ.js +0 -61
- package/dist/__chunks/YHHO5POQ.js.map +0 -1
- package/dist/__chunks/Z3JCDZYS.js +0 -58
- package/dist/__chunks/Z3JCDZYS.js.map +0 -1
|
@@ -1,24 +1,54 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import AvatarGroupAvatar from './AvatarGroupAvatar.js';
|
|
1
|
+
import { ReactNode, ReactElement } from 'react';
|
|
3
2
|
|
|
3
|
+
type Size = "sm" | "md" | "lg" | "xl";
|
|
4
|
+
type Orientation = "standard" | "reverse";
|
|
5
|
+
type AvatarGroupContextType = {
|
|
6
|
+
size: Size;
|
|
7
|
+
orientation: Orientation;
|
|
8
|
+
};
|
|
9
|
+
declare function useAvatarGroup(): AvatarGroupContextType | null;
|
|
4
10
|
/**
|
|
5
11
|
* [AvatarGroup](https://cambly-syntax.vercel.app/?path=/docs/components-avatargroup--docs) is a stack of avatars to represent a group of people
|
|
12
|
+
*
|
|
13
|
+
* Pass in Avatar components as children to the AvatarGroup component. The size prop that is passed into the AvatarGroup component will override Avatar's size prop..
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
*
|
|
17
|
+
* <AvatarGroup size="xl" orientation="standard">
|
|
18
|
+
* <Avatar accessibilityLabel="Joseph Liotta" src="image.png" />
|
|
19
|
+
* <Avatar accessibilityLabel="Joseph Liotta" src="image.png" />
|
|
20
|
+
* <Avatar accessibilityLabel="Joseph Liotta" src="image.png" />
|
|
21
|
+
* </AvatarGroup>
|
|
22
|
+
*
|
|
6
23
|
*/
|
|
7
|
-
declare function AvatarGroup({
|
|
24
|
+
declare function AvatarGroup({ size, orientation, children, }: {
|
|
8
25
|
/**
|
|
9
|
-
*
|
|
26
|
+
* Size of the avatars in the AvatarGroup.
|
|
27
|
+
*
|
|
28
|
+
* * `sm`: 24px
|
|
29
|
+
* * `md`: 40px
|
|
30
|
+
* * `lg`: 72px
|
|
31
|
+
* * `xl`: 128px
|
|
32
|
+
*
|
|
33
|
+
* @defaultValue `md`
|
|
10
34
|
*/
|
|
11
|
-
|
|
35
|
+
size?: Size;
|
|
36
|
+
/**
|
|
37
|
+
* Orientation of the AvatarGroup.
|
|
38
|
+
* This describes the order of rendering of the Avatar components.
|
|
39
|
+
* Standard renders the Avatar components with the right component on top.
|
|
40
|
+
* Reverse renders the Avatar components with the left component on top.
|
|
41
|
+
*
|
|
42
|
+
* @defaultValue `standard`
|
|
43
|
+
*/
|
|
44
|
+
orientation?: Orientation;
|
|
12
45
|
/**
|
|
13
|
-
*
|
|
14
|
-
* standard - avatars stack from right to left
|
|
15
|
-
* reverse - avatars stack from left to right
|
|
46
|
+
* Avatars to be rendered within the AvatarGroup.
|
|
16
47
|
*/
|
|
17
|
-
|
|
18
|
-
}):
|
|
48
|
+
children: ReactNode;
|
|
49
|
+
}): ReactElement;
|
|
19
50
|
declare namespace AvatarGroup {
|
|
20
51
|
var displayName: string;
|
|
21
|
-
var Avatar: typeof AvatarGroupAvatar;
|
|
22
52
|
}
|
|
23
53
|
|
|
24
|
-
export { AvatarGroup as default };
|
|
54
|
+
export { AvatarGroup as default, useAvatarGroup };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require('../__chunks/
|
|
5
|
-
require('../__chunks/Z3JCDZYS.js');
|
|
3
|
+
|
|
4
|
+
var _SSXWBCF3js = require('../__chunks/SSXWBCF3.js');
|
|
6
5
|
require('../__chunks/PYNS67IV.js');
|
|
7
6
|
require('../__chunks/TPMQI44L.js');
|
|
8
7
|
require('../__chunks/ERXGNP37.js');
|
|
@@ -10,5 +9,6 @@ require('../__chunks/5AR53MHD.js');
|
|
|
10
9
|
require('../__chunks/LULBCTQR.js');
|
|
11
10
|
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
exports.default = _SSXWBCF3js.AvatarGroup; exports.useAvatarGroup = _SSXWBCF3js.useAvatarGroup;
|
|
14
14
|
//# sourceMappingURL=AvatarGroup.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AvatarGroup
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "../__chunks/L34SSETB.mjs";
|
|
2
|
+
AvatarGroup,
|
|
3
|
+
useAvatarGroup
|
|
4
|
+
} from "../__chunks/F7PM3X2U.mjs";
|
|
6
5
|
import "../__chunks/LKQ7PJ4S.mjs";
|
|
7
6
|
import "../__chunks/3PCHHAIY.mjs";
|
|
8
7
|
import "../__chunks/FWVHWU47.mjs";
|
|
9
8
|
import "../__chunks/IXDA4ZXP.mjs";
|
|
10
9
|
import "../__chunks/CUDAH5IW.mjs";
|
|
11
10
|
export {
|
|
12
|
-
AvatarGroup as default
|
|
11
|
+
AvatarGroup as default,
|
|
12
|
+
useAvatarGroup
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=AvatarGroup.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _TUACMS2Vjs = require('../__chunks/TUACMS2V.js');
|
|
4
4
|
require('../__chunks/HOUO3WV6.js');
|
|
5
5
|
require('../__chunks/2O6FDRTF.js');
|
|
6
6
|
require('../__chunks/F3ZST4RL.js');
|
|
@@ -11,5 +11,5 @@ require('../__chunks/5AR53MHD.js');
|
|
|
11
11
|
require('../__chunks/LULBCTQR.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.default =
|
|
14
|
+
exports.default = _TUACMS2Vjs.SelectList;
|
|
15
15
|
//# sourceMappingURL=SelectList.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box_default
|
|
3
|
+
} from "./LKQ7PJ4S.mjs";
|
|
4
|
+
|
|
5
|
+
// src/AvatarGroup/AvatarGroup.tsx
|
|
6
|
+
import {
|
|
7
|
+
createContext,
|
|
8
|
+
useContext
|
|
9
|
+
} from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
"use client";
|
|
12
|
+
var AvatarGroupContext = createContext(null);
|
|
13
|
+
function useAvatarGroup() {
|
|
14
|
+
const context = useContext(AvatarGroupContext);
|
|
15
|
+
return !context ? null : context;
|
|
16
|
+
}
|
|
17
|
+
function AvatarGroup({
|
|
18
|
+
size = "md",
|
|
19
|
+
orientation = "standard",
|
|
20
|
+
children
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ jsx(AvatarGroupContext.Provider, { value: { size, orientation }, children: /* @__PURE__ */ jsx(
|
|
23
|
+
Box_default,
|
|
24
|
+
{
|
|
25
|
+
display: "flex",
|
|
26
|
+
justifyContent: orientation === "standard" ? "start" : "end",
|
|
27
|
+
dangerouslySetInlineStyle: {
|
|
28
|
+
__style: {
|
|
29
|
+
flexDirection: orientation === "standard" ? "row" : "row-reverse"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
35
|
+
}
|
|
36
|
+
AvatarGroup.displayName = "AvatarGroup";
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
useAvatarGroup,
|
|
40
|
+
AvatarGroup
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=F7PM3X2U.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactNode,\n createContext,\n useContext,\n type ReactElement,\n} from \"react\";\nimport Box from \"../Box/Box\";\n\ntype Size = \"sm\" | \"md\" | \"lg\" | \"xl\";\ntype Orientation = \"standard\" | \"reverse\";\n\ntype AvatarGroupContextType = {\n size: Size;\n orientation: Orientation;\n};\n\nconst AvatarGroupContext = createContext<AvatarGroupContextType | null>(null);\n\nexport function useAvatarGroup(): AvatarGroupContextType | null {\n const context = useContext(AvatarGroupContext);\n return !context ? null : context;\n}\n\n/**\n * [AvatarGroup](https://cambly-syntax.vercel.app/?path=/docs/components-avatargroup--docs) is a stack of avatars to represent a group of people\n *\n * Pass in Avatar components as children to the AvatarGroup component. The size prop that is passed into the AvatarGroup component will override Avatar's size prop..\n *\n * Usage:\n *\n * <AvatarGroup size=\"xl\" orientation=\"standard\">\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * </AvatarGroup>\n *\n */\nexport default function AvatarGroup({\n size = \"md\",\n orientation = \"standard\",\n children,\n}: {\n /**\n * Size of the avatars in the AvatarGroup.\n *\n * * `sm`: 24px\n * * `md`: 40px\n * * `lg`: 72px\n * * `xl`: 128px\n *\n * @defaultValue `md`\n */\n size?: Size;\n /**\n * Orientation of the AvatarGroup.\n * This describes the order of rendering of the Avatar components.\n * Standard renders the Avatar components with the right component on top.\n * Reverse renders the Avatar components with the left component on top.\n *\n * @defaultValue `standard`\n */\n orientation?: Orientation;\n /**\n * Avatars to be rendered within the AvatarGroup.\n */\n children: ReactNode;\n}): ReactElement {\n return (\n <AvatarGroupContext.Provider value={{ size, orientation }}>\n <Box\n display=\"flex\"\n justifyContent={orientation === \"standard\" ? \"start\" : \"end\"}\n dangerouslySetInlineStyle={{\n __style: {\n flexDirection: orientation === \"standard\" ? \"row\" : \"row-reverse\",\n },\n }}\n >\n {children}\n </Box>\n </AvatarGroupContext.Provider>\n );\n}\n\nAvatarGroup.displayName = \"AvatarGroup\";\n"],"mappings":";;;;;AAEA;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AAgED;AAvEN;AAkBA,IAAM,qBAAqB,cAA6C,IAAI;AAErE,SAAS,iBAAgD;AAC9D,QAAM,UAAU,WAAW,kBAAkB;AAC7C,SAAO,CAAC,UAAU,OAAO;AAC3B;AAgBe,SAAR,YAA6B;AAAA,EAClC,OAAO;AAAA,EACP,cAAc;AAAA,EACd;AACF,GAyBiB;AACf,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,MAAM,YAAY,GACtD;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,gBAAgB,gBAAgB,aAAa,UAAU;AAAA,MACvD,2BAA2B;AAAA,QACzB,SAAS;AAAA,UACP,eAAe,gBAAgB,aAAa,QAAQ;AAAA,QACtD;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,YAAY,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/SelectList/SelectList.tsx","../../../syntax-design-tokens/dist/js/index.js","css-module:./SelectList.module.css#css-module"],"sourcesContent":["import React, {\n type ReactElement,\n type ReactNode,\n useId,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport {\n ColorBaseDestructive700,\n ColorBaseGray800,\n} from \"@cambly/syntax-design-tokens\";\nimport Typography from \"../Typography/Typography\";\nimport styles from \"./SelectList.module.css\";\nimport focusStyles from \"../Focus.module.css\";\nimport SelectOption from \"./SelectOption\";\nimport useFocusVisible from \"../useFocusVisible\";\nimport useIsHydrated from \"../useIsHydrated\";\n\nconst iconSize = {\n sm: 20,\n md: 24,\n lg: 24,\n} as const;\n\n/**\n * [SelectList](https://cambly-syntax.vercel.app/?path=/docs/components-selectlist--docs) is a dropdown menu that allows users to select one option from a list.\n */\nexport default function SelectList({\n children,\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n errorText,\n helperText,\n id,\n label,\n onChange,\n onClick,\n placeholderText,\n selectedValue = \"\",\n size = \"md\",\n}: {\n /**\n * One or more SelectList.Option components.\n */\n children: ReactNode;\n /**\n * Test id for the select element\n */\n \"data-testid\"?: string;\n /**\n * true if the select dropdown is disabled\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Callback to be called when select is clicked\n */\n onClick?: React.MouseEventHandler<HTMLSelectElement>;\n /**\n * Text shown below select box if there is an input error.\n */\n errorText?: string;\n /**\n * Text shown below select box\n */\n helperText?: string;\n /**\n * Id of the select element\n */\n id?: string;\n /**\n * Text shown above select box\n */\n label: string;\n /**\n * The callback to be called when an option is selected\n */\n onChange: React.ChangeEventHandler<HTMLSelectElement>;\n /**\n * Text showing in select box if no option has been chosen.\n * We should always have a placeholder unless there is a default option selected\n */\n placeholderText?: string;\n /**\n * Value of the currently selected option\n */\n selectedValue?: string;\n /**\n * Size of the select box\n * * `sm`: 32px\n * * `md`: 40px\n * * `lg`: 48px\n *\n * @defaultValue \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n}): ReactElement {\n const reactId = useId();\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const selectId = id ?? reactId;\n const { isFocusVisible } = useFocusVisible();\n const [isFocused, setIsFocused] = useState(false);\n\n return (\n <div\n className={classNames(styles.selectContainer, {\n [styles.opacityOverlay]: disabled,\n })}\n >\n {label && (\n <label htmlFor={selectId} className={styles.outerTextContainer}>\n <Typography size={100} color=\"gray700\">\n {label}\n </Typography>\n </label>\n )}\n <div className={styles.selectWrapper}>\n <select\n id={selectId}\n data-testid={dataTestId}\n disabled={disabled}\n className={classNames(styles.selectBox, styles[size], {\n [styles.unselected]: !selectedValue && !errorText,\n [styles.selected]: selectedValue && !errorText,\n [styles.selectError]: errorText,\n [focusStyles.accessibilityOutlineFocus]:\n isFocused && isFocusVisible, // for focus keyboard\n [styles.selectMouseFocusStyling]: isFocused && !isFocusVisible, // for focus mouse\n })}\n onChange={onChange}\n onClick={onClick}\n value={\n placeholderText && !selectedValue ? placeholderText : selectedValue\n }\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n >\n {placeholderText && (\n <option disabled value={placeholderText}>\n {placeholderText}\n </option>\n )}\n {children}\n </select>\n <div className={styles.arrowIcon}>\n <svg\n focusable=\"false\"\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n width={iconSize[size]}\n >\n <path\n fill={errorText ? ColorBaseDestructive700 : ColorBaseGray800}\n d=\"M15.88 9.29 12 13.17 8.12 9.29a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0z\"\n />\n </svg>\n </div>\n </div>\n {(helperText || errorText) && (\n <div className={styles.outerTextContainer}>\n <Typography\n size={100}\n color={errorText ? \"destructive-primary\" : \"gray700\"}\n >\n {errorText ? errorText : helperText}\n </Typography>\n </div>\n )}\n </div>\n );\n}\n\nSelectList.Option = SelectOption;\n","/**\n * Do not edit directly\n * Generated on Wed, 03 Jan 2024 21:46:06 GMT\n */\n\nexport const ColorBaseBlack = \"#000000\";\nexport const ColorBaseDestructive100 = \"#fef3f5\";\nexport const ColorBaseDestructive200 = \"#fad6de\";\nexport const ColorBaseDestructive300 = \"#f2a2b2\";\nexport const ColorBaseDestructive700 = \"#d32a4b\";\nexport const ColorBaseDestructive800 = \"#81162c\";\nexport const ColorBaseDestructive900 = \"#55101d\";\nexport const ColorBaseGray10 = \"#cbcbcb\"; // Used as the default color for dividers and inner strokes\nexport const ColorBaseGray30 = \"#000000\"; // For IconButton background when on top of an image\nexport const ColorBaseGray60 = \"#000000\"; // Used for icon background in classroom video grid\nexport const ColorBaseGray80 = \"#000000\"; // Used as the background for modals\nexport const ColorBaseGray100 = \"#f7f7f7\";\nexport const ColorBaseGray200 = \"#f0f0f0\"; // Used for light mode backgrounds when showing card content on top\nexport const ColorBaseGray300 = \"#d0d0d0\"; // Used for component outlines, eg: select and textfield\nexport const ColorBaseGray700 = \"#767676\"; // For secondary text in light mode\nexport const ColorBaseGray800 = \"#353535\";\nexport const ColorBaseGray900 = \"#191919\"; // Default text color, Classroom background\nexport const ColorBaseOrange100 = \"#fdf2f0\";\nexport const ColorBaseOrange200 = \"#f6cdc4\";\nexport const ColorBaseOrange300 = \"#ec9987\";\nexport const ColorBaseOrange700 = \"#c34124\";\nexport const ColorBaseOrange800 = \"#732818\";\nexport const ColorBaseOrange900 = \"#4d1a10\";\nexport const ColorBasePrimary100 = \"#eff6fa\";\nexport const ColorBasePrimary200 = \"#c1dbe7\";\nexport const ColorBasePrimary300 = \"#84b7d0\";\nexport const ColorBasePrimary700 = \"#236482\";\nexport const ColorBasePrimary800 = \"#274858\";\nexport const ColorBasePrimary900 = \"#1b303b\";\nexport const ColorBaseSuccess100 = \"#eff7f1\";\nexport const ColorBaseSuccess200 = \"#bddcc6\";\nexport const ColorBaseSuccess300 = \"#81ba92\";\nexport const ColorBaseSuccess700 = \"#397b4d\";\nexport const ColorBaseSuccess800 = \"#2d4936\";\nexport const ColorBaseSuccess900 = \"#1e3124\";\nexport const ColorBasePurple100 = \"#f9f5fa\";\nexport const ColorBasePurple200 = \"#e8dceb\";\nexport const ColorBasePurple300 = \"#cdb4d3\";\nexport const ColorBasePurple700 = \"#8b5f95\";\nexport const ColorBasePurple800 = \"#523b58\";\nexport const ColorBasePurple900 = \"#37273b\";\nexport const ColorBaseYellow100 = \"#fdf5d9\";\nexport const ColorBaseYellow200 = \"#fbe8a3\";\nexport const ColorBaseYellow300 = \"#f8d663\";\nexport const ColorBaseYellow700 = \"#ffc929\";\nexport const ColorBaseYellow800 = \"#765f1c\";\nexport const ColorBaseYellow900 = \"#3b3009\";\nexport const ColorBaseWhite = \"#ffffff\";\nexport const Elevation400 = \"0px 16px 32px 0px #00000040\";\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/SelectList/SelectList.module.css\"; export default {\"selectContainer\":\"_selectContainer_3ifov_1\",\"opacityOverlay\":\"_opacityOverlay_3ifov_7\",\"outerTextContainer\":\"_outerTextContainer_3ifov_11\",\"selectWrapper\":\"_selectWrapper_3ifov_16\",\"selectBox\":\"_selectBox_3ifov_21\",\"selectMouseFocusStyling\":\"_selectMouseFocusStyling_3ifov_37\",\"unselected\":\"_unselected_3ifov_42\",\"selected\":\"_selected_3ifov_46\",\"arrowIcon\":\"_arrowIcon_3ifov_50\",\"sm\":\"_sm_3ifov_64\",\"md\":\"_md_3ifov_70\",\"lg\":\"_lg_3ifov_76\",\"selectError\":\"_selectError_3ifov_82\"}"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,OAAO,gBAAgB;;;ACGhB,IAAM,0BAA0B;AAWhC,IAAM,mBAAmB;;;ACpBoE,IAAO,4BAAQ,EAAC,mBAAkB,4BAA2B,kBAAiB,2BAA0B,sBAAqB,gCAA+B,iBAAgB,2BAA0B,aAAY,uBAAsB,2BAA0B,qCAAoC,cAAa,wBAAuB,YAAW,sBAAqB,aAAY,uBAAsB,MAAK,gBAAe,MAAK,gBAAe,MAAK,gBAAe,eAAc,wBAAuB;;;AFgHvkB,cAMF,YANE;AA9FV,IAAM,WAAW;AAAA,EACf,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAKe,SAAR,WAA4B;AAAA,EACjC;AAAA,EACA,eAAe;AAAA,EACf,UAAU,eAAe;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,OAAO;AACT,GAwDiB;AACf,QAAM,UAAU,MAAM;AACtB,QAAM,aAAa,cAAc;AACjC,QAAM,WAAW,CAAC,cAAc;AAChC,QAAM,WAAW,kBAAM;AACvB,QAAM,EAAE,eAAe,IAAI,gBAAgB;AAC3C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,WAAW,0BAAO,iBAAiB;AAAA,QAC5C,CAAC,0BAAO,cAAc,GAAG;AAAA,MAC3B,CAAC;AAAA,MAEA;AAAA,iBACC,oBAAC,WAAM,SAAS,UAAU,WAAW,0BAAO,oBAC1C,8BAAC,sBAAW,MAAM,KAAK,OAAM,WAC1B,iBACH,GACF;AAAA,QAEF,qBAAC,SAAI,WAAW,0BAAO,eACrB;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,eAAa;AAAA,cACb;AAAA,cACA,WAAW,WAAW,0BAAO,WAAW,0BAAO,IAAI,GAAG;AAAA,gBACpD,CAAC,0BAAO,UAAU,GAAG,CAAC,iBAAiB,CAAC;AAAA,gBACxC,CAAC,0BAAO,QAAQ,GAAG,iBAAiB,CAAC;AAAA,gBACrC,CAAC,0BAAO,WAAW,GAAG;AAAA,gBACtB,CAAC,qBAAY,yBAAyB,GACpC,aAAa;AAAA;AAAA,gBACf,CAAC,0BAAO,uBAAuB,GAAG,aAAa,CAAC;AAAA;AAAA,cAClD,CAAC;AAAA,cACD;AAAA,cACA;AAAA,cACA,OACE,mBAAmB,CAAC,gBAAgB,kBAAkB;AAAA,cAExD,SAAS,MAAM,aAAa,IAAI;AAAA,cAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,cAE/B;AAAA,mCACC,oBAAC,YAAO,UAAQ,MAAC,OAAO,iBACrB,2BACH;AAAA,gBAED;AAAA;AAAA;AAAA,UACH;AAAA,UACA,oBAAC,SAAI,WAAW,0BAAO,WACrB;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cACZ,SAAQ;AAAA,cACR,OAAO,SAAS,IAAI;AAAA,cAEpB;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,YAAY,0BAA0B;AAAA,kBAC5C,GAAE;AAAA;AAAA,cACJ;AAAA;AAAA,UACF,GACF;AAAA,WACF;AAAA,SACE,cAAc,cACd,oBAAC,SAAI,WAAW,0BAAO,oBACrB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,OAAO,YAAY,wBAAwB;AAAA,YAE1C,sBAAY,YAAY;AAAA;AAAA,QAC3B,GACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,WAAW,SAAS;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/SelectList/SelectList.tsx","../../../syntax-design-tokens/dist/js/index.js","css-module:./SelectList.module.css#css-module"],"sourcesContent":["import React, {\n type ReactElement,\n type ReactNode,\n useId,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport {\n ColorBaseDestructive700,\n ColorBaseGray800,\n} from \"@cambly/syntax-design-tokens\";\nimport Typography from \"../Typography/Typography\";\nimport styles from \"./SelectList.module.css\";\nimport focusStyles from \"../Focus.module.css\";\nimport SelectOption from \"./SelectOption\";\nimport useFocusVisible from \"../useFocusVisible\";\nimport useIsHydrated from \"../useIsHydrated\";\n\nconst iconSize = {\n sm: 20,\n md: 24,\n lg: 24,\n} as const;\n\n/**\n * [SelectList](https://cambly-syntax.vercel.app/?path=/docs/components-selectlist--docs) is a dropdown menu that allows users to select one option from a list.\n */\nexport default function SelectList({\n children,\n \"data-testid\": dataTestId,\n disabled: disabledProp = false,\n errorText,\n helperText,\n id,\n label,\n onChange,\n onClick,\n placeholderText,\n selectedValue = \"\",\n size = \"md\",\n}: {\n /**\n * One or more SelectList.Option components.\n */\n children: ReactNode;\n /**\n * Test id for the select element\n */\n \"data-testid\"?: string;\n /**\n * true if the select dropdown is disabled\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * Callback to be called when select is clicked\n */\n onClick?: React.MouseEventHandler<HTMLSelectElement>;\n /**\n * Text shown below select box if there is an input error.\n */\n errorText?: string;\n /**\n * Text shown below select box\n */\n helperText?: string;\n /**\n * Id of the select element\n */\n id?: string;\n /**\n * Text shown above select box\n */\n label: string;\n /**\n * The callback to be called when an option is selected\n */\n onChange: React.ChangeEventHandler<HTMLSelectElement>;\n /**\n * Text showing in select box if no option has been chosen.\n * We should always have a placeholder unless there is a default option selected\n */\n placeholderText?: string;\n /**\n * Value of the currently selected option\n */\n selectedValue?: string;\n /**\n * Size of the select box\n * * `sm`: 32px\n * * `md`: 40px\n * * `lg`: 48px\n *\n * @defaultValue \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n}): ReactElement {\n const reactId = useId();\n const isHydrated = useIsHydrated();\n const disabled = !isHydrated || disabledProp;\n const selectId = id ?? reactId;\n const { isFocusVisible } = useFocusVisible();\n const [isFocused, setIsFocused] = useState(false);\n\n return (\n <div\n className={classNames(styles.selectContainer, {\n [styles.opacityOverlay]: disabled,\n })}\n >\n {label && (\n <label htmlFor={selectId} className={styles.outerTextContainer}>\n <Typography size={100} color=\"gray700\">\n {label}\n </Typography>\n </label>\n )}\n <div className={styles.selectWrapper}>\n <select\n id={selectId}\n data-testid={dataTestId}\n disabled={disabled}\n className={classNames(styles.selectBox, styles[size], {\n [styles.unselected]: !selectedValue && !errorText,\n [styles.selected]: selectedValue && !errorText,\n [styles.selectError]: errorText,\n [focusStyles.accessibilityOutlineFocus]:\n isFocused && isFocusVisible, // for focus keyboard\n [styles.selectMouseFocusStyling]: isFocused && !isFocusVisible, // for focus mouse\n })}\n onChange={onChange}\n onClick={onClick}\n value={\n placeholderText && !selectedValue ? placeholderText : selectedValue\n }\n onFocus={() => setIsFocused(true)}\n onBlur={() => setIsFocused(false)}\n >\n {placeholderText && (\n <option disabled value={placeholderText}>\n {placeholderText}\n </option>\n )}\n {children}\n </select>\n <div className={styles.arrowIcon}>\n <svg\n focusable=\"false\"\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n width={iconSize[size]}\n >\n <path\n fill={errorText ? ColorBaseDestructive700 : ColorBaseGray800}\n d=\"M15.88 9.29 12 13.17 8.12 9.29a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0z\"\n />\n </svg>\n </div>\n </div>\n {(helperText || errorText) && (\n <div className={styles.outerTextContainer}>\n <Typography\n size={100}\n color={errorText ? \"destructive-primary\" : \"gray700\"}\n >\n {errorText ? errorText : helperText}\n </Typography>\n </div>\n )}\n </div>\n );\n}\n\nSelectList.Option = SelectOption;\n","/**\n * Do not edit directly\n * Generated on Thu, 11 Jan 2024 21:39:06 GMT\n */\n\nexport const ColorBaseBlack = \"#000000\";\nexport const ColorBaseDestructive100 = \"#fef3f5\";\nexport const ColorBaseDestructive200 = \"#fad6de\";\nexport const ColorBaseDestructive300 = \"#f2a2b2\";\nexport const ColorBaseDestructive700 = \"#d32a4b\";\nexport const ColorBaseDestructive800 = \"#81162c\";\nexport const ColorBaseDestructive900 = \"#55101d\";\nexport const ColorBaseGray10 = \"#cbcbcb\"; // Used as the default color for dividers and inner strokes\nexport const ColorBaseGray30 = \"#000000\"; // For IconButton background when on top of an image\nexport const ColorBaseGray60 = \"#000000\"; // Used for icon background in classroom video grid\nexport const ColorBaseGray80 = \"#000000\"; // Used as the background for modals\nexport const ColorBaseGray100 = \"#f7f7f7\";\nexport const ColorBaseGray200 = \"#f0f0f0\"; // Used for light mode backgrounds when showing card content on top\nexport const ColorBaseGray300 = \"#d0d0d0\"; // Used for component outlines, eg: select and textfield\nexport const ColorBaseGray700 = \"#767676\"; // For secondary text in light mode\nexport const ColorBaseGray800 = \"#353535\";\nexport const ColorBaseGray900 = \"#191919\"; // Default text color, Classroom background\nexport const ColorBaseOrange100 = \"#fdf2f0\";\nexport const ColorBaseOrange200 = \"#f6cdc4\";\nexport const ColorBaseOrange300 = \"#ec9987\";\nexport const ColorBaseOrange700 = \"#c34124\";\nexport const ColorBaseOrange800 = \"#732818\";\nexport const ColorBaseOrange900 = \"#4d1a10\";\nexport const ColorBasePrimary100 = \"#eff6fa\";\nexport const ColorBasePrimary200 = \"#c1dbe7\";\nexport const ColorBasePrimary300 = \"#84b7d0\";\nexport const ColorBasePrimary700 = \"#236482\";\nexport const ColorBasePrimary800 = \"#274858\";\nexport const ColorBasePrimary900 = \"#1b303b\";\nexport const ColorBaseSuccess100 = \"#eff7f1\";\nexport const ColorBaseSuccess200 = \"#bddcc6\";\nexport const ColorBaseSuccess300 = \"#81ba92\";\nexport const ColorBaseSuccess700 = \"#397b4d\";\nexport const ColorBaseSuccess800 = \"#2d4936\";\nexport const ColorBaseSuccess900 = \"#1e3124\";\nexport const ColorBasePurple100 = \"#f9f5fa\";\nexport const ColorBasePurple200 = \"#e8dceb\";\nexport const ColorBasePurple300 = \"#cdb4d3\";\nexport const ColorBasePurple700 = \"#8b5f95\";\nexport const ColorBasePurple800 = \"#523b58\";\nexport const ColorBasePurple900 = \"#37273b\";\nexport const ColorBaseYellow100 = \"#fdf5d9\";\nexport const ColorBaseYellow200 = \"#fbe8a3\";\nexport const ColorBaseYellow300 = \"#f8d663\";\nexport const ColorBaseYellow700 = \"#ffc929\";\nexport const ColorBaseYellow800 = \"#765f1c\";\nexport const ColorBaseYellow900 = \"#3b3009\";\nexport const ColorBaseWhite = \"#ffffff\";\nexport const Elevation400 = \"0px 16px 32px 0px #00000040\";\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/SelectList/SelectList.module.css\"; export default {\"selectContainer\":\"_selectContainer_3ifov_1\",\"opacityOverlay\":\"_opacityOverlay_3ifov_7\",\"outerTextContainer\":\"_outerTextContainer_3ifov_11\",\"selectWrapper\":\"_selectWrapper_3ifov_16\",\"selectBox\":\"_selectBox_3ifov_21\",\"selectMouseFocusStyling\":\"_selectMouseFocusStyling_3ifov_37\",\"unselected\":\"_unselected_3ifov_42\",\"selected\":\"_selected_3ifov_46\",\"arrowIcon\":\"_arrowIcon_3ifov_50\",\"sm\":\"_sm_3ifov_64\",\"md\":\"_md_3ifov_70\",\"lg\":\"_lg_3ifov_76\",\"selectError\":\"_selectError_3ifov_82\"}"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,OAAO,gBAAgB;;;ACGhB,IAAM,0BAA0B;AAWhC,IAAM,mBAAmB;;;ACpBoE,IAAO,4BAAQ,EAAC,mBAAkB,4BAA2B,kBAAiB,2BAA0B,sBAAqB,gCAA+B,iBAAgB,2BAA0B,aAAY,uBAAsB,2BAA0B,qCAAoC,cAAa,wBAAuB,YAAW,sBAAqB,aAAY,uBAAsB,MAAK,gBAAe,MAAK,gBAAe,MAAK,gBAAe,eAAc,wBAAuB;;;AFgHvkB,cAMF,YANE;AA9FV,IAAM,WAAW;AAAA,EACf,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAKe,SAAR,WAA4B;AAAA,EACjC;AAAA,EACA,eAAe;AAAA,EACf,UAAU,eAAe;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB,OAAO;AACT,GAwDiB;AACf,QAAM,UAAU,MAAM;AACtB,QAAM,aAAa,cAAc;AACjC,QAAM,WAAW,CAAC,cAAc;AAChC,QAAM,WAAW,kBAAM;AACvB,QAAM,EAAE,eAAe,IAAI,gBAAgB;AAC3C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAEhD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,WAAW,0BAAO,iBAAiB;AAAA,QAC5C,CAAC,0BAAO,cAAc,GAAG;AAAA,MAC3B,CAAC;AAAA,MAEA;AAAA,iBACC,oBAAC,WAAM,SAAS,UAAU,WAAW,0BAAO,oBAC1C,8BAAC,sBAAW,MAAM,KAAK,OAAM,WAC1B,iBACH,GACF;AAAA,QAEF,qBAAC,SAAI,WAAW,0BAAO,eACrB;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,eAAa;AAAA,cACb;AAAA,cACA,WAAW,WAAW,0BAAO,WAAW,0BAAO,IAAI,GAAG;AAAA,gBACpD,CAAC,0BAAO,UAAU,GAAG,CAAC,iBAAiB,CAAC;AAAA,gBACxC,CAAC,0BAAO,QAAQ,GAAG,iBAAiB,CAAC;AAAA,gBACrC,CAAC,0BAAO,WAAW,GAAG;AAAA,gBACtB,CAAC,qBAAY,yBAAyB,GACpC,aAAa;AAAA;AAAA,gBACf,CAAC,0BAAO,uBAAuB,GAAG,aAAa,CAAC;AAAA;AAAA,cAClD,CAAC;AAAA,cACD;AAAA,cACA;AAAA,cACA,OACE,mBAAmB,CAAC,gBAAgB,kBAAkB;AAAA,cAExD,SAAS,MAAM,aAAa,IAAI;AAAA,cAChC,QAAQ,MAAM,aAAa,KAAK;AAAA,cAE/B;AAAA,mCACC,oBAAC,YAAO,UAAQ,MAAC,OAAO,iBACrB,2BACH;AAAA,gBAED;AAAA;AAAA;AAAA,UACH;AAAA,UACA,oBAAC,SAAI,WAAW,0BAAO,WACrB;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,eAAY;AAAA,cACZ,SAAQ;AAAA,cACR,OAAO,SAAS,IAAI;AAAA,cAEpB;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,YAAY,0BAA0B;AAAA,kBAC5C,GAAE;AAAA;AAAA,cACJ;AAAA;AAAA,UACF,GACF;AAAA,WACF;AAAA,SACE,cAAc,cACd,oBAAC,SAAI,WAAW,0BAAO,oBACrB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,OAAO,YAAY,wBAAwB;AAAA,YAE1C,sBAAY,YAAY;AAAA;AAAA,QAC3B,GACF;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,WAAW,SAAS;","names":[]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useAvatarGroup
|
|
3
|
+
} from "./F7PM3X2U.mjs";
|
|
4
|
+
import {
|
|
5
|
+
Box_default
|
|
6
|
+
} from "./LKQ7PJ4S.mjs";
|
|
7
|
+
import {
|
|
8
|
+
__spreadValues
|
|
9
|
+
} from "./CUDAH5IW.mjs";
|
|
10
|
+
|
|
11
|
+
// src/Avatar/Avatar.tsx
|
|
12
|
+
import classNames from "classnames";
|
|
13
|
+
|
|
14
|
+
// css-module:./Avatar.module.css#css-module
|
|
15
|
+
var Avatar_module_default = { "avatar": "_avatar_vflu6_1", "avatarImage": "_avatarImage_vflu6_5", "sm": "_sm_vflu6_14", "md": "_md_vflu6_19", "lg": "_lg_vflu6_24", "xl": "_xl_vflu6_29" };
|
|
16
|
+
|
|
17
|
+
// src/Avatar/Avatar.tsx
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var sizeToIconStyles = {
|
|
20
|
+
sm: { bottom: 6, marginInlineEnd: 2, height: 4, width: 4 },
|
|
21
|
+
md: { bottom: 6, marginInlineEnd: 2, height: 8, width: 8 },
|
|
22
|
+
lg: { bottom: 6, marginInlineEnd: 6, height: 12, width: 12 },
|
|
23
|
+
xl: { bottom: 12, marginInlineEnd: 12, height: 16, width: 16 }
|
|
24
|
+
};
|
|
25
|
+
var sizeToMargin = {
|
|
26
|
+
sm: -16,
|
|
27
|
+
md: -28,
|
|
28
|
+
lg: -48,
|
|
29
|
+
xl: -88
|
|
30
|
+
};
|
|
31
|
+
function AvatarInternal({
|
|
32
|
+
accessibilityLabel,
|
|
33
|
+
icon,
|
|
34
|
+
size = "md",
|
|
35
|
+
src
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames(Avatar_module_default.avatar, Avatar_module_default[size]), children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
alt: accessibilityLabel,
|
|
42
|
+
src,
|
|
43
|
+
className: classNames(Avatar_module_default.avatarImage, Avatar_module_default[size])
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
icon && /* @__PURE__ */ jsx(Box_default, { display: "flex", position: "relative", justifyContent: "end", children: /* @__PURE__ */ jsx(
|
|
47
|
+
Box_default,
|
|
48
|
+
{
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
position: "absolute",
|
|
53
|
+
dangerouslySetInlineStyle: {
|
|
54
|
+
__style: __spreadValues({
|
|
55
|
+
border: "1px solid white"
|
|
56
|
+
}, sizeToIconStyles[size])
|
|
57
|
+
},
|
|
58
|
+
rounding: "full",
|
|
59
|
+
children: icon
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
var Avatar = ({
|
|
65
|
+
accessibilityLabel,
|
|
66
|
+
icon,
|
|
67
|
+
size = "md",
|
|
68
|
+
src
|
|
69
|
+
}) => {
|
|
70
|
+
const avatarGroupContext = useAvatarGroup();
|
|
71
|
+
if (avatarGroupContext !== null) {
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
Box_default,
|
|
74
|
+
{
|
|
75
|
+
position: "relative",
|
|
76
|
+
dangerouslySetInlineStyle: {
|
|
77
|
+
__style: {
|
|
78
|
+
marginInlineEnd: sizeToMargin[avatarGroupContext.size]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ jsx(
|
|
82
|
+
Box_default,
|
|
83
|
+
{
|
|
84
|
+
display: "flex",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyContent: "center",
|
|
87
|
+
backgroundColor: "white",
|
|
88
|
+
rounding: "full",
|
|
89
|
+
children: /* @__PURE__ */ jsx(
|
|
90
|
+
AvatarInternal,
|
|
91
|
+
{
|
|
92
|
+
accessibilityLabel,
|
|
93
|
+
icon,
|
|
94
|
+
size: avatarGroupContext.size,
|
|
95
|
+
src
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
AvatarInternal,
|
|
105
|
+
{
|
|
106
|
+
accessibilityLabel,
|
|
107
|
+
icon,
|
|
108
|
+
size,
|
|
109
|
+
src
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
var Avatar_default = Avatar;
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
Avatar_default
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=JD6Q4NMG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Avatar/Avatar.tsx","css-module:./Avatar.module.css#css-module"],"sourcesContent":["import { type ReactElement } from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./Avatar.module.css\";\nimport Box from \"../Box/Box\";\nimport { useAvatarGroup } from \"../AvatarGroup/AvatarGroup\";\n\nconst sizeToIconStyles = {\n sm: { bottom: 6, marginInlineEnd: 2, height: 4, width: 4 },\n md: { bottom: 6, marginInlineEnd: 2, height: 8, width: 8 },\n lg: { bottom: 6, marginInlineEnd: 6, height: 12, width: 12 },\n xl: { bottom: 12, marginInlineEnd: 12, height: 16, width: 16 },\n} as const;\n\nconst sizeToMargin = {\n sm: -16,\n md: -28,\n lg: -48,\n xl: -88,\n} as const;\n\nfunction AvatarInternal({\n accessibilityLabel,\n icon,\n size = \"md\",\n src,\n}: {\n accessibilityLabel: string;\n icon?: React.ReactElement;\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n src: string;\n}): ReactElement {\n return (\n <div className={classNames(styles.avatar, styles[size])}>\n <img\n alt={accessibilityLabel}\n src={src}\n className={classNames(styles.avatarImage, styles[size])}\n />\n {icon && (\n <Box display=\"flex\" position=\"relative\" justifyContent=\"end\">\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"absolute\"\n dangerouslySetInlineStyle={{\n __style: {\n border: \"1px solid white\",\n ...sizeToIconStyles[size],\n },\n }}\n rounding=\"full\"\n >\n {icon}\n </Box>\n </Box>\n )}\n </div>\n );\n}\n\n/**\n * [Avatar](https://cambly-syntax.vercel.app/?path=/docs/components-avatar--docs) is a circular image that represents a user.\n */\nconst Avatar = ({\n accessibilityLabel,\n icon,\n size = \"md\",\n src,\n}: {\n /**\n * Alt text to use for the image.\n * This should describe the image to people using screen readers.\n */\n accessibilityLabel: string;\n /**\n * optional icon that appears on the bottom corner of the avatar\n */\n icon?: React.ReactElement;\n /**\n * Size of the avatar.\n *\n * * `sm`: 24px\n * * `md`: 40px\n * * `lg`: 72px\n * * `xl`: 128px\n *\n * @defaultValue `md`\n */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * URL of the image to display as the avatar.\n */\n src: string;\n}): JSX.Element => {\n const avatarGroupContext = useAvatarGroup();\n\n if (avatarGroupContext !== null) {\n return (\n <Box\n position=\"relative\"\n dangerouslySetInlineStyle={{\n __style: {\n marginInlineEnd: sizeToMargin[avatarGroupContext.size],\n },\n }}\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundColor=\"white\"\n rounding=\"full\"\n >\n <AvatarInternal\n accessibilityLabel={accessibilityLabel}\n icon={icon}\n size={avatarGroupContext.size}\n src={src}\n />\n </Box>\n </Box>\n );\n }\n\n return (\n <AvatarInternal\n accessibilityLabel={accessibilityLabel}\n icon={icon}\n size={size}\n src={src}\n />\n );\n};\n\nexport default Avatar;\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/Avatar/Avatar.module.css\"; export default {\"avatar\":\"_avatar_vflu6_1\",\"avatarImage\":\"_avatarImage_vflu6_5\",\"sm\":\"_sm_vflu6_14\",\"md\":\"_md_vflu6_19\",\"lg\":\"_lg_vflu6_24\",\"xl\":\"_xl_vflu6_29\"}"],"mappings":";;;;;;;;;;;AACA,OAAO,gBAAgB;;;ACDqE,IAAO,wBAAQ,EAAC,UAAS,mBAAkB,eAAc,wBAAuB,MAAK,gBAAe,MAAK,gBAAe,MAAK,gBAAe,MAAK,eAAc;;;ADgCvP,SACE,KADF;AA1BJ,IAAM,mBAAmB;AAAA,EACvB,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EACzD,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EACzD,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,IAAI,OAAO,GAAG;AAAA,EAC3D,IAAI,EAAE,QAAQ,IAAI,iBAAiB,IAAI,QAAQ,IAAI,OAAO,GAAG;AAC/D;AAEA,IAAM,eAAe;AAAA,EACnB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAKiB;AACf,SACE,qBAAC,SAAI,WAAW,WAAW,sBAAO,QAAQ,sBAAO,IAAI,CAAC,GACpD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,WAAW,WAAW,sBAAO,aAAa,sBAAO,IAAI,CAAC;AAAA;AAAA,IACxD;AAAA,IACC,QACC,oBAAC,eAAI,SAAQ,QAAO,UAAS,YAAW,gBAAe,OACrD;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,YAAW;AAAA,QACX,gBAAe;AAAA,QACf,UAAS;AAAA,QACT,2BAA2B;AAAA,UACzB,SAAS;AAAA,YACP,QAAQ;AAAA,aACL,iBAAiB,IAAI;AAAA,QAE5B;AAAA,QACA,UAAS;AAAA,QAER;AAAA;AAAA,IACH,GACF;AAAA,KAEJ;AAEJ;AAKA,IAAM,SAAS,CAAC;AAAA,EACd;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,MAyBmB;AACjB,QAAM,qBAAqB,eAAe;AAE1C,MAAI,uBAAuB,MAAM;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,2BAA2B;AAAA,UACzB,SAAS;AAAA,YACP,iBAAiB,aAAa,mBAAmB,IAAI;AAAA,UACvD;AAAA,QACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,YAAW;AAAA,YACX,gBAAe;AAAA,YACf,iBAAgB;AAAA,YAChB,UAAS;AAAA,YAET;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA,MAAM,mBAAmB;AAAA,gBACzB;AAAA;AAAA,YACF;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _SSXWBCF3js = require('./SSXWBCF3.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _PYNS67IVjs = require('./PYNS67IV.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _LULBCTQRjs = require('./LULBCTQR.js');
|
|
10
|
+
|
|
11
|
+
// src/Avatar/Avatar.tsx
|
|
12
|
+
var _classnames = require('classnames'); var _classnames2 = _interopRequireDefault(_classnames);
|
|
13
|
+
|
|
14
|
+
// css-module:./Avatar.module.css#css-module
|
|
15
|
+
var Avatar_module_default = { "avatar": "_avatar_vflu6_1", "avatarImage": "_avatarImage_vflu6_5", "sm": "_sm_vflu6_14", "md": "_md_vflu6_19", "lg": "_lg_vflu6_24", "xl": "_xl_vflu6_29" };
|
|
16
|
+
|
|
17
|
+
// src/Avatar/Avatar.tsx
|
|
18
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
19
|
+
var sizeToIconStyles = {
|
|
20
|
+
sm: { bottom: 6, marginInlineEnd: 2, height: 4, width: 4 },
|
|
21
|
+
md: { bottom: 6, marginInlineEnd: 2, height: 8, width: 8 },
|
|
22
|
+
lg: { bottom: 6, marginInlineEnd: 6, height: 12, width: 12 },
|
|
23
|
+
xl: { bottom: 12, marginInlineEnd: 12, height: 16, width: 16 }
|
|
24
|
+
};
|
|
25
|
+
var sizeToMargin = {
|
|
26
|
+
sm: -16,
|
|
27
|
+
md: -28,
|
|
28
|
+
lg: -48,
|
|
29
|
+
xl: -88
|
|
30
|
+
};
|
|
31
|
+
function AvatarInternal({
|
|
32
|
+
accessibilityLabel,
|
|
33
|
+
icon,
|
|
34
|
+
size = "md",
|
|
35
|
+
src
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _classnames2.default.call(void 0, Avatar_module_default.avatar, Avatar_module_default[size]), children: [
|
|
38
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
39
|
+
"img",
|
|
40
|
+
{
|
|
41
|
+
alt: accessibilityLabel,
|
|
42
|
+
src,
|
|
43
|
+
className: _classnames2.default.call(void 0, Avatar_module_default.avatarImage, Avatar_module_default[size])
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
icon && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _PYNS67IVjs.Box_default, { display: "flex", position: "relative", justifyContent: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
47
|
+
_PYNS67IVjs.Box_default,
|
|
48
|
+
{
|
|
49
|
+
display: "flex",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
position: "absolute",
|
|
53
|
+
dangerouslySetInlineStyle: {
|
|
54
|
+
__style: _LULBCTQRjs.__spreadValues.call(void 0, {
|
|
55
|
+
border: "1px solid white"
|
|
56
|
+
}, sizeToIconStyles[size])
|
|
57
|
+
},
|
|
58
|
+
rounding: "full",
|
|
59
|
+
children: icon
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
var Avatar = ({
|
|
65
|
+
accessibilityLabel,
|
|
66
|
+
icon,
|
|
67
|
+
size = "md",
|
|
68
|
+
src
|
|
69
|
+
}) => {
|
|
70
|
+
const avatarGroupContext = _SSXWBCF3js.useAvatarGroup.call(void 0, );
|
|
71
|
+
if (avatarGroupContext !== null) {
|
|
72
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
73
|
+
_PYNS67IVjs.Box_default,
|
|
74
|
+
{
|
|
75
|
+
position: "relative",
|
|
76
|
+
dangerouslySetInlineStyle: {
|
|
77
|
+
__style: {
|
|
78
|
+
marginInlineEnd: sizeToMargin[avatarGroupContext.size]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
82
|
+
_PYNS67IVjs.Box_default,
|
|
83
|
+
{
|
|
84
|
+
display: "flex",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyContent: "center",
|
|
87
|
+
backgroundColor: "white",
|
|
88
|
+
rounding: "full",
|
|
89
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
90
|
+
AvatarInternal,
|
|
91
|
+
{
|
|
92
|
+
accessibilityLabel,
|
|
93
|
+
icon,
|
|
94
|
+
size: avatarGroupContext.size,
|
|
95
|
+
src
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
104
|
+
AvatarInternal,
|
|
105
|
+
{
|
|
106
|
+
accessibilityLabel,
|
|
107
|
+
icon,
|
|
108
|
+
size,
|
|
109
|
+
src
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
var Avatar_default = Avatar;
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
exports.Avatar_default = Avatar_default;
|
|
118
|
+
//# sourceMappingURL=MMHLD5IF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Avatar/Avatar.tsx","css-module:./Avatar.module.css#css-module"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,gBAAgB;;;ACDqE,IAAO,wBAAQ,EAAC,UAAS,mBAAkB,eAAc,wBAAuB,MAAK,gBAAe,MAAK,gBAAe,MAAK,gBAAe,MAAK,eAAc;;;ADgCvP,SACE,KADF;AA1BJ,IAAM,mBAAmB;AAAA,EACvB,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EACzD,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,GAAG,OAAO,EAAE;AAAA,EACzD,IAAI,EAAE,QAAQ,GAAG,iBAAiB,GAAG,QAAQ,IAAI,OAAO,GAAG;AAAA,EAC3D,IAAI,EAAE,QAAQ,IAAI,iBAAiB,IAAI,QAAQ,IAAI,OAAO,GAAG;AAC/D;AAEA,IAAM,eAAe;AAAA,EACnB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,GAKiB;AACf,SACE,qBAAC,SAAI,WAAW,WAAW,sBAAO,QAAQ,sBAAO,IAAI,CAAC,GACpD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,WAAW,WAAW,sBAAO,aAAa,sBAAO,IAAI,CAAC;AAAA;AAAA,IACxD;AAAA,IACC,QACC,oBAAC,eAAI,SAAQ,QAAO,UAAS,YAAW,gBAAe,OACrD;AAAA,MAAC;AAAA;AAAA,QACC,SAAQ;AAAA,QACR,YAAW;AAAA,QACX,gBAAe;AAAA,QACf,UAAS;AAAA,QACT,2BAA2B;AAAA,UACzB,SAAS;AAAA,YACP,QAAQ;AAAA,aACL,iBAAiB,IAAI;AAAA,QAE5B;AAAA,QACA,UAAS;AAAA,QAER;AAAA;AAAA,IACH,GACF;AAAA,KAEJ;AAEJ;AAKA,IAAM,SAAS,CAAC;AAAA,EACd;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AACF,MAyBmB;AACjB,QAAM,qBAAqB,eAAe;AAE1C,MAAI,uBAAuB,MAAM;AAC/B,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,2BAA2B;AAAA,UACzB,SAAS;AAAA,YACP,iBAAiB,aAAa,mBAAmB,IAAI;AAAA,UACvD;AAAA,QACF;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,YAAW;AAAA,YACX,gBAAe;AAAA,YACf,iBAAgB;AAAA,YAChB,UAAS;AAAA,YAET;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA,MAAM,mBAAmB;AAAA,gBACzB;AAAA;AAAA,YACF;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,iBAAQ","sourcesContent":["import { type ReactElement } from \"react\";\nimport classNames from \"classnames\";\nimport styles from \"./Avatar.module.css\";\nimport Box from \"../Box/Box\";\nimport { useAvatarGroup } from \"../AvatarGroup/AvatarGroup\";\n\nconst sizeToIconStyles = {\n sm: { bottom: 6, marginInlineEnd: 2, height: 4, width: 4 },\n md: { bottom: 6, marginInlineEnd: 2, height: 8, width: 8 },\n lg: { bottom: 6, marginInlineEnd: 6, height: 12, width: 12 },\n xl: { bottom: 12, marginInlineEnd: 12, height: 16, width: 16 },\n} as const;\n\nconst sizeToMargin = {\n sm: -16,\n md: -28,\n lg: -48,\n xl: -88,\n} as const;\n\nfunction AvatarInternal({\n accessibilityLabel,\n icon,\n size = \"md\",\n src,\n}: {\n accessibilityLabel: string;\n icon?: React.ReactElement;\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n src: string;\n}): ReactElement {\n return (\n <div className={classNames(styles.avatar, styles[size])}>\n <img\n alt={accessibilityLabel}\n src={src}\n className={classNames(styles.avatarImage, styles[size])}\n />\n {icon && (\n <Box display=\"flex\" position=\"relative\" justifyContent=\"end\">\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n position=\"absolute\"\n dangerouslySetInlineStyle={{\n __style: {\n border: \"1px solid white\",\n ...sizeToIconStyles[size],\n },\n }}\n rounding=\"full\"\n >\n {icon}\n </Box>\n </Box>\n )}\n </div>\n );\n}\n\n/**\n * [Avatar](https://cambly-syntax.vercel.app/?path=/docs/components-avatar--docs) is a circular image that represents a user.\n */\nconst Avatar = ({\n accessibilityLabel,\n icon,\n size = \"md\",\n src,\n}: {\n /**\n * Alt text to use for the image.\n * This should describe the image to people using screen readers.\n */\n accessibilityLabel: string;\n /**\n * optional icon that appears on the bottom corner of the avatar\n */\n icon?: React.ReactElement;\n /**\n * Size of the avatar.\n *\n * * `sm`: 24px\n * * `md`: 40px\n * * `lg`: 72px\n * * `xl`: 128px\n *\n * @defaultValue `md`\n */\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\";\n /**\n * URL of the image to display as the avatar.\n */\n src: string;\n}): JSX.Element => {\n const avatarGroupContext = useAvatarGroup();\n\n if (avatarGroupContext !== null) {\n return (\n <Box\n position=\"relative\"\n dangerouslySetInlineStyle={{\n __style: {\n marginInlineEnd: sizeToMargin[avatarGroupContext.size],\n },\n }}\n >\n <Box\n display=\"flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n backgroundColor=\"white\"\n rounding=\"full\"\n >\n <AvatarInternal\n accessibilityLabel={accessibilityLabel}\n icon={icon}\n size={avatarGroupContext.size}\n src={src}\n />\n </Box>\n </Box>\n );\n }\n\n return (\n <AvatarInternal\n accessibilityLabel={accessibilityLabel}\n icon={icon}\n size={size}\n src={src}\n />\n );\n};\n\nexport default Avatar;\n","import \"/home/runner/work/syntax/syntax/packages/syntax-core/src/Avatar/Avatar.module.css\"; export default {\"avatar\":\"_avatar_vflu6_1\",\"avatarImage\":\"_avatarImage_vflu6_5\",\"sm\":\"_sm_vflu6_14\",\"md\":\"_md_vflu6_19\",\"lg\":\"_lg_vflu6_24\",\"xl\":\"_xl_vflu6_29\"}"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _PYNS67IVjs = require('./PYNS67IV.js');
|
|
4
|
+
|
|
5
|
+
// src/AvatarGroup/AvatarGroup.tsx
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _react = require('react');
|
|
10
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
11
|
+
"use client";
|
|
12
|
+
var AvatarGroupContext = _react.createContext.call(void 0, null);
|
|
13
|
+
function useAvatarGroup() {
|
|
14
|
+
const context = _react.useContext.call(void 0, AvatarGroupContext);
|
|
15
|
+
return !context ? null : context;
|
|
16
|
+
}
|
|
17
|
+
function AvatarGroup({
|
|
18
|
+
size = "md",
|
|
19
|
+
orientation = "standard",
|
|
20
|
+
children
|
|
21
|
+
}) {
|
|
22
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AvatarGroupContext.Provider, { value: { size, orientation }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
+
_PYNS67IVjs.Box_default,
|
|
24
|
+
{
|
|
25
|
+
display: "flex",
|
|
26
|
+
justifyContent: orientation === "standard" ? "start" : "end",
|
|
27
|
+
dangerouslySetInlineStyle: {
|
|
28
|
+
__style: {
|
|
29
|
+
flexDirection: orientation === "standard" ? "row" : "row-reverse"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
children
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
35
|
+
}
|
|
36
|
+
AvatarGroup.displayName = "AvatarGroup";
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
exports.useAvatarGroup = useAvatarGroup; exports.AvatarGroup = AvatarGroup;
|
|
42
|
+
//# sourceMappingURL=SSXWBCF3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":";;;;;AAEA;AAAA,EAEE;AAAA,EACA;AAAA,OAEK;AAgED;AAvEN;AAkBA,IAAM,qBAAqB,cAA6C,IAAI;AAErE,SAAS,iBAAgD;AAC9D,QAAM,UAAU,WAAW,kBAAkB;AAC7C,SAAO,CAAC,UAAU,OAAO;AAC3B;AAgBe,SAAR,YAA6B;AAAA,EAClC,OAAO;AAAA,EACP,cAAc;AAAA,EACd;AACF,GAyBiB;AACf,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,EAAE,MAAM,YAAY,GACtD;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,gBAAgB,gBAAgB,aAAa,UAAU;AAAA,MACvD,2BAA2B;AAAA,QACzB,SAAS;AAAA,UACP,eAAe,gBAAgB,aAAa,QAAQ;AAAA,QACtD;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH,GACF;AAEJ;AAEA,YAAY,cAAc","sourcesContent":["\"use client\";\n\nimport {\n type ReactNode,\n createContext,\n useContext,\n type ReactElement,\n} from \"react\";\nimport Box from \"../Box/Box\";\n\ntype Size = \"sm\" | \"md\" | \"lg\" | \"xl\";\ntype Orientation = \"standard\" | \"reverse\";\n\ntype AvatarGroupContextType = {\n size: Size;\n orientation: Orientation;\n};\n\nconst AvatarGroupContext = createContext<AvatarGroupContextType | null>(null);\n\nexport function useAvatarGroup(): AvatarGroupContextType | null {\n const context = useContext(AvatarGroupContext);\n return !context ? null : context;\n}\n\n/**\n * [AvatarGroup](https://cambly-syntax.vercel.app/?path=/docs/components-avatargroup--docs) is a stack of avatars to represent a group of people\n *\n * Pass in Avatar components as children to the AvatarGroup component. The size prop that is passed into the AvatarGroup component will override Avatar's size prop..\n *\n * Usage:\n *\n * <AvatarGroup size=\"xl\" orientation=\"standard\">\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * <Avatar accessibilityLabel=\"Joseph Liotta\" src=\"image.png\" />\n * </AvatarGroup>\n *\n */\nexport default function AvatarGroup({\n size = \"md\",\n orientation = \"standard\",\n children,\n}: {\n /**\n * Size of the avatars in the AvatarGroup.\n *\n * * `sm`: 24px\n * * `md`: 40px\n * * `lg`: 72px\n * * `xl`: 128px\n *\n * @defaultValue `md`\n */\n size?: Size;\n /**\n * Orientation of the AvatarGroup.\n * This describes the order of rendering of the Avatar components.\n * Standard renders the Avatar components with the right component on top.\n * Reverse renders the Avatar components with the left component on top.\n *\n * @defaultValue `standard`\n */\n orientation?: Orientation;\n /**\n * Avatars to be rendered within the AvatarGroup.\n */\n children: ReactNode;\n}): ReactElement {\n return (\n <AvatarGroupContext.Provider value={{ size, orientation }}>\n <Box\n display=\"flex\"\n justifyContent={orientation === \"standard\" ? \"start\" : \"end\"}\n dangerouslySetInlineStyle={{\n __style: {\n flexDirection: orientation === \"standard\" ? \"row\" : \"row-reverse\",\n },\n }}\n >\n {children}\n </Box>\n </AvatarGroupContext.Provider>\n );\n}\n\nAvatarGroup.displayName = \"AvatarGroup\";\n"]}
|