@ciromaciel/auth-react 1.6.0 → 1.7.1
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 +10 -0
- package/dist/index.esm.js +69 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +69 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4482,6 +4482,8 @@ const UPGRADE_THRESHOLD = 0.8;
|
|
|
4482
4482
|
* @property {string} [id] - Stable key
|
|
4483
4483
|
* @property {string} label - The row's text
|
|
4484
4484
|
* @property {Function} [icon] - A Tabler icon component
|
|
4485
|
+
* @property {string} [description] - One line under the label, saying what the action does
|
|
4486
|
+
* @property {'danger'} [tone] - For what cannot be undone: red label and icon
|
|
4485
4487
|
* @property {Function} onClick
|
|
4486
4488
|
*
|
|
4487
4489
|
* @typedef {Object} UserInformationPlan
|
|
@@ -4508,6 +4510,7 @@ const UPGRADE_THRESHOLD = 0.8;
|
|
|
4508
4510
|
* @param {Function} [props.onAccountClick]
|
|
4509
4511
|
* @param {Function} [props.onBillingClick]
|
|
4510
4512
|
* @param {UserInformationItem[]} [props.items] - The panel's own rows, shown in their own group
|
|
4513
|
+
* @param {string} [props.itemsLabel] - A title for that group ("Seus dados"); without it, none
|
|
4511
4514
|
* @param {UserInformationPlan} [props.plan] - The plan strip; omitted, the strip is not drawn
|
|
4512
4515
|
* @param {UserInformationOrganization} [props.organization] - Where the person is acting
|
|
4513
4516
|
* @param {boolean} [props.branded=true] - The footer: "Protegido por Auth" and the terms link
|
|
@@ -4523,6 +4526,7 @@ function UserInformation({
|
|
|
4523
4526
|
onAccountClick,
|
|
4524
4527
|
onBillingClick,
|
|
4525
4528
|
items = [],
|
|
4529
|
+
itemsLabel,
|
|
4526
4530
|
plan,
|
|
4527
4531
|
organization,
|
|
4528
4532
|
branded = true,
|
|
@@ -4620,6 +4624,7 @@ function UserInformation({
|
|
|
4620
4624
|
hasDivider: !organization?.name && !plan
|
|
4621
4625
|
}), panelRows.length > 0 && /*#__PURE__*/jsxRuntime.jsx(RowGroup, {
|
|
4622
4626
|
rows: panelRows,
|
|
4627
|
+
label: itemsLabel,
|
|
4623
4628
|
hasDivider: true
|
|
4624
4629
|
}), signOut && /*#__PURE__*/jsxRuntime.jsx(RowGroup, {
|
|
4625
4630
|
rows: [{
|
|
@@ -4669,6 +4674,9 @@ function UserInformation({
|
|
|
4669
4674
|
});
|
|
4670
4675
|
}
|
|
4671
4676
|
|
|
4677
|
+
// "12.400 de 60.000 páginas", not "12400 de 60000": the History counts pages in the thousands.
|
|
4678
|
+
const formatCount = value => Number(value).toLocaleString('pt-BR');
|
|
4679
|
+
|
|
4672
4680
|
/** The organization, the role and the plan's usage, on the alternate surface. */
|
|
4673
4681
|
function ContextStrip({
|
|
4674
4682
|
organization,
|
|
@@ -4768,7 +4776,7 @@ function ContextStrip({
|
|
|
4768
4776
|
fz: 12,
|
|
4769
4777
|
fw: isFull ? 700 : 500,
|
|
4770
4778
|
c: isFull ? 'red.8' : 'gray.6',
|
|
4771
|
-
children: `${plan.used} de ${plan.limit}${plan.unit ? ` ${plan.unit}` : ''}${isFull && !limitNoticeOnTop ? ' · limite atingido' : ''}`
|
|
4779
|
+
children: `${formatCount(plan.used)} de ${formatCount(plan.limit)}${plan.unit ? ` ${plan.unit}` : ''}${isFull && !limitNoticeOnTop ? ' · limite atingido' : ''}`
|
|
4772
4780
|
}), showsInvite && /*#__PURE__*/jsxRuntime.jsx(core.UnstyledButton, {
|
|
4773
4781
|
onClick: plan.onClick,
|
|
4774
4782
|
fz: 11,
|
|
@@ -4791,24 +4799,59 @@ function ContextStrip({
|
|
|
4791
4799
|
}
|
|
4792
4800
|
function RowGroup({
|
|
4793
4801
|
rows,
|
|
4802
|
+
label,
|
|
4794
4803
|
hasDivider
|
|
4795
4804
|
}) {
|
|
4796
|
-
return /*#__PURE__*/jsxRuntime.
|
|
4805
|
+
return /*#__PURE__*/jsxRuntime.jsxs(core.Stack, {
|
|
4797
4806
|
gap: 0,
|
|
4798
4807
|
p: 6,
|
|
4808
|
+
role: label ? 'group' : undefined,
|
|
4809
|
+
"aria-label": label || undefined,
|
|
4799
4810
|
style: hasDivider ? {
|
|
4800
4811
|
borderTop: '1px solid var(--mantine-color-gray-2)'
|
|
4801
4812
|
} : undefined,
|
|
4802
|
-
children:
|
|
4813
|
+
children: [label && /*#__PURE__*/jsxRuntime.jsx(core.Text, {
|
|
4814
|
+
"aria-hidden": true,
|
|
4815
|
+
fz: 11,
|
|
4816
|
+
fw: 800,
|
|
4817
|
+
tt: "uppercase",
|
|
4818
|
+
lts: "1.5px",
|
|
4819
|
+
c: "gray.4",
|
|
4820
|
+
px: 10,
|
|
4821
|
+
pt: 6,
|
|
4822
|
+
pb: 2,
|
|
4823
|
+
children: label
|
|
4824
|
+
}), rows.map(row => /*#__PURE__*/jsxRuntime.jsx(Row, {
|
|
4803
4825
|
...row
|
|
4804
|
-
}, row.id || row.label))
|
|
4826
|
+
}, row.id || row.label))]
|
|
4805
4827
|
});
|
|
4806
4828
|
}
|
|
4829
|
+
|
|
4830
|
+
/*
|
|
4831
|
+
* A panel's row may carry a line saying what it does and, for what cannot be
|
|
4832
|
+
* undone, the danger tone — still as data, so every card keeps one shape. The
|
|
4833
|
+
* History needed both: "Apagar tudo" looked exactly like "Exportar".
|
|
4834
|
+
*/
|
|
4835
|
+
const ROW_TONES = {
|
|
4836
|
+
default: {
|
|
4837
|
+
text: 'gray.9',
|
|
4838
|
+
icon: 'var(--mantine-color-gray-5)',
|
|
4839
|
+
hover: 'var(--mantine-color-gray-1)'
|
|
4840
|
+
},
|
|
4841
|
+
danger: {
|
|
4842
|
+
text: 'red.8',
|
|
4843
|
+
icon: 'var(--mantine-color-red-8)',
|
|
4844
|
+
hover: 'var(--mantine-color-red-0)'
|
|
4845
|
+
}
|
|
4846
|
+
};
|
|
4807
4847
|
function Row({
|
|
4808
4848
|
label,
|
|
4849
|
+
description,
|
|
4850
|
+
tone,
|
|
4809
4851
|
icon: Icon,
|
|
4810
4852
|
onClick
|
|
4811
4853
|
}) {
|
|
4854
|
+
const look = ROW_TONES[tone] || ROW_TONES.default;
|
|
4812
4855
|
return /*#__PURE__*/jsxRuntime.jsxs(core.UnstyledButton, {
|
|
4813
4856
|
role: "menuitem",
|
|
4814
4857
|
onClick: onClick,
|
|
@@ -4817,7 +4860,7 @@ function Row({
|
|
|
4817
4860
|
w: "100%",
|
|
4818
4861
|
style: {
|
|
4819
4862
|
display: 'flex',
|
|
4820
|
-
alignItems: 'center',
|
|
4863
|
+
alignItems: description ? 'flex-start' : 'center',
|
|
4821
4864
|
gap: 10,
|
|
4822
4865
|
borderRadius: 0
|
|
4823
4866
|
}
|
|
@@ -4825,23 +4868,35 @@ function Row({
|
|
|
4825
4868
|
* Hover and keyboard focus share the same surface: a row reached
|
|
4826
4869
|
* with the arrows must look exactly like the one under the mouse.
|
|
4827
4870
|
*/,
|
|
4828
|
-
onMouseEnter: event => event.currentTarget.style.background =
|
|
4871
|
+
onMouseEnter: event => event.currentTarget.style.background = look.hover,
|
|
4829
4872
|
onMouseLeave: event => event.currentTarget.style.background = 'transparent',
|
|
4830
|
-
onFocus: event => event.currentTarget.style.background =
|
|
4873
|
+
onFocus: event => event.currentTarget.style.background = look.hover,
|
|
4831
4874
|
onBlur: event => event.currentTarget.style.background = 'transparent',
|
|
4832
4875
|
children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
|
|
4833
4876
|
size: 16,
|
|
4834
4877
|
stroke: 1.5,
|
|
4835
4878
|
style: {
|
|
4836
4879
|
flex: 'none',
|
|
4837
|
-
color:
|
|
4880
|
+
color: look.icon,
|
|
4881
|
+
marginTop: description ? 1 : 0
|
|
4838
4882
|
}
|
|
4839
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4883
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(core.Box, {
|
|
4884
|
+
style: {
|
|
4885
|
+
minWidth: 0
|
|
4886
|
+
},
|
|
4887
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(core.Text, {
|
|
4888
|
+
fz: 12,
|
|
4889
|
+
fw: 500,
|
|
4890
|
+
c: look.text,
|
|
4891
|
+
truncate: "end",
|
|
4892
|
+
children: label
|
|
4893
|
+
}), description && /*#__PURE__*/jsxRuntime.jsx(core.Text, {
|
|
4894
|
+
fz: 12,
|
|
4895
|
+
fw: 500,
|
|
4896
|
+
c: "gray.5",
|
|
4897
|
+
lh: 1.4,
|
|
4898
|
+
children: description
|
|
4899
|
+
})]
|
|
4845
4900
|
})]
|
|
4846
4901
|
});
|
|
4847
4902
|
}
|