@react-spectrum/s2 0.7.0 → 0.8.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/dist/ActionBar.cjs.map +1 -1
- package/dist/ActionBar.css.map +1 -1
- package/dist/ActionBar.mjs.map +1 -1
- package/dist/ActionButton.cjs +26 -7
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +74 -18
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +26 -7
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/Add.cjs.map +1 -1
- package/dist/Add.mjs.map +1 -1
- package/dist/Asterisk.cjs.map +1 -1
- package/dist/Asterisk.mjs.map +1 -1
- package/dist/Breadcrumbs.cjs.map +1 -1
- package/dist/Breadcrumbs.css.map +1 -1
- package/dist/Breadcrumbs.mjs.map +1 -1
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs.map +1 -1
- package/dist/ButtonGroup.cjs +3 -2
- package/dist/ButtonGroup.cjs.map +1 -1
- package/dist/ButtonGroup.css.map +1 -1
- package/dist/ButtonGroup.mjs +3 -2
- package/dist/ButtonGroup.mjs.map +1 -1
- package/dist/Card.cjs +1 -1
- package/dist/Card.cjs.map +1 -1
- package/dist/Card.css.map +1 -1
- package/dist/Card.mjs +1 -1
- package/dist/Card.mjs.map +1 -1
- package/dist/CenterBaseline.cjs.map +1 -1
- package/dist/CenterBaseline.css.map +1 -1
- package/dist/CenterBaseline.mjs.map +1 -1
- package/dist/Checkmark.cjs.map +1 -1
- package/dist/Checkmark.mjs.map +1 -1
- package/dist/Chevron.cjs.map +1 -1
- package/dist/Chevron.mjs.map +1 -1
- package/dist/ColorHandle.cjs.map +1 -1
- package/dist/ColorHandle.css.map +1 -1
- package/dist/ColorHandle.mjs.map +1 -1
- package/dist/ColorSwatchPicker.cjs +2 -2
- package/dist/ColorSwatchPicker.cjs.map +1 -1
- package/dist/ColorSwatchPicker.css.map +1 -1
- package/dist/ColorSwatchPicker.mjs +2 -2
- package/dist/ColorSwatchPicker.mjs.map +1 -1
- package/dist/ComboBox.cjs.map +1 -1
- package/dist/ComboBox.css.map +1 -1
- package/dist/ComboBox.mjs.map +1 -1
- package/dist/Content.cjs +6 -6
- package/dist/Content.cjs.map +1 -1
- package/dist/Content.mjs +6 -6
- package/dist/Content.mjs.map +1 -1
- package/dist/Cross.cjs.map +1 -1
- package/dist/Cross.mjs.map +1 -1
- package/dist/Dash.cjs.map +1 -1
- package/dist/Dash.mjs.map +1 -1
- package/dist/DialogContainer.cjs.map +1 -1
- package/dist/DialogContainer.mjs.map +1 -1
- package/dist/DialogTrigger.cjs.map +1 -1
- package/dist/DialogTrigger.mjs.map +1 -1
- package/dist/Disclosure.cjs +24 -21
- package/dist/Disclosure.cjs.map +1 -1
- package/dist/Disclosure.css +12 -20
- package/dist/Disclosure.css.map +1 -1
- package/dist/Disclosure.mjs +24 -21
- package/dist/Disclosure.mjs.map +1 -1
- package/dist/Divider.cjs +6 -0
- package/dist/Divider.cjs.map +1 -1
- package/dist/Divider.css +8 -0
- package/dist/Divider.css.map +1 -1
- package/dist/Divider.mjs +6 -0
- package/dist/Divider.mjs.map +1 -1
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs.map +1 -1
- package/dist/Image.cjs +1 -1
- package/dist/Image.cjs.map +1 -1
- package/dist/Image.css.map +1 -1
- package/dist/Image.mjs +1 -1
- package/dist/Image.mjs.map +1 -1
- package/dist/ImageCoordinator.cjs.map +1 -1
- package/dist/ImageCoordinator.mjs.map +1 -1
- package/dist/Link.cjs.map +1 -1
- package/dist/Link.css.map +1 -1
- package/dist/Link.mjs.map +1 -1
- package/dist/LinkOut.cjs.map +1 -1
- package/dist/LinkOut.mjs.map +1 -1
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs.map +1 -1
- package/dist/NotificationBadge.cjs +163 -0
- package/dist/NotificationBadge.cjs.map +1 -0
- package/dist/NotificationBadge.css +227 -0
- package/dist/NotificationBadge.css.map +1 -0
- package/dist/NotificationBadge.mjs +157 -0
- package/dist/NotificationBadge.mjs.map +1 -0
- package/dist/Picker.cjs.map +1 -1
- package/dist/Picker.css.map +1 -1
- package/dist/Picker.mjs.map +1 -1
- package/dist/Provider.cjs.map +1 -1
- package/dist/Provider.css.map +1 -1
- package/dist/Provider.mjs.map +1 -1
- package/dist/Slider.cjs.map +1 -1
- package/dist/Slider.css.map +1 -1
- package/dist/Slider.mjs.map +1 -1
- package/dist/StatusLight.cjs +2 -2
- package/dist/StatusLight.cjs.map +1 -1
- package/dist/StatusLight.css.map +1 -1
- package/dist/StatusLight.mjs +2 -2
- package/dist/StatusLight.mjs.map +1 -1
- package/dist/Tabs.cjs +1 -0
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +1 -0
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs.map +1 -1
- package/dist/TabsPicker.css.map +1 -1
- package/dist/TabsPicker.mjs.map +1 -1
- package/dist/Toast.cjs +557 -0
- package/dist/Toast.cjs.map +1 -0
- package/dist/Toast.css +461 -0
- package/dist/Toast.css.map +1 -0
- package/dist/Toast.mjs +551 -0
- package/dist/Toast.mjs.map +1 -0
- package/dist/Toast_module.cjs +70 -0
- package/dist/Toast_module.cjs.map +1 -0
- package/dist/Toast_module.css +119 -0
- package/dist/Toast_module.css.map +1 -0
- package/dist/Toast_module.mjs +72 -0
- package/dist/Toast_module.mjs.map +1 -0
- package/dist/ToggleButton.cjs.map +1 -1
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs.map +1 -1
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/TreeView.cjs.map +1 -1
- package/dist/TreeView.css.map +1 -1
- package/dist/TreeView.mjs.map +1 -1
- package/dist/ar-AE.cjs +6 -1
- package/dist/ar-AE.cjs.map +1 -1
- package/dist/ar-AE.mjs +6 -1
- package/dist/ar-AE.mjs.map +1 -1
- package/dist/bg-BG.cjs +6 -1
- package/dist/bg-BG.cjs.map +1 -1
- package/dist/bg-BG.mjs +6 -1
- package/dist/bg-BG.mjs.map +1 -1
- package/dist/cs-CZ.cjs +10 -2
- package/dist/cs-CZ.cjs.map +1 -1
- package/dist/cs-CZ.mjs +10 -2
- package/dist/cs-CZ.mjs.map +1 -1
- package/dist/da-DK.cjs +8 -3
- package/dist/da-DK.cjs.map +1 -1
- package/dist/da-DK.mjs +8 -3
- package/dist/da-DK.mjs.map +1 -1
- package/dist/de-DE.cjs +7 -3
- package/dist/de-DE.cjs.map +1 -1
- package/dist/de-DE.mjs +7 -3
- package/dist/de-DE.mjs.map +1 -1
- package/dist/el-GR.cjs +6 -1
- package/dist/el-GR.cjs.map +1 -1
- package/dist/el-GR.mjs +6 -1
- package/dist/el-GR.mjs.map +1 -1
- package/dist/en-US.cjs +6 -1
- package/dist/en-US.cjs.map +1 -1
- package/dist/en-US.mjs +6 -1
- package/dist/en-US.mjs.map +1 -1
- package/dist/es-ES.cjs +10 -6
- package/dist/es-ES.cjs.map +1 -1
- package/dist/es-ES.mjs +10 -6
- package/dist/es-ES.mjs.map +1 -1
- package/dist/et-EE.cjs +6 -1
- package/dist/et-EE.cjs.map +1 -1
- package/dist/et-EE.mjs +6 -1
- package/dist/et-EE.mjs.map +1 -1
- package/dist/fi-FI.cjs +7 -2
- package/dist/fi-FI.cjs.map +1 -1
- package/dist/fi-FI.mjs +7 -2
- package/dist/fi-FI.mjs.map +1 -1
- package/dist/fr-FR.cjs +7 -3
- package/dist/fr-FR.cjs.map +1 -1
- package/dist/fr-FR.mjs +7 -3
- package/dist/fr-FR.mjs.map +1 -1
- package/dist/he-IL.cjs +9 -5
- package/dist/he-IL.cjs.map +1 -1
- package/dist/he-IL.mjs +9 -5
- package/dist/he-IL.mjs.map +1 -1
- package/dist/hr-HR.cjs +11 -3
- package/dist/hr-HR.cjs.map +1 -1
- package/dist/hr-HR.mjs +11 -3
- package/dist/hr-HR.mjs.map +1 -1
- package/dist/hu-HU.cjs +6 -1
- package/dist/hu-HU.cjs.map +1 -1
- package/dist/hu-HU.mjs +6 -1
- package/dist/hu-HU.mjs.map +1 -1
- package/dist/it-IT.cjs +6 -2
- package/dist/it-IT.cjs.map +1 -1
- package/dist/it-IT.mjs +6 -2
- package/dist/it-IT.mjs.map +1 -1
- package/dist/ja-JP.cjs +7 -2
- package/dist/ja-JP.cjs.map +1 -1
- package/dist/ja-JP.mjs +7 -2
- package/dist/ja-JP.mjs.map +1 -1
- package/dist/ko-KR.cjs +8 -3
- package/dist/ko-KR.cjs.map +1 -1
- package/dist/ko-KR.mjs +8 -3
- package/dist/ko-KR.mjs.map +1 -1
- package/dist/lt-LT.cjs +8 -3
- package/dist/lt-LT.cjs.map +1 -1
- package/dist/lt-LT.mjs +8 -3
- package/dist/lt-LT.mjs.map +1 -1
- package/dist/lv-LV.cjs +9 -4
- package/dist/lv-LV.cjs.map +1 -1
- package/dist/lv-LV.mjs +9 -4
- package/dist/lv-LV.mjs.map +1 -1
- package/dist/main.cjs +9 -0
- package/dist/main.cjs.map +1 -1
- package/dist/module.mjs +6 -2
- package/dist/module.mjs.map +1 -1
- package/dist/nb-NO.cjs +12 -4
- package/dist/nb-NO.cjs.map +1 -1
- package/dist/nb-NO.mjs +12 -4
- package/dist/nb-NO.mjs.map +1 -1
- package/dist/nl-NL.cjs +6 -1
- package/dist/nl-NL.cjs.map +1 -1
- package/dist/nl-NL.mjs +6 -1
- package/dist/nl-NL.mjs.map +1 -1
- package/dist/pl-PL.cjs +11 -3
- package/dist/pl-PL.cjs.map +1 -1
- package/dist/pl-PL.mjs +11 -3
- package/dist/pl-PL.mjs.map +1 -1
- package/dist/pressScale.cjs.map +1 -1
- package/dist/pressScale.mjs.map +1 -1
- package/dist/pt-BR.cjs +6 -1
- package/dist/pt-BR.cjs.map +1 -1
- package/dist/pt-BR.mjs +6 -1
- package/dist/pt-BR.mjs.map +1 -1
- package/dist/pt-PT.cjs +6 -1
- package/dist/pt-PT.cjs.map +1 -1
- package/dist/pt-PT.mjs +6 -1
- package/dist/pt-PT.mjs.map +1 -1
- package/dist/ro-RO.cjs +8 -4
- package/dist/ro-RO.cjs.map +1 -1
- package/dist/ro-RO.mjs +8 -4
- package/dist/ro-RO.mjs.map +1 -1
- package/dist/ru-RU.cjs +11 -3
- package/dist/ru-RU.cjs.map +1 -1
- package/dist/ru-RU.mjs +11 -3
- package/dist/ru-RU.mjs.map +1 -1
- package/dist/sk-SK.cjs +10 -2
- package/dist/sk-SK.cjs.map +1 -1
- package/dist/sk-SK.mjs +10 -2
- package/dist/sk-SK.mjs.map +1 -1
- package/dist/sl-SI.cjs +11 -3
- package/dist/sl-SI.cjs.map +1 -1
- package/dist/sl-SI.mjs +11 -3
- package/dist/sl-SI.mjs.map +1 -1
- package/dist/sr-SP.cjs +10 -2
- package/dist/sr-SP.cjs.map +1 -1
- package/dist/sr-SP.mjs +10 -2
- package/dist/sr-SP.mjs.map +1 -1
- package/dist/sv-SE.cjs +6 -2
- package/dist/sv-SE.cjs.map +1 -1
- package/dist/sv-SE.mjs +6 -2
- package/dist/sv-SE.mjs.map +1 -1
- package/dist/tr-TR.cjs +7 -2
- package/dist/tr-TR.cjs.map +1 -1
- package/dist/tr-TR.mjs +7 -2
- package/dist/tr-TR.mjs.map +1 -1
- package/dist/types.d.ts +97 -29
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.cjs +10 -2
- package/dist/uk-UA.cjs.map +1 -1
- package/dist/uk-UA.mjs +10 -2
- package/dist/uk-UA.mjs.map +1 -1
- package/dist/zh-CN.cjs +6 -1
- package/dist/zh-CN.cjs.map +1 -1
- package/dist/zh-CN.mjs +6 -1
- package/dist/zh-CN.mjs.map +1 -1
- package/dist/zh-TW.cjs +6 -1
- package/dist/zh-TW.cjs.map +1 -1
- package/dist/zh-TW.mjs +6 -1
- package/dist/zh-TW.mjs.map +1 -1
- package/icons/Skeleton.cjs.map +1 -1
- package/icons/Skeleton.css.map +1 -1
- package/icons/Skeleton.mjs.map +1 -1
- package/package.json +21 -19
- package/src/ActionBar.tsx +9 -2
- package/src/ActionButton.tsx +38 -3
- package/src/Breadcrumbs.tsx +1 -1
- package/src/Button.tsx +2 -2
- package/src/ButtonGroup.tsx +4 -2
- package/src/Calendar.tsx +2 -1
- package/src/Card.tsx +1 -1
- package/src/CenterBaseline.tsx +1 -1
- package/src/ColorHandle.tsx +2 -2
- package/src/ColorSwatchPicker.tsx +2 -1
- package/src/ComboBox.tsx +2 -2
- package/src/Content.tsx +6 -6
- package/src/DateField.tsx +1 -1
- package/src/DatePicker.tsx +1 -1
- package/src/DateRangePicker.tsx +1 -1
- package/src/DialogContainer.tsx +2 -2
- package/src/DialogTrigger.tsx +2 -1
- package/src/Disclosure.tsx +18 -24
- package/src/Divider.tsx +2 -0
- package/src/Field.tsx +2 -2
- package/src/Image.tsx +1 -1
- package/src/ImageCoordinator.tsx +3 -3
- package/src/Link.tsx +1 -1
- package/src/ListBox.tsx +3 -2
- package/src/Menu.tsx +5 -5
- package/src/NotificationBadge.tsx +172 -0
- package/src/Picker.tsx +2 -2
- package/src/Provider.tsx +1 -1
- package/src/RangeCalendar.tsx +2 -1
- package/src/Skeleton.tsx +4 -4
- package/src/Slider.tsx +1 -1
- package/src/StatusLight.tsx +2 -2
- package/src/Tabs.tsx +4 -3
- package/src/TabsPicker.tsx +1 -1
- package/src/TimeField.tsx +1 -1
- package/src/Toast.module.css +153 -0
- package/src/Toast.tsx +579 -0
- package/src/ToggleButton.tsx +1 -1
- package/src/Toolbar.tsx +2 -1
- package/src/Tooltip.tsx +2 -2
- package/src/TreeView.tsx +2 -2
- package/src/index.ts +6 -1
- package/src/page.macro.ts +3 -3
- package/src/pressScale.ts +1 -1
- package/src/style-utils.ts +2 -2
- package/style/dist/main.cjs +18 -18
- package/style/dist/module.mjs +9 -9
- package/style/dist/spectrum-theme.cjs +191 -191
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +183 -183
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/style-macro.cjs +74 -74
- package/style/dist/style-macro.cjs.map +1 -1
- package/style/dist/style-macro.mjs +68 -68
- package/style/dist/style-macro.mjs.map +1 -1
- package/style/dist/types.d.ts +4 -4
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +5 -5
- package/style/style-macro.ts +3 -3
- package/style/tokens.ts +22 -6
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
require("./NotificationBadge.css");
|
|
2
|
+
var $4526404114e78c80$exports = require("./intlStrings.cjs");
|
|
3
|
+
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
|
|
4
|
+
var $62rny$reactjsxruntime = require("react/jsx-runtime");
|
|
5
|
+
var $62rny$reactariautils = require("@react-aria/utils");
|
|
6
|
+
var $62rny$internationalizednumber = require("@internationalized/number");
|
|
7
|
+
var $62rny$react = require("react");
|
|
8
|
+
var $62rny$reactspectrumutils = require("@react-spectrum/utils");
|
|
9
|
+
var $62rny$reactariai18n = require("@react-aria/i18n");
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function $parcel$export(e, n, v, s) {
|
|
17
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
$parcel$export(module.exports, "NotificationBadgeContext", () => $cd7301fb33ba8690$export$9ab75c96ebaa396c);
|
|
21
|
+
$parcel$export(module.exports, "NotificationBadge", () => $cd7301fb33ba8690$export$529cab0ca6be204e);
|
|
22
|
+
/*
|
|
23
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
24
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
+
*
|
|
28
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
+
* governing permissions and limitations under the License.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const $cd7301fb33ba8690$export$9ab75c96ebaa396c = /*#__PURE__*/ (0, $62rny$react.createContext)(null);
|
|
41
|
+
const $cd7301fb33ba8690$var$badge = function anonymous(props, overrides) {
|
|
42
|
+
let rules = " .";
|
|
43
|
+
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r)[^\s]+/g) || [];
|
|
44
|
+
rules += matches.join('');
|
|
45
|
+
let $l = false;
|
|
46
|
+
for (let p of matches)if (/^\s*l/.test(p)) $l = true;
|
|
47
|
+
if (props.isDisabled) rules += ' _0j';
|
|
48
|
+
else rules += ' _0d';
|
|
49
|
+
rules += ' _d-bc1l9oh';
|
|
50
|
+
rules += ' _d-1uotwbwg';
|
|
51
|
+
rules += ' _d-eo0c6sf';
|
|
52
|
+
rules += ' _d-enzzrge';
|
|
53
|
+
rules += ' _d-enzykdd';
|
|
54
|
+
rules += ' _d-enzwzjc';
|
|
55
|
+
rules += ' _d-enzrfpb';
|
|
56
|
+
rules += ' _da';
|
|
57
|
+
if (props.size === "XL") {
|
|
58
|
+
rules += ' _ebf';
|
|
59
|
+
rules += ' _ee';
|
|
60
|
+
} else if (props.size === "L") {
|
|
61
|
+
rules += ' _ebd';
|
|
62
|
+
rules += ' _ec';
|
|
63
|
+
} else if (props.size === "M") {
|
|
64
|
+
rules += ' _ebb';
|
|
65
|
+
rules += ' _ea';
|
|
66
|
+
} else if (props.size === "S") {
|
|
67
|
+
rules += ' _ebb';
|
|
68
|
+
rules += ' _ea';
|
|
69
|
+
}
|
|
70
|
+
rules += ' _fb';
|
|
71
|
+
rules += ' _g-1x99dlob';
|
|
72
|
+
rules += ' _ga';
|
|
73
|
+
rules += ' aa_____K';
|
|
74
|
+
if (props.isStaticColor) rules += ' a_____R';
|
|
75
|
+
else rules += ' ac';
|
|
76
|
+
rules += ' waa';
|
|
77
|
+
rules += ' ua-375yri';
|
|
78
|
+
rules += ' va-375yri';
|
|
79
|
+
rules += ' sa-375yri';
|
|
80
|
+
rules += ' ta-375yri';
|
|
81
|
+
rules += ' ca_____I';
|
|
82
|
+
rules += ' _3d';
|
|
83
|
+
rules += ' _2c';
|
|
84
|
+
rules += ' b-375toh';
|
|
85
|
+
rules += ' k-375toq';
|
|
86
|
+
if (props.isSingleDigit) rules += ' _cb';
|
|
87
|
+
else if (props.isIndicatorOnly) rules += ' _cb';
|
|
88
|
+
if (!$l) rules += ' ld';
|
|
89
|
+
if (props.isDoubleDigit) rules += ' CI';
|
|
90
|
+
if (props.isDoubleDigit) rules += ' DI';
|
|
91
|
+
rules += ' _wg';
|
|
92
|
+
rules += ' _xg';
|
|
93
|
+
rules += ' _yg';
|
|
94
|
+
rules += ' _zg';
|
|
95
|
+
rules += ' -_375toh_b-a_____J';
|
|
96
|
+
if (props.isStaticColor) rules += ' -_375toh_b-_____G';
|
|
97
|
+
else {
|
|
98
|
+
if (props.isPressed) rules += ' -_375toh_b-_____S';
|
|
99
|
+
else if (props.isFocusVisible) rules += ' -_375toh_b-_____S';
|
|
100
|
+
else if (props.isHovered) rules += ' -_375toh_b-_____S';
|
|
101
|
+
else rules += ' -_375toh_b-_____R';
|
|
102
|
+
}
|
|
103
|
+
if (props.size === "XL") {
|
|
104
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
105
|
+
else rules += ' -_375toq_k-G';
|
|
106
|
+
} else if (props.size === "L") {
|
|
107
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
108
|
+
else rules += ' -_375toq_k-E';
|
|
109
|
+
} else if (props.size === "M") {
|
|
110
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k-w';
|
|
111
|
+
else rules += ' -_375toq_k--8p5mjn';
|
|
112
|
+
} else if (props.size === "S") {
|
|
113
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k-w';
|
|
114
|
+
else rules += ' -_375toq_k-A';
|
|
115
|
+
}
|
|
116
|
+
return rules;
|
|
117
|
+
};
|
|
118
|
+
const $cd7301fb33ba8690$export$529cab0ca6be204e = /*#__PURE__*/ (0, $62rny$react.forwardRef)(function Badge(props, ref) {
|
|
119
|
+
let stringFormatter = (0, $62rny$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
|
|
120
|
+
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $cd7301fb33ba8690$export$9ab75c96ebaa396c);
|
|
121
|
+
let { size: size = 'S', value: value, isDisabled: isDisabled = false, staticColor: staticColor, ...otherProps } = props;
|
|
122
|
+
let domRef = (0, $62rny$reactspectrumutils.useDOMRef)(ref);
|
|
123
|
+
let { locale: locale } = (0, $62rny$reactariai18n.useLocale)();
|
|
124
|
+
let formattedValue = '';
|
|
125
|
+
let isIndicatorOnly = false;
|
|
126
|
+
let isSingleDigit = false;
|
|
127
|
+
let isDoubleDigit = false;
|
|
128
|
+
if (value == null) isIndicatorOnly = true;
|
|
129
|
+
else if (value <= 0) throw new Error('Value cannot be negative or zero');
|
|
130
|
+
else if (!Number.isInteger(value)) throw new Error('Value must be a positive integer');
|
|
131
|
+
else {
|
|
132
|
+
formattedValue = new (0, $62rny$internationalizednumber.NumberFormatter)(locale).format(Math.min(value, 99));
|
|
133
|
+
let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)
|
|
134
|
+
if (length === 1) isSingleDigit = true;
|
|
135
|
+
else if (length === 2) isDoubleDigit = true;
|
|
136
|
+
if (value > 99) formattedValue = stringFormatter.format('notificationbadge.plus', {
|
|
137
|
+
notifications: formattedValue
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
let ariaLabel = props['aria-label'] || undefined;
|
|
141
|
+
if (ariaLabel === undefined && isIndicatorOnly) ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');
|
|
142
|
+
return /*#__PURE__*/ (0, $62rny$reactjsxruntime.jsx)("span", {
|
|
143
|
+
...(0, $62rny$reactariautils.filterDOMProps)(otherProps, {
|
|
144
|
+
labelable: true
|
|
145
|
+
}),
|
|
146
|
+
role: ariaLabel && 'img',
|
|
147
|
+
"aria-label": ariaLabel,
|
|
148
|
+
className: (props.UNSAFE_className || '') + $cd7301fb33ba8690$var$badge({
|
|
149
|
+
size: size,
|
|
150
|
+
isIndicatorOnly: isIndicatorOnly,
|
|
151
|
+
isSingleDigit: isSingleDigit,
|
|
152
|
+
isDoubleDigit: isDoubleDigit,
|
|
153
|
+
isDisabled: isDisabled,
|
|
154
|
+
isStaticColor: !!staticColor
|
|
155
|
+
}, props.styles),
|
|
156
|
+
style: props.UNSAFE_style,
|
|
157
|
+
ref: domRef,
|
|
158
|
+
children: formattedValue
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=NotificationBadge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoCM,MAAM,0DAA2B,CAAA,GAAA,0BAAY,EAAqF;AAEzI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEC,MAAM,0DAAoB,CAAA,GAAA,uBAAS,EAAE,SAAS,MAAM,KAA6B,EAAE,GAA2B;IACnH,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,YACP,KAAK,cACL,aAAa,oBACb,WAAW,EACX,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,iBAAiB;IAErB,IAAI,kBAAkB;IACtB,IAAI,gBAAgB;IACpB,IAAI,gBAAgB;IAEpB,IAAI,SAAS,MACX,kBAAkB;SACb,IAAI,SAAS,GAClB,MAAM,IAAI,MAAM;SACX,IAAI,CAAC,OAAO,SAAS,CAAC,QAC3B,MAAM,IAAI,MAAM;SACX;QACL,iBAAiB,IAAI,CAAA,GAAA,8CAAc,EAAE,QAAQ,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO;QACpE,IAAI,SAAS,KAAK,GAAG,CAAC,SAAS,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG,IAAI,GAAI,4GAA4G;QACpL,IAAI,WAAW,GACb,gBAAgB;aACX,IAAI,WAAW,GACpB,gBAAgB;QAGlB,IAAI,QAAQ,IACV,iBAAiB,gBAAgB,MAAM,CAAC,0BAA0B;YAAC,eAAe;QAAc;IAEpG;IAEA,IAAI,YAAY,KAAK,CAAC,aAAa,IAAI;IACvC,IAAI,cAAc,aAAa,iBAC7B,YAAY,gBAAgB,MAAM,CAAC;IAGrC,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,YAAY;YAAC,WAAW;QAAI,EAAE;QACjD,MAAM,aAAa;QACnB,cAAY;QACZ,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,4BAAM;kBAAC;6BAAM;2BAAiB;2BAAe;wBAAe;YAAY,eAAe,CAAC,CAAC;QAAW,GAAG,MAAM,MAAM;QAC/J,OAAO,MAAM,YAAY;QACzB,KAAK;kBACJ;;AAGP","sources":["packages/@react-spectrum/s2/src/NotificationBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFormatter} from '@internationalized/number';\nimport React, {createContext, forwardRef} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface NotificationBadgeStyleProps {\n /**\n * The size of the notification badge.\n *\n * @default 'S'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport interface NotificationBadgeProps extends DOMProps, AriaLabelingProps, StyleProps, NotificationBadgeStyleProps, SlotProps {\n /**\n * The value to be displayed in the notification badge.\n */\n value?: number | null\n}\n\ninterface NotificationBadgeContextProps extends Partial<NotificationBadgeProps> {\n isDisabled?: boolean,\n staticColor?: 'black' | 'white' | 'auto'\n}\n\nexport const NotificationBadgeContext = createContext<ContextValue<Partial<NotificationBadgeContextProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst badge = style({\n display: {\n default: 'flex',\n isDisabled: 'none'\n },\n font: 'control',\n color: {\n default: 'white',\n isStaticColor: 'auto',\n forcedColors: 'ButtonText'\n },\n fontSize: {\n size: {\n S: 'ui-xs',\n M: 'ui-xs',\n L: 'ui-sm',\n XL: 'ui'\n }\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderWidth: {\n forcedColors: '[1px]'\n },\n borderColor: {\n forcedColors: 'ButtonBorder'\n },\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'ButtonFace'\n },\n height: {\n size: {\n S: {\n default: 12,\n isIndicatorOnly: 8\n },\n M: {\n default: fontRelative(18), // sort of arbitrary? tried to get as close to the figma designs as possible\n isIndicatorOnly: 8\n },\n L: {\n default: 16,\n isIndicatorOnly: fontRelative(12)\n },\n XL: {\n default: 18,\n isIndicatorOnly: fontRelative(12)\n }\n }\n },\n aspectRatio: {\n isIndicatorOnly: 'square',\n isSingleDigit: 'square'\n },\n width: 'max',\n paddingX: {\n isDoubleDigit: 'edge-to-text'\n },\n borderRadius: 'pill'\n}, getAllowedOverrides());\n\n/**\n * Notification badges are used to indicate new or pending activity .\n */\nexport const NotificationBadge = forwardRef(function Badge(props: NotificationBadgeProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, NotificationBadgeContext);\n let {\n size = 'S',\n value,\n isDisabled = false,\n staticColor,\n ...otherProps\n } = props as NotificationBadgeContextProps;\n let domRef = useDOMRef(ref);\n let {locale} = useLocale();\n let formattedValue = '';\n\n let isIndicatorOnly = false;\n let isSingleDigit = false;\n let isDoubleDigit = false;\n\n if (value == null) {\n isIndicatorOnly = true;\n } else if (value <= 0) {\n throw new Error('Value cannot be negative or zero');\n } else if (!Number.isInteger(value)) {\n throw new Error('Value must be a positive integer');\n } else {\n formattedValue = new NumberFormatter(locale).format(Math.min(value, 99));\n let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)\n if (length === 1) {\n isSingleDigit = true;\n } else if (length === 2) {\n isDoubleDigit = true;\n }\n\n if (value > 99) {\n formattedValue = stringFormatter.format('notificationbadge.plus', {notifications: formattedValue});\n }\n }\n\n let ariaLabel = props['aria-label'] || undefined;\n if (ariaLabel === undefined && isIndicatorOnly) {\n ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');\n }\n\n return (\n <span\n {...filterDOMProps(otherProps, {labelable: true})}\n role={ariaLabel && 'img'}\n aria-label={ariaLabel}\n className={(props.UNSAFE_className || '') + badge({size, isIndicatorOnly, isSingleDigit, isDoubleDigit, isDisabled, isStaticColor: !!staticColor}, props.styles)}\n style={props.UNSAFE_style}\n ref={domRef}>\n {formattedValue}\n </span>\n );\n});\n"],"names":[],"version":3,"file":"NotificationBadge.cjs.map"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
@layer _.a {
|
|
2
|
+
._0d {
|
|
3
|
+
display: flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
._0j {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
._da {
|
|
11
|
+
font-family: adobe-clean-variable, adobe-clean, ui-sans-serif, system-ui, sans-serif;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
._ea {
|
|
15
|
+
font-size: .6875rem;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
._ec {
|
|
19
|
+
font-size: .75rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
._ee {
|
|
23
|
+
font-size: .875rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
._fb {
|
|
27
|
+
font-variation-settings: "wght" 400;
|
|
28
|
+
font-synthesis-weight: none;
|
|
29
|
+
font-weight: 400;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
._ga {
|
|
33
|
+
line-height: 1.3;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ac {
|
|
37
|
+
color: #fff;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.a_____R {
|
|
41
|
+
color: lch(from var(--b, var(--s2-container-bg)) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
._3d {
|
|
45
|
+
justify-content: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
._2c {
|
|
49
|
+
align-items: center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.b-375toh {
|
|
53
|
+
background-color: var(--b);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.k-375toq {
|
|
57
|
+
height: var(--k);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
._cb {
|
|
61
|
+
aspect-ratio: 1;
|
|
62
|
+
aspect-ratio: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ld {
|
|
66
|
+
width: max-content;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.CI {
|
|
70
|
+
padding-inline-start: calc(var(--k, var(--o)) * 3 / 8);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.DI {
|
|
74
|
+
padding-inline-end: calc(var(--k, var(--o)) * 3 / 8);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
._wg {
|
|
78
|
+
border-start-start-radius: calc(var(--k, var(--o, 9999px)) / 2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
._xg {
|
|
82
|
+
border-start-end-radius: calc(var(--k, var(--o, 9999px)) / 2);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
._yg {
|
|
86
|
+
border-end-start-radius: calc(var(--k, var(--o, 9999px)) / 2);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
._zg {
|
|
90
|
+
border-end-end-radius: calc(var(--k, var(--o, 9999px)) / 2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.-_375toh_b-_____R {
|
|
94
|
+
--b: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #4069fd);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.-_375toh_b-_____S {
|
|
98
|
+
--b: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.-_375toh_b-_____G {
|
|
102
|
+
--b: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.-_375toq_k-A {
|
|
106
|
+
--k: calc(.75rem * var(--s2-scale));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.-_375toq_k--8p5mjn {
|
|
110
|
+
--k: 1.28571em;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.-_375toq_k-w {
|
|
114
|
+
--k: calc(.5rem * var(--s2-scale));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.-_375toq_k-E {
|
|
118
|
+
--k: calc(1rem * var(--s2-scale));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.-_375toq_k-G {
|
|
122
|
+
--k: calc(1.125rem * var(--s2-scale));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.-_375toq_k--1916w3k {
|
|
126
|
+
--k: .857143em;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@layer _.b {
|
|
131
|
+
._d-enzrfpb:lang(ar) {
|
|
132
|
+
font-family: myriad-arabic, ui-sans-serif, system-ui, sans-serif;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
._g-1x99dlob:is(:lang(ja), :lang(ko), :lang(zh), :lang(zh-Hant), :lang(zh-Hans)) {
|
|
136
|
+
line-height: 1.5;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@layer _.c {
|
|
141
|
+
._d-enzwzjc:lang(he) {
|
|
142
|
+
font-family: myriad-hebrew, ui-sans-serif, system-ui, sans-serif;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@layer _.d {
|
|
147
|
+
._d-enzykdd:lang(ja) {
|
|
148
|
+
font-family: adobe-clean-han-japanese, Hiragino Kaku Gothic ProN, ヒラギノ角ゴ ProN W3, Osaka, YuGothic, Yu Gothic, メイリオ, Meiryo, MS Pゴシック, MS PGothic, sans-serif;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@layer _.e {
|
|
153
|
+
._d-enzzrge:lang(ko) {
|
|
154
|
+
font-family: adobe-clean-han-korean, source-han-korean, Malgun Gothic, Apple Gothic, sans-serif;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@layer _.f {
|
|
159
|
+
._d-eo0c6sf:lang(zh) {
|
|
160
|
+
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Heiti TC Light, sans-serif;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@layer _.g {
|
|
165
|
+
._d-1uotwbwg:lang(zh-hant) {
|
|
166
|
+
font-family: adobe-clean-han-traditional, source-han-traditional, MingLiu, Microsoft JhengHei UI, Microsoft JhengHei, Heiti TC Light, sans-serif;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@layer _.h {
|
|
171
|
+
._d-bc1l9oh:is(:lang(zh-Hans), :lang(zh-CN), :lang(zh-SG)) {
|
|
172
|
+
font-family: adobe-clean-han-simplified-c, source-han-simplified-c, SimSun, Heiti SC Light, sans-serif;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@layer _.b.b {
|
|
177
|
+
@media not ((hover: hover) and (pointer: fine)) {
|
|
178
|
+
._ebb {
|
|
179
|
+
font-size: .8125rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
._ebd {
|
|
183
|
+
font-size: .9375rem;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
._ebf {
|
|
187
|
+
font-size: 1.0625rem;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@layer _.b.a {
|
|
193
|
+
@media (forced-colors: active) {
|
|
194
|
+
.aa_____K {
|
|
195
|
+
color: buttontext;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.waa {
|
|
199
|
+
border-style: solid;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.ua-375yri {
|
|
203
|
+
border-top-width: 1px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.va-375yri {
|
|
207
|
+
border-bottom-width: 1px;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.sa-375yri {
|
|
211
|
+
border-inline-start-width: 1px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.ta-375yri {
|
|
215
|
+
border-inline-end-width: 1px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.ca_____I {
|
|
219
|
+
border-color: buttonborder;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.-_375toh_b-a_____J {
|
|
223
|
+
--b: ButtonFace;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/*# sourceMappingURL=NotificationBadge.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgDc;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA","sources":["packages/@react-spectrum/s2/src/NotificationBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFormatter} from '@internationalized/number';\nimport React, {createContext, forwardRef} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface NotificationBadgeStyleProps {\n /**\n * The size of the notification badge.\n *\n * @default 'S'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport interface NotificationBadgeProps extends DOMProps, AriaLabelingProps, StyleProps, NotificationBadgeStyleProps, SlotProps {\n /**\n * The value to be displayed in the notification badge.\n */\n value?: number | null\n}\n\ninterface NotificationBadgeContextProps extends Partial<NotificationBadgeProps> {\n isDisabled?: boolean,\n staticColor?: 'black' | 'white' | 'auto'\n}\n\nexport const NotificationBadgeContext = createContext<ContextValue<Partial<NotificationBadgeContextProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst badge = style({\n display: {\n default: 'flex',\n isDisabled: 'none'\n },\n font: 'control',\n color: {\n default: 'white',\n isStaticColor: 'auto',\n forcedColors: 'ButtonText'\n },\n fontSize: {\n size: {\n S: 'ui-xs',\n M: 'ui-xs',\n L: 'ui-sm',\n XL: 'ui'\n }\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderWidth: {\n forcedColors: '[1px]'\n },\n borderColor: {\n forcedColors: 'ButtonBorder'\n },\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'ButtonFace'\n },\n height: {\n size: {\n S: {\n default: 12,\n isIndicatorOnly: 8\n },\n M: {\n default: fontRelative(18), // sort of arbitrary? tried to get as close to the figma designs as possible\n isIndicatorOnly: 8\n },\n L: {\n default: 16,\n isIndicatorOnly: fontRelative(12)\n },\n XL: {\n default: 18,\n isIndicatorOnly: fontRelative(12)\n }\n }\n },\n aspectRatio: {\n isIndicatorOnly: 'square',\n isSingleDigit: 'square'\n },\n width: 'max',\n paddingX: {\n isDoubleDigit: 'edge-to-text'\n },\n borderRadius: 'pill'\n}, getAllowedOverrides());\n\n/**\n * Notification badges are used to indicate new or pending activity .\n */\nexport const NotificationBadge = forwardRef(function Badge(props: NotificationBadgeProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, NotificationBadgeContext);\n let {\n size = 'S',\n value,\n isDisabled = false,\n staticColor,\n ...otherProps\n } = props as NotificationBadgeContextProps;\n let domRef = useDOMRef(ref);\n let {locale} = useLocale();\n let formattedValue = '';\n\n let isIndicatorOnly = false;\n let isSingleDigit = false;\n let isDoubleDigit = false;\n\n if (value == null) {\n isIndicatorOnly = true;\n } else if (value <= 0) {\n throw new Error('Value cannot be negative or zero');\n } else if (!Number.isInteger(value)) {\n throw new Error('Value must be a positive integer');\n } else {\n formattedValue = new NumberFormatter(locale).format(Math.min(value, 99));\n let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)\n if (length === 1) {\n isSingleDigit = true;\n } else if (length === 2) {\n isDoubleDigit = true;\n }\n\n if (value > 99) {\n formattedValue = stringFormatter.format('notificationbadge.plus', {notifications: formattedValue});\n }\n }\n\n let ariaLabel = props['aria-label'] || undefined;\n if (ariaLabel === undefined && isIndicatorOnly) {\n ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');\n }\n\n return (\n <span\n {...filterDOMProps(otherProps, {labelable: true})}\n role={ariaLabel && 'img'}\n aria-label={ariaLabel}\n className={(props.UNSAFE_className || '') + badge({size, isIndicatorOnly, isSingleDigit, isDoubleDigit, isDisabled, isStaticColor: !!staticColor}, props.styles)}\n style={props.UNSAFE_style}\n ref={domRef}>\n {formattedValue}\n </span>\n );\n});\n"],"names":[],"version":3,"file":"NotificationBadge.css.map"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import "./NotificationBadge.css";
|
|
2
|
+
import $bfWIi$intlStringsmjs from "./intlStrings.mjs";
|
|
3
|
+
import {useSpectrumContextProps as $5ce63c423902f47d$export$764f6146fadd77f7} from "../icons/useSpectrumContextProps.mjs";
|
|
4
|
+
import {jsx as $bfWIi$jsx} from "react/jsx-runtime";
|
|
5
|
+
import {filterDOMProps as $bfWIi$filterDOMProps} from "@react-aria/utils";
|
|
6
|
+
import {NumberFormatter as $bfWIi$NumberFormatter} from "@internationalized/number";
|
|
7
|
+
import {createContext as $bfWIi$createContext, forwardRef as $bfWIi$forwardRef} from "react";
|
|
8
|
+
import {useDOMRef as $bfWIi$useDOMRef} from "@react-spectrum/utils";
|
|
9
|
+
import {useLocalizedStringFormatter as $bfWIi$useLocalizedStringFormatter, useLocale as $bfWIi$useLocale} from "@react-aria/i18n";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $parcel$interopDefault(a) {
|
|
13
|
+
return a && a.__esModule ? a.default : a;
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const $bfb270fb056fefc5$export$9ab75c96ebaa396c = /*#__PURE__*/ (0, $bfWIi$createContext)(null);
|
|
34
|
+
const $bfb270fb056fefc5$var$badge = function anonymous(props, overrides) {
|
|
35
|
+
let rules = " .";
|
|
36
|
+
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r)[^\s]+/g) || [];
|
|
37
|
+
rules += matches.join('');
|
|
38
|
+
let $l = false;
|
|
39
|
+
for (let p of matches)if (/^\s*l/.test(p)) $l = true;
|
|
40
|
+
if (props.isDisabled) rules += ' _0j';
|
|
41
|
+
else rules += ' _0d';
|
|
42
|
+
rules += ' _d-bc1l9oh';
|
|
43
|
+
rules += ' _d-1uotwbwg';
|
|
44
|
+
rules += ' _d-eo0c6sf';
|
|
45
|
+
rules += ' _d-enzzrge';
|
|
46
|
+
rules += ' _d-enzykdd';
|
|
47
|
+
rules += ' _d-enzwzjc';
|
|
48
|
+
rules += ' _d-enzrfpb';
|
|
49
|
+
rules += ' _da';
|
|
50
|
+
if (props.size === "XL") {
|
|
51
|
+
rules += ' _ebf';
|
|
52
|
+
rules += ' _ee';
|
|
53
|
+
} else if (props.size === "L") {
|
|
54
|
+
rules += ' _ebd';
|
|
55
|
+
rules += ' _ec';
|
|
56
|
+
} else if (props.size === "M") {
|
|
57
|
+
rules += ' _ebb';
|
|
58
|
+
rules += ' _ea';
|
|
59
|
+
} else if (props.size === "S") {
|
|
60
|
+
rules += ' _ebb';
|
|
61
|
+
rules += ' _ea';
|
|
62
|
+
}
|
|
63
|
+
rules += ' _fb';
|
|
64
|
+
rules += ' _g-1x99dlob';
|
|
65
|
+
rules += ' _ga';
|
|
66
|
+
rules += ' aa_____K';
|
|
67
|
+
if (props.isStaticColor) rules += ' a_____R';
|
|
68
|
+
else rules += ' ac';
|
|
69
|
+
rules += ' waa';
|
|
70
|
+
rules += ' ua-375yri';
|
|
71
|
+
rules += ' va-375yri';
|
|
72
|
+
rules += ' sa-375yri';
|
|
73
|
+
rules += ' ta-375yri';
|
|
74
|
+
rules += ' ca_____I';
|
|
75
|
+
rules += ' _3d';
|
|
76
|
+
rules += ' _2c';
|
|
77
|
+
rules += ' b-375toh';
|
|
78
|
+
rules += ' k-375toq';
|
|
79
|
+
if (props.isSingleDigit) rules += ' _cb';
|
|
80
|
+
else if (props.isIndicatorOnly) rules += ' _cb';
|
|
81
|
+
if (!$l) rules += ' ld';
|
|
82
|
+
if (props.isDoubleDigit) rules += ' CI';
|
|
83
|
+
if (props.isDoubleDigit) rules += ' DI';
|
|
84
|
+
rules += ' _wg';
|
|
85
|
+
rules += ' _xg';
|
|
86
|
+
rules += ' _yg';
|
|
87
|
+
rules += ' _zg';
|
|
88
|
+
rules += ' -_375toh_b-a_____J';
|
|
89
|
+
if (props.isStaticColor) rules += ' -_375toh_b-_____G';
|
|
90
|
+
else {
|
|
91
|
+
if (props.isPressed) rules += ' -_375toh_b-_____S';
|
|
92
|
+
else if (props.isFocusVisible) rules += ' -_375toh_b-_____S';
|
|
93
|
+
else if (props.isHovered) rules += ' -_375toh_b-_____S';
|
|
94
|
+
else rules += ' -_375toh_b-_____R';
|
|
95
|
+
}
|
|
96
|
+
if (props.size === "XL") {
|
|
97
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
98
|
+
else rules += ' -_375toq_k-G';
|
|
99
|
+
} else if (props.size === "L") {
|
|
100
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k--1916w3k';
|
|
101
|
+
else rules += ' -_375toq_k-E';
|
|
102
|
+
} else if (props.size === "M") {
|
|
103
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k-w';
|
|
104
|
+
else rules += ' -_375toq_k--8p5mjn';
|
|
105
|
+
} else if (props.size === "S") {
|
|
106
|
+
if (props.isIndicatorOnly) rules += ' -_375toq_k-w';
|
|
107
|
+
else rules += ' -_375toq_k-A';
|
|
108
|
+
}
|
|
109
|
+
return rules;
|
|
110
|
+
};
|
|
111
|
+
const $bfb270fb056fefc5$export$529cab0ca6be204e = /*#__PURE__*/ (0, $bfWIi$forwardRef)(function Badge(props, ref) {
|
|
112
|
+
let stringFormatter = (0, $bfWIi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bfWIi$intlStringsmjs))), '@react-spectrum/s2');
|
|
113
|
+
[props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $bfb270fb056fefc5$export$9ab75c96ebaa396c);
|
|
114
|
+
let { size: size = 'S', value: value, isDisabled: isDisabled = false, staticColor: staticColor, ...otherProps } = props;
|
|
115
|
+
let domRef = (0, $bfWIi$useDOMRef)(ref);
|
|
116
|
+
let { locale: locale } = (0, $bfWIi$useLocale)();
|
|
117
|
+
let formattedValue = '';
|
|
118
|
+
let isIndicatorOnly = false;
|
|
119
|
+
let isSingleDigit = false;
|
|
120
|
+
let isDoubleDigit = false;
|
|
121
|
+
if (value == null) isIndicatorOnly = true;
|
|
122
|
+
else if (value <= 0) throw new Error('Value cannot be negative or zero');
|
|
123
|
+
else if (!Number.isInteger(value)) throw new Error('Value must be a positive integer');
|
|
124
|
+
else {
|
|
125
|
+
formattedValue = new (0, $bfWIi$NumberFormatter)(locale).format(Math.min(value, 99));
|
|
126
|
+
let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)
|
|
127
|
+
if (length === 1) isSingleDigit = true;
|
|
128
|
+
else if (length === 2) isDoubleDigit = true;
|
|
129
|
+
if (value > 99) formattedValue = stringFormatter.format('notificationbadge.plus', {
|
|
130
|
+
notifications: formattedValue
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
let ariaLabel = props['aria-label'] || undefined;
|
|
134
|
+
if (ariaLabel === undefined && isIndicatorOnly) ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');
|
|
135
|
+
return /*#__PURE__*/ (0, $bfWIi$jsx)("span", {
|
|
136
|
+
...(0, $bfWIi$filterDOMProps)(otherProps, {
|
|
137
|
+
labelable: true
|
|
138
|
+
}),
|
|
139
|
+
role: ariaLabel && 'img',
|
|
140
|
+
"aria-label": ariaLabel,
|
|
141
|
+
className: (props.UNSAFE_className || '') + $bfb270fb056fefc5$var$badge({
|
|
142
|
+
size: size,
|
|
143
|
+
isIndicatorOnly: isIndicatorOnly,
|
|
144
|
+
isSingleDigit: isSingleDigit,
|
|
145
|
+
isDoubleDigit: isDoubleDigit,
|
|
146
|
+
isDisabled: isDisabled,
|
|
147
|
+
isStaticColor: !!staticColor
|
|
148
|
+
}, props.styles),
|
|
149
|
+
style: props.UNSAFE_style,
|
|
150
|
+
ref: domRef,
|
|
151
|
+
children: formattedValue
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
export {$bfb270fb056fefc5$export$9ab75c96ebaa396c as NotificationBadgeContext, $bfb270fb056fefc5$export$529cab0ca6be204e as NotificationBadge};
|
|
157
|
+
//# sourceMappingURL=NotificationBadge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoCM,MAAM,0DAA2B,CAAA,GAAA,oBAAY,EAAqF;AAEzI,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEC,MAAM,0DAAoB,CAAA,GAAA,iBAAS,EAAE,SAAS,MAAM,KAA6B,EAAE,GAA2B;IACnH,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAChE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,YACP,KAAK,cACL,aAAa,oBACb,WAAW,EACX,GAAG,YACJ,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,iBAAiB;IAErB,IAAI,kBAAkB;IACtB,IAAI,gBAAgB;IACpB,IAAI,gBAAgB;IAEpB,IAAI,SAAS,MACX,kBAAkB;SACb,IAAI,SAAS,GAClB,MAAM,IAAI,MAAM;SACX,IAAI,CAAC,OAAO,SAAS,CAAC,QAC3B,MAAM,IAAI,MAAM;SACX;QACL,iBAAiB,IAAI,CAAA,GAAA,sBAAc,EAAE,QAAQ,MAAM,CAAC,KAAK,GAAG,CAAC,OAAO;QACpE,IAAI,SAAS,KAAK,GAAG,CAAC,SAAS,KAAK,QAAQ,MAAM,KAAK,MAAM,GAAG,IAAI,GAAI,4GAA4G;QACpL,IAAI,WAAW,GACb,gBAAgB;aACX,IAAI,WAAW,GACpB,gBAAgB;QAGlB,IAAI,QAAQ,IACV,iBAAiB,gBAAgB,MAAM,CAAC,0BAA0B;YAAC,eAAe;QAAc;IAEpG;IAEA,IAAI,YAAY,KAAK,CAAC,aAAa,IAAI;IACvC,IAAI,cAAc,aAAa,iBAC7B,YAAY,gBAAgB,MAAM,CAAC;IAGrC,qBACE,gBAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,YAAY;YAAC,WAAW;QAAI,EAAE;QACjD,MAAM,aAAa;QACnB,cAAY;QACZ,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,4BAAM;kBAAC;6BAAM;2BAAiB;2BAAe;wBAAe;YAAY,eAAe,CAAC,CAAC;QAAW,GAAG,MAAM,MAAM;QAC/J,OAAO,MAAM,YAAY;QACzB,KAAK;kBACJ;;AAGP","sources":["packages/@react-spectrum/s2/src/NotificationBadge.tsx"],"sourcesContent":["/*\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps, DOMProps, DOMRef, DOMRefValue} from '@react-types/shared';\nimport {ContextValue, SlotProps} from 'react-aria-components';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {fontRelative, style} from '../style' with {type: 'macro'};\nimport {getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {NumberFormatter} from '@internationalized/number';\nimport React, {createContext, forwardRef} from 'react';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface NotificationBadgeStyleProps {\n /**\n * The size of the notification badge.\n *\n * @default 'S'\n */\n size?: 'S' | 'M' | 'L' | 'XL'\n}\n\nexport interface NotificationBadgeProps extends DOMProps, AriaLabelingProps, StyleProps, NotificationBadgeStyleProps, SlotProps {\n /**\n * The value to be displayed in the notification badge.\n */\n value?: number | null\n}\n\ninterface NotificationBadgeContextProps extends Partial<NotificationBadgeProps> {\n isDisabled?: boolean,\n staticColor?: 'black' | 'white' | 'auto'\n}\n\nexport const NotificationBadgeContext = createContext<ContextValue<Partial<NotificationBadgeContextProps>, DOMRefValue<HTMLDivElement>>>(null);\n\nconst badge = style({\n display: {\n default: 'flex',\n isDisabled: 'none'\n },\n font: 'control',\n color: {\n default: 'white',\n isStaticColor: 'auto',\n forcedColors: 'ButtonText'\n },\n fontSize: {\n size: {\n S: 'ui-xs',\n M: 'ui-xs',\n L: 'ui-sm',\n XL: 'ui'\n }\n },\n borderStyle: {\n forcedColors: 'solid'\n },\n borderWidth: {\n forcedColors: '[1px]'\n },\n borderColor: {\n forcedColors: 'ButtonBorder'\n },\n justifyContent: 'center',\n alignItems: 'center',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-1000',\n forcedColors: 'ButtonFace'\n },\n height: {\n size: {\n S: {\n default: 12,\n isIndicatorOnly: 8\n },\n M: {\n default: fontRelative(18), // sort of arbitrary? tried to get as close to the figma designs as possible\n isIndicatorOnly: 8\n },\n L: {\n default: 16,\n isIndicatorOnly: fontRelative(12)\n },\n XL: {\n default: 18,\n isIndicatorOnly: fontRelative(12)\n }\n }\n },\n aspectRatio: {\n isIndicatorOnly: 'square',\n isSingleDigit: 'square'\n },\n width: 'max',\n paddingX: {\n isDoubleDigit: 'edge-to-text'\n },\n borderRadius: 'pill'\n}, getAllowedOverrides());\n\n/**\n * Notification badges are used to indicate new or pending activity .\n */\nexport const NotificationBadge = forwardRef(function Badge(props: NotificationBadgeProps, ref: DOMRef<HTMLDivElement>) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/s2');\n [props, ref] = useSpectrumContextProps(props, ref, NotificationBadgeContext);\n let {\n size = 'S',\n value,\n isDisabled = false,\n staticColor,\n ...otherProps\n } = props as NotificationBadgeContextProps;\n let domRef = useDOMRef(ref);\n let {locale} = useLocale();\n let formattedValue = '';\n\n let isIndicatorOnly = false;\n let isSingleDigit = false;\n let isDoubleDigit = false;\n\n if (value == null) {\n isIndicatorOnly = true;\n } else if (value <= 0) {\n throw new Error('Value cannot be negative or zero');\n } else if (!Number.isInteger(value)) {\n throw new Error('Value must be a positive integer');\n } else {\n formattedValue = new NumberFormatter(locale).format(Math.min(value, 99));\n let length = Math.log(value <= 99 ? value : 99) * Math.LOG10E + 1 | 0; // for positive integers (https://stackoverflow.com/questions/14879691/get-number-of-digits-with-javascript)\n if (length === 1) {\n isSingleDigit = true;\n } else if (length === 2) {\n isDoubleDigit = true;\n }\n\n if (value > 99) {\n formattedValue = stringFormatter.format('notificationbadge.plus', {notifications: formattedValue});\n }\n }\n\n let ariaLabel = props['aria-label'] || undefined;\n if (ariaLabel === undefined && isIndicatorOnly) {\n ariaLabel = stringFormatter.format('notificationbadge.indicatorOnly');\n }\n\n return (\n <span\n {...filterDOMProps(otherProps, {labelable: true})}\n role={ariaLabel && 'img'}\n aria-label={ariaLabel}\n className={(props.UNSAFE_className || '') + badge({size, isIndicatorOnly, isSingleDigit, isDoubleDigit, isDisabled, isStaticColor: !!staticColor}, props.styles)}\n style={props.UNSAFE_style}\n ref={domRef}>\n {formattedValue}\n </span>\n );\n});\n"],"names":[],"version":3,"file":"NotificationBadge.mjs.map"}
|