@deque/cauldron-react 6.2.0 → 6.2.1-canary.0efb2078
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/{src/components → components}/Link/index.d.ts +1 -4
- package/lib/{src/components → components}/RadioGroup/index.d.ts +0 -1
- package/lib/components/SearchField/index.d.ts +13 -0
- package/lib/components/internal/TextFieldWrapper/index.d.ts +7 -0
- package/lib/{src/index.d.ts → index.d.ts} +1 -0
- package/lib/index.js +95 -28
- package/lib/utils/idRefs.d.ts +25 -0
- package/package.json +2 -2
- package/lib/__tests__/setupTests.d.ts +0 -2
- package/lib/src/axe.d.ts +0 -3
- package/lib/src/components/Button/index.test.d.ts +0 -1
- package/lib/src/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/lib/src/components/Combobox/Combobox.test.d.ts +0 -1
- package/lib/src/components/Tag/index.test.d.ts +0 -1
- package/lib/src/components/TextField/TextField.test.d.ts +0 -1
- package/lib/src/components/Timeline/timeline.test.d.ts +0 -1
- package/lib/src/utils/remove-ids/index.d.ts +0 -2
- package/lib/src/utils/token-list/index.d.ts +0 -5
- /package/lib/{src/components → components}/Accordion/Accordion.d.ts +0 -0
- /package/lib/{src/components → components}/Accordion/index.d.ts +0 -0
- /package/lib/{src/components → components}/Address/index.d.ts +0 -0
- /package/lib/{src/components → components}/Alert/index.d.ts +0 -0
- /package/lib/{src/components → components}/Breadcrumb/Breadcrumb.d.ts +0 -0
- /package/lib/{src/components → components}/Breadcrumb/BreadcrumbItem.d.ts +0 -0
- /package/lib/{src/components → components}/Breadcrumb/BreadcrumbLink.d.ts +0 -0
- /package/lib/{src/components → components}/Breadcrumb/index.d.ts +0 -0
- /package/lib/{src/components → components}/Button/index.d.ts +0 -0
- /package/lib/{src/components → components}/Checkbox/index.d.ts +0 -0
- /package/lib/{src/components → components}/ClickOutsideListener/index.d.ts +0 -0
- /package/lib/{src/components → components}/Code/index.d.ts +0 -0
- /package/lib/{src/components → components}/Combobox/Combobox.d.ts +0 -0
- /package/lib/{src/components → components}/Combobox/ComboboxContext.d.ts +0 -0
- /package/lib/{src/components → components}/Combobox/ComboboxGroup.d.ts +0 -0
- /package/lib/{src/components → components}/Combobox/ComboboxOption.d.ts +0 -0
- /package/lib/{src/components → components}/Combobox/index.d.ts +0 -0
- /package/lib/{src/components → components}/DescriptionList/index.d.ts +0 -0
- /package/lib/{src/components → components}/Dialog/index.d.ts +0 -0
- /package/lib/{src/components → components}/ExpandCollapsePanel/ExpandCollapsePanel.d.ts +0 -0
- /package/lib/{src/components → components}/ExpandCollapsePanel/PanelTrigger.d.ts +0 -0
- /package/lib/{src/components → components}/ExpandCollapsePanel/index.d.ts +0 -0
- /package/lib/{src/components → components}/FieldWrap/index.d.ts +0 -0
- /package/lib/{src/components → components}/Icon/index.d.ts +0 -0
- /package/lib/{src/components → components}/Icon/types.d.ts +0 -0
- /package/lib/{src/components → components}/IconButton/index.d.ts +0 -0
- /package/lib/{src/components → components}/Layout/index.d.ts +0 -0
- /package/lib/{src/components → components}/Line/index.d.ts +0 -0
- /package/lib/{src/components → components}/Listbox/Listbox.d.ts +0 -0
- /package/lib/{src/components → components}/Listbox/ListboxContext.d.ts +0 -0
- /package/lib/{src/components → components}/Listbox/ListboxGroup.d.ts +0 -0
- /package/lib/{src/components → components}/Listbox/ListboxOption.d.ts +0 -0
- /package/lib/{src/components → components}/Listbox/index.d.ts +0 -0
- /package/lib/{src/components → components}/Loader/index.d.ts +0 -0
- /package/lib/{src/components → components}/LoaderOverlay/axe-loader.d.ts +0 -0
- /package/lib/{src/components → components}/LoaderOverlay/index.d.ts +0 -0
- /package/lib/{src/components → components}/Main/index.d.ts +0 -0
- /package/lib/{src/components → components}/MenuBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/MenuItem/click-link.d.ts +0 -0
- /package/lib/{src/components → components}/MenuItem/index.d.ts +0 -0
- /package/lib/{src/components → components}/Modal/index.d.ts +0 -0
- /package/lib/{src/components → components}/NavBar/NavBar.d.ts +0 -0
- /package/lib/{src/components → components}/NavBar/NavItem.d.ts +0 -0
- /package/lib/{src/components → components}/NavBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/Notice/index.d.ts +0 -0
- /package/lib/{src/components → components}/Offscreen/index.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/OptionsMenu.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/OptionsMenuItem.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/OptionsMenuList.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/OptionsMenuTrigger.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/OptionsMenuWrapper.d.ts +0 -0
- /package/lib/{src/components → components}/OptionsMenu/index.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/Pagination.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/index.d.ts +0 -0
- /package/lib/{src/components → components}/Pagination/usePagination.d.ts +0 -0
- /package/lib/{src/components → components}/Panel/Panel.d.ts +0 -0
- /package/lib/{src/components → components}/Panel/PanelContent.d.ts +0 -0
- /package/lib/{src/components → components}/Panel/PanelHeader.d.ts +0 -0
- /package/lib/{src/components → components}/Panel/index.d.ts +0 -0
- /package/lib/{src/components → components}/Popover/index.d.ts +0 -0
- /package/lib/{src/components → components}/ProgressBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/RadioCardGroup/index.d.ts +0 -0
- /package/lib/{src/components → components}/Scrim/index.d.ts +0 -0
- /package/lib/{src/components → components}/Select/index.d.ts +0 -0
- /package/lib/{src/components → components}/SideBar/SideBar.d.ts +0 -0
- /package/lib/{src/components → components}/SideBar/SideBarItem.d.ts +0 -0
- /package/lib/{src/components → components}/SideBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/SkipLink/index.d.ts +0 -0
- /package/lib/{src/components → components}/Stepper/index.d.ts +0 -0
- /package/lib/{src/components → components}/Table/Table.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableBody.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableCell.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableFooter.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableHead.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableHeader.d.ts +0 -0
- /package/lib/{src/components → components}/Table/TableRow.d.ts +0 -0
- /package/lib/{src/components → components}/Table/index.d.ts +0 -0
- /package/lib/{src/components → components}/Tabs/Tab.d.ts +0 -0
- /package/lib/{src/components → components}/Tabs/TabPanel.d.ts +0 -0
- /package/lib/{src/components → components}/Tabs/Tabs.d.ts +0 -0
- /package/lib/{src/components → components}/Tabs/index.d.ts +0 -0
- /package/lib/{src/components → components}/Tag/index.d.ts +0 -0
- /package/lib/{src/components → components}/TagButton/index.d.ts +0 -0
- /package/lib/{src/components → components}/TextField/index.d.ts +0 -0
- /package/lib/{src/components → components}/Timeline/Timeline.d.ts +0 -0
- /package/lib/{src/components → components}/Timeline/TimelineItem.d.ts +0 -0
- /package/lib/{src/components → components}/Timeline/index.d.ts +0 -0
- /package/lib/{src/components → components}/Toast/index.d.ts +0 -0
- /package/lib/{src/components → components}/Toast/utils.d.ts +0 -0
- /package/lib/{src/components → components}/Tooltip/index.d.ts +0 -0
- /package/lib/{src/components → components}/TooltipTabstop/index.d.ts +0 -0
- /package/lib/{src/components → components}/TopBar/TopBar.d.ts +0 -0
- /package/lib/{src/components → components}/TopBar/TopBarMenu.d.ts +0 -0
- /package/lib/{src/components → components}/TopBar/TopBarTrigger.d.ts +0 -0
- /package/lib/{src/components → components}/TopBar/index.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/ColumnGroupHeader.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/ColumnHeader.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/ColumnLeft.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/ColumnList.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/ColumnRight.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/TwoColumnPanel.d.ts +0 -0
- /package/lib/{src/components → components}/TwoColumnPanel/index.d.ts +0 -0
- /package/lib/{src/components → components}/Workspace/index.d.ts +0 -0
- /package/lib/{src/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/{src/contexts → contexts}/theme.d.ts +0 -0
- /package/lib/{src/types.d.ts → types.d.ts} +0 -0
- /package/lib/{src/utils → utils}/aria-isolate/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/focusable-selector/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/is-browser/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/polymorphic-type/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/query-all/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/rndid/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/setRef.d.ts +0 -0
- /package/lib/{src/utils → utils}/stylesheets/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/use-did-update/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/useIntersectionRef.d.ts +0 -0
- /package/lib/{src/utils → utils}/useSharedRef.d.ts +0 -0
- /package/lib/{src/utils → utils}/viewport/index.d.ts +0 -0
|
@@ -4,8 +4,5 @@ export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>
|
|
|
4
4
|
variant?: 'button' | 'button-secondary';
|
|
5
5
|
thin?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const Link:
|
|
8
|
-
({ children, linkRef, className, variant, thin, ...other }: LinkProps): React.JSX.Element;
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
7
|
+
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
11
8
|
export default Link;
|
|
@@ -12,7 +12,6 @@ export interface RadioGroupProps extends Omit<React.HTMLAttributes<HTMLDivElemen
|
|
|
12
12
|
value?: any;
|
|
13
13
|
inline?: boolean;
|
|
14
14
|
onChange?: (radio: RadioItem, input: HTMLElement) => void;
|
|
15
|
-
hasLabel?: never;
|
|
16
15
|
}
|
|
17
16
|
declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
17
|
export default RadioGroup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
2
|
+
import type { ContentNode } from '../../types';
|
|
3
|
+
interface SearchFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
4
|
+
label: ContentNode;
|
|
5
|
+
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
7
|
+
onChange?: (value: string, e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
hideLabel?: boolean;
|
|
9
|
+
isForm?: boolean;
|
|
10
|
+
trailingChildren?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare const SearchField: React.ForwardRefExoticComponent<SearchFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
+
export default SearchField;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export interface TextFieldWrapperProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const TextFieldWrapper: React.ForwardRefExoticComponent<TextFieldWrapperProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export default TextFieldWrapper;
|
|
@@ -30,6 +30,7 @@ export { default as Checkbox } from './components/Checkbox';
|
|
|
30
30
|
export { default as Tooltip, TooltipHead, TooltipContent } from './components/Tooltip';
|
|
31
31
|
export { default as TooltipTabstop } from './components/TooltipTabstop';
|
|
32
32
|
export { default as TextField } from './components/TextField';
|
|
33
|
+
export { default as SearchField } from './components/SearchField';
|
|
33
34
|
export { default as ClickOutsideListener } from './components/ClickOutsideListener';
|
|
34
35
|
export { default as ExpandCollapsePanel, PanelTrigger } from './components/ExpandCollapsePanel';
|
|
35
36
|
export { default as Sidebar, SideBarItem } from './components/SideBar';
|
package/lib/index.js
CHANGED
|
@@ -1601,6 +1601,43 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
1601
1601
|
});
|
|
1602
1602
|
Button.displayName = 'Button';
|
|
1603
1603
|
|
|
1604
|
+
/**
|
|
1605
|
+
* Returns a unique set of id refs from the provided string
|
|
1606
|
+
* @param ids - string of id refs
|
|
1607
|
+
*/
|
|
1608
|
+
function idRefs(ids) {
|
|
1609
|
+
if (!ids || !ids.trim()) {
|
|
1610
|
+
return new Set();
|
|
1611
|
+
}
|
|
1612
|
+
return new Set(ids.trim().split(/\s+/));
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Returns an updated id ref string with the provided id value added
|
|
1616
|
+
* @param ids - string of id refs
|
|
1617
|
+
* @param id - id to add
|
|
1618
|
+
*/
|
|
1619
|
+
function addIdRef(ids, id) {
|
|
1620
|
+
return tslib.__spreadArray([], tslib.__read(idRefs(ids).add(id)), false).join(' ');
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Returns an updated id ref string with the provided id value removed
|
|
1624
|
+
* @param ids - string of id refs
|
|
1625
|
+
* @param id - id to remove
|
|
1626
|
+
*/
|
|
1627
|
+
function removeIdRef(_ids, id) {
|
|
1628
|
+
var ids = idRefs(_ids);
|
|
1629
|
+
ids.delete(id);
|
|
1630
|
+
return tslib.__spreadArray([], tslib.__read(ids), false).join(' ');
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Returns if an id ref string contains the provided id value
|
|
1634
|
+
* @param ids - string of id refs
|
|
1635
|
+
* @param id - id to check if it exists in the provided idRef string
|
|
1636
|
+
*/
|
|
1637
|
+
function hasIdRef(ids, id) {
|
|
1638
|
+
return idRefs(ids).has(id);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1604
1641
|
var TIP_HIDE_DELAY = 100;
|
|
1605
1642
|
// fires a custom "cauldron:tooltip:show" / "cauldron:tooltip:hide" event
|
|
1606
1643
|
// to allow projects using cauldron to hook into when a tooltip is shown/hidden
|
|
@@ -1723,11 +1760,17 @@ function Tooltip(_a) {
|
|
|
1723
1760
|
}, [tooltipElement, show, hide]);
|
|
1724
1761
|
// Keep the target's id in sync
|
|
1725
1762
|
React.useEffect(function () {
|
|
1726
|
-
var
|
|
1727
|
-
if (!(
|
|
1728
|
-
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association,
|
|
1763
|
+
var idRefs = targetElement === null || targetElement === void 0 ? void 0 : targetElement.getAttribute(association);
|
|
1764
|
+
if (!hasIdRef(idRefs, id)) {
|
|
1765
|
+
targetElement === null || targetElement === void 0 ? void 0 : targetElement.setAttribute(association, addIdRef(idRefs, id));
|
|
1729
1766
|
}
|
|
1730
|
-
|
|
1767
|
+
return function () {
|
|
1768
|
+
if (targetElement) {
|
|
1769
|
+
var idRefs_1 = targetElement.getAttribute(association);
|
|
1770
|
+
targetElement.setAttribute(association, removeIdRef(idRefs_1, id));
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
}, [targetElement, id, association]);
|
|
1731
1774
|
return (React__default["default"].createElement(React__default["default"].Fragment, null, (showTooltip || hideElementOnHidden) && isBrowser()
|
|
1732
1775
|
? reactDom.createPortal(React__default["default"].createElement("div", tslib.__assign({ id: id, className: classNames__default["default"]('Tooltip', "Tooltip--".concat(placement), className, {
|
|
1733
1776
|
TooltipInfo: variant === 'info',
|
|
@@ -1968,15 +2011,15 @@ var Toast = /** @class */ (function (_super) {
|
|
|
1968
2011
|
return Toast;
|
|
1969
2012
|
}(React__default["default"].Component));
|
|
1970
2013
|
|
|
1971
|
-
var Link = function (_a) {
|
|
2014
|
+
var Link = React.forwardRef(function (_a, ref) {
|
|
1972
2015
|
var children = _a.children, linkRef = _a.linkRef, className = _a.className, variant = _a.variant, thin = _a.thin, other = tslib.__rest(_a, ["children", "linkRef", "className", "variant", "thin"]);
|
|
1973
|
-
return (React__default["default"].createElement("a", tslib.__assign({ ref: linkRef, className: classNames__default["default"](className, {
|
|
2016
|
+
return (React__default["default"].createElement("a", tslib.__assign({ ref: ref || linkRef, className: classNames__default["default"](className, {
|
|
1974
2017
|
Link: !variant,
|
|
1975
2018
|
'Button--primary': variant === 'button',
|
|
1976
2019
|
'Button--secondary': variant === 'button-secondary',
|
|
1977
2020
|
'Button--thin': thin
|
|
1978
2021
|
}) }, other), children));
|
|
1979
|
-
};
|
|
2022
|
+
});
|
|
1980
2023
|
Link.displayName = 'Link';
|
|
1981
2024
|
|
|
1982
2025
|
var Loader = React__default["default"].forwardRef(function (_a, ref) {
|
|
@@ -1998,19 +2041,6 @@ var randomId = function () {
|
|
|
1998
2041
|
return "x_".concat(i++, "_").concat(num);
|
|
1999
2042
|
};
|
|
2000
2043
|
|
|
2001
|
-
/**
|
|
2002
|
-
* Adds an id to a token list attribute if its not already present in the list
|
|
2003
|
-
*/
|
|
2004
|
-
var tokenList = function (id, currentVal) {
|
|
2005
|
-
if (currentVal === void 0) { currentVal = ''; }
|
|
2006
|
-
var values = currentVal.split(' ');
|
|
2007
|
-
if (values.includes(id)) {
|
|
2008
|
-
return currentVal;
|
|
2009
|
-
}
|
|
2010
|
-
values.push(id);
|
|
2011
|
-
return values.join(' ').trim();
|
|
2012
|
-
};
|
|
2013
|
-
|
|
2014
2044
|
var Select = React__default["default"].forwardRef(function (_a, ref) {
|
|
2015
2045
|
var options = _a.options, children = _a.children, disabled = _a.disabled, label = _a.label, id = _a.id, required = _a.required, _b = _a.requiredText, requiredText = _b === void 0 ? 'Required' : _b, error = _a.error, value = _a.value, ariaDescribedby = _a["aria-describedby"], defaultValue = _a.defaultValue, onChange = _a.onChange, rest = tslib.__rest(_a, ["options", "children", "disabled", "label", "id", "required", "requiredText", "error", "value", 'aria-describedby', "defaultValue", "onChange"]);
|
|
2016
2046
|
if (options && children) {
|
|
@@ -2044,7 +2074,7 @@ var Select = React__default["default"].forwardRef(function (_a, ref) {
|
|
|
2044
2074
|
dynamicProps.defaultValue = defaultValue;
|
|
2045
2075
|
}
|
|
2046
2076
|
if (error) {
|
|
2047
|
-
dynamicProps['aria-describedby'] =
|
|
2077
|
+
dynamicProps['aria-describedby'] = addIdRef(ariaDescribedby, errorId);
|
|
2048
2078
|
}
|
|
2049
2079
|
// In order to support controlled selects, we
|
|
2050
2080
|
// have to attach an `onChange` to the select.
|
|
@@ -2260,10 +2290,10 @@ var Checkbox = React.forwardRef(function (_a, ref) {
|
|
|
2260
2290
|
}, []), errorId = _f.errorId, labelDescriptionId = _f.labelDescriptionId;
|
|
2261
2291
|
var ariaDescribedbyId = ariaDescribedby;
|
|
2262
2292
|
if (error) {
|
|
2263
|
-
ariaDescribedbyId =
|
|
2293
|
+
ariaDescribedbyId = addIdRef(ariaDescribedbyId, errorId);
|
|
2264
2294
|
}
|
|
2265
2295
|
if (labelDescription) {
|
|
2266
|
-
ariaDescribedbyId =
|
|
2296
|
+
ariaDescribedbyId = addIdRef(ariaDescribedbyId, labelDescriptionId);
|
|
2267
2297
|
}
|
|
2268
2298
|
return (React__default["default"].createElement("div", { className: "Checkbox__wrap" },
|
|
2269
2299
|
React__default["default"].createElement("div", { className: classNames__default["default"]('Checkbox is--flex-row', className) },
|
|
@@ -2349,7 +2379,7 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2349
2379
|
var Field = multiline ? 'textarea' : 'input';
|
|
2350
2380
|
var inputProps = {
|
|
2351
2381
|
'aria-describedby': error
|
|
2352
|
-
?
|
|
2382
|
+
? addIdRef(ariaDescribedby, this.errorId)
|
|
2353
2383
|
: ariaDescribedby
|
|
2354
2384
|
};
|
|
2355
2385
|
return (React__default["default"].createElement("div", { className: "Field" },
|
|
@@ -2396,6 +2426,44 @@ var TextField = /** @class */ (function (_super) {
|
|
|
2396
2426
|
return TextField;
|
|
2397
2427
|
}(React__default["default"].Component));
|
|
2398
2428
|
|
|
2429
|
+
var TextFieldWrapper = React.forwardRef(function (_a, ref) {
|
|
2430
|
+
var className = _a.className, children = _a.children, otherProps = tslib.__rest(_a, ["className", "children"]);
|
|
2431
|
+
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('TextFieldWrapper', className) }, otherProps, { ref: ref }), children));
|
|
2432
|
+
});
|
|
2433
|
+
TextFieldWrapper.displayName = 'TextFieldWrapper';
|
|
2434
|
+
|
|
2435
|
+
var SearchField = React.forwardRef(function (_a, ref) {
|
|
2436
|
+
var label = _a.label, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, onChange = _a.onChange, _c = _a.hideLabel, hideLabel = _c === void 0 ? false : _c, _d = _a.placeholder, placeholder = _d === void 0 ? 'Search...' : _d, _e = _a.isForm, isForm = _e === void 0 ? true : _e, propId = _a.id, propValue = _a.value, trailingChildren = _a.trailingChildren, otherProps = tslib.__rest(_a, ["label", "defaultValue", "onChange", "hideLabel", "placeholder", "isForm", "id", "value", "trailingChildren"]);
|
|
2437
|
+
var isControlled = typeof propValue !== 'undefined';
|
|
2438
|
+
var _f = tslib.__read(React.useState(isControlled ? propValue : defaultValue), 2), value = _f[0], setValue = _f[1];
|
|
2439
|
+
var _g = tslib.__read(propId ? [propId] : nextId.useId(1, 'search-field'), 1), id = _g[0];
|
|
2440
|
+
var inputId = React.useRef(id).current;
|
|
2441
|
+
var handleChange = function (e) {
|
|
2442
|
+
var newValue = e.target.value;
|
|
2443
|
+
if (typeof onChange === 'function') {
|
|
2444
|
+
onChange(newValue, e);
|
|
2445
|
+
}
|
|
2446
|
+
if (isControlled) {
|
|
2447
|
+
return;
|
|
2448
|
+
}
|
|
2449
|
+
setValue(newValue);
|
|
2450
|
+
};
|
|
2451
|
+
var Field = isForm ? 'form' : 'div';
|
|
2452
|
+
if (typeof trailingChildren === 'string') {
|
|
2453
|
+
trailingChildren = React__default["default"].createElement("span", null, trailingChildren);
|
|
2454
|
+
}
|
|
2455
|
+
return (React__default["default"].createElement(Field, { role: isForm ? 'search' : undefined, className: "SearchField", "aria-labelledby": isForm ? "".concat(inputId, "-label") : undefined },
|
|
2456
|
+
hideLabel ? (React__default["default"].createElement(Offscreen, null,
|
|
2457
|
+
React__default["default"].createElement("label", { htmlFor: inputId, id: "".concat(inputId, "-label") }, label))) : (React__default["default"].createElement("label", { className: "Field__label", htmlFor: inputId, id: "".concat(inputId, "-label") }, label)),
|
|
2458
|
+
React__default["default"].createElement(TextFieldWrapper, { className: classNames__default["default"]({
|
|
2459
|
+
'TextFieldWrapper--disabled': otherProps.disabled
|
|
2460
|
+
}) },
|
|
2461
|
+
React__default["default"].createElement(Icon, { type: "magnifying-glass", className: "SearchField__search-icon" }),
|
|
2462
|
+
React__default["default"].createElement("input", tslib.__assign({ id: inputId, value: value, onChange: handleChange, placeholder: placeholder, ref: ref }, otherProps, { className: classNames__default["default"](otherProps.className, 'Field__text-input'), type: "search" })),
|
|
2463
|
+
trailingChildren)));
|
|
2464
|
+
});
|
|
2465
|
+
SearchField.displayName = 'SearchField';
|
|
2466
|
+
|
|
2399
2467
|
SyntaxHighlighter__default["default"].registerLanguage('javascript', js__default["default"]);
|
|
2400
2468
|
SyntaxHighlighter__default["default"].registerLanguage('css', css__default["default"]);
|
|
2401
2469
|
SyntaxHighlighter__default["default"].registerLanguage('html', xml__default["default"]);
|
|
@@ -3702,7 +3770,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3702
3770
|
noMatchingOptions));
|
|
3703
3771
|
var errorId = "".concat(id, "-error");
|
|
3704
3772
|
var inputProps = tslib.__assign(tslib.__assign({}, props), { 'aria-describedby': error
|
|
3705
|
-
?
|
|
3773
|
+
? addIdRef(ariaDescribedby, errorId)
|
|
3706
3774
|
: ariaDescribedby });
|
|
3707
3775
|
return (React__default["default"].createElement("div", { id: id, className: classNames__default["default"]('Combobox', className), ref: comboboxRef },
|
|
3708
3776
|
name && React__default["default"].createElement("input", { type: "hidden", name: name, value: formValue }),
|
|
@@ -3712,9 +3780,7 @@ var Combobox = React.forwardRef(function (_a, ref) {
|
|
|
3712
3780
|
}), id: "".concat(id, "-label"), htmlFor: "".concat(id, "-input") },
|
|
3713
3781
|
React__default["default"].createElement("span", null, label),
|
|
3714
3782
|
isRequired && (React__default["default"].createElement("span", { className: "Field__required-text" }, requiredText))),
|
|
3715
|
-
React__default["default"].createElement(
|
|
3716
|
-
'Combobox__input--error': hasError
|
|
3717
|
-
}),
|
|
3783
|
+
React__default["default"].createElement(TextFieldWrapper, { className: classNames__default["default"]({ 'TextFieldWrapper--error': hasError }),
|
|
3718
3784
|
// We're handling click here to open the listbox when the wrapping element is clicked,
|
|
3719
3785
|
// there's already keyboard handlers to open the listbox on the input element
|
|
3720
3786
|
onClick: handleInputClick },
|
|
@@ -4029,6 +4095,7 @@ exports.ProgressBar = ProgressBar;
|
|
|
4029
4095
|
exports.RadioCardGroup = RadioCardGroup;
|
|
4030
4096
|
exports.RadioGroup = RadioGroup;
|
|
4031
4097
|
exports.Scrim = Scrim;
|
|
4098
|
+
exports.SearchField = SearchField;
|
|
4032
4099
|
exports.Select = Select;
|
|
4033
4100
|
exports.SideBar = SideBar;
|
|
4034
4101
|
exports.SideBarItem = SideBarItem;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type IdRefs = string | null | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* Returns a unique set of id refs from the provided string
|
|
4
|
+
* @param ids - string of id refs
|
|
5
|
+
*/
|
|
6
|
+
export default function idRefs(ids: IdRefs): Set<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Returns an updated id ref string with the provided id value added
|
|
9
|
+
* @param ids - string of id refs
|
|
10
|
+
* @param id - id to add
|
|
11
|
+
*/
|
|
12
|
+
export declare function addIdRef(ids: IdRefs, id: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns an updated id ref string with the provided id value removed
|
|
15
|
+
* @param ids - string of id refs
|
|
16
|
+
* @param id - id to remove
|
|
17
|
+
*/
|
|
18
|
+
export declare function removeIdRef(_ids: IdRefs, id: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Returns if an id ref string contains the provided id value
|
|
21
|
+
* @param ids - string of id refs
|
|
22
|
+
* @param id - id to check if it exists in the provided idRef string
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasIdRef(ids: IdRefs, id: string): boolean;
|
|
25
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1-canary.0efb2078",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "yarn build:lib && yarn build:css",
|
|
18
18
|
"prebuild:lib": "node scripts/buildIconTypes.js",
|
|
19
|
-
"build:lib": "rollup -c
|
|
19
|
+
"build:lib": "rollup -c",
|
|
20
20
|
"build:css": "postcss --output=lib/cauldron.css src/index.css",
|
|
21
21
|
"dev": "concurrently 'yarn build:css --watch' 'rollup -c --watch'",
|
|
22
22
|
"prepublishOnly": "NODE_ENV=production yarn build",
|
package/lib/src/axe.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare function recursivelyRemoveIds(element: React.ReactNode): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | null | undefined;
|
|
2
|
-
export default recursivelyRemoveIds;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|