@algolia/satellite 1.0.0-beta.144 → 1.0.0-beta.146
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/README.md +2 -0
- package/cjs/AutoComplete/AutoComplete.d.ts +1 -1
- package/cjs/AutoComplete/AutoComplete.js +21 -6
- package/cjs/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/cjs/Button/Button.tailwind.d.ts +1 -1
- package/cjs/Card/Card.tailwind.d.ts +1 -1
- package/cjs/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/cjs/DatePicker/DatePicker.tailwind.d.ts +2 -2
- package/cjs/DatePicker/components/Calendar.js +2 -7
- package/cjs/DatePicker/types.d.ts +3 -7
- package/cjs/DatePicker/utils.d.ts +1 -8
- package/cjs/DatePicker/utils.js +1 -28
- package/cjs/Dropdown/components/DropdownLinkItem.d.ts +1 -0
- package/cjs/EmptyState/EmptyState.tailwind.d.ts +1 -1
- package/cjs/Flag/Flag.js +5 -3
- package/cjs/Flag/Flag.tailwind.d.ts +1 -1
- package/cjs/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/cjs/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/cjs/Input/Input.tailwind.d.ts +1 -1
- package/cjs/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/cjs/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/cjs/Link/BaseLink.d.ts +6 -2
- package/cjs/Link/ButtonLink.d.ts +3 -1
- package/cjs/Link/IconButtonLink.d.ts +3 -1
- package/cjs/Link/Link.d.ts +2 -0
- package/cjs/Medallion/Medallion.tailwind.d.ts +1 -1
- package/cjs/Modal/Modal.tailwind.d.ts +1 -1
- package/cjs/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/cjs/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/cjs/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/cjs/RangeSlider/RangeSlider.tailwind.d.ts +1 -1
- package/cjs/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/cjs/Select/Select.tailwind.d.ts +1 -1
- package/cjs/Sidebar/SidebarButtonLink.d.ts +7 -1
- package/cjs/Sidebar/SidebarButtonLink.js +15 -19
- package/cjs/Sidebar/SidebarLink.d.ts +2 -1
- package/cjs/Switch/Switch.tailwind.d.ts +1 -1
- package/cjs/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/cjs/Tables/Table/Table.tailwind.d.ts +1 -1
- package/cjs/Tabs/Tabs.tailwind.d.ts +1 -1
- package/cjs/Tag/Tag.tailwind.d.ts +1 -1
- package/cjs/TextArea/TextArea.tailwind.d.ts +1 -1
- package/cjs/Toggle/Toggle.tailwind.d.ts +1 -1
- package/cjs/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/cjs/Typography/Typography.tailwind.d.ts +1 -1
- package/cjs/UserContent/UserContent.tailwind.d.ts +1 -1
- package/cjs/styles/base.tailwind.d.ts +1 -1
- package/cjs/styles/helpers/prefixTailwindClassName.js +10 -10
- package/cjs/utilities/utilities.tailwind.d.ts +1 -1
- package/esm/AutoComplete/AutoComplete.d.ts +1 -1
- package/esm/AutoComplete/AutoComplete.js +21 -6
- package/esm/AutoComplete/AutoComplete.tailwind.d.ts +1 -1
- package/esm/Button/Button.tailwind.d.ts +1 -1
- package/esm/Card/Card.tailwind.d.ts +1 -1
- package/esm/Checkbox/Checkbox.tailwind.d.ts +1 -1
- package/esm/DatePicker/DatePicker.tailwind.d.ts +2 -2
- package/esm/DatePicker/components/Calendar.js +2 -6
- package/esm/DatePicker/types.d.ts +3 -7
- package/esm/DatePicker/utils.d.ts +1 -8
- package/esm/DatePicker/utils.js +1 -19
- package/esm/Dropdown/components/DropdownLinkItem.d.ts +1 -0
- package/esm/EmptyState/EmptyState.tailwind.d.ts +1 -1
- package/esm/Flag/Flag.js +5 -3
- package/esm/Flag/Flag.tailwind.d.ts +1 -1
- package/esm/FlexGrid/FlexGrid.tailwind.d.ts +1 -1
- package/esm/HelpUnderline/HelpUnderline.tailwind.d.ts +1 -1
- package/esm/Input/Input.tailwind.d.ts +1 -1
- package/esm/InstantSearch/InstantSearch.tailwind.d.ts +1 -1
- package/esm/KeyboardKey/KeyboardKey.tailwind.d.ts +1 -1
- package/esm/Link/BaseLink.d.ts +6 -2
- package/esm/Link/ButtonLink.d.ts +3 -1
- package/esm/Link/IconButtonLink.d.ts +3 -1
- package/esm/Link/Link.d.ts +2 -0
- package/esm/Medallion/Medallion.tailwind.d.ts +1 -1
- package/esm/Modal/Modal.tailwind.d.ts +1 -1
- package/esm/ProgressBar/ProgressBar.tailwind.d.ts +1 -1
- package/esm/ProgressSpinner/ProgressSpinner.tailwind.d.ts +1 -1
- package/esm/RadioGroup/RadioButton.tailwind.d.ts +1 -1
- package/esm/RangeSlider/RangeSlider.tailwind.d.ts +1 -1
- package/esm/ScrollIndicator/ScrollIndicator.tailwind.d.ts +1 -1
- package/esm/Select/Select.tailwind.d.ts +1 -1
- package/esm/Sidebar/SidebarButtonLink.d.ts +7 -1
- package/esm/Sidebar/SidebarButtonLink.js +15 -18
- package/esm/Sidebar/SidebarLink.d.ts +2 -1
- package/esm/Switch/Switch.tailwind.d.ts +1 -1
- package/esm/Tables/DataTable/DataTable.tailwind.d.ts +1 -1
- package/esm/Tables/Table/Table.tailwind.d.ts +1 -1
- package/esm/Tabs/Tabs.tailwind.d.ts +1 -1
- package/esm/Tag/Tag.tailwind.d.ts +1 -1
- package/esm/TextArea/TextArea.tailwind.d.ts +1 -1
- package/esm/Toggle/Toggle.tailwind.d.ts +1 -1
- package/esm/Tooltip/Tooltip.tailwind.d.ts +1 -1
- package/esm/Typography/Typography.tailwind.d.ts +1 -1
- package/esm/UserContent/UserContent.tailwind.d.ts +1 -1
- package/esm/styles/base.tailwind.d.ts +1 -1
- package/esm/styles/helpers/prefixTailwindClassName.js +10 -10
- package/esm/utilities/utilities.tailwind.d.ts +1 -1
- package/package.json +2 -2
- package/satellite.min.css +1 -1
@@ -8,21 +8,21 @@
|
|
8
8
|
* @param {string} classname
|
9
9
|
*/
|
10
10
|
function prefixTailwindClassName(tailwindPrefix, classname) {
|
11
|
-
var
|
12
|
-
|
13
|
-
var
|
14
|
-
var prefixInsertIndex = classNameSafeZone.lastIndexOf("!");
|
11
|
+
var searchZone = classname.replace(/-\[[^\]]+\]$/, ""); // important marker
|
12
|
+
|
13
|
+
var prefixInsertIndex = searchZone.lastIndexOf("!"); // modifier separator
|
15
14
|
|
16
15
|
if (prefixInsertIndex === -1) {
|
17
|
-
prefixInsertIndex =
|
18
|
-
}
|
16
|
+
prefixInsertIndex = searchZone.lastIndexOf(":");
|
17
|
+
} // container marker
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
|
20
|
+
if (prefixInsertIndex === -1) {
|
21
|
+
prefixInsertIndex = searchZone.lastIndexOf("@");
|
23
22
|
}
|
24
23
|
|
25
|
-
|
24
|
+
prefixInsertIndex += 1;
|
25
|
+
return classname.slice(0, prefixInsertIndex) + tailwindPrefix + classname.slice(prefixInsertIndex);
|
26
26
|
}
|
27
27
|
|
28
28
|
module.exports = prefixTailwindClassName;
|
@@ -58,7 +58,7 @@ export declare class AutoComplete<T extends Option = Option> extends Component<A
|
|
58
58
|
handleShowAllResults: (evt: MouseEvent<HTMLButtonElement>) => void;
|
59
59
|
removeValue: (removedOption: T) => void;
|
60
60
|
getA11yStatusMessage: (options: A11yStatusMessageOptions<Option>) => any;
|
61
|
-
renderInput: (
|
61
|
+
renderInput: (autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
|
62
62
|
renderMenu: (results: T[], autocompleteHelpers: ControllerStateAndHelpers<T | Option>) => JSX.Element;
|
63
63
|
renderSelect: (autocompleteHelpers: ControllerStateAndHelpers<T | Option>, fieldState: FieldState) => JSX.Element;
|
64
64
|
private get locale();
|
@@ -12,7 +12,8 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
12
12
|
|
13
13
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
14
14
|
|
15
|
-
var _excluded = ["optionItemPrefix"]
|
15
|
+
var _excluded = ["optionItemPrefix"],
|
16
|
+
_excluded2 = ["ref"];
|
16
17
|
|
17
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
18
19
|
|
@@ -352,7 +353,7 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
352
353
|
return "";
|
353
354
|
});
|
354
355
|
|
355
|
-
_defineProperty(_assertThisInitialized(_this), "renderInput", function (
|
356
|
+
_defineProperty(_assertThisInitialized(_this), "renderInput", function (autocompleteHelpers, fieldState) {
|
356
357
|
var _this$props3 = _this.props,
|
357
358
|
id = _this$props3.id,
|
358
359
|
placeholder = _this$props3.placeholder,
|
@@ -515,22 +516,36 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
515
516
|
return _this.menuWrapperRef = wrapperEl;
|
516
517
|
},
|
517
518
|
children: function children(popper) {
|
519
|
+
var _getMenuProps = getMenuProps({
|
520
|
+
ref: popper.ref
|
521
|
+
}),
|
522
|
+
menuRef = _getMenuProps.ref,
|
523
|
+
menuProps = _objectWithoutProperties(_getMenuProps, _excluded2);
|
524
|
+
|
518
525
|
return /*#__PURE__*/_jsx(ClickAwayContainer, {
|
519
526
|
element: _this.menuWrapperRef,
|
520
527
|
children: /*#__PURE__*/_jsx("div", {
|
528
|
+
/**
|
529
|
+
* We put the `menuRef` on a different element than the menu props so that Downshift correctly includes
|
530
|
+
* the entire Popper element when identifying a click outside. We keep the rest of the`menuProps` on the
|
531
|
+
* `ul` itself for accessibility reasons (it needs to be the direct parent of menu item elements).
|
532
|
+
* While a bit hackish, we made sure that Downshift only uses the ref to compute click outside and not
|
533
|
+
* anything else:
|
534
|
+
* https://github.com/downshift-js/downshift/blob/3fb0ed21278c5f1d0a077ed9b1d0dfd55a75c71b/src/downshift.js#L951
|
535
|
+
*/
|
536
|
+
ref: menuRef,
|
521
537
|
className: cx(stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["z-dropdown"]))), menuClassName),
|
522
538
|
style: _objectSpread(_objectSpread({}, popper.style), dropdownStyle),
|
523
539
|
"data-popper-placement": popper.placement,
|
524
|
-
ref: popper.ref,
|
525
540
|
children: /*#__PURE__*/_jsxs(Card, {
|
526
541
|
fullBleed: true,
|
527
542
|
elevation: "300",
|
528
|
-
children: [results.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({},
|
543
|
+
children: [results.length === 0 ? /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({}, menuProps), {}, {
|
529
544
|
className: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["min-h-10"]))),
|
530
545
|
children: emptyState
|
531
546
|
})) : /*#__PURE__*/_jsx(ScrollIndicator, {
|
532
547
|
className: menuSize === "large" ? stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["max-h-96"]))) : stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["max-h-64"]))),
|
533
|
-
children: /*#__PURE__*/_jsxs("ul", _objectSpread(_objectSpread({},
|
548
|
+
children: /*#__PURE__*/_jsxs("ul", _objectSpread(_objectSpread({}, menuProps), {}, {
|
534
549
|
children: [results.slice(0, showAllResults ? Number.MAX_SAFE_INTEGER : maxResults).map(function (result, index) {
|
535
550
|
return /*#__PURE__*/_jsx("li", _objectSpread(_objectSpread({}, getItemProps({
|
536
551
|
item: result,
|
@@ -584,7 +599,7 @@ export var AutoComplete = /*#__PURE__*/function (_Component) {
|
|
584
599
|
|
585
600
|
return /*#__PURE__*/_jsxs("div", {
|
586
601
|
className: className,
|
587
|
-
children: [_this.renderInput(
|
602
|
+
children: [_this.renderInput(autocompleteHelpers, fieldState), _this.inputContainerRef && /*#__PURE__*/createPortal(_this.renderMenu(results, autocompleteHelpers), (_this$context$portalT = _this.context["portalTarget"]) !== null && _this$context$portalT !== void 0 ? _this$context$portalT : document.body)]
|
588
603
|
});
|
589
604
|
});
|
590
605
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export = datePickerPlugin;
|
2
2
|
declare const datePickerPlugin: {
|
3
|
-
handler: import("tailwindcss/types/config").PluginCreator;
|
4
|
-
config?: import("tailwindcss").Config | undefined;
|
3
|
+
handler: import("tailwindcss/types/config").PluginCreator;
|
4
|
+
config?: Partial<import("tailwindcss").Config> | undefined;
|
5
5
|
};
|
@@ -6,7 +6,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
7
7
|
|
8
8
|
import { DayPicker } from "react-day-picker";
|
9
|
-
import { getDateFnsLocale } from "../utils";
|
10
9
|
import NavBar from "./NavBar";
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
12
11
|
var excludedDayPickerPropsList = ["captionElement", "showOutsideDays", "enableOutsideDaysClick", "fixedWeeks", "labels", "navbarElement", "onTodayButtonClick", "pagedNavigation", "renderDay", "renderWeek", "reverseMonths", "showWeekNumber", "showWeekDays", "weekdayElement", "weekdaysLong", "weekdaysShort"];
|
@@ -34,14 +33,11 @@ var Calendar = function Calendar(props) {
|
|
34
33
|
//stl`bg-grey-600 text-white rounded-l border-0`,
|
35
34
|
displayedRangesEnd: "rdp-day_displayedRangesEnd" //stl`bg-grey-600 text-white rounded-r border-0`,
|
36
35
|
|
37
|
-
};
|
38
|
-
// https://react-day-picker.js.org/basics/localization#adopting-other-numbering-systems
|
39
|
-
|
40
|
-
var dateFnsLocale = getDateFnsLocale(props.locale.code);
|
36
|
+
};
|
41
37
|
return /*#__PURE__*/_jsx(DayPicker, _objectSpread(_objectSpread({
|
42
38
|
mode: props.mode
|
43
39
|
}, curatedProps), {}, {
|
44
|
-
locale:
|
40
|
+
locale: props.locale.formatter,
|
45
41
|
dir: props.locale.rtl ? "rtl" : "ltr",
|
46
42
|
modifiersClassNames: modifierClassNames,
|
47
43
|
showOutsideDays: false,
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import type
|
1
|
+
import type { Locale as DateFnsLocale } from "date-fns";
|
2
2
|
import type { ModalProps } from "./components/Modal";
|
3
3
|
export declare type DatePickerLocale = {
|
4
|
-
/**
|
5
|
-
|
6
|
-
* for rendering the actual calendar component in the correct language. This has no effect on the custom translations
|
7
|
-
* listed below. (i.e. `openButton`, `apply`, etc.)
|
8
|
-
*/
|
9
|
-
code?: keyof typeof Locales;
|
4
|
+
/** The date-fns locale object used to localize dates. Defaults to* `en-US`. */
|
5
|
+
formatter?: DateFnsLocale;
|
10
6
|
/** rtl should be used optionally in conjunction with supported language codes, such as `rtl: true` when code is `arSA` */
|
11
7
|
rtl?: boolean;
|
12
8
|
/**
|
@@ -1,10 +1,3 @@
|
|
1
|
-
import type { Locale } from "date-fns";
|
2
1
|
import type { DatePickerLocale } from "./types";
|
3
2
|
export declare const formatDate: (date: Date | number) => string;
|
4
|
-
export declare const DEFAULT_DATE_PICKER_LOCALE: Required<DatePickerLocale
|
5
|
-
/**
|
6
|
-
* Looks up a date-fns locale. This falls back to `en`
|
7
|
-
* @param locale the ISO 639-1 language code to look up @link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
8
|
-
* @returns date-fns locale.
|
9
|
-
*/
|
10
|
-
export declare function getDateFnsLocale(locale?: string): Locale;
|
3
|
+
export declare const DEFAULT_DATE_PICKER_LOCALE: Required<Omit<DatePickerLocale, "formatter">>;
|
package/esm/DatePicker/utils.js
CHANGED
@@ -1,30 +1,12 @@
|
|
1
1
|
import format from "date-fns/format";
|
2
|
-
import * as Locales from "date-fns/locale";
|
3
2
|
export var formatDate = function formatDate(date) {
|
4
3
|
return format(date, "MMM do, yyyy");
|
5
4
|
};
|
6
5
|
export var DEFAULT_DATE_PICKER_LOCALE = {
|
7
|
-
code: "enUS",
|
8
6
|
rtl: false,
|
9
7
|
apply: "Apply",
|
10
8
|
cancel: "Cancel",
|
11
9
|
openButton: "Enter a date...",
|
12
10
|
previousMonth: "Previous month",
|
13
11
|
nextMonth: "Next month"
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* Looks up a date-fns locale. This falls back to `en`
|
17
|
-
* @param locale the ISO 639-1 language code to look up @link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
18
|
-
* @returns date-fns locale.
|
19
|
-
*/
|
20
|
-
|
21
|
-
export function getDateFnsLocale(locale) {
|
22
|
-
var _allLocales$locale;
|
23
|
-
|
24
|
-
if (!locale) {
|
25
|
-
return Locales.enUS;
|
26
|
-
}
|
27
|
-
|
28
|
-
var allLocales = Locales;
|
29
|
-
return (_allLocales$locale = allLocales[locale]) !== null && _allLocales$locale !== void 0 ? _allLocales$locale : Locales.enUS;
|
30
|
-
}
|
12
|
+
};
|
@@ -2,6 +2,7 @@
|
|
2
2
|
import type { IconComponentType } from "../../types";
|
3
3
|
import { DropdownBaseItemProps } from "../useDropdownItemProps";
|
4
4
|
export declare type DropdownLinkItemProps = DropdownBaseItemProps<HTMLAnchorElement> & JSX.IntrinsicElements["a"] & {
|
5
|
+
href: string;
|
5
6
|
/** Left aligned icon */
|
6
7
|
startIcon?: IconComponentType;
|
7
8
|
};
|
package/esm/Flag/Flag.js
CHANGED
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
4
4
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19;
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
|
6
6
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
8
8
|
|
@@ -90,12 +90,14 @@ export var Flag = function Flag(_ref) {
|
|
90
90
|
className: cx(stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["shrink-0 text-white rounded-full p-2px mt-1"]))), VARIANT_CLASSNAMES[variant]),
|
91
91
|
size: 16
|
92
92
|
}), /*#__PURE__*/_jsxs("div", {
|
93
|
-
className: stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["flex-1 ml-4"]))),
|
93
|
+
className: stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["flex-1 ml-4 min-w-0 break-words"]))),
|
94
94
|
children: [/*#__PURE__*/_jsxs("div", {
|
95
95
|
className: stl(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["flex justify-between"]))),
|
96
96
|
children: [hasTitle ? /*#__PURE__*/_jsx("h3", {
|
97
|
+
className: stl(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["overflow-hidden"]))),
|
97
98
|
children: title
|
98
99
|
}) : /*#__PURE__*/_jsx("div", {
|
100
|
+
className: stl(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["min-w-0"]))),
|
99
101
|
children: children
|
100
102
|
}), onDismiss && /*#__PURE__*/_jsx(IconButton, {
|
101
103
|
icon: X,
|
@@ -105,7 +107,7 @@ export var Flag = function Flag(_ref) {
|
|
105
107
|
onClick: onDismiss
|
106
108
|
})]
|
107
109
|
}), hasTitle && children && /*#__PURE__*/_jsx("div", {
|
108
|
-
className: stl(
|
110
|
+
className: stl(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["text-grey-600 mt-2"]))),
|
109
111
|
children: children
|
110
112
|
})]
|
111
113
|
})]
|
package/esm/Link/BaseLink.d.ts
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
import type { AnchorHTMLAttributes } from "react";
|
2
|
-
export declare type BaseLinkProps =
|
3
|
-
|
2
|
+
export declare type BaseLinkProps = {
|
3
|
+
href: string;
|
4
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement>;
|
5
|
+
export declare const BaseLink: import("react").ForwardRefExoticComponent<{
|
6
|
+
href: string;
|
7
|
+
} & AnchorHTMLAttributes<HTMLAnchorElement> & import("react").RefAttributes<HTMLAnchorElement>>;
|
4
8
|
export default BaseLink;
|
package/esm/Link/ButtonLink.d.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { ButtonBaseProps, ExtractProps } from "../Button/types";
|
3
|
-
export declare type ButtonLinkProps = ButtonBaseProps & ExtractProps<"a"
|
3
|
+
export declare type ButtonLinkProps = ButtonBaseProps & ExtractProps<"a"> & {
|
4
|
+
href: string;
|
5
|
+
};
|
4
6
|
export declare const ButtonLink: ({ endIcon: EndIcon, href, onClick, ...props }: ButtonLinkProps) => JSX.Element;
|
5
7
|
export default ButtonLink;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { IconButtonBaseProps } from "../Button/IconButton";
|
3
3
|
import type { ExtractProps } from "../Button/types";
|
4
|
-
export declare type IconButtonLinkProps = IconButtonBaseProps & ExtractProps<"a"
|
4
|
+
export declare type IconButtonLinkProps = IconButtonBaseProps & ExtractProps<"a"> & {
|
5
|
+
href: string;
|
6
|
+
};
|
5
7
|
export declare const IconButtonLink: ({ href, onClick, ...props }: IconButtonLinkProps) => JSX.Element;
|
6
8
|
export default IconButtonLink;
|
package/esm/Link/Link.d.ts
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
import type { AnchorHTMLAttributes } from "react";
|
2
2
|
import type { IconComponentType } from "../types";
|
3
3
|
export declare type LinkProps = {
|
4
|
+
href: string;
|
4
5
|
startIcon?: IconComponentType;
|
5
6
|
endIcon?: IconComponentType;
|
6
7
|
} & AnchorHTMLAttributes<HTMLAnchorElement>;
|
7
8
|
export declare const Link: import("react").ForwardRefExoticComponent<{
|
9
|
+
href: string;
|
8
10
|
startIcon?: IconComponentType | undefined;
|
9
11
|
endIcon?: IconComponentType | undefined;
|
10
12
|
} & AnchorHTMLAttributes<HTMLAnchorElement> & import("react").RefAttributes<HTMLAnchorElement>>;
|
@@ -8,7 +8,13 @@ export interface SidebarButtonLinkProps {
|
|
8
8
|
id?: string;
|
9
9
|
icon: SidebarButtonLinkIcon;
|
10
10
|
href: string;
|
11
|
-
children: ReactNode;
|
12
11
|
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
12
|
+
disabled?: boolean;
|
13
|
+
/**
|
14
|
+
* Alternative content for the tooltip.
|
15
|
+
* @default children
|
16
|
+
*/
|
17
|
+
tooltipContent?: ReactNode;
|
18
|
+
children: ReactNode;
|
13
19
|
}
|
14
20
|
export declare const SidebarButtonLink: FC<SidebarButtonLinkProps>;
|
@@ -9,7 +9,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
9
9
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
10
10
|
|
11
11
|
import { useState } from "react";
|
12
|
-
import { BaseLink } from "../Link";
|
13
12
|
import stl from "../styles/helpers/satellitePrefixer";
|
14
13
|
import { TooltipWrapper } from "../Tooltip";
|
15
14
|
import useLinkProps from "../utils/useLinkProps";
|
@@ -18,7 +17,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
19
18
|
|
20
19
|
var Tooltip = function Tooltip(_ref) {
|
21
|
-
var
|
20
|
+
var content = _ref.content,
|
22
21
|
children = _ref.children;
|
23
22
|
return /*#__PURE__*/_jsx(TooltipWrapper, {
|
24
23
|
placement: "right",
|
@@ -30,40 +29,38 @@ var Tooltip = function Tooltip(_ref) {
|
|
30
29
|
offset: [0, 32]
|
31
30
|
}
|
32
31
|
}],
|
33
|
-
content:
|
32
|
+
content: content,
|
34
33
|
wrapperClassName: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["block"]))),
|
35
34
|
interactive: false,
|
36
35
|
children: children
|
37
36
|
});
|
38
37
|
};
|
39
38
|
|
40
|
-
export var SidebarButtonLink = function SidebarButtonLink(
|
41
|
-
var id =
|
42
|
-
icon =
|
43
|
-
href =
|
44
|
-
|
45
|
-
|
39
|
+
export var SidebarButtonLink = function SidebarButtonLink(props) {
|
40
|
+
var id = props.id,
|
41
|
+
icon = props.icon,
|
42
|
+
href = props.href,
|
43
|
+
disabled = props.disabled,
|
44
|
+
children = props.children;
|
46
45
|
|
47
46
|
var _useSidebarContext = useSidebarContext(),
|
48
47
|
isLinkActive = _useSidebarContext.isLinkActive,
|
49
48
|
collapsed = _useSidebarContext.collapsed;
|
50
49
|
|
51
|
-
var linkProps = useLinkProps(
|
52
|
-
href: href,
|
53
|
-
onClick: onClick
|
54
|
-
});
|
50
|
+
var linkProps = useLinkProps(props);
|
55
51
|
|
56
52
|
var _useState = useState(false),
|
57
53
|
_useState2 = _slicedToArray(_useState, 2),
|
58
54
|
isInteractedWith = _useState2[0],
|
59
55
|
setIsInteractedWith = _useState2[1];
|
60
56
|
|
61
|
-
var isActive = isLinkActive(href);
|
62
|
-
var showColors = isActive || isInteractedWith;
|
57
|
+
var isActive = !disabled && isLinkActive(href);
|
58
|
+
var showColors = !disabled && (isActive || isInteractedWith);
|
63
59
|
var Icon = "active" in icon ? showColors ? icon.active : icon.inactive : icon;
|
60
|
+
var tooltipContent = "tooltipContent" in props ? props.tooltipContent : children;
|
64
61
|
return /*#__PURE__*/_jsx(Tooltip, {
|
65
|
-
|
66
|
-
children: /*#__PURE__*/_jsxs(
|
62
|
+
content: collapsed ? tooltipContent : null,
|
63
|
+
children: /*#__PURE__*/_jsxs("a", _objectSpread(_objectSpread({}, linkProps), {}, {
|
67
64
|
id: id,
|
68
65
|
onMouseEnter: function onMouseEnter() {
|
69
66
|
return setIsInteractedWith(true);
|
@@ -77,7 +74,7 @@ export var SidebarButtonLink = function SidebarButtonLink(_ref2) {
|
|
77
74
|
onBlur: function onBlur() {
|
78
75
|
return setIsInteractedWith(false);
|
79
76
|
},
|
80
|
-
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n h-8 min-w-8 w-full rounded\n flex items-center space-x-3\n border border-transparent\n display-body
|
77
|
+
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n h-8 min-w-8 w-full rounded\n flex items-center space-x-3\n border border-transparent\n display-body\n hover:no-underline focus:no-underline\n ", "\n ", "\n ", "\n ", "\n "])), disabled ? "cursor-not-allowed opacity-70" : "focus:border-grey-500", isActive ? "shadow-z100" : !disabled && "hover:border-grey-200", isActive && "bg-gradient-to-b from-white to-grey-50", collapsed ? "pl-2" : "px-2"),
|
81
78
|
"aria-current": isActive,
|
82
79
|
children: [/*#__PURE__*/_jsx(Icon, {
|
83
80
|
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["", " ml-[-3px]"])), showColors ? "text-accent-600" : "text-grey-400"),
|
@@ -2,7 +2,8 @@ import type { FC, ReactNode } from "react";
|
|
2
2
|
import type { IconComponentType } from "../types";
|
3
3
|
export declare type SidebarLinkProps = {
|
4
4
|
icon: IconComponentType;
|
5
|
+
href: string;
|
5
6
|
disabled?: boolean;
|
6
7
|
children: ReactNode;
|
7
|
-
} & Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "id" | "className" | "
|
8
|
+
} & Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "id" | "className" | "target" | "rel" | "aria-label" | "onClick">;
|
8
9
|
export declare const SidebarLink: FC<SidebarLinkProps>;
|