@deque/cauldron-react 6.1.0-canary.e8a7f45e → 6.1.0-canary.f877edfd

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/lib/cauldron.css CHANGED
@@ -56,6 +56,8 @@ a.Button--thin {
56
56
 
57
57
  .Icon svg {
58
58
  display: block;
59
+ height: var(--icon-size);
60
+ width: var(--icon-size);
59
61
  }
60
62
 
61
63
  /* Icon--down is the default orientation */
package/lib/index.js CHANGED
@@ -1345,7 +1345,8 @@ SideBarItem.defaultProps = {
1345
1345
  */
1346
1346
  var AriaIsolate = /** @class */ (function () {
1347
1347
  function AriaIsolate(el) {
1348
- if (!(el instanceof HTMLElement)) {
1348
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-constructor
1349
+ if (typeof HTMLElement === 'undefined' || !(el instanceof HTMLElement)) {
1349
1350
  throw new Error('AriaIsolate must be instantiated with a valid HTML element');
1350
1351
  }
1351
1352
  this.element = el;
@@ -1735,7 +1736,9 @@ function Tooltip(_a) {
1735
1736
  }), ref: setTooltipElement, role: "tooltip", style: styles.popper }, attributes.popper, props),
1736
1737
  variant !== 'big' && (React__default["default"].createElement("div", { className: "TooltipArrow", ref: setArrowElement, style: styles.arrow })),
1737
1738
  children), (portal && 'current' in portal ? portal.current : portal) ||
1738
- document.body)
1739
+ (
1740
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
1741
+ document === null || document === void 0 ? void 0 : document.body))
1739
1742
  : null));
1740
1743
  }
1741
1744
  Tooltip.displayName = 'Tooltip';
@@ -3717,10 +3720,13 @@ var Combobox = React.forwardRef(function (_a, ref) {
3717
3720
  onClick: handleInputClick },
3718
3721
  React__default["default"].createElement("input", tslib.__assign({ type: "text", id: "".concat(id, "-input"), ref: inputRef, value: value, role: "combobox", "aria-autocomplete": !isAutoComplete ? 'none' : 'list', "aria-controls": "".concat(id, "-listbox"), "aria-expanded": open, "aria-haspopup": "listbox", "aria-activedescendant": open && activeDescendant ? activeDescendant.element.id : undefined }, inputProps, { onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur })),
3719
3722
  React__default["default"].createElement("span", { className: "Combobox__arrow" })),
3720
- React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal
3721
- ? reactDom.createPortal(comboboxListbox, portal instanceof HTMLElement
3723
+ React__default["default"].createElement(ComboboxProvider, { autocomplete: autocomplete, inputValue: value, formValue: formValue, selectedValue: selectedValue, matches: !isAutoComplete || defaultAutoCompleteMatches, matchingOptions: matchingOptions, setMatchingOptions: setMatchingOptions, setFormValue: setFormValue }, portal && typeof document !== 'undefined'
3724
+ ? reactDom.createPortal(comboboxListbox,
3725
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3726
+ portal instanceof HTMLElement
3722
3727
  ? portal
3723
3728
  : portal.current ||
3729
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3724
3730
  /* istanbul ignore next: default fallback value */ document.body)
3725
3731
  : comboboxListbox),
3726
3732
  hasError && (React__default["default"].createElement("div", { className: "Error", id: errorId }, error))));
@@ -3868,10 +3874,25 @@ var Popover = React.forwardRef(function (_a, ref) {
3868
3874
  }), ref: popoverRef, role: "dialog", style: styles.popper }, attributes.popper, additionalProps, props),
3869
3875
  React__default["default"].createElement("div", { className: "Popover__popoverArrow", ref: setArrowElement, style: styles.arrow }),
3870
3876
  React__default["default"].createElement("div", { className: "Popover__borderLeft" }),
3871
- variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) || document.body);
3877
+ variant === 'prompt' ? (React__default["default"].createElement(PromptPopoverContent, { applyButtonText: applyButtonText, onApply: onApply, closeButtonText: closeButtonText, infoText: infoText || '', onClose: handleClosePopover, infoTextId: "".concat(id, "-label") })) : (children)))), (portal && 'current' in portal ? portal.current : portal) ||
3878
+ // Dependent on "isBrowser" check above:
3879
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3880
+ document.body);
3872
3881
  });
3873
3882
  Popover.displayName = 'Popover';
3874
3883
 
