@koine/react 2.0.0-beta.16 → 2.0.0-beta.17
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/Animations/useReveal.js +4 -3
- package/Autocomplete/AutocompleteMui.js +3 -3
- package/Calendar/CalendarDaygridCell.js +2 -2
- package/Calendar/CalendarDaygridNav.js +2 -1
- package/Calendar/CalendarDaygridTable.js +4 -4
- package/Calendar/CalendarLegend.js +2 -1
- package/Calendar/useCalendar.js +15 -15
- package/Details/Details.js +4 -4
- package/Form/Form.js +2 -2
- package/Forms/Password/Password.js +2 -2
- package/Grid/Grid.js +2 -2
- package/Header/useHeader.js +5 -4
- package/MenuItem/useMenuItem.js +2 -2
- package/Progress/ProgressOverlay.js +2 -2
- package/Rating/Rating.js +3 -3
- package/Sidebar/Sidebar.js +3 -3
- package/Spacing/Spacing.js +3 -3
- package/Tabs/useTabs.js +3 -2
- package/Typography/ReadMore.js +5 -5
- package/Typography/TextLoop.js +4 -4
- package/createUseMediaQueryWidth.js +4 -3
- package/package.json +3 -3
- package/styles/media.js +3 -2
- package/styles/theme--vanilla.js +2 -1
- package/styles/theme.js +2 -2
- package/useAsyncFn.js +3 -3
- package/useDateLocale.js +3 -3
- package/useInterval.js +2 -2
- package/useKeyUp.js +2 -2
- package/useMeasure.js +9 -9
- package/usePrevious.js +2 -1
- package/useScrollThreshold.js +2 -1
- package/useScrollTo.js +2 -1
- package/useSpinDelay.js +2 -1
- package/useTraceUpdate.js +2 -1
- package/useWindowSize.js +3 -2
package/Animations/useReveal.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
export function useReveal(_a) {
|
|
3
4
|
var _b = _a.direction, direction = _b === void 0 ? "left" : _b, _c = _a.offsetStartY, offsetStartY = _c === void 0 ? -2 : _c, _d = _a.offsetEndY, offsetEndY = _d === void 0 ? 0 : _d, _e = _a.offsetStartX, offsetStartX = _e === void 0 ? "all" : _e;
|
|
4
5
|
var ref = useRef(null);
|
|
5
|
-
var _f = useState(0), startY = _f[0], setStartY = _f[1];
|
|
6
|
-
var _g = useState(0), endY = _g[0], setEndY = _g[1];
|
|
7
|
-
var _h = useState(0), startX = _h[0], setStartX = _h[1];
|
|
6
|
+
var _f = __read(useState(0), 2), startY = _f[0], setStartY = _f[1];
|
|
7
|
+
var _g = __read(useState(0), 2), endY = _g[0], setEndY = _g[1];
|
|
8
|
+
var _h = __read(useState(0), 2), startX = _h[0], setStartX = _h[1];
|
|
8
9
|
useEffect(function () {
|
|
9
10
|
if (!ref.current) {
|
|
10
11
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator, __rest } from "tslib";
|
|
1
|
+
import { __assign, __awaiter, __generator, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import useAutocomplete from "@mui/base/useAutocomplete";
|
|
4
4
|
import { useCallback, useMemo, useState } from "react";
|
|
@@ -10,8 +10,8 @@ import { normaliseAutocompleteValue } from "./helpers.js";
|
|
|
10
10
|
export var Autocomplete = function (_a) {
|
|
11
11
|
var creatable = _a.creatable, multiple = _a.multiple, autoComplete = _a.autoComplete, loadOptions = _a.loadOptions, _b = _a.options, defaultOptions = _b === void 0 ? [] : _b, defaultValue = _a.defaultValue, controlledValue = _a.value, defaultInputValue = _a.defaultInputValue, label = _a.label, placeholder = _a.placeholder, register = _a.register, setValue = _a.setValue, name = _a.name, onChange = _a.onChange, $ref = _a.$ref, children = _a.children, props = __rest(_a, ["creatable", "multiple", "autoComplete", "loadOptions", "options", "defaultValue", "value", "defaultInputValue", "label", "placeholder", "register", "setValue", "name", "onChange", "$ref", "children"]);
|
|
12
12
|
var defaultOptionsMemo = useMemo(function () { return normaliseOptions(defaultOptions); }, [defaultOptions]);
|
|
13
|
-
var _c = useState(defaultOptionsMemo), options = _c[0], setOptions = _c[1];
|
|
14
|
-
var _d = useState(false), loading = _d[0], setLoading = _d[1];
|
|
13
|
+
var _c = __read(useState(defaultOptionsMemo), 2), options = _c[0], setOptions = _c[1];
|
|
14
|
+
var _d = __read(useState(false), 2), loading = _d[0], setLoading = _d[1];
|
|
15
15
|
var _e = useAutocomplete({
|
|
16
16
|
id: "Autocomplete",
|
|
17
17
|
multiple: multiple ? true : undefined,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useState } from "react";
|
|
4
4
|
import { MdAdd as IconExpand, } from "react-icons/md";
|
|
@@ -10,7 +10,7 @@ var styleBtn = {
|
|
|
10
10
|
};
|
|
11
11
|
export var CalendarDaygridCell = function (_a) {
|
|
12
12
|
var eventClicked = _a.eventClicked, setEventClicked = _a.setEventClicked, setEventHovered = _a.setEventHovered, view = _a.view, maxEvents = _a.maxEvents, events = _a.events, calendarsMap = _a.calendarsMap, _b = _a.Cell, Cell = _b === void 0 ? "div" : _b, _c = _a.CellOverflow, CellOverflow = _c === void 0 ? "div" : _c, _d = _a.CellEvent, CellEvent = _d === void 0 ? "div" : _d, _e = _a.CellEventBtn, CellEventBtn = _e === void 0 ? "div" : _e, _f = _a.CellEventTitle, CellEventTitle = _f === void 0 ? "span" : _f, _g = _a.CellEventStart, CellEventStart = _g === void 0 ? "span" : _g;
|
|
13
|
-
var _h = useState(false), isExpanded = _h[0], expand = _h[1];
|
|
13
|
+
var _h = __read(useState(false), 2), isExpanded = _h[0], expand = _h[1];
|
|
14
14
|
var eventsWithoutPlaceholders = events.filter(function (event) { return !event.placeholder; });
|
|
15
15
|
return (_jsx(Cell, { children: events.map(function (event, i) {
|
|
16
16
|
if (i === maxEvents && !isExpanded) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import format from "date-fns/format";
|
|
3
4
|
import { useDateLocale } from "../useDateLocale.js";
|
|
4
5
|
export var KoineCalendarDaygridNav = function (_a) {
|
|
5
6
|
var range = _a.range, view = _a.view, todayInView = _a.todayInView, handlePrev = _a.handlePrev, handleNext = _a.handleNext, handleToday = _a.handleToday, handleView = _a.handleView, localeCode = _a.locale, _b = _a.NavRoot, NavRoot = _b === void 0 ? "nav" : _b, _c = _a.NavTitle, NavTitle = _c === void 0 ? "div" : _c, _d = _a.NavBtns, NavBtns = _d === void 0 ? "div" : _d, _e = _a.NavBtnPrev, NavBtnPrev = _e === void 0 ? "button" : _e, _f = _a.NavBtnNext, NavBtnNext = _f === void 0 ? "button" : _f, _g = _a.NavBtnToday, NavBtnToday = _g === void 0 ? "button" : _g, _h = _a.NavBtnViewMonth, NavBtnViewMonth = _h === void 0 ? "button" : _h, _j = _a.NavBtnViewWeek, NavBtnViewWeek = _j === void 0 ? "button" : _j;
|
|
6
|
-
var start =
|
|
7
|
+
var _k = __read(range, 2), start = _k[0], end = _k[1];
|
|
7
8
|
var locale = useDateLocale(localeCode);
|
|
8
9
|
var opts = { locale: locale };
|
|
9
10
|
var formatted = "";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import eachWeekOfInterval from "date-fns/eachWeekOfInterval";
|
|
4
4
|
import { useEffect, useMemo, useState } from "react";
|
|
@@ -7,7 +7,7 @@ import { useDateLocale } from "../useDateLocale.js";
|
|
|
7
7
|
import { CalendarDaygridCell, } from "./CalendarDaygridCell.js";
|
|
8
8
|
import { processEventsInView } from "./utils.js";
|
|
9
9
|
function getView(range) {
|
|
10
|
-
var start =
|
|
10
|
+
var _a = __read(range, 2), start = _a[0], end = _a[1];
|
|
11
11
|
var weeks = eachWeekOfInterval({ start: start, end: end }, { weekStartsOn: 1 });
|
|
12
12
|
return {
|
|
13
13
|
month: start.getMonth(),
|
|
@@ -24,8 +24,8 @@ export var KoineCalendarDaygridTable = function (_a) {
|
|
|
24
24
|
CellEventTitle: CellEventTitle,
|
|
25
25
|
CellEventStart: CellEventStart,
|
|
26
26
|
};
|
|
27
|
-
var _l = useState(dayLabels || [0, 1, 2, 3, 4, 5, 6]), days = _l[0], setDays = _l[1];
|
|
28
|
-
var _m = useState([]), weeksEvents = _m[0], setWeeksEvents = _m[1];
|
|
27
|
+
var _l = __read(useState(dayLabels || [0, 1, 2, 3, 4, 5, 6]), 2), days = _l[0], setDays = _l[1];
|
|
28
|
+
var _m = __read(useState([]), 2), weeksEvents = _m[0], setWeeksEvents = _m[1];
|
|
29
29
|
var locale = useDateLocale(localeCode);
|
|
30
30
|
var _o = useMemo(function () { return getView(range); }, [range]), month = _o.month, weeks = _o.weeks;
|
|
31
31
|
var swipeableHandlers = useSwipeable({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
export var KoineCalendarLegend = function (_a) {
|
|
3
4
|
var _b = _a.calendarsMap, calendarsMap = _b === void 0 ? {} : _b, toggleCalendarVisibility = _a.toggleCalendarVisibility, _c = _a.LegendItem, LegendItem = _c === void 0 ? "div" : _c, _d = _a.LegendItemStatus, LegendItemStatus = _d === void 0 ? "span" : _d, _e = _a.LegendItemLabel, LegendItemLabel = _e === void 0 ? "span" : _e, _f = _a.LegendItemEvents, LegendItemEvents = _f === void 0 ? "span" : _f;
|
|
4
5
|
return (_jsx(_Fragment, { children: Object.entries(calendarsMap).map(function (_a) {
|
|
5
|
-
var id =
|
|
6
|
+
var _b = __read(_a, 2), id = _b[0], calendar = _b[1];
|
|
6
7
|
return (_jsxs(LegendItem, { onClick: function () { return toggleCalendarVisibility(id); }, "$color": calendar.color, "$empty": calendar.events === 0, disabled: calendar.events === 0, children: [_jsx(LegendItemStatus, { children: calendar.on ? "\u2b24" : "\u2b58" }), _jsx(LegendItemLabel, { children: calendar.name }), _jsx(LegendItemEvents, { children: calendar.events })] }, "CalendarLegend." + id));
|
|
7
8
|
}) }));
|
|
8
9
|
};
|
package/Calendar/useCalendar.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
1
|
+
import { __assign, __awaiter, __generator, __read } from "tslib";
|
|
2
2
|
import { useCallback, useEffect, useReducer, useState } from "react";
|
|
3
3
|
import { getCalendarsEventsFromGoogle } from "./calendar-api-google.js";
|
|
4
4
|
import { getEndDate, getNextDate, getPrevDate, getStartDate, isTodayInView, } from "./utils.js";
|
|
5
5
|
export function useCalendar(_a) {
|
|
6
6
|
var _this = this;
|
|
7
7
|
var locale = _a.locale, apiKey = _a.apiKey, calendars = _a.calendars, initialEvents = _a.events, initialStart = _a.start, initialEnd = _a.end, _b = _a.view, initialView = _b === void 0 ? "month" : _b, _c = _a.timeZone, timeZone = _c === void 0 ? "" : _c, onError = _a.onError;
|
|
8
|
-
var _d = useState(initialView), view = _d[0], setView = _d[1];
|
|
8
|
+
var _d = __read(useState(initialView), 2), view = _d[0], setView = _d[1];
|
|
9
9
|
var start = initialStart || getStartDate(new Date(), view);
|
|
10
10
|
var end = initialEnd || getEndDate(start, view);
|
|
11
|
-
var _e = useState([start, end]), range = _e[0], setRange = _e[1];
|
|
12
|
-
var _f = useState(isTodayInView(start, end)), todayInView = _f[0], setTodayInView = _f[1];
|
|
13
|
-
var _g = useState(initialEvents || {}), events = _g[0], setEvents = _g[1];
|
|
14
|
-
var _h = useState(null), eventHovered = _h[0], setEventHovered = _h[1];
|
|
15
|
-
var _j = useState(null), eventClicked = _j[0], setEventClicked = _j[1];
|
|
16
|
-
var _k = useReducer(function (state, action) {
|
|
11
|
+
var _e = __read(useState([start, end]), 2), range = _e[0], setRange = _e[1];
|
|
12
|
+
var _f = __read(useState(isTodayInView(start, end)), 2), todayInView = _f[0], setTodayInView = _f[1];
|
|
13
|
+
var _g = __read(useState(initialEvents || {}), 2), events = _g[0], setEvents = _g[1];
|
|
14
|
+
var _h = __read(useState(null), 2), eventHovered = _h[0], setEventHovered = _h[1];
|
|
15
|
+
var _j = __read(useState(null), 2), eventClicked = _j[0], setEventClicked = _j[1];
|
|
16
|
+
var _k = __read(useReducer(function (state, action) {
|
|
17
17
|
var _a;
|
|
18
18
|
var type = action.type;
|
|
19
19
|
switch (type) {
|
|
20
20
|
case "events": {
|
|
21
21
|
var events_1 = action.payload;
|
|
22
22
|
return Object.entries(state).reduce(function (map, _a) {
|
|
23
|
-
var id =
|
|
23
|
+
var _b = __read(_a, 2), id = _b[0], calendar = _b[1];
|
|
24
24
|
map[id] = __assign(__assign({}, calendar), { events: events_1[id] || 0 });
|
|
25
25
|
return map;
|
|
26
26
|
}, {});
|
|
@@ -32,7 +32,7 @@ export function useCalendar(_a) {
|
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
34
|
return Object.entries(state).reduce(function (map, _a) {
|
|
35
|
-
var id =
|
|
35
|
+
var _b = __read(_a, 2), id = _b[0], calendar = _b[1];
|
|
36
36
|
map[id] = __assign(__assign({}, calendar), { on: visible_1.indexOf(id) > -1 });
|
|
37
37
|
return map;
|
|
38
38
|
}, {});
|
|
@@ -44,7 +44,7 @@ export function useCalendar(_a) {
|
|
|
44
44
|
}, calendars.reduce(function (map, calendar) {
|
|
45
45
|
map[calendar.id] = __assign(__assign({}, calendar), { name: calendar.name || "", on: true, events: 0 });
|
|
46
46
|
return map;
|
|
47
|
-
}, {})), calendarsMap = _k[0], updateCalendars = _k[1];
|
|
47
|
+
}, {})), 2), calendarsMap = _k[0], updateCalendars = _k[1];
|
|
48
48
|
var toggleCalendarVisibility = useCallback(function (idOrIds) {
|
|
49
49
|
updateCalendars({ type: "visibility", payload: idOrIds });
|
|
50
50
|
}, [updateCalendars]);
|
|
@@ -84,7 +84,7 @@ export function useCalendar(_a) {
|
|
|
84
84
|
});
|
|
85
85
|
}); }, [setEvents, apiKey, timeZone, onError]);
|
|
86
86
|
var handleToday = useCallback(function () {
|
|
87
|
-
var start =
|
|
87
|
+
var _a = __read(range, 2), start = _a[0], end = _a[1];
|
|
88
88
|
var newStart = getStartDate(new Date(), view);
|
|
89
89
|
var newEnd = getEndDate(newStart, view);
|
|
90
90
|
setRange([newStart, newEnd]);
|
|
@@ -96,7 +96,7 @@ export function useCalendar(_a) {
|
|
|
96
96
|
}, [view, range]);
|
|
97
97
|
var handlePrev = useCallback(function () {
|
|
98
98
|
setRange(function (_a) {
|
|
99
|
-
var start =
|
|
99
|
+
var _b = __read(_a, 1), start = _b[0];
|
|
100
100
|
var newStart = getPrevDate(start, view);
|
|
101
101
|
var newEnd = getEndDate(newStart, view);
|
|
102
102
|
return [newStart, newEnd];
|
|
@@ -106,7 +106,7 @@ export function useCalendar(_a) {
|
|
|
106
106
|
}, [view]);
|
|
107
107
|
var handleNext = useCallback(function () {
|
|
108
108
|
setRange(function (_a) {
|
|
109
|
-
var start =
|
|
109
|
+
var _b = __read(_a, 1), start = _b[0];
|
|
110
110
|
var newStart = getNextDate(start, view);
|
|
111
111
|
var newEnd = getEndDate(newStart, view);
|
|
112
112
|
return [newStart, newEnd];
|
|
@@ -123,7 +123,7 @@ export function useCalendar(_a) {
|
|
|
123
123
|
setEventHovered(null);
|
|
124
124
|
}, [start]);
|
|
125
125
|
useEffect(function () {
|
|
126
|
-
var start =
|
|
126
|
+
var _a = __read(range, 2), start = _a[0], end = _a[1];
|
|
127
127
|
loadCalendars(calendars, start, end);
|
|
128
128
|
setTodayInView(isTodayInView(start, end));
|
|
129
129
|
}, [range]);
|
package/Details/Details.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useId, useRef, useState, } from "react";
|
|
4
4
|
import { extendComponent, } from "../extendComponent.js";
|
|
@@ -10,12 +10,12 @@ export var Content = "div";
|
|
|
10
10
|
var DetailsWithRef = forwardRef(function Details(_a, ref) {
|
|
11
11
|
var id = _a.id, propOpen = _a.open, recalc = _a.recalc, summary = _a.summary, children = _a.children, _Root = _a.Root, _Summary = _a.Summary, _Body = _a.Body, _Content = _a.Content, onChange = _a.onChange, props = __rest(_a, ["id", "open", "recalc", "summary", "children", "Root", "Summary", "Body", "Content", "onChange"]);
|
|
12
12
|
var isControlled = typeof propOpen !== "undefined";
|
|
13
|
-
var _b = useState(propOpen), stateOpen = _b[0], setStateOpen = _b[1];
|
|
14
|
-
var _c = useState(0), setHeight = _c[1];
|
|
13
|
+
var _b = __read(useState(propOpen), 2), stateOpen = _b[0], setStateOpen = _b[1];
|
|
14
|
+
var _c = __read(useState(0), 2), setHeight = _c[1];
|
|
15
15
|
var hash = id ? "#".concat(id) : "";
|
|
16
16
|
var winSize = useWindowSize();
|
|
17
17
|
var open = isControlled ? propOpen : stateOpen;
|
|
18
|
-
var
|
|
18
|
+
var _d = __read(useState(open ? "unset" : "hidden"), 1), overflow = _d[0];
|
|
19
19
|
var content = useRef(null);
|
|
20
20
|
var defaultId = useId();
|
|
21
21
|
id = id || defaultId;
|
package/Form/Form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { extendComponent, } from "../extendComponent.js";
|
|
@@ -14,7 +14,7 @@ export var Form = function (_a) {
|
|
|
14
14
|
} : _b, _Fail = _a.Fail, _c = _a.failProps, failProps = _c === void 0 ? {
|
|
15
15
|
children: "Failed.",
|
|
16
16
|
} : _c, collapseOnOk = _a.collapseOnOk, collapseOnFail = _a.collapseOnFail, _d = _a.okTimeout, okTimeout = _d === void 0 ? 3000 : _d, _e = _a.failTimeout, failTimeout = _e === void 0 ? 3000 : _e, children = _a.children, props = __rest(_a, ["Root", "Overlay", "Progress", "Collapsable", "ok", "fail", "loading", "Ok", "okProps", "Fail", "failProps", "collapseOnOk", "collapseOnFail", "okTimeout", "failTimeout", "children"]);
|
|
17
|
-
var _f = useState(""), open = _f[0], setOpen = _f[1];
|
|
17
|
+
var _f = __read(useState(""), 2), open = _f[0], setOpen = _f[1];
|
|
18
18
|
var commonProps = {
|
|
19
19
|
head: null,
|
|
20
20
|
components: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
|
+
import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useState } from "react";
|
|
4
4
|
import { ImEyeBlocked as IconInvisible, ImEye as IconVisible, } from "react-icons/im";
|
|
@@ -11,7 +11,7 @@ export var PasswordInputNative = styled(InputNative)(templateObject_2 || (templa
|
|
|
11
11
|
var PasswordIcon = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n opacity: 0.5;\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n opacity: 0.5;\n"])), ICON_WIDTH);
|
|
12
12
|
export var Password = forwardRef(function Password(_a, ref) {
|
|
13
13
|
var register = _a.register, name = _a.name, label = _a.label, props = __rest(_a, ["register", "name", "label"]);
|
|
14
|
-
var _b = useState(false), visible = _b[0], setVisible = _b[1];
|
|
14
|
+
var _b = __read(useState(false), 2), visible = _b[0], setVisible = _b[1];
|
|
15
15
|
return (_jsxs(_Fragment, { children: [label && _jsx(Label, { children: label }), _jsxs(PasswordInputWrap, { children: [_jsx(PasswordInputNative, __assign({ type: visible ? "text" : "password", autoComplete: "new-password" }, (register ? register(name) : { name: name, ref: ref }), props)), _jsx(PasswordIcon, { onClick: function () { return setVisible(function (prev) { return !prev; }); }, children: visible ? _jsx(IconInvisible, {}) : _jsx(IconVisible, {}) })] })] }));
|
|
16
16
|
});
|
|
17
17
|
var templateObject_1, templateObject_2, templateObject_3;
|
package/Grid/Grid.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
1
|
+
import { __makeTemplateObject, __read } from "tslib";
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
export var GRID_COLUMNS = 12;
|
|
4
4
|
export var GRID_GUTTER_DEFAULT = "half";
|
|
@@ -26,7 +26,7 @@ function getColCss(props) {
|
|
|
26
26
|
var offsets = $offset.split(",");
|
|
27
27
|
for (var i = 0; i <= offsets.length; i++) {
|
|
28
28
|
if (offsets[i]) {
|
|
29
|
-
var _a = offsets[i].split(":"), offsetBreakpoint = _a[0], offsetSize = _a[1];
|
|
29
|
+
var _a = __read(offsets[i].split(":"), 2), offsetBreakpoint = _a[0], offsetSize = _a[1];
|
|
30
30
|
css += " \n @media(min-width: ".concat(breakpoints[offsetBreakpoint], "px){\n margin-left: ").concat((100 * offsetSize) / GRID_COLUMNS, "%;\n }\n ");
|
|
31
31
|
}
|
|
32
32
|
}
|
package/Header/useHeader.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useState } from "react";
|
|
2
3
|
import { useMedia } from "../styles/media.js";
|
|
3
4
|
import { useTheme } from "../styles/theme.js";
|
|
4
5
|
import { useScrollPosition } from "../useScrollPosition.js";
|
|
5
6
|
export var useHeader = function () {
|
|
6
|
-
var _a = useState(false), isSticky = _a[0], setIsSticky = _a[1];
|
|
7
|
+
var _a = __read(useState(false), 2), isSticky = _a[0], setIsSticky = _a[1];
|
|
7
8
|
var themed = useTheme().header;
|
|
8
9
|
var isDesktopLayout = useMedia("min:".concat(themed.breakpoint));
|
|
9
10
|
var valueIdx = isDesktopLayout ? 1 : 0;
|
|
10
|
-
var _b = useState(themed.height[valueIdx]), headerHeight = _b[0], setHeaderHeight = _b[1];
|
|
11
|
-
var _c = useState(themed.height[valueIdx]), placeholderHeight = _c[0], setPlaceholderHeight = _c[1];
|
|
12
|
-
var _d = useState(themed.logoWidth[valueIdx]), logoWidth = _d[0], setLogoWidth = _d[1];
|
|
11
|
+
var _b = __read(useState(themed.height[valueIdx]), 2), headerHeight = _b[0], setHeaderHeight = _b[1];
|
|
12
|
+
var _c = __read(useState(themed.height[valueIdx]), 2), placeholderHeight = _c[0], setPlaceholderHeight = _c[1];
|
|
13
|
+
var _d = __read(useState(themed.logoWidth[valueIdx]), 2), logoWidth = _d[0], setLogoWidth = _d[1];
|
|
13
14
|
useScrollPosition(function (currentPosition) {
|
|
14
15
|
var isPastThreshold = currentPosition.y * -1 > 40;
|
|
15
16
|
if (isSticky !== isPastThreshold)
|
package/MenuItem/useMenuItem.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
2
|
import useMenu from "@mui/base/useMenu";
|
|
3
3
|
import useForkRef from "@mui/utils/useForkRef";
|
|
4
4
|
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
@@ -16,7 +16,7 @@ export function useMenuItem(props) {
|
|
|
16
16
|
useEffect(function () {
|
|
17
17
|
registerItem(id, { disabled: disabled, id: id, ref: itemRef, label: label });
|
|
18
18
|
}, [id, registerItem, disabled, ref, label]);
|
|
19
|
-
var _d = useState(false), focusRequested = _d[0], requestFocus = _d[1];
|
|
19
|
+
var _d = __read(useState(false), 2), focusRequested = _d[0], requestFocus = _d[1];
|
|
20
20
|
var focusIfRequested = useCallback(function () {
|
|
21
21
|
if (focusRequested && itemRef.current != null) {
|
|
22
22
|
itemRef.current.focus();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
1
|
+
import { __makeTemplateObject, __read } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { m } from "framer-motion";
|
|
4
4
|
import { useEffect } from "react";
|
|
@@ -10,7 +10,7 @@ var ProgressOverlayWrap = styled(m.div)(templateObject_1 || (templateObject_1 =
|
|
|
10
10
|
var ProgressOverlayCenterer = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--progress-overlay-bg);\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--progress-overlay-bg);\n"])));
|
|
11
11
|
export var ProgressOverlay = function (_a) {
|
|
12
12
|
var running = _a.running;
|
|
13
|
-
var _b = useHeader(), headerHeight = _b[2];
|
|
13
|
+
var _b = __read(useHeader(), 3), headerHeight = _b[2];
|
|
14
14
|
useEffect(function () {
|
|
15
15
|
document.body.style.cursor = running ? "wait" : "";
|
|
16
16
|
}, [running]);
|
package/Rating/Rating.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
|
+
import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useId, useState } from "react";
|
|
4
4
|
import styled from "styled-components";
|
|
@@ -15,8 +15,8 @@ export var RatingRoot = styled.div(templateObject_5 || (templateObject_5 = __mak
|
|
|
15
15
|
export var Rating = function (_a) {
|
|
16
16
|
var _b = _a.value, value = _b === void 0 ? 0 : _b, count = _a.count, _c = _a.min, min = _c === void 0 ? 0 : _c, _d = _a.max, max = _d === void 0 ? 5 : _d, _e = _a.showDetails, showDetails = _e === void 0 ? true : _e, colorBg = _a.colorBg, colorStroke = _a.colorStroke, _f = _a.starSize, starSize = _f === void 0 ? 16 : _f;
|
|
17
17
|
var id = useId();
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var _g = __read(useState(value), 1), currentValue = _g[0];
|
|
19
|
+
var _h = __read(useState([]), 2), stars = _h[0], setStars = _h[1];
|
|
20
20
|
var getStars = useCallback(function (activeCount) {
|
|
21
21
|
var stars = [];
|
|
22
22
|
for (var currentStar = min + 1; currentStar < max + 1; currentStar++) {
|
package/Sidebar/Sidebar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __makeTemplateObject } from "tslib";
|
|
1
|
+
import { __makeTemplateObject, __read } from "tslib";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useState } from "react";
|
|
4
4
|
import { CgCloseR as IconClose } from "react-icons/cg";
|
|
@@ -13,8 +13,8 @@ var SidebarWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTe
|
|
|
13
13
|
var SidebarToggle = styled.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n z-index: 21;\n position: fixed;\n right: var(--gutter-half);\n bottom: var(--gutter-half);\n ", " {\n display: none;\n }\n\n path {\n stroke: currentColor;\n }\n"], ["\n z-index: 21;\n position: fixed;\n right: var(--gutter-half);\n bottom: var(--gutter-half);\n ", " {\n display: none;\n }\n\n path {\n stroke: currentColor;\n }\n"])), min.md);
|
|
14
14
|
export var Sidebar = function (_a) {
|
|
15
15
|
var children = _a.children;
|
|
16
|
-
var _b = useState(false), open = _b[0], setOpen = _b[1];
|
|
17
|
-
var _c = useHeader(), headerHeight = _c[2];
|
|
16
|
+
var _b = __read(useState(false), 2), open = _b[0], setOpen = _b[1];
|
|
17
|
+
var _c = __read(useHeader(), 3), headerHeight = _c[2];
|
|
18
18
|
var handleClickToggle = useCallback(function () {
|
|
19
19
|
setOpen(function (prevOpen) { return !prevOpen; });
|
|
20
20
|
}, []);
|
package/Spacing/Spacing.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject, __rest, __spreadArray } from "tslib";
|
|
1
|
+
import { __assign, __makeTemplateObject, __read, __rest, __spreadArray } from "tslib";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import { isUndefined } from "@koine/utils";
|
|
5
5
|
import { spacingBottom, spacingTop, } from "../styles/spacing.js";
|
|
6
|
-
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), function (p) { return p.$top && spacingTop.call.apply(spacingTop, __spreadArray([p.theme], p.$top, false)); }, function (p) { return p.$bottom && spacingBottom.call.apply(spacingBottom, __spreadArray([p.theme], p.$bottom, false)); });
|
|
6
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n ", "\n"], ["\n ", "\n ", "\n"])), function (p) { return p.$top && spacingTop.call.apply(spacingTop, __spreadArray([p.theme], __read(p.$top), false)); }, function (p) { return p.$bottom && spacingBottom.call.apply(spacingBottom, __spreadArray([p.theme], __read(p.$bottom), false)); });
|
|
7
7
|
var extractDirectionArgs = function (raw) {
|
|
8
|
-
var _a = raw.split(":"), size = _a[0], factor = _a[1], property = _a[2], devices = _a[3];
|
|
8
|
+
var _a = __read(raw.split(":"), 4), size = _a[0], factor = _a[1], property = _a[2], devices = _a[3];
|
|
9
9
|
var factorArg = isUndefined(factor) ? undefined : parseFloat(factor);
|
|
10
10
|
var devicesArg = devices === null || devices === void 0 ? void 0 : devices.split(",");
|
|
11
11
|
return [size, factorArg, property, devicesArg];
|
package/Tabs/useTabs.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import useControlled from "@mui/utils/useControlled";
|
|
2
3
|
import { useCallback, useId, useMemo } from "react";
|
|
3
4
|
export var useTabs = function (props) {
|
|
4
5
|
var valueProp = props.value, defaultValue = props.defaultValue, onChange = props.onChange, orientation = props.orientation, direction = props.direction, selectionFollowsFocus = props.selectionFollowsFocus;
|
|
5
|
-
var _a = useControlled({
|
|
6
|
+
var _a = __read(useControlled({
|
|
6
7
|
controlled: valueProp,
|
|
7
8
|
default: defaultValue,
|
|
8
9
|
name: "Tabs",
|
|
9
10
|
state: "value",
|
|
10
|
-
}), value = _a[0], setValue = _a[1];
|
|
11
|
+
}), 2), value = _a[0], setValue = _a[1];
|
|
11
12
|
var idPrefix = useId();
|
|
12
13
|
var onSelected = useCallback(function (e, newValue) {
|
|
13
14
|
setValue(newValue);
|
package/Typography/ReadMore.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
|
+
import { __assign, __makeTemplateObject, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { m, useSpring } from "framer-motion";
|
|
4
4
|
import { useMemo, useRef, useState } from "react";
|
|
@@ -13,10 +13,10 @@ var BtnIcon = styled.span(templateObject_6 || (templateObject_6 = __makeTemplate
|
|
|
13
13
|
export var ReadMore = function (_a) {
|
|
14
14
|
var _b = _a.lines, lines = _b === void 0 ? 3 : _b, _c = _a.lineHeight, lineHeight = _c === void 0 ? 1.6 : _c, _d = _a.fontSize, fontSize = _d === void 0 ? 14 : _d, _e = _a.bg, bg = _e === void 0 ? "var(--bodyBg)" : _e, _f = _a.expand, expand = _f === void 0 ? "Expand" : _f, _g = _a.collapse, collapse = _g === void 0 ? "Collapse" : _g, props = __rest(_a, ["lines", "lineHeight", "fontSize", "bg", "expand", "collapse"]);
|
|
15
15
|
var defaultMaxHeight = lines * (lineHeight * fontSize);
|
|
16
|
-
var _h = useState(false), expanded = _h[0], setExpanded = _h[1];
|
|
17
|
-
var _j = useState(defaultMaxHeight), maxHeight = _j[0], setMaxHeight = _j[1];
|
|
18
|
-
var _k = useState(0), fullHeight = _k[0], setFullHeight = _k[1];
|
|
19
|
-
var _l = useState(false), exceeds = _l[0], setExceeds = _l[1];
|
|
16
|
+
var _h = __read(useState(false), 2), expanded = _h[0], setExpanded = _h[1];
|
|
17
|
+
var _j = __read(useState(defaultMaxHeight), 2), maxHeight = _j[0], setMaxHeight = _j[1];
|
|
18
|
+
var _k = __read(useState(0), 2), fullHeight = _k[0], setFullHeight = _k[1];
|
|
19
|
+
var _l = __read(useState(false), 2), exceeds = _l[0], setExceeds = _l[1];
|
|
20
20
|
var content = useRef(null);
|
|
21
21
|
var height = useSpring(defaultMaxHeight);
|
|
22
22
|
var styles = useMemo(function () { return (exceeds ? { height: height, overflow: "hidden" } : {}); }, [exceeds, height]);
|
package/Typography/TextLoop.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
|
1
|
+
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { AnimatePresence, m } from "framer-motion";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
export var TextLoopPiece = function (_a) {
|
|
6
6
|
var _b = _a.text, text = _b === void 0 ? "" : _b, _c = _a.style, style = _c === void 0 ? {} : _c, _d = _a.className, className = _d === void 0 ? "" : _d, _e = _a.direction, direction = _e === void 0 ? "up" : _e, _f = _a.inline, inline = _f === void 0 ? true : _f, _g = _a.noOverflow, noOverflow = _g === void 0 ? true : _g, _h = _a.delay, delay = _h === void 0 ? 400 : _h;
|
|
7
7
|
var placeholderRef = useRef(null);
|
|
8
|
-
var _j = useState({ data: "", key: "" }), content = _j[0], setContent = _j[1];
|
|
9
|
-
var _k = useState(inline ? 0 : "auto"), width = _k[0], setWidth = _k[1];
|
|
8
|
+
var _j = __read(useState({ data: "", key: "" }), 2), content = _j[0], setContent = _j[1];
|
|
9
|
+
var _k = __read(useState(inline ? 0 : "auto"), 2), width = _k[0], setWidth = _k[1];
|
|
10
10
|
useEffect(function () {
|
|
11
11
|
var timeoutId = setTimeout(function () {
|
|
12
12
|
if (!placeholderRef.current)
|
|
@@ -36,7 +36,7 @@ export var TextLoopPiece = function (_a) {
|
|
|
36
36
|
};
|
|
37
37
|
export var TextLoop = function (_a) {
|
|
38
38
|
var texts = _a.texts, _b = _a.interval, interval = _b === void 0 ? 3000 : _b, props = __rest(_a, ["texts", "interval"]);
|
|
39
|
-
var _c = useState(0), index = _c[0], setIndex = _c[1];
|
|
39
|
+
var _c = __read(useState(0), 2), index = _c[0], setIndex = _c[1];
|
|
40
40
|
useEffect(function () {
|
|
41
41
|
var intervalId = setInterval(function () { return setIndex(function (index) { return index + 1; }); }, interval);
|
|
42
42
|
return function () { return clearTimeout(intervalId); };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useState } from "react";
|
|
2
3
|
import { getMediaQueryWidthResolvers, isUndefined, } from "@koine/utils";
|
|
3
4
|
import useIsomorphicLayoutEffect from "./useIsomorphicLayoutEffect.js";
|
|
@@ -5,16 +6,16 @@ export function createUseMediaQueryWidth(customBreakpoints) {
|
|
|
5
6
|
var queryResolvers = getMediaQueryWidthResolvers(customBreakpoints);
|
|
6
7
|
return function useMediaQueryWidth(media, serverValue) {
|
|
7
8
|
var definition = media.substring(1);
|
|
8
|
-
var _a = definition.split("-"), rule = _a[0], ruleBreakpoint = _a[1];
|
|
9
|
+
var _a = __read(definition.split("-"), 2), rule = _a[0], ruleBreakpoint = _a[1];
|
|
9
10
|
if (isUndefined(ruleBreakpoint)) {
|
|
10
11
|
ruleBreakpoint = rule;
|
|
11
12
|
}
|
|
12
13
|
if (isUndefined(rule)) {
|
|
13
14
|
rule = "min";
|
|
14
15
|
}
|
|
15
|
-
var _b = ruleBreakpoint.split("_"), br1 = _b[0], br2 = _b[1];
|
|
16
|
+
var _b = __read(ruleBreakpoint.split("_"), 2), br1 = _b[0], br2 = _b[1];
|
|
16
17
|
var query = queryResolvers[rule](br1, br2);
|
|
17
|
-
var _c = useState(isUndefined(serverValue) ? null : serverValue), matches = _c[0], setMatches = _c[1];
|
|
18
|
+
var _c = __read(useState(isUndefined(serverValue) ? null : serverValue), 2), matches = _c[0], setMatches = _c[1];
|
|
18
19
|
useIsomorphicLayoutEffect(function () {
|
|
19
20
|
var mq = window.matchMedia(query);
|
|
20
21
|
var handleChange = function (event) {
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@koine/react",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/dom": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/dom": "2.0.0-beta.17",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.17"
|
|
7
7
|
},
|
|
8
8
|
"peerDependenciesMeta": {
|
|
9
9
|
"@hookform/resolvers": {
|
|
@@ -655,5 +655,5 @@
|
|
|
655
655
|
}
|
|
656
656
|
},
|
|
657
657
|
"peerDependencies": {},
|
|
658
|
-
"version": "2.0.0-beta.
|
|
658
|
+
"version": "2.0.0-beta.17"
|
|
659
659
|
}
|
package/styles/media.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
var _a;
|
|
2
|
+
import { __read } from "tslib";
|
|
2
3
|
import { useEffect, useState } from "react";
|
|
3
4
|
import { breakpoints, useTheme } from "./theme.js";
|
|
4
5
|
export var min = (_a = generateMediaQueries(breakpoints), _a.min), max = _a.max, up = _a.up, down = _a.down, between = _a.between, only = _a.only;
|
|
5
6
|
export function useMedia(media) {
|
|
6
7
|
var breakpoints = useTheme().breakpoints;
|
|
7
|
-
var _a = useState(false), matches = _a[0], setMatches = _a[1];
|
|
8
|
-
var _b = media.split(":"), _c = _b[0], direction = _c === void 0 ? "min" : _c, breakpoint = _b[1];
|
|
8
|
+
var _a = __read(useState(false), 2), matches = _a[0], setMatches = _a[1];
|
|
9
|
+
var _b = __read(media.split(":"), 2), _c = _b[0], direction = _c === void 0 ? "min" : _c, breakpoint = _b[1];
|
|
9
10
|
var px = breakpoints[breakpoint];
|
|
10
11
|
if (direction === "max") {
|
|
11
12
|
px = px - 0.02;
|
package/styles/theme--vanilla.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useEffect, useState } from "react";
|
|
3
4
|
import { isBrowser } from "@koine/utils";
|
|
@@ -23,7 +24,7 @@ export var ThemeVanillaContext = createContext({
|
|
|
23
24
|
});
|
|
24
25
|
export var ThemeVanillaProvider = function (_a) {
|
|
25
26
|
var initialTheme = _a.initialTheme, children = _a.children;
|
|
26
|
-
var _b = useState(initialTheme), theme = _b[0], setTheme = _b[1];
|
|
27
|
+
var _b = __read(useState(initialTheme), 2), theme = _b[0], setTheme = _b[1];
|
|
27
28
|
var rawSetTheme = function (rawTheme) {
|
|
28
29
|
if (!rawTheme || !isBrowser) {
|
|
29
30
|
return;
|
package/styles/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
2
|
import { useTheme as _useTheme } from "styled-components";
|
|
3
3
|
var DEFAULT_BREAKPOINTS = {
|
|
4
4
|
xs: 0,
|
|
@@ -10,7 +10,7 @@ var DEFAULT_BREAKPOINTS = {
|
|
|
10
10
|
};
|
|
11
11
|
export var breakpoints = process.env["BREAKPOINTS"]
|
|
12
12
|
? process.env["BREAKPOINTS"].split(",").reduce(function (map, pair) {
|
|
13
|
-
var _a = pair.split(":"), key = _a[0], value = _a[1];
|
|
13
|
+
var _a = __read(pair.split(":"), 2), key = _a[0], value = _a[1];
|
|
14
14
|
map[key] = parseFloat(value);
|
|
15
15
|
return map;
|
|
16
16
|
}, {})
|
package/useAsyncFn.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useCallback, useRef, useState } from "react";
|
|
3
3
|
import { useMountedState } from "./useMountedState.js";
|
|
4
4
|
export function useAsyncFn(fn, deps, initialState) {
|
|
@@ -6,7 +6,7 @@ export function useAsyncFn(fn, deps, initialState) {
|
|
|
6
6
|
if (initialState === void 0) { initialState = { loading: false }; }
|
|
7
7
|
var lastCallId = useRef(0);
|
|
8
8
|
var isMounted = useMountedState();
|
|
9
|
-
var _a = useState(initialState), state = _a[0], set = _a[1];
|
|
9
|
+
var _a = __read(useState(initialState), 2), state = _a[0], set = _a[1];
|
|
10
10
|
var callback = useCallback(function () {
|
|
11
11
|
var args = [];
|
|
12
12
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -16,7 +16,7 @@ export function useAsyncFn(fn, deps, initialState) {
|
|
|
16
16
|
if (!state.loading) {
|
|
17
17
|
set(function (prevState) { return (__assign(__assign({}, prevState), { loading: true })); });
|
|
18
18
|
}
|
|
19
|
-
return fn.apply(void 0, args).then(function (value) {
|
|
19
|
+
return fn.apply(void 0, __spreadArray([], __read(args), false)).then(function (value) {
|
|
20
20
|
isMounted() &&
|
|
21
21
|
callId === lastCallId.current &&
|
|
22
22
|
set({ value: value, loading: false });
|
package/useDateLocale.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
1
|
+
import { __awaiter, __generator, __read } from "tslib";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
export function useDateLocale(locale, defaultLocale) {
|
|
4
4
|
var _this = this;
|
|
5
5
|
if (defaultLocale === void 0) { defaultLocale = "en"; }
|
|
6
|
-
var _a = useState(), data = _a[0], setData = _a[1];
|
|
7
|
-
var _b = useState(defaultLocale), current = _b[0], setCurrent = _b[1];
|
|
6
|
+
var _a = __read(useState(), 2), data = _a[0], setData = _a[1];
|
|
7
|
+
var _b = __read(useState(defaultLocale), 2), current = _b[0], setCurrent = _b[1];
|
|
8
8
|
useEffect(function () {
|
|
9
9
|
var importLocaleFile = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
10
10
|
var localeToSet;
|
package/useInterval.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import { noop } from "@koine/utils";
|
|
4
4
|
export function useInterval(callback, delay, deps) {
|
|
@@ -6,7 +6,7 @@ export function useInterval(callback, delay, deps) {
|
|
|
6
6
|
var savedCallback = useRef();
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
savedCallback.current = callback;
|
|
9
|
-
}, __spreadArray([callback], deps,
|
|
9
|
+
}, __spreadArray([callback], __read(deps), false));
|
|
10
10
|
useEffect(function () {
|
|
11
11
|
function tick() {
|
|
12
12
|
if (savedCallback.current)
|
package/useKeyUp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { on } from "@koine/dom";
|
|
4
4
|
export function useKeyUp(callback, deps) {
|
|
@@ -13,6 +13,6 @@ export function useKeyUp(callback, deps) {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
return listener;
|
|
16
|
-
}, __spreadArray([callback], deps,
|
|
16
|
+
}, __spreadArray([callback], __read(deps), false));
|
|
17
17
|
}
|
|
18
18
|
export default useKeyUp;
|
package/useMeasure.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { debounce, noop } from "@koine/utils";
|
|
4
4
|
import { listenResizeDebounced, listenScrollDebounced, off, on, } from "@koine/dom";
|
|
@@ -10,7 +10,7 @@ function findScrollContainers(element) {
|
|
|
10
10
|
var _a = window.getComputedStyle(element), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
|
|
11
11
|
if ([overflow, overflowX, overflowY].some(function (prop) { return prop === "auto" || prop === "scroll"; }))
|
|
12
12
|
result.push(element);
|
|
13
|
-
return __spreadArray(__spreadArray([], result,
|
|
13
|
+
return __spreadArray(__spreadArray([], __read(result), false), __read(findScrollContainers(element.parentElement)), false);
|
|
14
14
|
}
|
|
15
15
|
var keys = [
|
|
16
16
|
"x",
|
|
@@ -27,7 +27,7 @@ var areBoundsEqual = function (a, b) {
|
|
|
27
27
|
};
|
|
28
28
|
export function useMeasure(options) {
|
|
29
29
|
var _a = (options || {}).scroll, scroll = _a === void 0 ? false : _a;
|
|
30
|
-
var _b = useState({
|
|
30
|
+
var _b = __read(useState({
|
|
31
31
|
left: 0,
|
|
32
32
|
top: 0,
|
|
33
33
|
width: 0,
|
|
@@ -36,7 +36,7 @@ export function useMeasure(options) {
|
|
|
36
36
|
right: 0,
|
|
37
37
|
x: 0,
|
|
38
38
|
y: 0,
|
|
39
|
-
}), bounds = _b[0], setBounds = _b[1];
|
|
39
|
+
}), 2), bounds = _b[0], setBounds = _b[1];
|
|
40
40
|
var state = useRef([
|
|
41
41
|
null,
|
|
42
42
|
null,
|
|
@@ -48,13 +48,13 @@ export function useMeasure(options) {
|
|
|
48
48
|
mounted.current = true;
|
|
49
49
|
return function () { return void (mounted.current = false); };
|
|
50
50
|
}, []);
|
|
51
|
-
var _c = useMemo(function () {
|
|
51
|
+
var _c = __read(useMemo(function () {
|
|
52
52
|
var callback = function () {
|
|
53
53
|
var _args = [];
|
|
54
54
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
55
55
|
_args[_i] = arguments[_i];
|
|
56
56
|
}
|
|
57
|
-
var _a = state.current, element = _a[0], lastBounds = _a[3];
|
|
57
|
+
var _a = __read(state.current, 4), element = _a[0], lastBounds = _a[3];
|
|
58
58
|
if (!element)
|
|
59
59
|
return;
|
|
60
60
|
var size = element.getBoundingClientRect();
|
|
@@ -66,9 +66,9 @@ export function useMeasure(options) {
|
|
|
66
66
|
};
|
|
67
67
|
var debouncedCallback = debounce(callback);
|
|
68
68
|
return [callback, debouncedCallback, debouncedCallback];
|
|
69
|
-
}, [setBounds]), forceRefresh = _c[0], scrollChange = _c[2];
|
|
69
|
+
}, [setBounds]), 3), forceRefresh = _c[0], scrollChange = _c[2];
|
|
70
70
|
function removeListeners() {
|
|
71
|
-
var _a = state.current, scrollContainers = _a[1], resizeObserver = _a[2];
|
|
71
|
+
var _a = __read(state.current, 3), scrollContainers = _a[1], resizeObserver = _a[2];
|
|
72
72
|
if (scrollContainers) {
|
|
73
73
|
scrollContainers.forEach(function (element) {
|
|
74
74
|
return off(element, "scroll", scrollChange);
|
|
@@ -81,7 +81,7 @@ export function useMeasure(options) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
function addListeners() {
|
|
84
|
-
var _a = state.current, element = _a[0], scrollContainers = _a[1];
|
|
84
|
+
var _a = __read(state.current, 2), element = _a[0], scrollContainers = _a[1];
|
|
85
85
|
if (!element)
|
|
86
86
|
return;
|
|
87
87
|
if (!observer && ResizeObserver) {
|
package/usePrevious.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useState } from "react";
|
|
2
3
|
export function usePrevious(state, defaulValue) {
|
|
3
|
-
var _a = useState([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
4
|
+
var _a = __read(useState([state, defaulValue]), 2), tuple = _a[0], setTuple = _a[1];
|
|
4
5
|
if (tuple[1] !== state) {
|
|
5
6
|
setTuple([tuple[1], state]);
|
|
6
7
|
}
|
package/useScrollThreshold.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useCallback, useEffect, useState } from "react";
|
|
2
3
|
import { noop } from "@koine/utils";
|
|
3
4
|
import { listenScroll } from "@koine/dom";
|
|
4
5
|
export var useScrollThreshold = function (threshold, callback) {
|
|
5
|
-
var _a = useState(false), isBelow = _a[0], setIsBelow = _a[1];
|
|
6
|
+
var _a = __read(useState(false), 2), isBelow = _a[0], setIsBelow = _a[1];
|
|
6
7
|
var handler = useCallback(function () {
|
|
7
8
|
if (threshold) {
|
|
8
9
|
var posY = window.scrollY;
|
package/useScrollTo.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { isBrowser } from "@koine/utils";
|
|
2
3
|
import useHeader from "./Header/useHeader.js";
|
|
3
4
|
export function useScrollTo(id, offset) {
|
|
4
5
|
if (id === void 0) { id = ""; }
|
|
5
6
|
if (offset === void 0) { offset = 0; }
|
|
6
|
-
var _a = useHeader(), headerHeight = _a[2];
|
|
7
|
+
var _a = __read(useHeader(), 3), headerHeight = _a[2];
|
|
7
8
|
if (!isBrowser) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
package/useSpinDelay.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
var State;
|
|
3
4
|
(function (State) {
|
|
@@ -9,7 +10,7 @@ var State;
|
|
|
9
10
|
export function useSpinDelay(loading, delay, minDuration) {
|
|
10
11
|
if (delay === void 0) { delay = 500; }
|
|
11
12
|
if (minDuration === void 0) { minDuration = 200; }
|
|
12
|
-
var _a = useState(State.IDLE), state = _a[0], setState = _a[1];
|
|
13
|
+
var _a = __read(useState(State.IDLE), 2), state = _a[0], setState = _a[1];
|
|
13
14
|
var timeout = useRef();
|
|
14
15
|
useEffect(function () {
|
|
15
16
|
if (loading && state === State.IDLE) {
|
package/useTraceUpdate.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useRef } from "react";
|
|
2
3
|
export function useTraceUpdate(props) {
|
|
3
4
|
var prev = useRef(props);
|
|
4
5
|
useEffect(function () {
|
|
5
6
|
var changedProps = Object.entries(props).reduce(function (ps, _a) {
|
|
6
|
-
var k =
|
|
7
|
+
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
7
8
|
if (prev.current[k] !== v) {
|
|
8
9
|
ps[k] = [prev.current[k], v];
|
|
9
10
|
}
|
package/useWindowSize.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useState } from "react";
|
|
2
3
|
import { listenResize, listenResizeDebounced } from "@koine/dom";
|
|
3
4
|
export function useWindowSize(wait, immediate) {
|
|
4
|
-
var _a = useState(0), width = _a[0], widthSet = _a[1];
|
|
5
|
-
var _b = useState(0), height = _b[0], heightSet = _b[1];
|
|
5
|
+
var _a = __read(useState(0), 2), width = _a[0], widthSet = _a[1];
|
|
6
|
+
var _b = __read(useState(0), 2), height = _b[0], heightSet = _b[1];
|
|
6
7
|
useEffect(function () {
|
|
7
8
|
function updateSize() {
|
|
8
9
|
widthSet(window.innerWidth);
|