@algolia/satellite 1.0.0-beta.128 → 1.0.0-beta.131
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/cjs/AutoComplete/components/AutoCompleteEmptyState.d.ts +2 -0
- package/cjs/Avatars/UserAvatar.js +14 -9
- package/cjs/Banner/Banner.d.ts +6 -3
- package/cjs/Banner/Banner.js +1 -1
- package/cjs/Banners/Alert/Alert.d.ts +6 -2
- package/cjs/Banners/Alert/Alert.js +1 -1
- package/cjs/Banners/Promote/Promote.d.ts +2 -2
- package/cjs/Banners/Promote/Promote.js +1 -1
- package/cjs/DatePicker/DatePicker/DatePicker.d.ts +7 -2
- package/cjs/DatePicker/DatePicker/DatePicker.js +12 -1
- package/cjs/DatePicker/DatePicker.tailwind.js +10 -2
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/cjs/DatePicker/DateRangePicker/DateRangePicker.js +18 -2
- package/cjs/DatePicker/components/Calendar.d.ts +8 -2
- package/cjs/DatePicker/components/Calendar.js +50 -3
- package/cjs/DatePicker/components/NavBar.d.ts +8 -1
- package/cjs/DatePicker/components/NavBar.js +50 -5
- package/cjs/Dropdown/DropdownButton.d.ts +1 -1
- package/cjs/EmptyState/types.d.ts +1 -1
- package/cjs/Input/Input.js +1 -1
- package/cjs/Input/Input.tailwind.js +0 -3
- package/cjs/Insert/Insert.d.ts +1 -0
- package/cjs/KeyboardKey/KeyboardKey.d.ts +6 -0
- package/cjs/KeyboardKey/KeyboardKey.js +50 -0
- package/cjs/KeyboardKey/KeyboardKey.tailwind.d.ts +5 -0
- package/cjs/KeyboardKey/KeyboardKey.tailwind.js +33 -0
- package/cjs/KeyboardKey/index.d.ts +2 -0
- package/cjs/KeyboardKey/index.js +26 -0
- package/cjs/Modal/Modal.js +24 -4
- package/cjs/ProgressSpinner/ProgressSpinner.js +4 -1
- package/cjs/RadioGroup/RadioGroup.js +1 -1
- package/cjs/Tag/Tag.d.ts +7 -3
- package/cjs/Tag/Tag.js +13 -11
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +14 -0
- package/cjs/styles/tailwind.config.js +1 -1
- package/cjs/utilities/utilities.tailwind.d.ts +2 -0
- package/cjs/utilities/utilities.tailwind.js +32 -0
- package/esm/AutoComplete/components/AutoCompleteEmptyState.d.ts +2 -0
- package/esm/Avatars/UserAvatar.js +15 -10
- package/esm/Banner/Banner.d.ts +6 -3
- package/esm/Banner/Banner.js +1 -1
- package/esm/Banners/Alert/Alert.d.ts +6 -2
- package/esm/Banners/Alert/Alert.js +1 -1
- package/esm/Banners/Promote/Promote.d.ts +2 -2
- package/esm/Banners/Promote/Promote.js +1 -1
- package/esm/DatePicker/DatePicker/DatePicker.d.ts +7 -2
- package/esm/DatePicker/DatePicker/DatePicker.js +13 -2
- package/esm/DatePicker/DatePicker.tailwind.js +10 -2
- package/esm/DatePicker/DateRangePicker/DateRangePicker.d.ts +7 -2
- package/esm/DatePicker/DateRangePicker/DateRangePicker.js +17 -3
- package/esm/DatePicker/components/Calendar.d.ts +8 -2
- package/esm/DatePicker/components/Calendar.js +43 -3
- package/esm/DatePicker/components/NavBar.d.ts +8 -1
- package/esm/DatePicker/components/NavBar.js +41 -5
- package/esm/Dropdown/DropdownButton.d.ts +1 -1
- package/esm/EmptyState/types.d.ts +1 -1
- package/esm/Input/Input.js +1 -1
- package/esm/Input/Input.tailwind.js +0 -3
- package/esm/Insert/Insert.d.ts +1 -0
- package/esm/KeyboardKey/KeyboardKey.d.ts +6 -0
- package/esm/KeyboardKey/KeyboardKey.js +28 -0
- package/esm/KeyboardKey/KeyboardKey.tailwind.d.ts +5 -0
- package/esm/KeyboardKey/KeyboardKey.tailwind.js +31 -0
- package/esm/KeyboardKey/index.d.ts +2 -0
- package/esm/KeyboardKey/index.js +2 -0
- package/esm/Modal/Modal.js +23 -5
- package/esm/ProgressSpinner/ProgressSpinner.js +4 -1
- package/esm/RadioGroup/RadioGroup.js +1 -1
- package/esm/Tag/Tag.d.ts +7 -3
- package/esm/Tag/Tag.js +13 -11
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/styles/tailwind.config.js +1 -1
- package/esm/utilities/utilities.tailwind.d.ts +2 -0
- package/esm/utilities/utilities.tailwind.js +27 -0
- package/package.json +12 -7
- package/satellite.css +47 -6
- package/satellite.min.css +1 -1
@@ -1,7 +1,13 @@
|
|
1
1
|
import { FunctionComponent } from "react";
|
2
2
|
import { DayPickerProps } from "react-day-picker";
|
3
3
|
declare type ExcludedDayPickerProps = "captionElement" | "showOutsideDays" | "enableOutsideDaysClick" | "fixedWeeks" | "labels" | "navbarElement" | "onTodayButtonClick" | "pagedNavigation" | "renderDay" | "renderWeek" | "reverseMonths" | "showWeekNumbers" | "showWeekDays" | "todayButton" | "weekdayElement" | "weekdaysLong" | "weekdaysShort";
|
4
|
-
export
|
5
|
-
|
4
|
+
export declare type EditableYearProps = {
|
5
|
+
editableYear?: false;
|
6
|
+
} | {
|
7
|
+
editableYear: true;
|
8
|
+
years?: number[];
|
9
|
+
initialDate?: Date;
|
10
|
+
};
|
11
|
+
export declare type CalendarProps = Omit<DayPickerProps, ExcludedDayPickerProps> & EditableYearProps;
|
6
12
|
declare const Calendar: FunctionComponent<CalendarProps>;
|
7
13
|
export default Calendar;
|
@@ -1,24 +1,64 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
-
import React from "react";
|
3
|
+
import React, { useCallback, useMemo, useState } from "react";
|
4
4
|
import DayPicker from "react-day-picker";
|
5
|
+
import { add, eachYearOfInterval, getYear, setYear } from "date-fns";
|
5
6
|
import NavBar from "./NavBar";
|
6
7
|
var excludedDayPickerPropsList = ["captionElement", "showOutsideDays", "enableOutsideDaysClick", "fixedWeeks", "labels", "navbarElement", "onTodayButtonClick", "pagedNavigation", "renderDay", "renderWeek", "reverseMonths", "showWeekNumbers", "showWeekDays", "todayButton", "weekdayElement", "weekdaysLong", "weekdaysShort"];
|
7
8
|
|
8
9
|
var Calendar = function Calendar(props) {
|
10
|
+
var initialDate = useMemo(function () {
|
11
|
+
return props.editableYear && props.initialDate ? props.initialDate : new Date();
|
12
|
+
}, [props]);
|
13
|
+
|
14
|
+
var _useState = useState(initialDate),
|
15
|
+
_useState2 = _slicedToArray(_useState, 2),
|
16
|
+
month = _useState2[0],
|
17
|
+
setMonth = _useState2[1];
|
18
|
+
|
19
|
+
var years = useMemo(function () {
|
20
|
+
if (!props.editableYear) return [];
|
21
|
+
if (props.years) return props.years;
|
22
|
+
return eachYearOfInterval({
|
23
|
+
start: add(initialDate, {
|
24
|
+
years: -5
|
25
|
+
}),
|
26
|
+
end: add(initialDate, {
|
27
|
+
years: 10
|
28
|
+
})
|
29
|
+
}).map(getYear);
|
30
|
+
}, [props, initialDate]);
|
31
|
+
var onYearChange = useCallback(function (year) {
|
32
|
+
return setMonth(setYear(month, year));
|
33
|
+
}, [month]);
|
9
34
|
var curatedProps = Object.fromEntries(Object.entries(props).filter(function (_ref) {
|
10
35
|
var _ref2 = _slicedToArray(_ref, 1),
|
11
36
|
key = _ref2[0];
|
12
37
|
|
13
|
-
return (// @ts-
|
38
|
+
return (// @ts-expect-error
|
14
39
|
!excludedDayPickerPropsList.includes(key)
|
15
40
|
);
|
16
41
|
}));
|
42
|
+
var yearsProps = useMemo(function () {
|
43
|
+
return props.editableYear ? {
|
44
|
+
editableYear: true,
|
45
|
+
years: years,
|
46
|
+
onYearChange: onYearChange
|
47
|
+
} : {
|
48
|
+
editableYear: false
|
49
|
+
};
|
50
|
+
}, [onYearChange, props, years]);
|
17
51
|
return /*#__PURE__*/React.createElement(DayPicker, _extends({}, curatedProps, {
|
52
|
+
month: props.editableYear ? month : undefined,
|
18
53
|
showOutsideDays: false,
|
19
54
|
enableOutsideDaysClick: false,
|
20
55
|
fixedWeeks: false,
|
21
|
-
navbarElement:
|
56
|
+
navbarElement: function navbarElement(navBarProps) {
|
57
|
+
return /*#__PURE__*/React.createElement(NavBar, _extends({}, navBarProps, yearsProps));
|
58
|
+
},
|
59
|
+
captionElement: function captionElement() {
|
60
|
+
return null;
|
61
|
+
}
|
22
62
|
}));
|
23
63
|
};
|
24
64
|
|
@@ -1,5 +1,12 @@
|
|
1
1
|
import { FunctionComponent } from "react";
|
2
2
|
import { NavbarElementProps } from "react-day-picker";
|
3
|
-
export declare type
|
3
|
+
export declare type NavBarYearProps = {
|
4
|
+
editableYear?: false;
|
5
|
+
} | {
|
6
|
+
editableYear: true;
|
7
|
+
years: number[];
|
8
|
+
onYearChange: (year: number) => void;
|
9
|
+
};
|
10
|
+
export declare type NavBarProps = NavbarElementProps & NavBarYearProps;
|
4
11
|
declare const NavBar: FunctionComponent<NavBarProps>;
|
5
12
|
export default NavBar;
|
@@ -1,8 +1,12 @@
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
2
4
|
|
3
|
-
var _templateObject;
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
4
6
|
|
5
|
-
|
7
|
+
var _excluded = ["onPreviousClick", "onNextClick", "showPreviousButton", "showNextButton", "month", "localeUtils"];
|
8
|
+
import cx from "classnames";
|
9
|
+
import React, { useMemo } from "react";
|
6
10
|
import { ChevronLeft, ChevronRight } from "react-feather";
|
7
11
|
import stl from "../../styles/helpers/satellitePrefixer";
|
8
12
|
import { IconButton } from "../../Button";
|
@@ -11,9 +15,26 @@ var NavBar = function NavBar(_ref) {
|
|
11
15
|
var onPreviousClick = _ref.onPreviousClick,
|
12
16
|
onNextClick = _ref.onNextClick,
|
13
17
|
showPreviousButton = _ref.showPreviousButton,
|
14
|
-
showNextButton = _ref.showNextButton
|
18
|
+
showNextButton = _ref.showNextButton,
|
19
|
+
month = _ref.month,
|
20
|
+
localeUtils = _ref.localeUtils,
|
21
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
22
|
+
|
23
|
+
var years = useMemo(function () {
|
24
|
+
if (!props.editableYear) return [];
|
25
|
+
var monthYear = month.getFullYear(); // year of the currently shown month
|
26
|
+
|
27
|
+
if (props.years.includes(monthYear)) return props.years;
|
28
|
+
var minYear = Math.min.apply(Math, _toConsumableArray(props.years).concat([monthYear]));
|
29
|
+
var maxYear = Math.max.apply(Math, _toConsumableArray(props.years).concat([monthYear]));
|
30
|
+
return Array.from({
|
31
|
+
length: maxYear - minYear + 1
|
32
|
+
}, function (_, i) {
|
33
|
+
return i + minYear;
|
34
|
+
});
|
35
|
+
}, [props, month]);
|
15
36
|
return /*#__PURE__*/React.createElement("div", {
|
16
|
-
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full
|
37
|
+
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["w-full top-3 left-0 pt-5 px-5 pb-2 flex justify-between"])))
|
17
38
|
}, /*#__PURE__*/React.createElement(IconButton, {
|
18
39
|
icon: ChevronLeft,
|
19
40
|
title: "Previous month",
|
@@ -21,7 +42,22 @@ var NavBar = function NavBar(_ref) {
|
|
21
42
|
return onPreviousClick();
|
22
43
|
},
|
23
44
|
disabled: !showPreviousButton
|
24
|
-
}), /*#__PURE__*/React.createElement(
|
45
|
+
}), /*#__PURE__*/React.createElement("div", {
|
46
|
+
className: cx(stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex items-center text-center"]))))
|
47
|
+
}, /*#__PURE__*/React.createElement("div", {
|
48
|
+
className: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["font-medium text-md"])))
|
49
|
+
}, localeUtils.getMonths()[month.getMonth()], " ", props.editableYear ? /*#__PURE__*/React.createElement("select", {
|
50
|
+
className: cx("DayPicker-Year", stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["pl-0.5 font-medium outline-none border-transparent border-2 rounded focus:border-nebula-600 focus:shadow-z100 appearance-none"])))),
|
51
|
+
value: month.getFullYear(),
|
52
|
+
onChange: function onChange(e) {
|
53
|
+
return props.onYearChange(parseInt(e.currentTarget.value));
|
54
|
+
}
|
55
|
+
}, years.map(function (year) {
|
56
|
+
return /*#__PURE__*/React.createElement("option", {
|
57
|
+
key: year,
|
58
|
+
value: year
|
59
|
+
}, year);
|
60
|
+
})) : month.getFullYear())), /*#__PURE__*/React.createElement(IconButton, {
|
25
61
|
icon: ChevronRight,
|
26
62
|
title: "Next month",
|
27
63
|
onClick: function onClick() {
|
@@ -2,7 +2,7 @@ import React, { FunctionComponent } from "react";
|
|
2
2
|
import { ButtonProps } from "../Button";
|
3
3
|
import { RenderTargetParams } from "./Dropdown";
|
4
4
|
export interface DropdownButtonProps extends Omit<ButtonProps<"button">, "title" | "endIcon"> {
|
5
|
-
/**
|
5
|
+
/** Descriptive title for `Dropdown` */
|
6
6
|
title: React.ReactNode;
|
7
7
|
renderFooter?: (args: RenderTargetParams) => React.ReactNode;
|
8
8
|
}
|
@@ -3,7 +3,7 @@ import { FlexGridDirection } from "../FlexGrid";
|
|
3
3
|
export declare type EmptyStateUsageContexts = "result" | "feature" | "page";
|
4
4
|
export declare type EmptyStateWidths = "medium" | "large" | "xlarge";
|
5
5
|
export interface EmptyStatePropsAll {
|
6
|
-
/** Descriptive title for the state
|
6
|
+
/** Descriptive title for the state */
|
7
7
|
title: React.ReactNode;
|
8
8
|
/** Optional description to explain why the screen is empty or define next steps */
|
9
9
|
description?: React.ReactNode;
|
package/esm/Input/Input.js
CHANGED
@@ -101,7 +101,7 @@ export var Input = /*#__PURE__*/forwardRef(function (_ref, externalRef) {
|
|
101
101
|
var StatusIcon = status === "invalid" ? InvalidIcon : status === "validated" ? ValidatedIcon : React.Fragment;
|
102
102
|
var clearable = typeof clearableProp === "boolean" ? clearableProp : type === "search";
|
103
103
|
return /*#__PURE__*/React.createElement("div", {
|
104
|
-
className: cx(stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n
|
104
|
+
className: cx(stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n input no-search-input-decoration group\n ", "\n ", "\n "])), focused && "input-focused", disabled && "input-disabled"), VARIANT_CLASSNAMES[variant], STATUS_CLASSNAMES[status], className),
|
105
105
|
style: style,
|
106
106
|
onClick: function onClick() {
|
107
107
|
var _inputRef$current;
|
@@ -37,9 +37,6 @@ var inputPlugin = function inputPlugin(_ref) {
|
|
37
37
|
"-webkit-appearance": "none",
|
38
38
|
margin: 0
|
39
39
|
},
|
40
|
-
'&[type="search"]::-webkit-search-decoration, &[type="search"]::-webkit-search-cancel-button, &[type="search"]::-webkit-search-results-button, &[type="search"]::-webkit-search-results-decoration': {
|
41
|
-
"-webkit-appearance": "none"
|
42
|
-
},
|
43
40
|
"&:focus": {
|
44
41
|
outline: "none"
|
45
42
|
},
|
package/esm/Insert/Insert.d.ts
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
2
|
+
|
3
|
+
var _templateObject;
|
4
|
+
|
5
|
+
import React, { createElement } from "react";
|
6
|
+
import { ArrowUp, ArrowDown, ArrowLeft, ArrowRight, CornerDownLeft } from "react-feather";
|
7
|
+
import cx from "classnames";
|
8
|
+
import stl from "../styles/helpers/satellitePrefixer";
|
9
|
+
var KEY_MAPPINGS = {
|
10
|
+
up: ArrowUp,
|
11
|
+
down: ArrowDown,
|
12
|
+
left: ArrowLeft,
|
13
|
+
right: ArrowRight,
|
14
|
+
enter: CornerDownLeft,
|
15
|
+
escape: "esc"
|
16
|
+
};
|
17
|
+
export var KeyboardKey = function KeyboardKey(_ref) {
|
18
|
+
var className = _ref.className,
|
19
|
+
value = _ref.value;
|
20
|
+
var mappedValue = !KEY_MAPPINGS[value] ? value : typeof KEY_MAPPINGS[value] === "string" ? KEY_MAPPINGS[value] : /*#__PURE__*/createElement(KEY_MAPPINGS[value], {
|
21
|
+
"aria-label": value,
|
22
|
+
width: "1em",
|
23
|
+
height: "1em"
|
24
|
+
});
|
25
|
+
return /*#__PURE__*/React.createElement("kbd", {
|
26
|
+
className: cx(stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["keyboard-key "]))), className)
|
27
|
+
}, mappedValue);
|
28
|
+
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// @ts-check
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @type {import('../tailwind-types').TailwindPlugin}
|
5
|
+
*/
|
6
|
+
var keyboardKeyPlugin = function keyboardKeyPlugin(_ref) {
|
7
|
+
var addComponents = _ref.addComponents,
|
8
|
+
theme = _ref.theme;
|
9
|
+
addComponents({
|
10
|
+
".keyboard-key": {
|
11
|
+
borderRadius: theme("borderRadius.DEFAULT"),
|
12
|
+
height: 20,
|
13
|
+
minWidth: 20,
|
14
|
+
padding: "0 4px",
|
15
|
+
display: "inline-flex",
|
16
|
+
textAlign: "center",
|
17
|
+
alignItems: "center",
|
18
|
+
justifyContent: "center",
|
19
|
+
fontFamily: theme("fontFamily.mono"),
|
20
|
+
// Matches typo-subdued
|
21
|
+
color: theme("colors.grey.600"),
|
22
|
+
// Should match display-caption
|
23
|
+
fontSize: theme("fontSize.sm"),
|
24
|
+
lineHeight: theme("lineHeight.sm"),
|
25
|
+
background: "linear-gradient(134deg, #e6e7ec 0%, #ffffff 70%)",
|
26
|
+
boxShadow: "\n 2px 1px 4px -2px rgba(35, 38, 59, 0.24),\n inset -0.6px -0.6px 1px #dcdde7, inset 0.6px 0.6px 1px #ffffff\n "
|
27
|
+
}
|
28
|
+
});
|
29
|
+
};
|
30
|
+
|
31
|
+
export default keyboardKeyPlugin;
|
package/esm/Modal/Modal.js
CHANGED
@@ -1,10 +1,15 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
3
|
import _extends from "@babel/runtime/helpers/extends";
|
3
4
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
4
5
|
|
5
6
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
6
7
|
|
7
|
-
|
8
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
9
|
+
|
10
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
11
|
+
|
12
|
+
import React, { useRef, useState, useEffect, useMemo } from "react";
|
8
13
|
import { createPortal } from "react-dom";
|
9
14
|
import { CSSTransition } from "react-transition-group";
|
10
15
|
import useKeyPressEvent from "react-use/lib/useKeyPressEvent";
|
@@ -14,6 +19,7 @@ import { X } from "react-feather";
|
|
14
19
|
import stl from "../styles/helpers/satellitePrefixer";
|
15
20
|
import Card from "../Card";
|
16
21
|
import { IconButton } from "../Button";
|
22
|
+
import uniqueId from "../utils/uniqueId";
|
17
23
|
import ModalFooter from "./components/ModalFooter";
|
18
24
|
|
19
25
|
var ModalAnimation = function ModalAnimation(props) {
|
@@ -67,6 +73,9 @@ export var Modal = function Modal(_ref) {
|
|
67
73
|
var dialogRef = useRef(null);
|
68
74
|
var mouseDownTargetRef = useRef(null);
|
69
75
|
var ModalContainer = animate ? ModalAnimation : ModalNoAnimation;
|
76
|
+
var modalTitleId = useMemo(function () {
|
77
|
+
return uniqueId("modal-title");
|
78
|
+
}, []);
|
70
79
|
useLockBodyScroll(open);
|
71
80
|
useKeyPressEvent("Escape", function () {
|
72
81
|
if (open) onDismiss();
|
@@ -98,15 +107,23 @@ export var Modal = function Modal(_ref) {
|
|
98
107
|
modalWrapperRef.removeEventListener("mousedown", onMouseDown);
|
99
108
|
};
|
100
109
|
}, [modalWrapperRef, onDismiss]);
|
110
|
+
|
111
|
+
var modalAccessibilityProps = _objectSpread({
|
112
|
+
role: "dialog"
|
113
|
+
}, title ? {
|
114
|
+
"aria-labelledby": modalTitleId
|
115
|
+
} : {
|
116
|
+
"aria-label": "Modal"
|
117
|
+
});
|
118
|
+
|
101
119
|
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(ModalContainer, {
|
102
120
|
"in": open
|
103
121
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
104
122
|
className: cx(stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["bg-grey-900 bg-opacity-30 z-modalOverlay inset-x-0 inset-y-0 fixed w-full h-full"]))))
|
105
|
-
}), /*#__PURE__*/React.createElement("div", {
|
123
|
+
}), /*#__PURE__*/React.createElement("div", _extends({
|
106
124
|
className: cx(stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["modal-container inset-x-0 inset-y-0 fixed w-full h-full p-4 overflow-x-hidden overflow-y-auto"]))), centerY && stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["flex items-center"])))),
|
107
|
-
ref: setModalWrapperRef
|
108
|
-
|
109
|
-
}, /*#__PURE__*/React.createElement(Card, {
|
125
|
+
ref: setModalWrapperRef
|
126
|
+
}, modalAccessibilityProps), /*#__PURE__*/React.createElement(Card, {
|
110
127
|
ref: dialogRef,
|
111
128
|
elevation: "500",
|
112
129
|
className: cx(stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["my-6 mx-auto"]))), SIZE_CLASSNAMES[size], className),
|
@@ -114,6 +131,7 @@ export var Modal = function Modal(_ref) {
|
|
114
131
|
}, /*#__PURE__*/React.createElement("header", {
|
115
132
|
className: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n px-8 min-h-14\n flex items-center justify-between space-x-2\n ", "\n ", "\n "])), title ? "border-b border-grey-100" : "justify-end", !title && hideCloseIcon && "hidden")
|
116
133
|
}, title && /*#__PURE__*/React.createElement("h2", {
|
134
|
+
id: modalTitleId,
|
117
135
|
className: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["flex-1 display-heading truncate"])))
|
118
136
|
}, title), !hideCloseIcon && /*#__PURE__*/React.createElement(IconButton, {
|
119
137
|
icon: X,
|
@@ -27,7 +27,10 @@ export var ProgressSpinner = function ProgressSpinner(_ref) {
|
|
27
27
|
className: cx(stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["progress-spinner"]))), align && ALIGN_CLASSNAMES[align], className),
|
28
28
|
viewBox: "".concat(size / 2, " ").concat(size / 2, " ").concat(size, " ").concat(size),
|
29
29
|
width: size,
|
30
|
-
height: size
|
30
|
+
height: size,
|
31
|
+
role: "status",
|
32
|
+
"aria-busy": true,
|
33
|
+
"aria-live": "polite"
|
31
34
|
}), /*#__PURE__*/React.createElement("title", null, "Loading spinner"), /*#__PURE__*/React.createElement("circle", {
|
32
35
|
cx: size,
|
33
36
|
cy: size,
|
@@ -25,7 +25,7 @@ export var RadioGroupItem = function RadioGroupItem(_ref) {
|
|
25
25
|
var checked = value === contextValue;
|
26
26
|
disabled = contextDisabled || disabled;
|
27
27
|
return /*#__PURE__*/React.createElement("label", {
|
28
|
-
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex items-center justify-between\n min-h-10 px-4 py-2\n
|
28
|
+
className: stl(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex items-center justify-between\n min-h-10 px-4 py-2\n ", "\n ", "\n ", ""])), disabled ? "text-grey-300" : "hover:bg-grey-100", disabled ? "cursor-not-allowed" : "cursor-pointer", textPosition === "right" && "flex-row-reverse")
|
29
29
|
}, /*#__PURE__*/React.createElement("span", {
|
30
30
|
className: stl(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["flex-1 truncate ", ""])), textPosition === "right" ? "ml-2" : "mr-2")
|
31
31
|
}, children), /*#__PURE__*/React.createElement(RadioButton, {
|
package/esm/Tag/Tag.d.ts
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
import React from "react";
|
2
|
-
import { ColorVariant } from "../types";
|
2
|
+
import type { ColorVariant } from "../types";
|
3
|
+
export declare type TagVariants = ColorVariant | "pink";
|
3
4
|
export interface TagProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement> {
|
4
|
-
/**
|
5
|
-
|
5
|
+
/**
|
6
|
+
* The "pink" variant should only be used for **Algolia admin** related things.
|
7
|
+
* @default "grey"
|
8
|
+
* */
|
9
|
+
variant?: TagVariants;
|
6
10
|
onDelete?: React.MouseEventHandler<HTMLElement>;
|
7
11
|
}
|
8
12
|
/**
|
package/esm/Tag/Tag.js
CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
4
4
|
var _excluded = ["children", "variant", "className", "onDelete"];
|
5
5
|
|
6
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
|
7
7
|
|
8
8
|
import React, { forwardRef } from "react";
|
9
9
|
import cx from "classnames";
|
@@ -15,15 +15,17 @@ var VARIANT_CLASSNAMES = {
|
|
15
15
|
blue: stl(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["bg-blue-100 border-blue-200 text-blue-700"]))),
|
16
16
|
green: stl(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["bg-green-100 border-green-300 text-green-800"]))),
|
17
17
|
orange: stl(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["bg-orange-100 border-orange-300 text-orange-800"]))),
|
18
|
-
red: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["bg-red-100 border-red-200 text-red-700"])))
|
18
|
+
red: stl(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["bg-red-100 border-red-200 text-red-700"]))),
|
19
|
+
pink: stl(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["bg-pink-100 border-pink-200 text-pink-700"])))
|
19
20
|
};
|
20
21
|
var BUTTON_CLOSE_VARIANT_CLASSNAMES = {
|
21
|
-
accent: stl(
|
22
|
-
grey: stl(
|
23
|
-
blue: stl(
|
24
|
-
green: stl(
|
25
|
-
orange: stl(
|
26
|
-
red: stl(
|
22
|
+
accent: stl(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["border-accent-200 hover:bg-accent-200 focus:bg-accent-200"]))),
|
23
|
+
grey: stl(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["border-grey-200 hover:bg-grey-200 focus:bg-grey-200"]))),
|
24
|
+
blue: stl(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["border-blue-200 hover:bg-blue-200 focus:bg-blue-200"]))),
|
25
|
+
green: stl(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["border-green-300 hover:bg-green-300 focus:bg-green-300"]))),
|
26
|
+
orange: stl(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["border-orange-300 hover:bg-orange-300 focus:bg-orange-300"]))),
|
27
|
+
red: stl(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["border-red-200 hover:bg-red-200 focus:bg-red-200"]))),
|
28
|
+
pink: stl(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["border-pink-200 hover:bg-pink-200 focus:bg-pink-200"])))
|
27
29
|
};
|
28
30
|
/**
|
29
31
|
* Use tags to visually label UI objects for quick recognition and navigation. (!) **Tags can be added or removed from an object by users**.
|
@@ -56,7 +58,7 @@ export var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
56
58
|
props = _objectWithoutProperties(_ref, _excluded);
|
57
59
|
|
58
60
|
var title = typeof children === "string" ? children : "tag";
|
59
|
-
var tagClassName = cx(stl(
|
61
|
+
var tagClassName = cx(stl(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["tag"]))), VARIANT_CLASSNAMES[variant], className);
|
60
62
|
var editable = Boolean(onDelete);
|
61
63
|
|
62
64
|
var handleDelete = function handleDelete(evt) {
|
@@ -72,9 +74,9 @@ export var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
72
74
|
"aria-label": title,
|
73
75
|
ref: ref
|
74
76
|
}), /*#__PURE__*/React.createElement("span", {
|
75
|
-
className: stl(
|
77
|
+
className: stl(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["truncate flex-1"])))
|
76
78
|
}, children), editable && /*#__PURE__*/React.createElement("button", {
|
77
|
-
className: cx(stl(
|
79
|
+
className: cx(stl(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["tag-close-button"]))), BUTTON_CLOSE_VARIANT_CLASSNAMES[variant]),
|
78
80
|
type: "button",
|
79
81
|
onClick: handleDelete,
|
80
82
|
"aria-label": "Remove ".concat(title)
|
package/esm/index.d.ts
CHANGED
package/esm/index.js
CHANGED
@@ -146,5 +146,5 @@ export default {
|
|
146
146
|
borderWidth: ["responsive", "first"],
|
147
147
|
visibility: ["responsive", "group-hover"]
|
148
148
|
},
|
149
|
-
plugins: [require("./base.tailwind"), typography.plugin, require("../FlexGrid/FlexGrid.tailwind"), require("../AutoComplete/AutoComplete.tailwind"), require("../Button/Button.tailwind"), require("../Card/Card.tailwind"), require("../Checkbox/Checkbox.tailwind"), require("../EmptyState/EmptyState.tailwind"), require("../Flag/Flag.tailwind"), require("../HelpUnderline/HelpUnderline.tailwind"), require("../Input/Input.tailwind"), require("../InstantSearch/InstantSearch.tailwind"), require("../Medallion/Medallion.tailwind"), require("../Modal/Modal.tailwind"), require("../ProgressBar/ProgressBar.tailwind"), require("../ProgressSpinner/ProgressSpinner.tailwind"), require("../RadioGroup/RadioButton.tailwind"), require("../RangeSlider/RangeSlider.tailwind"), require("../ScrollIndicator/ScrollIndicator.tailwind"), require("../Select/Select.tailwind"), require("../Sidebar/Sidebar.tailwind"), require("../Switch/Switch.tailwind"), require("../Tabs/Tabs.tailwind"), require("../Tables/DataTable/DataTable.tailwind"), require("../Tables/Table/Table.tailwind"), require("../Tag/Tag.tailwind"), require("../TextArea/TextArea.tailwind"), require("../Toggle/Toggle.tailwind"), require("../Tooltip/Tooltip.tailwind"), require("../UserContent/UserContent.tailwind"), require("../DatePicker/DatePicker.tailwind")]
|
149
|
+
plugins: [require("./base.tailwind"), require("../utilities/utilities.tailwind"), typography.plugin, require("../FlexGrid/FlexGrid.tailwind"), require("../AutoComplete/AutoComplete.tailwind"), require("../Button/Button.tailwind"), require("../Card/Card.tailwind"), require("../Checkbox/Checkbox.tailwind"), require("../EmptyState/EmptyState.tailwind"), require("../Flag/Flag.tailwind"), require("../HelpUnderline/HelpUnderline.tailwind"), require("../Input/Input.tailwind"), require("../InstantSearch/InstantSearch.tailwind"), require("../KeyboardKey/KeyboardKey.tailwind"), require("../Medallion/Medallion.tailwind"), require("../Modal/Modal.tailwind"), require("../ProgressBar/ProgressBar.tailwind"), require("../ProgressSpinner/ProgressSpinner.tailwind"), require("../RadioGroup/RadioButton.tailwind"), require("../RangeSlider/RangeSlider.tailwind"), require("../ScrollIndicator/ScrollIndicator.tailwind"), require("../Select/Select.tailwind"), require("../Sidebar/Sidebar.tailwind"), require("../Switch/Switch.tailwind"), require("../Tabs/Tabs.tailwind"), require("../Tables/DataTable/DataTable.tailwind"), require("../Tables/Table/Table.tailwind"), require("../Tag/Tag.tailwind"), require("../TextArea/TextArea.tailwind"), require("../Toggle/Toggle.tailwind"), require("../Tooltip/Tooltip.tailwind"), require("../UserContent/UserContent.tailwind"), require("../DatePicker/DatePicker.tailwind")]
|
150
150
|
};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
// @ts-check
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @type {import('../tailwind-types').TailwindPlugin}
|
6
|
+
*/
|
7
|
+
export default (function (_ref) {
|
8
|
+
var addUtilities = _ref.addUtilities;
|
9
|
+
addUtilities({
|
10
|
+
".no-scrollbar": {
|
11
|
+
// for Firefox
|
12
|
+
"scrollbar-width": "none",
|
13
|
+
// for Internet Explorer, Edge
|
14
|
+
"-ms-overflow-style": "none",
|
15
|
+
// for Chrome, Safari, and Opera
|
16
|
+
"&::-webkit-scrollbar": {
|
17
|
+
display: "none",
|
18
|
+
width: 0
|
19
|
+
}
|
20
|
+
},
|
21
|
+
".no-search-input-decoration": {
|
22
|
+
"&[type='search']": _defineProperty({}, "&::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration", {
|
23
|
+
display: "none"
|
24
|
+
})
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
package/package.json
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
{
|
2
2
|
"name": "@algolia/satellite",
|
3
|
-
"version": "1.0.0-beta.
|
3
|
+
"version": "1.0.0-beta.131",
|
4
4
|
"description": "Algolia design system React components",
|
5
5
|
"scripts": {
|
6
|
-
"clean": "
|
6
|
+
"clean": "rimraf dist",
|
7
7
|
"prebuild": "yarn clean",
|
8
8
|
"build": "cross-env NODE_ENV=production run-p build:types build:js build:manifests build:css build:css-min build:scss",
|
9
9
|
"build:_js": "babel src --extensions \".ts,.tsx,.js\" --ignore \"src/**/*.d.ts,src/**/*.stories.tsx,src/**/*.test.ts,src/**/*.test.tsx\"",
|
10
10
|
"build:esm": "cross-env BABEL_MODULE_TYPE=ESM yarn build:_js --out-dir dist/esm",
|
11
11
|
"build:cjs": "cross-env BABEL_MODULE_TYPE=CJS yarn build:_js --out-dir dist/cjs",
|
12
12
|
"build:js": "run-p build:esm build:cjs",
|
13
|
-
"build:css": "NODE_ENV= postcss -o dist/satellite.css src/styles/satellite.css",
|
14
|
-
"build:css-min": "NODE_ENV=production postcss -o dist/satellite.min.css src/styles/satellite.css",
|
15
|
-
"build:css-storybook": "NODE_ENV=storybook postcss -o dist/satellite.css src/styles/satellite.css",
|
13
|
+
"build:css": "cross-env NODE_ENV= postcss -o dist/satellite.css src/styles/satellite.css",
|
14
|
+
"build:css-min": "cross-env NODE_ENV=production postcss -o dist/satellite.min.css src/styles/satellite.css",
|
15
|
+
"build:css-storybook": "cross-env NODE_ENV=storybook postcss -o dist/satellite.css src/styles/satellite.css",
|
16
16
|
"build:scss": "node ./scripts/build-scss-variables.js",
|
17
17
|
"build:types": "node ./scripts/build-types.js",
|
18
18
|
"build:manifests": "node ./scripts/prepare-manifests.js",
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"version": "yarn changelog && git add CHANGELOG.md",
|
30
30
|
"postversion": "git push && git push --tags",
|
31
31
|
"release": "./scripts/release.sh",
|
32
|
-
"chromatic": "NODE_ENV=storybook chromatic --build-script-name build:storybook --exit-zero-on-changes --auto-accept-changes master"
|
32
|
+
"chromatic": "cross-env NODE_ENV=storybook chromatic --build-script-name build:storybook --exit-zero-on-changes --auto-accept-changes master"
|
33
33
|
},
|
34
34
|
"publishConfig": {
|
35
35
|
"access": "public"
|
@@ -43,7 +43,12 @@
|
|
43
43
|
"react",
|
44
44
|
"design"
|
45
45
|
],
|
46
|
-
"author": "Algolia
|
46
|
+
"author": "Algolia <contact@algolia.com>",
|
47
|
+
"contributors": [
|
48
|
+
"Vincent Lemeunier <vincent.lemeunier@algolia.com>",
|
49
|
+
"Kevin Østerkilde <kevin.osterkilde@algolia.com>",
|
50
|
+
"Clément Aupiais <clement.aupiais@algolia.com>"
|
51
|
+
],
|
47
52
|
"license": "MIT",
|
48
53
|
"bugs": {
|
49
54
|
"url": "https://github.com/algolia/satellite/issues"
|