3884
+ function Timeline(_a) {
3885
+ var className = _a.className, children = _a.children, props = tslib.__rest(_a, ["className", "children"]);
3886
+ return (React__default["default"].createElement("ol", tslib.__assign({ className: classNames__default["default"]('Timeline', className) }, props), children));
3887
+ }
3888
+
3889
+ function TimelineItem(_a) {
3890
+ var className = _a.className, children = _a.children, icon = _a.icon, props = tslib.__rest(_a, ["className", "children", "icon"]);
3891
+ return (React__default["default"].createElement("li", tslib.__assign({ className: classNames__default["default"]('TimelineItem', className) }, props),
3892
+ React__default["default"].createElement("span", { className: "TimelineItem__separator" }, icon),
3893
+ React__default["default"].createElement("div", { className: "TimelineItem__details" }, children)));
3894
+ }
3895
+
3875
3896
  var LIGHT_THEME_CLASS = 'cauldron--theme-light';
3876
3897
  var DARK_THEME_CLASS = 'cauldron--theme-dark';
3877
3898
  var ThemeContext = React.createContext({
@@ -3881,17 +3902,21 @@ var ThemeContext = React.createContext({
3881
3902
  }
3882
3903
  });
3883
3904
  var ThemeProvider = function (_a) {
3884
- var children = _a.children, _b = _a.context, context = _b === void 0 ? document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
3905
+ var children = _a.children,
3906
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3907
+ _b = _a.context,
3908
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-react-fc
3909
+ context = _b === void 0 ? document === null || document === void 0 ? void 0 : document.body : _b, _c = _a.initialTheme, initialTheme = _c === void 0 ? 'light' : _c;
3885
3910
  var _d = tslib.__read(React.useState(initialTheme), 2), theme = _d[0], setTheme = _d[1];
3886
3911
  var getThemeFromContext = function () {
3887
- return context.classList.contains(DARK_THEME_CLASS) ? 'dark' : 'light';
3912
+ return (context === null || context === void 0 ? void 0 : context.classList.contains(DARK_THEME_CLASS)) ? 'dark' : 'light';
3888
3913
  };
3889
3914
  var toggleTheme = function () {
3890
3915
  return setTheme(getThemeFromContext() === 'dark' ? 'light' : 'dark');
3891
3916
  };
3892
3917
  React.useEffect(function () {
3893
- context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
3894
- context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
3918
+ context === null || context === void 0 ? void 0 : context.classList.toggle(LIGHT_THEME_CLASS, theme === 'light');
3919
+ context === null || context === void 0 ? void 0 : context.classList.toggle(DARK_THEME_CLASS, theme === 'dark');
3895
3920
  }, [context, theme]);
3896
3921
  // Use a MutationObserver to track changes to the classes outside of the context of React
3897
3922
  var handleMutation = function (mutationList) {
@@ -3914,6 +3939,9 @@ var ThemeProvider = function (_a) {
3914
3939
  }
3915
3940
  };
3916
3941
  React.useEffect(function () {
3942
+ if (!context) {
3943
+ return;
3944
+ }
3917
3945
  var observer = new MutationObserver(handleMutation);
3918
3946
  observer.observe(context, {
3919
3947
  childList: false,
@@ -4024,6 +4052,8 @@ exports.TagLabel = TagLabel;
4024
4052
  exports.TextField = TextField;
4025
4053
  exports.ThemeContext = ThemeContext;
4026
4054
  exports.ThemeProvider = ThemeProvider;
4055
+ exports.Timeline = Timeline;
4056
+ exports.TimelineItem = TimelineItem;
4027
4057
  exports.Toast = Toast;
4028
4058
  exports.Tooltip = Tooltip;
4029
4059
  exports.TooltipContent = TooltipContent;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface TimelineProps extends React.HTMLAttributes<HTMLOListElement> {
3
+ className?: string;
4
+ }
5
+ export default function Timeline({ className, children, ...props }: TimelineProps): JSX.Element;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface TimelineItemProps extends React.HTMLAttributes<HTMLLIElement> {
3
+ icon?: React.ReactElement;
4
+ }
5
+ export default function TimelineItem({ className, children, icon, ...props }: TimelineItemProps): JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default } from './Timeline';
2
+ export { default as TimelineItem } from './TimelineItem';
@@ -0,0 +1 @@
1
+ export {};
@@ -53,6 +53,7 @@ export { default as Notice } from './components/Notice';
53
53
  export { default as Listbox, ListboxOption, ListboxGroup } from './components/Listbox';
54
54
  export { default as Combobox, ComboboxOption, ComboboxGroup } from './components/Combobox';
55
55
  export { default as Popover } from './components/Popover';
56
+ export { default as Timeline, TimelineItem } from './components/Timeline';
56
57
  /**
57
58
  * Helpers / Utils
58
59
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.1.0-canary.e8a7f45e",
3
+ "version": "6.1.0-canary.f877edfd",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",