@algolia/satellite 2.3.0 → 2.4.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/cjs/Actions/Accordion/Accordion.d.ts +8 -0
- package/dist/cjs/Actions/Accordion/Accordion.js +104 -57
- package/dist/cjs/Actions/Accordion/Accordion.styles.d.ts +170 -0
- package/dist/cjs/Actions/Accordion/Accordion.styles.js +57 -0
- package/dist/cjs/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +4 -4
- package/dist/cjs/Chat/ChatMessage/ChatMessage.d.ts +1 -1
- package/dist/cjs/Chat/ChatMessage/ChatMessage.styles.d.ts +1 -1
- package/dist/cjs/Chat/ChatMessageError/ChatMessageError.styles.d.ts +2 -2
- package/dist/cjs/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +2 -2
- package/dist/cjs/Fields/TextArea/TextArea.tailwind.js +3 -3
- package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.d.ts +7 -0
- package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.js +11 -5
- package/dist/cjs/Helpers/MarkdownContent/MarkdownContent.tailwind.js +2 -2
- package/dist/cjs/Helpers/UserContent/UserContent.tailwind.js +1 -3
- package/dist/cjs/Illustrations/index.d.ts +7 -0
- package/dist/cjs/Illustrations/index.js +1254 -0
- package/dist/cjs/Indicators/EmptyState/EmptyState.js +35 -2
- package/dist/cjs/Indicators/EmptyState/types.d.ts +4 -3
- package/dist/cjs/Overlay/Modal/components/ModalFooter.js +2 -7
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/types.d.ts +7 -0
- package/dist/cjs/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/esm/Actions/Accordion/Accordion.d.ts +8 -0
- package/dist/esm/Actions/Accordion/Accordion.js +105 -58
- package/dist/esm/Actions/Accordion/Accordion.styles.d.ts +170 -0
- package/dist/esm/Actions/Accordion/Accordion.styles.js +50 -0
- package/dist/esm/Chat/ChatContextAccordion/ChatContextAccordion.styles.d.ts +4 -4
- package/dist/esm/Chat/ChatMessage/ChatMessage.d.ts +1 -1
- package/dist/esm/Chat/ChatMessage/ChatMessage.styles.d.ts +1 -1
- package/dist/esm/Chat/ChatMessageError/ChatMessageError.styles.d.ts +2 -2
- package/dist/esm/Chat/ChatMessageLoader/ChatMessageLoader.styles.d.ts +2 -2
- package/dist/esm/Fields/TextArea/TextArea.tailwind.js +3 -3
- package/dist/esm/Helpers/MarkdownContent/MarkdownContent.d.ts +7 -0
- package/dist/esm/Helpers/MarkdownContent/MarkdownContent.js +11 -5
- package/dist/esm/Helpers/MarkdownContent/MarkdownContent.tailwind.js +2 -2
- package/dist/esm/Helpers/UserContent/UserContent.tailwind.js +1 -3
- package/dist/esm/Illustrations/index.d.ts +7 -0
- package/dist/esm/Illustrations/index.js +1248 -0
- package/dist/esm/Indicators/EmptyState/EmptyState.js +35 -2
- package/dist/esm/Indicators/EmptyState/types.d.ts +4 -3
- package/dist/esm/Overlay/Modal/components/ModalFooter.js +2 -7
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/types.d.ts +7 -0
- package/dist/esm/utils/isCssPropertySupported.d.ts +1 -1
- package/dist/satellite.min.css +1 -1
- package/package.json +4 -5
@@ -5,11 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.EmptyState = void 0;
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
8
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
9
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
10
12
|
var _satellitePrefixer = _interopRequireDefault(require("./../../styles/helpers/satellitePrefixer"));
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
12
14
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30;
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
13
17
|
var CONTAINER_CONTEXT_CLASSNAMES = {
|
14
18
|
result: {
|
15
19
|
medium: (0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["max-w-xs"]))),
|
@@ -47,6 +51,30 @@ var ACTIONS_CONTEXT_CLASSNAMES = {
|
|
47
51
|
feature: (0, _satellitePrefixer["default"])(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2["default"])(["mt-3"]))),
|
48
52
|
page: (0, _satellitePrefixer["default"])(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2["default"])(["mt-6 md:flex-row"])))
|
49
53
|
};
|
54
|
+
var ILLUSTRATION_SIZES = {
|
55
|
+
small: {
|
56
|
+
width: 100,
|
57
|
+
height: 100
|
58
|
+
},
|
59
|
+
medium: {
|
60
|
+
width: 160,
|
61
|
+
height: 160
|
62
|
+
},
|
63
|
+
large: {
|
64
|
+
width: 400,
|
65
|
+
height: 400
|
66
|
+
}
|
67
|
+
};
|
68
|
+
var injectIllustrationSize = function injectIllustrationSize(illustration, illustrationSize, extraStyle) {
|
69
|
+
if (illustrationSize && illustration && (0, _typeof2["default"])(illustration) === "object" && "type" in illustration) {
|
70
|
+
return _objectSpread(_objectSpread({}, illustration), {}, {
|
71
|
+
props: _objectSpread(_objectSpread({}, illustration.props), {}, {
|
72
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, illustration.props.style), ILLUSTRATION_SIZES[illustrationSize]), extraStyle)
|
73
|
+
})
|
74
|
+
});
|
75
|
+
}
|
76
|
+
return illustration;
|
77
|
+
};
|
50
78
|
var renderEmptyState = function renderEmptyState(_ref) {
|
51
79
|
var title = _ref.title,
|
52
80
|
description = _ref.description,
|
@@ -54,6 +82,7 @@ var renderEmptyState = function renderEmptyState(_ref) {
|
|
54
82
|
actionsDirection = _ref.actionsDirection,
|
55
83
|
leadIllustration = _ref.leadIllustration,
|
56
84
|
pageIllustration = _ref.pageIllustration,
|
85
|
+
illustrationSize = _ref.illustrationSize,
|
57
86
|
_ref$usageContext = _ref.usageContext,
|
58
87
|
usageContext = _ref$usageContext === void 0 ? "feature" : _ref$usageContext,
|
59
88
|
_ref$width = _ref.width,
|
@@ -64,13 +93,17 @@ var renderEmptyState = function renderEmptyState(_ref) {
|
|
64
93
|
var titleClassNames = (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2["default"])(["text-grey-900"]))), TITLE_CONTEXT_CLASSNAMES[usageContext]);
|
65
94
|
var descriptionClassNames = (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2["default"])(["text-grey-600"]))), DESCRIPTION_CONTEXT_CLASSNAMES[usageContext]);
|
66
95
|
var actionsClassNames = (0, _clsx["default"])(ACTIONS_CONTEXT_CLASSNAMES[usageContext]);
|
96
|
+
var sizedLeadIllustration = injectIllustrationSize(leadIllustration, illustrationSize, {
|
97
|
+
display: "inline-block"
|
98
|
+
});
|
99
|
+
var sizedPageIllustration = injectIllustrationSize(pageIllustration, illustrationSize);
|
67
100
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
68
101
|
className: containerClassNames,
|
69
102
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
70
103
|
className: (0, _satellitePrefixer["default"])(_templateObject24 || (_templateObject24 = (0, _taggedTemplateLiteral2["default"])(["min-w-2/5"]))),
|
71
104
|
children: [centered && !!leadIllustration && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
72
105
|
className: LEAD_ILLUS_CONTEXT_CLASSNAMES[usageContext],
|
73
|
-
children:
|
106
|
+
children: sizedLeadIllustration
|
74
107
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
75
108
|
className: titleClassNames,
|
76
109
|
children: title
|
@@ -83,7 +116,7 @@ var renderEmptyState = function renderEmptyState(_ref) {
|
|
83
116
|
})]
|
84
117
|
}), !centered && usageContext === "page" && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
85
118
|
className: (0, _satellitePrefixer["default"])(_templateObject30 || (_templateObject30 = (0, _taggedTemplateLiteral2["default"])(["hidden lg:flex items-center justify-center"]))),
|
86
|
-
children:
|
119
|
+
children: sizedPageIllustration
|
87
120
|
})]
|
88
121
|
});
|
89
122
|
};
|
@@ -27,6 +27,7 @@ export interface EmptyStatePropsAll {
|
|
27
27
|
* Plop in an `img` element or `svg` here.
|
28
28
|
*/
|
29
29
|
pageIllustration?: ReactNode;
|
30
|
+
illustrationSize?: "small" | "medium" | "large";
|
30
31
|
/**
|
31
32
|
* UsageContext of the component.
|
32
33
|
* @default feature
|
@@ -43,13 +44,13 @@ export interface EmptyStatePropsAll {
|
|
43
44
|
*/
|
44
45
|
width?: EmptyStateWidths;
|
45
46
|
}
|
46
|
-
interface EmptyStatePropsUsageContextResult extends Omit<EmptyStatePropsAll, "usageContext" | "
|
47
|
+
interface EmptyStatePropsUsageContextResult extends Omit<EmptyStatePropsAll, "usageContext" | "pageIllustration"> {
|
47
48
|
usageContext: "result";
|
48
49
|
pageIllustration?: never;
|
49
50
|
}
|
50
|
-
interface EmptyStatePropsUsageContextFeature extends Omit<EmptyStatePropsAll, "usageContext" | "
|
51
|
+
interface EmptyStatePropsUsageContextFeature extends Omit<EmptyStatePropsAll, "usageContext" | "pageIllustration"> {
|
51
52
|
usageContext: "feature";
|
52
|
-
|
53
|
+
pageIllustration?: never;
|
53
54
|
}
|
54
55
|
interface EmptyStatePropsUsageContextPage extends Omit<EmptyStatePropsAll, "usageContext" | "centered"> {
|
55
56
|
usageContext: "page";
|
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
9
9
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
11
|
var _clsx = _interopRequireDefault(require("clsx"));
|
12
|
-
var _Layout = require("./../../../Layout");
|
13
12
|
var _satellitePrefixer = _interopRequireDefault(require("./../../../styles/helpers/satellitePrefixer"));
|
14
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
14
|
var _templateObject;
|
@@ -21,11 +20,7 @@ var ModalFooter = exports.ModalFooter = function ModalFooter(_ref) {
|
|
21
20
|
children = _ref.children,
|
22
21
|
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
23
22
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, props), {}, {
|
24
|
-
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["mt-8"]))), className),
|
25
|
-
children:
|
26
|
-
spacing: "md",
|
27
|
-
alignment: "center",
|
28
|
-
children: children
|
29
|
-
})
|
23
|
+
className: (0, _clsx["default"])((0, _satellitePrefixer["default"])(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["mt-8 flex justify-end gap-4 items-center"]))), className),
|
24
|
+
children: children
|
30
25
|
}));
|
31
26
|
};
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
@@ -146,6 +146,18 @@ Object.keys(_Icons).forEach(function (key) {
|
|
146
146
|
}
|
147
147
|
});
|
148
148
|
});
|
149
|
+
var _Illustrations = require("./Illustrations");
|
150
|
+
Object.keys(_Illustrations).forEach(function (key) {
|
151
|
+
if (key === "default" || key === "__esModule") return;
|
152
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
153
|
+
if (key in exports && exports[key] === _Illustrations[key]) return;
|
154
|
+
Object.defineProperty(exports, key, {
|
155
|
+
enumerable: true,
|
156
|
+
get: function get() {
|
157
|
+
return _Illustrations[key];
|
158
|
+
}
|
159
|
+
});
|
160
|
+
});
|
149
161
|
var _Indicators = require("./Indicators");
|
150
162
|
Object.keys(_Indicators).forEach(function (key) {
|
151
163
|
if (key === "default" || key === "__esModule") return;
|
package/dist/cjs/types.d.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
export declare type ColorVariant = "accent" | "grey" | "green" | "blue" | "orange" | "red";
|
2
3
|
/**
|
3
4
|
* Ensures at least one type is required
|
@@ -21,4 +22,10 @@ declare type Without<Type, Union> = {
|
|
21
22
|
[Property in Exclude<keyof Type, keyof Union>]?: never;
|
22
23
|
};
|
23
24
|
export declare type XOR<Type, Union> = Type | Union extends object ? (Without<Type, Union> & Union) | (Without<Union, Type> & Type) : Type | Union;
|
25
|
+
export declare type SvgComponent = React.ComponentType<{
|
26
|
+
className?: string;
|
27
|
+
style?: {
|
28
|
+
[s: string]: any;
|
29
|
+
};
|
30
|
+
}>;
|
24
31
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
export declare const isCssPropertySupported: <P extends number | typeof Symbol.iterator | "filter" | "fill" | "
|
1
|
+
export declare const isCssPropertySupported: <P extends number | typeof Symbol.iterator | "filter" | "fill" | "appearance" | "bottom" | "clear" | "columns" | "content" | "cursor" | "display" | "flex" | "float" | "gap" | "hyphens" | "inset" | "isolation" | "left" | "opacity" | "order" | "overflow" | "position" | "resize" | "right" | "rotate" | "scale" | "stroke" | "top" | "transform" | "transition" | "visibility" | "borderColor" | "borderRadius" | "borderSpacing" | "borderWidth" | "margin" | "padding" | "translate" | "item" | "width" | "height" | "color" | "alignmentBaseline" | "baselineShift" | "clip" | "clipPath" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "direction" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "imageRendering" | "letterSpacing" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "offset" | "paintOrder" | "pointerEvents" | "shapeRendering" | "stopColor" | "stopOpacity" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "textDecoration" | "textRendering" | "unicodeBidi" | "wordSpacing" | "writingMode" | "grid" | "marker" | "all" | "border" | "accentColor" | "alignContent" | "alignItems" | "alignSelf" | "animation" | "animationDelay" | "animationDirection" | "animationDuration" | "animationFillMode" | "animationIterationCount" | "animationName" | "animationPlayState" | "animationTimingFunction" | "aspectRatio" | "backfaceVisibility" | "background" | "backgroundAttachment" | "backgroundBlendMode" | "backgroundClip" | "backgroundColor" | "backgroundImage" | "backgroundOrigin" | "backgroundPosition" | "backgroundPositionX" | "backgroundPositionY" | "backgroundRepeat" | "backgroundSize" | "blockSize" | "borderBlock" | "borderBlockColor" | "borderBlockEnd" | "borderBlockEndColor" | "borderBlockEndStyle" | "borderBlockEndWidth" | "borderBlockStart" | "borderBlockStartColor" | "borderBlockStartStyle" | "borderBlockStartWidth" | "borderBlockStyle" | "borderBlockWidth" | "borderBottom" | "borderBottomColor" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderBottomStyle" | "borderBottomWidth" | "borderCollapse" | "borderEndEndRadius" | "borderEndStartRadius" | "borderImage" | "borderImageOutset" | "borderImageRepeat" | "borderImageSlice" | "borderImageSource" | "borderImageWidth" | "borderInline" | "borderInlineColor" | "borderInlineEnd" | "borderInlineEndColor" | "borderInlineEndStyle" | "borderInlineEndWidth" | "borderInlineStart" | "borderInlineStartColor" | "borderInlineStartStyle" | "borderInlineStartWidth" | "borderInlineStyle" | "borderInlineWidth" | "borderLeft" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRight" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderStartEndRadius" | "borderStartStartRadius" | "borderStyle" | "borderTop" | "borderTopColor" | "borderTopLeftRadius" | "borderTopRightRadius" | "borderTopStyle" | "borderTopWidth" | "boxShadow" | "boxSizing" | "breakAfter" | "breakBefore" | "breakInside" | "captionSide" | "caretColor" | "colorScheme" | "columnCount" | "columnFill" | "columnGap" | "columnRule" | "columnRuleColor" | "columnRuleStyle" | "columnRuleWidth" | "columnSpan" | "columnWidth" | "contain" | "counterIncrement" | "counterReset" | "counterSet" | "cssFloat" | "cssText" | "emptyCells" | "flexBasis" | "flexDirection" | "flexFlow" | "flexGrow" | "flexShrink" | "flexWrap" | "font" | "fontFeatureSettings" | "fontKerning" | "fontOpticalSizing" | "fontSynthesis" | "fontVariantAlternates" | "fontVariantCaps" | "fontVariantEastAsian" | "fontVariantLigatures" | "fontVariantNumeric" | "fontVariantPosition" | "fontVariationSettings" | "gridArea" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridColumn" | "gridColumnEnd" | "gridColumnGap" | "gridColumnStart" | "gridGap" | "gridRow" | "gridRowEnd" | "gridRowGap" | "gridRowStart" | "gridTemplate" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "imageOrientation" | "inlineSize" | "insetBlock" | "insetBlockEnd" | "insetBlockStart" | "insetInline" | "insetInlineEnd" | "insetInlineStart" | "justifyContent" | "justifyItems" | "justifySelf" | "lineBreak" | "lineHeight" | "listStyle" | "listStyleImage" | "listStylePosition" | "listStyleType" | "marginBlock" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInline" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maskClip" | "maskComposite" | "maskImage" | "maskMode" | "maskOrigin" | "maskPosition" | "maskRepeat" | "maskSize" | "maskType" | "maxBlockSize" | "maxHeight" | "maxInlineSize" | "maxWidth" | "minBlockSize" | "minHeight" | "minInlineSize" | "minWidth" | "mixBlendMode" | "objectFit" | "objectPosition" | "offsetDistance" | "offsetPath" | "offsetRotate" | "orphans" | "outline" | "outlineColor" | "outlineOffset" | "outlineStyle" | "outlineWidth" | "overflowAnchor" | "overflowWrap" | "overflowX" | "overflowY" | "overscrollBehavior" | "overscrollBehaviorBlock" | "overscrollBehaviorInline" | "overscrollBehaviorX" | "overscrollBehaviorY" | "paddingBlock" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInline" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "pageBreakAfter" | "pageBreakBefore" | "pageBreakInside" | "perspective" | "perspectiveOrigin" | "placeContent" | "placeItems" | "placeSelf" | "printColorAdjust" | "quotes" | "rowGap" | "rubyPosition" | "scrollBehavior" | "scrollMargin" | "scrollMarginBlock" | "scrollMarginBlockEnd" | "scrollMarginBlockStart" | "scrollMarginBottom" | "scrollMarginInline" | "scrollMarginInlineEnd" | "scrollMarginInlineStart" | "scrollMarginLeft" | "scrollMarginRight" | "scrollMarginTop" | "scrollPadding" | "scrollPaddingBlock" | "scrollPaddingBlockEnd" | "scrollPaddingBlockStart" | "scrollPaddingBottom" | "scrollPaddingInline" | "scrollPaddingInlineEnd" | "scrollPaddingInlineStart" | "scrollPaddingLeft" | "scrollPaddingRight" | "scrollPaddingTop" | "scrollSnapAlign" | "scrollSnapStop" | "scrollSnapType" | "scrollbarGutter" | "shapeImageThreshold" | "shapeMargin" | "shapeOutside" | "tabSize" | "tableLayout" | "textAlign" | "textAlignLast" | "textCombineUpright" | "textDecorationColor" | "textDecorationLine" | "textDecorationSkipInk" | "textDecorationStyle" | "textDecorationThickness" | "textEmphasis" | "textEmphasisColor" | "textEmphasisPosition" | "textEmphasisStyle" | "textIndent" | "textOrientation" | "textOverflow" | "textShadow" | "textTransform" | "textUnderlineOffset" | "textUnderlinePosition" | "touchAction" | "transformBox" | "transformOrigin" | "transformStyle" | "transitionDelay" | "transitionDuration" | "transitionProperty" | "transitionTimingFunction" | "userSelect" | "verticalAlign" | "webkitAlignContent" | "webkitAlignItems" | "webkitAlignSelf" | "webkitAnimation" | "webkitAnimationDelay" | "webkitAnimationDirection" | "webkitAnimationDuration" | "webkitAnimationFillMode" | "webkitAnimationIterationCount" | "webkitAnimationName" | "webkitAnimationPlayState" | "webkitAnimationTimingFunction" | "webkitAppearance" | "webkitBackfaceVisibility" | "webkitBackgroundClip" | "webkitBackgroundOrigin" | "webkitBackgroundSize" | "webkitBorderBottomLeftRadius" | "webkitBorderBottomRightRadius" | "webkitBorderRadius" | "webkitBorderTopLeftRadius" | "webkitBorderTopRightRadius" | "webkitBoxAlign" | "webkitBoxFlex" | "webkitBoxOrdinalGroup" | "webkitBoxOrient" | "webkitBoxPack" | "webkitBoxShadow" | "webkitBoxSizing" | "webkitFilter" | "webkitFlex" | "webkitFlexBasis" | "webkitFlexDirection" | "webkitFlexFlow" | "webkitFlexGrow" | "webkitFlexShrink" | "webkitFlexWrap" | "webkitJustifyContent" | "webkitLineClamp" | "webkitMask" | "webkitMaskBoxImage" | "webkitMaskBoxImageOutset" | "webkitMaskBoxImageRepeat" | "webkitMaskBoxImageSlice" | "webkitMaskBoxImageSource" | "webkitMaskBoxImageWidth" | "webkitMaskClip" | "webkitMaskComposite" | "webkitMaskImage" | "webkitMaskOrigin" | "webkitMaskPosition" | "webkitMaskRepeat" | "webkitMaskSize" | "webkitOrder" | "webkitPerspective" | "webkitPerspectiveOrigin" | "webkitTextFillColor" | "webkitTextSizeAdjust" | "webkitTextStroke" | "webkitTextStrokeColor" | "webkitTextStrokeWidth" | "webkitTransform" | "webkitTransformOrigin" | "webkitTransformStyle" | "webkitTransition" | "webkitTransitionDelay" | "webkitTransitionDuration" | "webkitTransitionProperty" | "webkitTransitionTimingFunction" | "webkitUserSelect" | "whiteSpace" | "widows" | "willChange" | "wordBreak" | "wordWrap" | "zIndex" | "getPropertyPriority" | "getPropertyValue" | "removeProperty" | "setProperty">(prop: P, value: CSSStyleDeclaration[P]) => boolean;
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import * as RadixAccordion from "@radix-ui/react-accordion";
|
2
2
|
import type { FC, ReactNode } from "react";
|
3
|
+
import type { VariantProps } from "tailwind-variants";
|
4
|
+
import { accordionStyles } from "./Accordion.styles";
|
3
5
|
import type { IconComponentType } from "../../Icons";
|
6
|
+
declare type AccordionVariants = VariantProps<typeof accordionStyles>;
|
4
7
|
declare type AccordionSharedProps = {
|
5
8
|
/**
|
6
9
|
* The content of the `Accordion`.
|
@@ -14,6 +17,11 @@ declare type AccordionSharedProps = {
|
|
14
17
|
* Whether the `Accordion` is disabled, preventing the user from interacting with the accordion and all its items.
|
15
18
|
*/
|
16
19
|
disabled?: boolean;
|
20
|
+
/**
|
21
|
+
* Display the Accordion in normal or a more compact style (no meta or description, smaller paddings).
|
22
|
+
* @default normal
|
23
|
+
*/
|
24
|
+
variant?: AccordionVariants["variant"];
|
17
25
|
};
|
18
26
|
declare type AccordionSingleProps = {
|
19
27
|
/**
|
@@ -1,21 +1,23 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
var _excluded = ["children", "variant"],
|
4
|
+
_excluded2 = ["children", "className"],
|
5
|
+
_excluded3 = ["onChange", "multiple"],
|
6
|
+
_excluded4 = ["onChange", "multiple", "collapsible"];
|
8
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
9
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
10
9
|
import * as RadixAccordion from "@radix-ui/react-accordion";
|
11
10
|
import cx from "clsx";
|
12
|
-
import { forwardRef } from "react";
|
11
|
+
import { createContext, forwardRef, useContext } from "react";
|
12
|
+
import { accordionStyles } from "./Accordion.styles";
|
13
13
|
import { ChevronDownIcon } from "./../../Icons";
|
14
|
-
import stl from "./../../styles/helpers/satellitePrefixer";
|
15
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
16
|
-
var
|
17
|
-
|
18
|
-
|
15
|
+
var AccordionVariantContext = /*#__PURE__*/createContext({
|
16
|
+
variant: "normal"
|
17
|
+
});
|
18
|
+
var useAccordionVariant = function useAccordionVariant() {
|
19
|
+
return useContext(AccordionVariantContext);
|
20
|
+
};
|
19
21
|
/**
|
20
22
|
* The `Accordion` component is a compact section for revealing and hiding content, ideal for keeping interfaces clean.
|
21
23
|
*
|
@@ -23,15 +25,36 @@ var TRIGGER_ICON_SIZE = 20;
|
|
23
25
|
*/
|
24
26
|
export var Accordion = function Accordion(_ref) {
|
25
27
|
var children = _ref.children,
|
26
|
-
|
28
|
+
_ref$variant = _ref.variant,
|
29
|
+
variant = _ref$variant === void 0 ? "normal" : _ref$variant,
|
27
30
|
props = _objectWithoutProperties(_ref, _excluded);
|
31
|
+
return /*#__PURE__*/_jsx(AccordionVariantContext.Provider, {
|
32
|
+
value: {
|
33
|
+
variant: variant
|
34
|
+
},
|
35
|
+
children: /*#__PURE__*/_jsx(AccordionRootInternal, _objectSpread(_objectSpread({}, props), {}, {
|
36
|
+
children: children
|
37
|
+
}))
|
38
|
+
});
|
39
|
+
};
|
40
|
+
var AccordionRootInternal = function AccordionRootInternal(_ref2) {
|
41
|
+
var children = _ref2.children,
|
42
|
+
className = _ref2.className,
|
43
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
44
|
+
var _useAccordionVariant = useAccordionVariant(),
|
45
|
+
variant = _useAccordionVariant.variant;
|
46
|
+
var styles = accordionStyles({
|
47
|
+
variant: variant
|
48
|
+
});
|
28
49
|
var sharedProps = {
|
29
|
-
className:
|
50
|
+
className: styles.base({
|
51
|
+
className: className
|
52
|
+
})
|
30
53
|
};
|
31
54
|
if (props.multiple) {
|
32
55
|
var _onChange = props.onChange,
|
33
56
|
_multiple = props.multiple,
|
34
|
-
_rest = _objectWithoutProperties(props,
|
57
|
+
_rest = _objectWithoutProperties(props, _excluded3);
|
35
58
|
return /*#__PURE__*/_jsx(RadixAccordion.Root, _objectSpread(_objectSpread(_objectSpread({}, _rest), sharedProps), {}, {
|
36
59
|
type: "multiple",
|
37
60
|
onValueChange: _onChange,
|
@@ -42,7 +65,7 @@ export var Accordion = function Accordion(_ref) {
|
|
42
65
|
multiple = props.multiple,
|
43
66
|
_props$collapsible = props.collapsible,
|
44
67
|
collapsible = _props$collapsible === void 0 ? true : _props$collapsible,
|
45
|
-
rest = _objectWithoutProperties(props,
|
68
|
+
rest = _objectWithoutProperties(props, _excluded4);
|
46
69
|
return /*#__PURE__*/_jsx(RadixAccordion.Root, _objectSpread(_objectSpread(_objectSpread({}, rest), sharedProps), {}, {
|
47
70
|
type: "single",
|
48
71
|
onValueChange: onChange,
|
@@ -51,71 +74,88 @@ export var Accordion = function Accordion(_ref) {
|
|
51
74
|
}));
|
52
75
|
};
|
53
76
|
Accordion.displayName = "Accordion";
|
54
|
-
var AccordionItem = /*#__PURE__*/forwardRef(function (
|
55
|
-
var value =
|
56
|
-
disabled =
|
57
|
-
children =
|
58
|
-
className =
|
77
|
+
var AccordionItem = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
78
|
+
var value = _ref3.value,
|
79
|
+
disabled = _ref3.disabled,
|
80
|
+
children = _ref3.children,
|
81
|
+
className = _ref3.className;
|
82
|
+
var _useAccordionVariant2 = useAccordionVariant(),
|
83
|
+
variant = _useAccordionVariant2.variant;
|
84
|
+
var styles = accordionStyles({
|
85
|
+
variant: variant
|
86
|
+
});
|
59
87
|
return /*#__PURE__*/_jsx(RadixAccordion.Item, {
|
60
88
|
value: value,
|
61
89
|
disabled: disabled,
|
62
90
|
ref: ref,
|
63
|
-
className:
|
91
|
+
className: styles.item({
|
92
|
+
className: className
|
93
|
+
}),
|
64
94
|
children: children
|
65
95
|
});
|
66
96
|
});
|
67
97
|
AccordionItem.displayName = "AccordionItem";
|
68
|
-
var AccordionHeader = /*#__PURE__*/forwardRef(function (
|
69
|
-
var children =
|
70
|
-
description =
|
71
|
-
Icon =
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
98
|
+
var AccordionHeader = /*#__PURE__*/forwardRef(function (_ref4, ref) {
|
99
|
+
var children = _ref4.children,
|
100
|
+
description = _ref4.description,
|
101
|
+
Icon = _ref4.icon,
|
102
|
+
iconClassName = _ref4.iconClassName,
|
103
|
+
iconBgClassName = _ref4.iconBgClassName,
|
104
|
+
meta = _ref4.meta,
|
105
|
+
triggerIcon = _ref4.triggerIcon,
|
106
|
+
triggerClassName = _ref4.triggerClassName,
|
107
|
+
className = _ref4.className,
|
108
|
+
titleWrapperClassName = _ref4.titleWrapperClassName,
|
109
|
+
titleClassName = _ref4.titleClassName;
|
110
|
+
var _useAccordionVariant3 = useAccordionVariant(),
|
111
|
+
variant = _useAccordionVariant3.variant;
|
112
|
+
var styles = accordionStyles({
|
113
|
+
variant: variant
|
114
|
+
});
|
115
|
+
var isCompact = variant === "compact";
|
82
116
|
var TriggerIcon = triggerIcon || ChevronDownIcon;
|
83
117
|
return /*#__PURE__*/_jsx(RadixAccordion.Header, {
|
84
|
-
className:
|
118
|
+
className: styles.header({
|
119
|
+
className: className
|
120
|
+
}),
|
85
121
|
children: /*#__PURE__*/_jsxs(RadixAccordion.Trigger, {
|
86
122
|
ref: ref,
|
87
|
-
className:
|
123
|
+
className: styles.trigger({
|
124
|
+
className: triggerClassName
|
125
|
+
}),
|
88
126
|
children: [/*#__PURE__*/_jsxs("div", {
|
89
|
-
className:
|
127
|
+
className: styles.titleWrapper({
|
128
|
+
className: titleWrapperClassName
|
129
|
+
}),
|
90
130
|
children: [Icon && /*#__PURE__*/_jsx("span", {
|
91
|
-
className:
|
131
|
+
className: styles.iconBg({
|
132
|
+
className: iconBgClassName
|
133
|
+
}),
|
92
134
|
"aria-hidden": true,
|
93
135
|
children: /*#__PURE__*/_jsx(Icon, {
|
94
|
-
className:
|
95
|
-
|
96
|
-
|
136
|
+
className: styles.icon({
|
137
|
+
className: iconClassName
|
138
|
+
})
|
97
139
|
})
|
98
140
|
}), /*#__PURE__*/_jsxs("div", {
|
99
|
-
className:
|
141
|
+
className: styles.titleCol(),
|
100
142
|
children: [/*#__PURE__*/_jsx("div", {
|
101
|
-
className:
|
143
|
+
className: styles.title({
|
144
|
+
className: titleClassName
|
145
|
+
}),
|
102
146
|
children: children
|
103
|
-
}), typeof description !== "undefined" && /*#__PURE__*/_jsx("div", {
|
104
|
-
className:
|
147
|
+
}), !isCompact && typeof description !== "undefined" && /*#__PURE__*/_jsx("div", {
|
148
|
+
className: styles.description(),
|
105
149
|
children: description
|
106
150
|
})]
|
107
151
|
})]
|
108
152
|
}), /*#__PURE__*/_jsxs("div", {
|
109
|
-
className:
|
110
|
-
children: [typeof meta !== "undefined" && /*#__PURE__*/_jsx("div", {
|
111
|
-
className:
|
153
|
+
className: styles.metaWrapper(),
|
154
|
+
children: [typeof meta !== "undefined" && !isCompact && /*#__PURE__*/_jsx("div", {
|
155
|
+
className: styles.meta(),
|
112
156
|
children: meta
|
113
157
|
}), /*#__PURE__*/_jsx(TriggerIcon, {
|
114
|
-
className: cx(
|
115
|
-
// Don't rotate the trigger icon if it's a custom one.
|
116
|
-
!triggerIcon && stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral([" group-data-[state=open]/accordion-trigger:rotate-180 motion-safe:transition-transform motion-safe:duration-300 motion-safe:ease-out"])))),
|
117
|
-
width: TRIGGER_ICON_SIZE,
|
118
|
-
height: TRIGGER_ICON_SIZE,
|
158
|
+
className: cx(styles.triggerIcon(), !triggerIcon && styles.triggerIconChevron()),
|
119
159
|
"aria-hidden": true
|
120
160
|
})]
|
121
161
|
})]
|
@@ -123,14 +163,21 @@ var AccordionHeader = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
123
163
|
});
|
124
164
|
});
|
125
165
|
AccordionHeader.displayName = "AccordionHeader";
|
126
|
-
var AccordionContent = /*#__PURE__*/forwardRef(function (
|
127
|
-
var children =
|
128
|
-
className =
|
166
|
+
var AccordionContent = /*#__PURE__*/forwardRef(function (_ref5, ref) {
|
167
|
+
var children = _ref5.children,
|
168
|
+
className = _ref5.className;
|
169
|
+
var _useAccordionVariant4 = useAccordionVariant(),
|
170
|
+
variant = _useAccordionVariant4.variant;
|
171
|
+
var styles = accordionStyles({
|
172
|
+
variant: variant
|
173
|
+
});
|
129
174
|
return /*#__PURE__*/_jsx(RadixAccordion.Content, {
|
130
175
|
ref: ref,
|
131
|
-
className:
|
176
|
+
className: styles.content({
|
177
|
+
className: className
|
178
|
+
}),
|
132
179
|
children: /*#__PURE__*/_jsx("div", {
|
133
|
-
className:
|
180
|
+
className: styles.contentInner(),
|
134
181
|
children: children
|
135
182
|
})
|
136
183
|
});
|