@ciromaciel/auth-react 1.6.0 → 1.7.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 +10 -0
- package/dist/index.esm.js +65 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +65 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,16 @@ organization and on which plan, then one list of actions with "Sair" last.
|
|
|
160
160
|
thing.
|
|
161
161
|
- `items` are your app's own rows, passed as data (`{ id, label, icon, onClick }`), shown in their
|
|
162
162
|
own group after billing. The component takes no JSX, so every app's card keeps the same shape.
|
|
163
|
+
A row may add `description` (one line saying what it does) and `tone: 'danger'` (red, for what
|
|
164
|
+
cannot be undone); `itemsLabel` titles the group:
|
|
165
|
+
|
|
166
|
+
```jsx
|
|
167
|
+
itemsLabel="Seus dados"
|
|
168
|
+
items={[
|
|
169
|
+
{ id: 'export', label: 'Exportar', description: 'Uma cópia de tudo, em JSON', icon: IconDownload, onClick: exportAll },
|
|
170
|
+
{ id: 'erase', label: 'Apagar tudo', description: 'Sem volta', tone: 'danger', icon: IconTrash, onClick: eraseAll },
|
|
171
|
+
]}
|
|
172
|
+
```
|
|
163
173
|
- `plan` and `organization` draw the context strip; leave them out and it is not drawn.
|
|
164
174
|
`limit: null` hides the usage bar.
|
|
165
175
|
- The strip informs; "Assinatura" is the way to billing. The strip adds a "Fazer upgrade"
|
package/dist/index.esm.js
CHANGED
|
@@ -4480,6 +4480,8 @@ const UPGRADE_THRESHOLD = 0.8;
|
|
|
4480
4480
|
* @property {string} [id] - Stable key
|
|
4481
4481
|
* @property {string} label - The row's text
|
|
4482
4482
|
* @property {Function} [icon] - A Tabler icon component
|
|
4483
|
+
* @property {string} [description] - One line under the label, saying what the action does
|
|
4484
|
+
* @property {'danger'} [tone] - For what cannot be undone: red label and icon
|
|
4483
4485
|
* @property {Function} onClick
|
|
4484
4486
|
*
|
|
4485
4487
|
* @typedef {Object} UserInformationPlan
|
|
@@ -4506,6 +4508,7 @@ const UPGRADE_THRESHOLD = 0.8;
|
|
|
4506
4508
|
* @param {Function} [props.onAccountClick]
|
|
4507
4509
|
* @param {Function} [props.onBillingClick]
|
|
4508
4510
|
* @param {UserInformationItem[]} [props.items] - The panel's own rows, shown in their own group
|
|
4511
|
+
* @param {string} [props.itemsLabel] - A title for that group ("Seus dados"); without it, none
|
|
4509
4512
|
* @param {UserInformationPlan} [props.plan] - The plan strip; omitted, the strip is not drawn
|
|
4510
4513
|
* @param {UserInformationOrganization} [props.organization] - Where the person is acting
|
|
4511
4514
|
* @param {boolean} [props.branded=true] - The footer: "Protegido por Auth" and the terms link
|
|
@@ -4521,6 +4524,7 @@ function UserInformation({
|
|
|
4521
4524
|
onAccountClick,
|
|
4522
4525
|
onBillingClick,
|
|
4523
4526
|
items = [],
|
|
4527
|
+
itemsLabel,
|
|
4524
4528
|
plan,
|
|
4525
4529
|
organization,
|
|
4526
4530
|
branded = true,
|
|
@@ -4618,6 +4622,7 @@ function UserInformation({
|
|
|
4618
4622
|
hasDivider: !organization?.name && !plan
|
|
4619
4623
|
}), panelRows.length > 0 && /*#__PURE__*/jsx(RowGroup, {
|
|
4620
4624
|
rows: panelRows,
|
|
4625
|
+
label: itemsLabel,
|
|
4621
4626
|
hasDivider: true
|
|
4622
4627
|
}), signOut && /*#__PURE__*/jsx(RowGroup, {
|
|
4623
4628
|
rows: [{
|
|
@@ -4789,24 +4794,59 @@ function ContextStrip({
|
|
|
4789
4794
|
}
|
|
4790
4795
|
function RowGroup({
|
|
4791
4796
|
rows,
|
|
4797
|
+
label,
|
|
4792
4798
|
hasDivider
|
|
4793
4799
|
}) {
|
|
4794
|
-
return /*#__PURE__*/
|
|
4800
|
+
return /*#__PURE__*/jsxs(Stack, {
|
|
4795
4801
|
gap: 0,
|
|
4796
4802
|
p: 6,
|
|
4803
|
+
role: label ? 'group' : undefined,
|
|
4804
|
+
"aria-label": label || undefined,
|
|
4797
4805
|
style: hasDivider ? {
|
|
4798
4806
|
borderTop: '1px solid var(--mantine-color-gray-2)'
|
|
4799
4807
|
} : undefined,
|
|
4800
|
-
children:
|
|
4808
|
+
children: [label && /*#__PURE__*/jsx(Text, {
|
|
4809
|
+
"aria-hidden": true,
|
|
4810
|
+
fz: 11,
|
|
4811
|
+
fw: 800,
|
|
4812
|
+
tt: "uppercase",
|
|
4813
|
+
lts: "1.5px",
|
|
4814
|
+
c: "gray.4",
|
|
4815
|
+
px: 10,
|
|
4816
|
+
pt: 6,
|
|
4817
|
+
pb: 2,
|
|
4818
|
+
children: label
|
|
4819
|
+
}), rows.map(row => /*#__PURE__*/jsx(Row, {
|
|
4801
4820
|
...row
|
|
4802
|
-
}, row.id || row.label))
|
|
4821
|
+
}, row.id || row.label))]
|
|
4803
4822
|
});
|
|
4804
4823
|
}
|
|
4824
|
+
|
|
4825
|
+
/*
|
|
4826
|
+
* A panel's row may carry a line saying what it does and, for what cannot be
|
|
4827
|
+
* undone, the danger tone — still as data, so every card keeps one shape. The
|
|
4828
|
+
* History needed both: "Apagar tudo" looked exactly like "Exportar".
|
|
4829
|
+
*/
|
|
4830
|
+
const ROW_TONES = {
|
|
4831
|
+
default: {
|
|
4832
|
+
text: 'gray.9',
|
|
4833
|
+
icon: 'var(--mantine-color-gray-5)',
|
|
4834
|
+
hover: 'var(--mantine-color-gray-1)'
|
|
4835
|
+
},
|
|
4836
|
+
danger: {
|
|
4837
|
+
text: 'red.8',
|
|
4838
|
+
icon: 'var(--mantine-color-red-8)',
|
|
4839
|
+
hover: 'var(--mantine-color-red-0)'
|
|
4840
|
+
}
|
|
4841
|
+
};
|
|
4805
4842
|
function Row({
|
|
4806
4843
|
label,
|
|
4844
|
+
description,
|
|
4845
|
+
tone,
|
|
4807
4846
|
icon: Icon,
|
|
4808
4847
|
onClick
|
|
4809
4848
|
}) {
|
|
4849
|
+
const look = ROW_TONES[tone] || ROW_TONES.default;
|
|
4810
4850
|
return /*#__PURE__*/jsxs(UnstyledButton, {
|
|
4811
4851
|
role: "menuitem",
|
|
4812
4852
|
onClick: onClick,
|
|
@@ -4815,7 +4855,7 @@ function Row({
|
|
|
4815
4855
|
w: "100%",
|
|
4816
4856
|
style: {
|
|
4817
4857
|
display: 'flex',
|
|
4818
|
-
alignItems: 'center',
|
|
4858
|
+
alignItems: description ? 'flex-start' : 'center',
|
|
4819
4859
|
gap: 10,
|
|
4820
4860
|
borderRadius: 0
|
|
4821
4861
|
}
|
|
@@ -4823,23 +4863,35 @@ function Row({
|
|
|
4823
4863
|
* Hover and keyboard focus share the same surface: a row reached
|
|
4824
4864
|
* with the arrows must look exactly like the one under the mouse.
|
|
4825
4865
|
*/,
|
|
4826
|
-
onMouseEnter: event => event.currentTarget.style.background =
|
|
4866
|
+
onMouseEnter: event => event.currentTarget.style.background = look.hover,
|
|
4827
4867
|
onMouseLeave: event => event.currentTarget.style.background = 'transparent',
|
|
4828
|
-
onFocus: event => event.currentTarget.style.background =
|
|
4868
|
+
onFocus: event => event.currentTarget.style.background = look.hover,
|
|
4829
4869
|
onBlur: event => event.currentTarget.style.background = 'transparent',
|
|
4830
4870
|
children: [Icon && /*#__PURE__*/jsx(Icon, {
|
|
4831
4871
|
size: 16,
|
|
4832
4872
|
stroke: 1.5,
|
|
4833
4873
|
style: {
|
|
4834
4874
|
flex: 'none',
|
|
4835
|
-
color:
|
|
4875
|
+
color: look.icon,
|
|
4876
|
+
marginTop: description ? 1 : 0
|
|
4836
4877
|
}
|
|
4837
|
-
}), /*#__PURE__*/
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4878
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
4879
|
+
style: {
|
|
4880
|
+
minWidth: 0
|
|
4881
|
+
},
|
|
4882
|
+
children: [/*#__PURE__*/jsx(Text, {
|
|
4883
|
+
fz: 12,
|
|
4884
|
+
fw: 500,
|
|
4885
|
+
c: look.text,
|
|
4886
|
+
truncate: "end",
|
|
4887
|
+
children: label
|
|
4888
|
+
}), description && /*#__PURE__*/jsx(Text, {
|
|
4889
|
+
fz: 12,
|
|
4890
|
+
fw: 500,
|
|
4891
|
+
c: "gray.5",
|
|
4892
|
+
lh: 1.4,
|
|
4893
|
+
children: description
|
|
4894
|
+
})]
|
|
4843
4895
|
})]
|
|
4844
4896
|
});
|
|
4845
4897
|
}
|