primereact 8.0.0-rc.2 → 8.0.0
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 +5 -4
- package/button/button.min.css +1 -1
- package/calendar/calendar.d.ts +1 -1
- package/carousel/carousel.cjs.js +4 -4
- package/carousel/carousel.cjs.min.js +1 -1
- package/carousel/carousel.esm.js +4 -4
- package/carousel/carousel.esm.min.js +1 -1
- package/carousel/carousel.js +4 -4
- package/carousel/carousel.min.js +1 -1
- package/chips/chips.cjs.js +6 -2
- package/chips/chips.cjs.min.js +1 -1
- package/chips/chips.esm.js +6 -2
- package/chips/chips.esm.min.js +1 -1
- package/chips/chips.js +6 -2
- package/chips/chips.min.js +1 -1
- package/core/core.js +52 -0
- package/core/core.min.js +1 -1
- package/hooks/hooks.cjs.js +52 -0
- package/hooks/hooks.cjs.min.js +1 -1
- package/hooks/hooks.d.ts +7 -5
- package/hooks/hooks.esm.js +52 -1
- package/hooks/hooks.esm.min.js +1 -1
- package/hooks/hooks.js +52 -0
- package/hooks/hooks.min.js +1 -1
- package/inputmask/inputmask.cjs.js +0 -2
- package/inputmask/inputmask.cjs.min.js +1 -1
- package/inputmask/inputmask.d.ts +0 -1
- package/inputmask/inputmask.esm.js +0 -2
- package/inputmask/inputmask.esm.min.js +1 -1
- package/inputmask/inputmask.js +0 -2
- package/inputmask/inputmask.min.js +1 -1
- package/package.json +4 -4
- package/primereact.all.cjs.js +65 -11
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.js +65 -12
- package/primereact.all.esm.min.js +1 -1
- package/primereact.all.js +65 -11
- package/primereact.all.min.js +1 -1
- package/resources/primereact.css +0 -4
- package/resources/primereact.min.css +1 -1
- package/resources/themes/arya-blue/theme.css +10 -0
- package/resources/themes/arya-green/theme.css +10 -0
- package/resources/themes/arya-orange/theme.css +10 -0
- package/resources/themes/arya-purple/theme.css +10 -0
- package/resources/themes/bootstrap4-dark-blue/theme.css +10 -0
- package/resources/themes/bootstrap4-dark-purple/theme.css +10 -0
- package/resources/themes/bootstrap4-light-blue/theme.css +10 -0
- package/resources/themes/bootstrap4-light-purple/theme.css +10 -0
- package/resources/themes/fluent-light/theme.css +10 -0
- package/resources/themes/lara-dark-blue/theme.css +10 -0
- package/resources/themes/lara-dark-indigo/theme.css +10 -0
- package/resources/themes/lara-dark-purple/theme.css +10 -0
- package/resources/themes/lara-dark-teal/theme.css +10 -0
- package/resources/themes/lara-light-blue/theme.css +10 -0
- package/resources/themes/lara-light-indigo/theme.css +10 -0
- package/resources/themes/lara-light-purple/theme.css +10 -0
- package/resources/themes/lara-light-teal/theme.css +10 -0
- package/resources/themes/luna-amber/theme.css +10 -0
- package/resources/themes/luna-blue/theme.css +10 -0
- package/resources/themes/luna-green/theme.css +10 -0
- package/resources/themes/luna-pink/theme.css +10 -0
- package/resources/themes/md-dark-deeppurple/theme.css +10 -0
- package/resources/themes/md-dark-indigo/theme.css +10 -0
- package/resources/themes/md-light-deeppurple/theme.css +10 -0
- package/resources/themes/md-light-indigo/theme.css +10 -0
- package/resources/themes/mdc-dark-deeppurple/theme.css +10 -0
- package/resources/themes/mdc-dark-indigo/theme.css +10 -0
- package/resources/themes/mdc-light-deeppurple/theme.css +10 -0
- package/resources/themes/mdc-light-indigo/theme.css +10 -0
- package/resources/themes/nova/theme.css +10 -0
- package/resources/themes/nova-accent/theme.css +10 -0
- package/resources/themes/nova-alt/theme.css +10 -0
- package/resources/themes/rhea/theme.css +10 -0
- package/resources/themes/saga-blue/theme.css +10 -0
- package/resources/themes/saga-green/theme.css +10 -0
- package/resources/themes/saga-orange/theme.css +10 -0
- package/resources/themes/saga-purple/theme.css +10 -0
- package/resources/themes/tailwind-light/theme.css +10 -0
- package/resources/themes/vela-blue/theme.css +10 -0
- package/resources/themes/vela-green/theme.css +10 -0
- package/resources/themes/vela-orange/theme.css +10 -0
- package/resources/themes/vela-purple/theme.css +10 -0
- package/togglebutton/togglebutton.cjs.js +3 -3
- package/togglebutton/togglebutton.cjs.min.js +1 -1
- package/togglebutton/togglebutton.d.ts +0 -1
- package/togglebutton/togglebutton.esm.js +3 -3
- package/togglebutton/togglebutton.esm.min.js +1 -1
- package/togglebutton/togglebutton.js +3 -3
- package/togglebutton/togglebutton.min.js +1 -1
- package/treeselect/treeselect.d.ts +4 -5
- package/web-types.json +1 -7
package/primereact.all.js
CHANGED
|
@@ -3016,6 +3016,57 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
3016
3016
|
};
|
|
3017
3017
|
/* eslint-enable */
|
|
3018
3018
|
|
|
3019
|
+
/**
|
|
3020
|
+
* Hook to wrap around useState that stores the value in the browser local/session storage.
|
|
3021
|
+
*
|
|
3022
|
+
* @param {any} initialValue the initial value to store
|
|
3023
|
+
* @param {string} key the key to store the value in local/session storage
|
|
3024
|
+
* @param {string} storage either 'local' or 'session' for what type of storage
|
|
3025
|
+
* @returns a stateful value, and a function to update it.
|
|
3026
|
+
*/
|
|
3027
|
+
|
|
3028
|
+
var useStorage = function useStorage(initialValue, key) {
|
|
3029
|
+
var storage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'local';
|
|
3030
|
+
// Since the local storage API isn't available in server-rendering environments,
|
|
3031
|
+
// we check that typeof window !== 'undefined' to make SSR and SSG work properly.
|
|
3032
|
+
var storageAvailable = typeof window !== 'undefined';
|
|
3033
|
+
|
|
3034
|
+
var _React$useState = React__namespace.useState(function () {
|
|
3035
|
+
if (!storageAvailable) {
|
|
3036
|
+
return initialValue;
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
try {
|
|
3040
|
+
var item = storage === 'local' ? window.localStorage.getItem(key) : window.sessionStorage.getItem(key);
|
|
3041
|
+
return item ? JSON.parse(item) : initialValue;
|
|
3042
|
+
} catch (error) {
|
|
3043
|
+
// If error also return initialValue
|
|
3044
|
+
return initialValue;
|
|
3045
|
+
}
|
|
3046
|
+
}),
|
|
3047
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3048
|
+
storedValue = _React$useState2[0],
|
|
3049
|
+
setStoredValue = _React$useState2[1];
|
|
3050
|
+
|
|
3051
|
+
var setValue = function setValue(value) {
|
|
3052
|
+
try {
|
|
3053
|
+
// Allow value to be a function so we have same API as useState
|
|
3054
|
+
var valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
3055
|
+
setStoredValue(valueToStore);
|
|
3056
|
+
|
|
3057
|
+
if (storageAvailable) {
|
|
3058
|
+
var serializedValue = JSON.stringify(valueToStore);
|
|
3059
|
+
storage === 'local' ? window.localStorage.setItem(key, serializedValue) : window.sessionStorage.setItem(key, serializedValue);
|
|
3060
|
+
}
|
|
3061
|
+
} catch (error) {
|
|
3062
|
+
throw new Error("PrimeReact useStorage: Failed to serialize the value at key: ".concat(key));
|
|
3063
|
+
}
|
|
3064
|
+
};
|
|
3065
|
+
|
|
3066
|
+
return [storedValue, setValue];
|
|
3067
|
+
};
|
|
3068
|
+
/* eslint-enable */
|
|
3069
|
+
|
|
3019
3070
|
/* eslint-disable */
|
|
3020
3071
|
var useTimeout = function useTimeout(fn) {
|
|
3021
3072
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -9625,7 +9676,6 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
9625
9676
|
var itemsContainerRef = React__namespace.useRef(null);
|
|
9626
9677
|
var remainingItems = React__namespace.useRef(0);
|
|
9627
9678
|
var allowAutoplay = React__namespace.useRef(!!props.autoplayInterval);
|
|
9628
|
-
var circular = React__namespace.useRef(props.circular || !!props.autoplayInterval);
|
|
9629
9679
|
var attributeSelector = React__namespace.useRef('');
|
|
9630
9680
|
var swipeThreshold = React__namespace.useRef(20);
|
|
9631
9681
|
var startPos = React__namespace.useRef(null);
|
|
@@ -9638,6 +9688,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
9638
9688
|
var prevValue = usePrevious(props.value);
|
|
9639
9689
|
var prevPage = usePrevious(props.page);
|
|
9640
9690
|
var isVertical = props.orientation === 'vertical';
|
|
9691
|
+
var circular = props.circular || !!props.autoplayInterval;
|
|
9641
9692
|
var isCircular = circular && props.value.length >= numVisibleState;
|
|
9642
9693
|
var isAutoplay = props.autoplayInterval && allowAutoplay.current;
|
|
9643
9694
|
var currentPage = props.onPageChange ? props.page : pageState;
|
|
@@ -9680,7 +9731,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
9680
9731
|
page = 0;
|
|
9681
9732
|
} else if (isCircular && pageState === 0 && dir === 1) {
|
|
9682
9733
|
totalShiftedItems = 0;
|
|
9683
|
-
page =
|
|
9734
|
+
page = totalIndicators - 1;
|
|
9684
9735
|
} else if (page === totalIndicators - 1 && remainingItems.current > 0) {
|
|
9685
9736
|
totalShiftedItems += remainingItems.current * -1 - numScrollState * dir;
|
|
9686
9737
|
isRemainingItemsAdded.current = true;
|
|
@@ -9893,7 +9944,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
9893
9944
|
remainingItems.current = (props.value.length - numVisibleState) % numScrollState;
|
|
9894
9945
|
var page = currentPage;
|
|
9895
9946
|
|
|
9896
|
-
if (totalIndicators !== 0 &&
|
|
9947
|
+
if (totalIndicators !== 0 && page >= totalIndicators) {
|
|
9897
9948
|
page = totalIndicators - 1;
|
|
9898
9949
|
|
|
9899
9950
|
if (props.onPageChange) {
|
|
@@ -10106,7 +10157,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
10106
10157
|
|
|
10107
10158
|
var createIndicator = function createIndicator(index) {
|
|
10108
10159
|
var isActive = currentPage === index;
|
|
10109
|
-
var key = '
|
|
10160
|
+
var key = 'carousel-indicator-' + index;
|
|
10110
10161
|
var className = classNames('p-carousel-indicator', {
|
|
10111
10162
|
'p-highlight': isActive
|
|
10112
10163
|
});
|
|
@@ -11133,14 +11184,18 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
11133
11184
|
var values = props.value ? _toConsumableArray(props.value) : [];
|
|
11134
11185
|
|
|
11135
11186
|
if (props.allowDuplicate || values.indexOf(item) === -1) {
|
|
11136
|
-
|
|
11187
|
+
var allowAddition = true;
|
|
11137
11188
|
|
|
11138
11189
|
if (props.onAdd) {
|
|
11139
|
-
props.onAdd({
|
|
11190
|
+
allowAddition = props.onAdd({
|
|
11140
11191
|
originalEvent: event,
|
|
11141
11192
|
value: item
|
|
11142
11193
|
});
|
|
11143
11194
|
}
|
|
11195
|
+
|
|
11196
|
+
if (allowAddition !== false) {
|
|
11197
|
+
values.push(item);
|
|
11198
|
+
}
|
|
11144
11199
|
}
|
|
11145
11200
|
|
|
11146
11201
|
updateInput(event, values, preventDefault);
|
|
@@ -26189,7 +26244,6 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
26189
26244
|
onInput: onInput,
|
|
26190
26245
|
onPaste: handleInputChange,
|
|
26191
26246
|
required: props.required,
|
|
26192
|
-
"aria-labelledby": props.ariaLabelledBy,
|
|
26193
26247
|
tooltip: props.tooltip,
|
|
26194
26248
|
tooltipOptions: props.tooltipOptions
|
|
26195
26249
|
}));
|
|
@@ -26217,7 +26271,6 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
26217
26271
|
required: false,
|
|
26218
26272
|
tooltip: null,
|
|
26219
26273
|
tooltipOptions: null,
|
|
26220
|
-
ariaLabelledBy: null,
|
|
26221
26274
|
onComplete: null,
|
|
26222
26275
|
onChange: null,
|
|
26223
26276
|
onFocus: null,
|
|
@@ -36878,7 +36931,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
36878
36931
|
};
|
|
36879
36932
|
|
|
36880
36933
|
var onKeyDown = function onKeyDown(event) {
|
|
36881
|
-
if (event.
|
|
36934
|
+
if (event.keyCode === 32) {
|
|
36882
36935
|
toggle(event);
|
|
36883
36936
|
event.preventDefault();
|
|
36884
36937
|
}
|
|
@@ -36920,7 +36973,8 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
36920
36973
|
onBlur: props.onBlur,
|
|
36921
36974
|
onKeyDown: onKeyDown,
|
|
36922
36975
|
tabIndex: tabIndex,
|
|
36923
|
-
"
|
|
36976
|
+
role: "button",
|
|
36977
|
+
"aria-pressed": props.checked
|
|
36924
36978
|
}), iconElement, /*#__PURE__*/React__namespace.createElement("span", {
|
|
36925
36979
|
className: "p-button-label"
|
|
36926
36980
|
}, label), /*#__PURE__*/React__namespace.createElement(Ripple, null)), hasTooltip && /*#__PURE__*/React__namespace.createElement(Tooltip, _extends({
|
|
@@ -36943,7 +36997,6 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
36943
36997
|
tabIndex: 0,
|
|
36944
36998
|
tooltip: null,
|
|
36945
36999
|
tooltipOptions: null,
|
|
36946
|
-
ariaLabelledBy: null,
|
|
36947
37000
|
onChange: null,
|
|
36948
37001
|
onFocus: null,
|
|
36949
37002
|
onBlur: null
|
|
@@ -41647,6 +41700,7 @@ var primereact = (function (exports, React, reactTransitionGroup, ReactDOM) {
|
|
|
41647
41700
|
exports.useOverlayScrollListener = useOverlayScrollListener;
|
|
41648
41701
|
exports.usePrevious = usePrevious;
|
|
41649
41702
|
exports.useResizeListener = useResizeListener;
|
|
41703
|
+
exports.useStorage = useStorage;
|
|
41650
41704
|
exports.useTimeout = useTimeout;
|
|
41651
41705
|
exports.useUnmountEffect = useUnmountEffect;
|
|
41652
41706
|
exports.useUpdateEffect = useUpdateEffect;
|