@taiv/ui 1.12.0 → 1.14.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/assets/assets.d.ts +5 -0
- package/dist/assets/assets.d.ts.map +1 -0
- package/dist/assets/assets.js +18 -0
- package/dist/assets/icons.d.ts +12 -0
- package/dist/assets/icons.d.ts.map +1 -0
- package/dist/assets/icons.js +62 -0
- package/dist/assets/svgs/GoogleIcon.d.ts +5 -0
- package/dist/assets/svgs/GoogleIcon.d.ts.map +1 -0
- package/dist/assets/svgs/GoogleIcon.js +2 -0
- package/dist/components/Data/Cards/ChartCard/ChartCard.d.ts.map +1 -1
- package/dist/components/Data/Cards/ChartCard/ChartCard.js +3 -2
- package/dist/components/Data/Cards/PieChartCard/PieChartCard.d.ts.map +1 -1
- package/dist/components/Data/Cards/PieChartCard/PieChartCard.js +2 -1
- package/dist/components/Data/Cards/StatsCard/StatsCard.d.ts.map +1 -1
- package/dist/components/Data/Cards/StatsCard/StatsCard.js +2 -1
- package/dist/components/Data/Chart/Chart.d.ts.map +1 -1
- package/dist/components/Data/Chart/Chart.js +5 -4
- package/dist/components/Data/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/components/Data/Chart/Chart.stories.js +6 -5
- package/dist/components/Data/CheckboxTable/CheckboxTable.d.ts.map +1 -1
- package/dist/components/Data/CheckboxTable/CheckboxTable.js +15 -14
- package/dist/components/Data/PieChart/PieChart.d.ts.map +1 -1
- package/dist/components/Data/PieChart/PieChart.js +4 -3
- package/dist/components/Data/PieChart/PieChart.stories.d.ts.map +1 -1
- package/dist/components/Data/PieChart/PieChart.stories.js +4 -3
- package/dist/components/Data/Progress/Progress.stories.d.ts.map +1 -1
- package/dist/components/Data/Progress/Progress.stories.js +7 -6
- package/dist/components/Data/RemovableItemList/RemovableItemList.d.ts.map +1 -1
- package/dist/components/Data/RemovableItemList/RemovableItemList.js +4 -3
- package/dist/components/Info/Badge/Badge.stories.d.ts.map +1 -1
- package/dist/components/Info/Badge/Badge.stories.js +5 -4
- package/dist/components/Info/Badge/sizes.d.ts.map +1 -1
- package/dist/components/Info/Badge/sizes.js +7 -6
- package/dist/components/Info/Badge/variants.d.ts.map +1 -1
- package/dist/components/Info/Badge/variants.js +3 -2
- package/dist/components/Info/InfoCard/InfoCard.d.ts.map +1 -1
- package/dist/components/Info/InfoCard/InfoCard.js +2 -1
- package/dist/components/Info/Modals/FormModal/FormModal.d.ts.map +1 -1
- package/dist/components/Info/Modals/FormModal/FormModal.js +12 -11
- package/dist/components/Info/Modals/FormModal/FormModal.stories.js +11 -11
- package/dist/components/Info/Modals/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Info/Modals/Modal/Modal.js +7 -6
- package/dist/components/Info/Modals/Modal/Modal.stories.d.ts +7 -0
- package/dist/components/Info/Modals/Modal/Modal.stories.d.ts.map +1 -0
- package/dist/components/Info/Modals/Modal/Modal.stories.js +61 -0
- package/dist/components/Info/Modals/Modals.stories.d.ts +16 -0
- package/dist/components/Info/Modals/Modals.stories.d.ts.map +1 -0
- package/dist/components/Info/Modals/Modals.stories.js +102 -0
- package/dist/components/Info/Notifications/NotificationProvider/NotificationProvider.d.ts.map +1 -1
- package/dist/components/Info/Notifications/NotificationProvider/NotificationProvider.js +7 -6
- package/dist/components/Info/Notifications/Notifications.stories.d.ts +10 -0
- package/dist/components/Info/Notifications/Notifications.stories.d.ts.map +1 -0
- package/dist/components/Info/Notifications/Notifications.stories.js +107 -0
- package/dist/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.js +2 -1
- package/dist/components/Info/Tooltips/InfoTooltip/InfoTooltip.d.ts +4 -4
- package/dist/components/Info/Tooltips/InfoTooltip/InfoTooltip.js +4 -4
- package/dist/components/Info/Tooltips/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/Tooltip/Tooltip.js +2 -1
- package/dist/components/Inputs/Buttons/Button/Button.js +2 -2
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts +1 -0
- package/dist/components/Inputs/Buttons/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/Button.stories.js +53 -46
- package/dist/components/Inputs/Buttons/Button/sizes.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/Button/sizes.js +4 -3
- package/dist/components/Inputs/Buttons/IconButton/IconButton.js +2 -2
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.js +7 -6
- package/dist/components/Inputs/Buttons/IconButton/sizes.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/sizes.js +4 -3
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.d.ts +35 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.js +37 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.stories.d.ts +14 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.stories.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/SSOButton/SSOButton.stories.js +121 -0
- package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/UnstyledButton/UnstyledButton.stories.js +4 -3
- package/dist/components/Inputs/Buttons/shared/variants.d.ts +29 -29
- package/dist/components/Inputs/Buttons/shared/variants.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/shared/variants.js +6 -5
- package/dist/components/Inputs/Controls/Checkbox/Checkbox.stories.js +3 -3
- package/dist/components/Inputs/Controls/Radio/Radio.js +1 -1
- package/dist/components/Inputs/Controls/Radio/Radio.stories.js +3 -3
- package/dist/components/Inputs/Controls/RadioList/RadioList.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/RadioList/RadioList.js +3 -2
- package/dist/components/Inputs/Controls/RadioList/RadioList.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/RadioList/RadioList.stories.js +3 -2
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Controls/SegmentedControl/SegmentedControl.stories.js +6 -5
- package/dist/components/Inputs/Controls/Toggle/Toggle.d.ts +4 -4
- package/dist/components/Inputs/Controls/Toggle/Toggle.js +5 -5
- package/dist/components/Inputs/Controls/Toggle/Toggle.stories.js +4 -4
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.js +5 -4
- package/dist/components/Inputs/Dates/DatePicker/DatePicker.stories.js +4 -4
- package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.js +6 -5
- package/dist/components/Inputs/Dropdowns/CascadingSelect/CascadingSelect.stories.js +5 -5
- package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.js +3 -3
- package/dist/components/Inputs/Dropdowns/FontSelect/FontSelect.stories.js +5 -5
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.js +7 -6
- package/dist/components/Inputs/Dropdowns/MultiSelect/MultiSelect.stories.js +5 -5
- package/dist/components/Inputs/Dropdowns/Select/Select.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/Select/Select.js +6 -5
- package/dist/components/Inputs/Dropdowns/Select/Select.stories.js +4 -4
- package/dist/components/Inputs/Dropdowns/shared/sizes.js +18 -18
- package/dist/components/Inputs/Sliders/Slider/Slider.d.ts.map +1 -1
- package/dist/components/Inputs/Sliders/Slider/Slider.js +15 -14
- package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.d.ts.map +1 -1
- package/dist/components/Inputs/Sliders/VolumeSlider/VolumeSlider.js +5 -4
- package/dist/components/Inputs/Sliders/shared/sizes.d.ts +9 -9
- package/dist/components/Inputs/Sliders/shared/sizes.js +9 -9
- package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.js +5 -4
- package/dist/components/Inputs/TextInputs/AutoComplete/AutoComplete.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/NumberInput/NumberInput.js +10 -10
- package/dist/components/Inputs/TextInputs/NumberInput/NumberInput.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.js +8 -8
- package/dist/components/Inputs/TextInputs/PasswordInput/PasswordInput.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.js +4 -3
- package/dist/components/Inputs/TextInputs/SearchBar/SearchBar.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/Inputs/TextInputs/TextArea/TextArea.js +6 -5
- package/dist/components/Inputs/TextInputs/TextArea/TextArea.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/TextInput/TextInput.js +5 -5
- package/dist/components/Inputs/TextInputs/TextInput/TextInput.stories.js +5 -5
- package/dist/components/Inputs/TextInputs/shared/sizes.d.ts +6 -6
- package/dist/components/Inputs/TextInputs/shared/sizes.js +3 -3
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts +7 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.d.ts.map +1 -0
- package/dist/components/Layout/AutoGrid/AutoGrid.stories.js +78 -0
- package/dist/components/Layout/Box/Box.d.ts +1 -3
- package/dist/components/Layout/Box/Box.d.ts.map +1 -1
- package/dist/components/Layout/Box/Box.js +2 -2
- package/dist/components/Layout/Box/Box.stories.d.ts +1 -2
- package/dist/components/Layout/Box/Box.stories.d.ts.map +1 -1
- package/dist/components/Layout/Box/Box.stories.js +28 -98
- package/dist/components/Layout/Card/Card.d.ts +1 -1
- package/dist/components/Layout/Card/Card.d.ts.map +1 -1
- package/dist/components/Layout/Card/Card.js +2 -2
- package/dist/components/Layout/Card/Card.stories.d.ts +10 -0
- package/dist/components/Layout/Card/Card.stories.d.ts.map +1 -0
- package/dist/components/Layout/Card/Card.stories.js +92 -0
- package/dist/components/Layout/Center/Center.d.ts +2 -3
- package/dist/components/Layout/Center/Center.d.ts.map +1 -1
- package/dist/components/Layout/Center/Center.js +2 -2
- package/dist/components/Layout/Center/Center.stories.d.ts +8 -0
- package/dist/components/Layout/Center/Center.stories.d.ts.map +1 -0
- package/dist/components/Layout/Center/Center.stories.js +70 -0
- package/dist/components/Layout/Divider/Divider.stories.d.ts +7 -0
- package/dist/components/Layout/Divider/Divider.stories.d.ts.map +1 -0
- package/dist/components/Layout/Divider/Divider.stories.js +67 -0
- package/dist/components/Layout/Frame/Frame.js +1 -1
- package/dist/components/Layout/Frame/Frame.stories.d.ts +8 -0
- package/dist/components/Layout/Frame/Frame.stories.d.ts.map +1 -0
- package/dist/components/Layout/Frame/Frame.stories.js +78 -0
- package/dist/components/Layout/Grid/Grid.stories.d.ts +8 -0
- package/dist/components/Layout/Grid/Grid.stories.d.ts.map +1 -0
- package/dist/components/Layout/Grid/Grid.stories.js +72 -0
- package/dist/components/Layout/Group/Group.stories.d.ts +10 -0
- package/dist/components/Layout/Group/Group.stories.d.ts.map +1 -0
- package/dist/components/Layout/Group/Group.stories.js +114 -0
- package/dist/components/Layout/Loader/Loader.stories.d.ts +10 -0
- package/dist/components/Layout/Loader/Loader.stories.d.ts.map +1 -0
- package/dist/components/Layout/Loader/Loader.stories.js +68 -0
- package/dist/components/Layout/SectionCard/SectionCard.d.ts +3 -5
- package/dist/components/Layout/SectionCard/SectionCard.d.ts.map +1 -1
- package/dist/components/Layout/SectionCard/SectionCard.js +3 -8
- package/dist/components/Layout/SectionCard/SectionCard.stories.d.ts +9 -0
- package/dist/components/Layout/SectionCard/SectionCard.stories.d.ts.map +1 -0
- package/dist/components/Layout/SectionCard/SectionCard.stories.js +98 -0
- package/dist/components/Layout/Stack/Stack.stories.d.ts +1 -2
- package/dist/components/Layout/Stack/Stack.stories.d.ts.map +1 -1
- package/dist/components/Layout/Stack/Stack.stories.js +47 -66
- package/dist/components/Layout/Table/Table.stories.d.ts.map +1 -1
- package/dist/components/Layout/Table/Table.stories.js +4 -3
- package/dist/components/Layout/Tabs/Tabs.d.ts +2 -4
- package/dist/components/Layout/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Layout/Tabs/Tabs.js +7 -6
- package/dist/components/Layout/Tabs/Tabs.stories.d.ts +9 -0
- package/dist/components/Layout/Tabs/Tabs.stories.d.ts.map +1 -0
- package/dist/components/Layout/Tabs/Tabs.stories.js +141 -0
- package/dist/components/Misc/IconBadge/IconBadge.js +1 -1
- package/dist/components/Misc/IconBadge/IconBadge.stories.d.ts +7 -0
- package/dist/components/Misc/IconBadge/IconBadge.stories.d.ts.map +1 -0
- package/dist/components/Misc/IconBadge/IconBadge.stories.js +48 -0
- package/dist/components/Misc/Stepper/Step.d.ts +16 -0
- package/dist/components/Misc/Stepper/Step.d.ts.map +1 -0
- package/dist/components/Misc/Stepper/Step.js +7 -0
- package/dist/components/Misc/Stepper/Step.stories.d.ts +477 -0
- package/dist/components/Misc/Stepper/Step.stories.d.ts.map +1 -0
- package/dist/components/Misc/Stepper/Step.stories.js +83 -0
- package/dist/components/Misc/Stepper/Stepper.d.ts +10 -0
- package/dist/components/Misc/Stepper/Stepper.d.ts.map +1 -0
- package/dist/components/Misc/Stepper/Stepper.js +72 -0
- package/dist/components/Misc/Stepper/Stepper.stories.d.ts +13 -0
- package/dist/components/Misc/Stepper/Stepper.stories.d.ts.map +1 -0
- package/dist/components/Misc/Stepper/Stepper.stories.js +126 -0
- package/dist/components/Misc/Stepper/variants.d.ts +54 -0
- package/dist/components/Misc/Stepper/variants.d.ts.map +1 -0
- package/dist/components/Misc/Stepper/variants.js +48 -0
- package/dist/components/Typography/CollapsibleText/CollapsibleText.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleText/CollapsibleText.js +2 -1
- package/dist/components/Typography/CollapsibleText/CollapsibleText.stories.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleText/CollapsibleText.stories.js +4 -3
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.js +2 -1
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.stories.d.ts.map +1 -1
- package/dist/components/Typography/CollapsibleTitle/CollapsibleTitle.stories.js +4 -3
- package/dist/components/Typography/Formula/Formula.d.ts.map +1 -1
- package/dist/components/Typography/Formula/Formula.js +5 -4
- package/dist/components/Typography/Formula/Formula.stories.d.ts +10 -0
- package/dist/components/Typography/Formula/Formula.stories.d.ts.map +1 -0
- package/dist/components/Typography/Formula/Formula.stories.js +85 -0
- package/dist/components/Typography/Fraction/Fraction.d.ts.map +1 -1
- package/dist/components/Typography/Fraction/Fraction.js +2 -1
- package/dist/components/Typography/Fraction/Fraction.stories.d.ts +9 -0
- package/dist/components/Typography/Fraction/Fraction.stories.d.ts.map +1 -0
- package/dist/components/Typography/Fraction/Fraction.stories.js +87 -0
- package/dist/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/components/Typography/Text/Text.js +6 -0
- package/dist/components/Typography/Text/Text.stories.d.ts +10 -0
- package/dist/components/Typography/Text/Text.stories.d.ts.map +1 -0
- package/dist/components/Typography/Text/Text.stories.js +101 -0
- package/dist/components/Typography/Title/Title.stories.d.ts +9 -0
- package/dist/components/Typography/Title/Title.stories.d.ts.map +1 -0
- package/dist/components/Typography/Title/Title.stories.js +98 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +3 -0
- package/dist/constants/breakpoints.d.ts +1 -1
- package/dist/constants/breakpoints.js +1 -1
- package/dist/constants/colors.d.ts +1 -0
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +1 -0
- package/dist/constants/font.js +10 -10
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/index.js +1 -0
- package/dist/constants/spacing.d.ts +12 -0
- package/dist/constants/spacing.d.ts.map +1 -0
- package/dist/constants/spacing.js +11 -0
- package/dist/docs/AIGeneratedBanner.d.ts +2 -0
- package/dist/docs/AIGeneratedBanner.d.ts.map +1 -0
- package/dist/docs/AIGeneratedBanner.js +5 -0
- package/dist/docs/design/Colors.stories.d.ts +7 -0
- package/dist/docs/design/Colors.stories.d.ts.map +1 -0
- package/dist/docs/design/Colors.stories.js +29 -0
- package/dist/docs/design/Spacing.stories.d.ts +6 -0
- package/dist/docs/design/Spacing.stories.d.ts.map +1 -0
- package/dist/docs/design/Spacing.stories.js +24 -0
- package/dist/docs/hooks/Copy.stories.d.ts +6 -0
- package/dist/docs/hooks/Copy.stories.d.ts.map +1 -0
- package/dist/docs/hooks/Copy.stories.js +61 -0
- package/dist/hooks/useConfirmationModal.d.ts.map +1 -1
- package/dist/hooks/useConfirmationModal.js +10 -9
- package/dist/hooks/useInfoModal.d.ts.map +1 -1
- package/dist/hooks/useInfoModal.js +10 -9
- package/dist/hooks/useMediaQuery.d.ts +2 -2
- package/dist/hooks/useMediaQuery.js +6 -6
- package/package.json +43 -32
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { NotificationProvider } from './NotificationProvider/NotificationProvider';
|
|
4
|
+
import { Group } from '../../Layout/Group/Group';
|
|
5
|
+
import { Button } from '../../Inputs/Buttons/Button/Button';
|
|
6
|
+
import { useNotifications } from '../../../hooks/useNotifications';
|
|
7
|
+
import { spacing } from '../../../constants/spacing';
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Hooks/Notifications',
|
|
10
|
+
tags: ['!dev'],
|
|
11
|
+
component: NotificationProvider,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
variant: {
|
|
17
|
+
control: { type: 'select' },
|
|
18
|
+
options: ['success', 'error', 'warning', 'info', 'copy'],
|
|
19
|
+
description: 'Visual style and icon of the notification',
|
|
20
|
+
table: {
|
|
21
|
+
type: { summary: "'success' | 'error' | 'warning' | 'info' | 'copy'" },
|
|
22
|
+
defaultValue: { summary: "'info'" },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
message: {
|
|
26
|
+
control: { type: 'text' },
|
|
27
|
+
description: 'Notification body text',
|
|
28
|
+
table: {
|
|
29
|
+
type: { summary: 'string' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
control: { type: 'text' },
|
|
34
|
+
description: 'Optional title override (defaults to variant title)',
|
|
35
|
+
table: {
|
|
36
|
+
type: { summary: 'string' },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
id: {
|
|
40
|
+
control: { type: 'text' },
|
|
41
|
+
description: 'Optional unique ID for tracking or hiding',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'string' },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export default meta;
|
|
49
|
+
const DefaultDemo = (args) => {
|
|
50
|
+
const { show } = useNotifications();
|
|
51
|
+
return (_jsx(Button, { onClick: () => show({
|
|
52
|
+
variant: args.variant,
|
|
53
|
+
message: args.message,
|
|
54
|
+
title: args.title || undefined,
|
|
55
|
+
id: args.id || undefined,
|
|
56
|
+
}), children: "Show Notification" }));
|
|
57
|
+
};
|
|
58
|
+
export const Default = {
|
|
59
|
+
args: {
|
|
60
|
+
variant: 'info',
|
|
61
|
+
message: 'Operation completed successfully!',
|
|
62
|
+
title: undefined,
|
|
63
|
+
id: undefined,
|
|
64
|
+
},
|
|
65
|
+
render: (args) => _jsx(DefaultDemo, { ...args }),
|
|
66
|
+
};
|
|
67
|
+
const VariantsDemo = () => {
|
|
68
|
+
const { show } = useNotifications();
|
|
69
|
+
return (_jsxs(Group, { gap: spacing.xs, children: [_jsx(Button, { variant: "success", onClick: () => show({ variant: 'success', message: 'Operation completed successfully!' }), children: "Success" }), _jsx(Button, { variant: "cancel", onClick: () => show({ variant: 'error', message: 'Something went wrong!' }), children: "Error" }), _jsx(Button, { variant: "warning", onClick: () => show({ variant: 'warning', message: 'Please review your input' }), children: "Warning" }), _jsx(Button, { variant: "primary", onClick: () => show({ variant: 'info', message: 'Here is some useful information' }), children: "Info" }), _jsx(Button, { variant: "secondary", onClick: () => show({ variant: 'copy', message: 'Copied to clipboard!' }), children: "Copy" })] }));
|
|
70
|
+
};
|
|
71
|
+
export const Variants = {
|
|
72
|
+
render: () => _jsx(VariantsDemo, {}),
|
|
73
|
+
};
|
|
74
|
+
const GenericErrorDemo = () => {
|
|
75
|
+
const { showError } = useNotifications();
|
|
76
|
+
return _jsx(Button, { variant: "cancel", onClick: showError, children: "Show Generic Error" });
|
|
77
|
+
};
|
|
78
|
+
export const GenericError = {
|
|
79
|
+
render: () => _jsx(GenericErrorDemo, {}),
|
|
80
|
+
};
|
|
81
|
+
const AsyncDemo = () => {
|
|
82
|
+
const { show, showLoading, showError, hide } = useNotifications();
|
|
83
|
+
const [isLoadingSuccess, setIsLoadingSuccess] = useState(false);
|
|
84
|
+
const [isLoadingFailure, setIsLoadingFailure] = useState(false);
|
|
85
|
+
const handleSuccess = () => {
|
|
86
|
+
setIsLoadingSuccess(true);
|
|
87
|
+
const id = showLoading({ message: 'Processing your request...' });
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
hide(id);
|
|
90
|
+
show({ variant: 'success', message: 'Operation completed!' });
|
|
91
|
+
setIsLoadingSuccess(false);
|
|
92
|
+
}, 3000);
|
|
93
|
+
};
|
|
94
|
+
const handleFailure = () => {
|
|
95
|
+
setIsLoadingFailure(true);
|
|
96
|
+
const id = showLoading({ message: 'Processing your request...' });
|
|
97
|
+
setTimeout(() => {
|
|
98
|
+
hide(id);
|
|
99
|
+
showError();
|
|
100
|
+
setIsLoadingFailure(false);
|
|
101
|
+
}, 3000);
|
|
102
|
+
};
|
|
103
|
+
return (_jsxs(Group, { gap: spacing.xs, children: [_jsx(Button, { variant: "success", onClick: handleSuccess, loading: isLoadingSuccess, children: isLoadingSuccess ? 'Processing...' : 'Async Success' }), _jsx(Button, { variant: "cancel", onClick: handleFailure, loading: isLoadingFailure, children: isLoadingFailure ? 'Processing...' : 'Async Failure' })] }));
|
|
104
|
+
};
|
|
105
|
+
export const AsyncNotifications = {
|
|
106
|
+
render: () => _jsx(AsyncDemo, {}),
|
|
107
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormulaTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FormulaTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Tooltips/FormulaTooltip/FormulaTooltip.tsx"],"names":[],"mappings":"AASA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,cAAc,GAAI,oCAAoC,mBAAmB,4CAgB9E,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -4,8 +4,9 @@ import { Text } from '../../../Typography/Text/Text';
|
|
|
4
4
|
import { Formula } from '../../../Typography/Formula/Formula';
|
|
5
5
|
import { Stack } from '../../../Layout/Stack/Stack';
|
|
6
6
|
import { blue } from '../../../../constants/colors';
|
|
7
|
+
import { spacing } from '../../../../constants/spacing';
|
|
7
8
|
import { Center } from '../../../Layout/Center/Center';
|
|
8
9
|
const FormulaTooltip = ({ title, description, expression }) => {
|
|
9
|
-
return (_jsx(Box, { p: "
|
|
10
|
+
return (_jsx(Box, { p: "8px", children: _jsxs(Stack, { gap: spacing.lg, children: [_jsxs(Stack, { gap: spacing.sm, sx: { maxWidth: '500px' }, children: [_jsx(Text, { weight: "semibold", children: title }), _jsx(Text, { variant: "label", children: description })] }), _jsx("div", { style: { padding: `${spacing.lg} ${spacing.xl}`, borderRadius: '16px', backgroundColor: blue[25], width: '100%' }, children: _jsx(Center, { children: _jsx(Formula, { expression: expression, color: blue[300] }) }) })] }) }));
|
|
10
11
|
};
|
|
11
12
|
export { FormulaTooltip };
|
|
@@ -26,10 +26,10 @@ declare const componentVariants: {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
declare const componentSizes: {
|
|
29
|
-
readonly sm: "
|
|
30
|
-
readonly md: "
|
|
31
|
-
readonly lg: "
|
|
32
|
-
readonly xl: "
|
|
29
|
+
readonly sm: "12px";
|
|
30
|
+
readonly md: "16px";
|
|
31
|
+
readonly lg: "20px";
|
|
32
|
+
readonly xl: "24px";
|
|
33
33
|
};
|
|
34
34
|
declare const InfoTooltip: ({ text, content, position, size, offset, className, styles, maxWidth, variant }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
35
35
|
export { InfoTooltip };
|
|
@@ -16,10 +16,10 @@ const componentVariants = {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
const componentSizes = {
|
|
19
|
-
sm: '
|
|
20
|
-
md: '
|
|
21
|
-
lg: '
|
|
22
|
-
xl: '
|
|
19
|
+
sm: '12px',
|
|
20
|
+
md: '16px',
|
|
21
|
+
lg: '20px',
|
|
22
|
+
xl: '24px',
|
|
23
23
|
};
|
|
24
24
|
const InfoTooltip = ({ text, content, position = 'top-start', size = 'md', offset, className, styles, maxWidth, variant = 'info' }) => {
|
|
25
25
|
const style = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Tooltips/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Tooltips/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C,UAAU,YAAY;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,OAAO,GAAI,mEAAiF,YAAY,4CAgD7G,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Tooltip as MantineTooltip, Box } from '@mantine/core';
|
|
3
3
|
import { neutral } from '../../../../constants/colors';
|
|
4
4
|
import { fontBase, fontSize, fontWeight } from '../../../../constants/font';
|
|
5
|
+
import { spacing } from '../../../../constants/spacing';
|
|
5
6
|
const Tooltip = ({ children, text, position = 'top-start', offset, className, styles, maxWidth }) => {
|
|
6
7
|
const positionToTransition = {
|
|
7
8
|
'top-end': 'slide-up',
|
|
@@ -24,7 +25,7 @@ const Tooltip = ({ children, text, position = 'top-start', offset, className, st
|
|
|
24
25
|
borderRadius: '8px',
|
|
25
26
|
textWrap: 'wrap',
|
|
26
27
|
maxWidth: maxWidth || '375px',
|
|
27
|
-
padding:
|
|
28
|
+
padding: `${spacing.sm} 11.25px`,
|
|
28
29
|
...fontSize['sm'],
|
|
29
30
|
height: 'fit-content',
|
|
30
31
|
},
|
|
@@ -19,9 +19,9 @@ export const Button = ({ onClick, size = 'md', variant = 'primary', fullWidth =
|
|
|
19
19
|
root: {
|
|
20
20
|
borderRadius: '8px',
|
|
21
21
|
width: fullWidth ? '100%' : 'fit-content',
|
|
22
|
-
height: `${selectedSize.height}
|
|
22
|
+
height: `${selectedSize.height}px`,
|
|
23
23
|
padding: selectedSize.padding,
|
|
24
|
-
minWidth: `${selectedSize.minWidth}
|
|
24
|
+
minWidth: `${selectedSize.minWidth}px`,
|
|
25
25
|
fontSize: selectedSize.fontSize,
|
|
26
26
|
boxShadow: shadow ? '0px 4px 6px rgba(0, 0, 0, 0.1)' : 'none',
|
|
27
27
|
transition: 'background 0.1s ease-in-out',
|
|
@@ -7,5 +7,6 @@ export declare const Default: Story;
|
|
|
7
7
|
export declare const Variants: Story;
|
|
8
8
|
export declare const Sizes: Story;
|
|
9
9
|
export declare const States: Story;
|
|
10
|
+
export declare const TogglingButtons: Story;
|
|
10
11
|
export declare const CustomStyles: Story;
|
|
11
12
|
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAyH7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAerB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAY7B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAgC1B,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { Button } from './Button';
|
|
3
4
|
import { Group } from '../../../Layout/Group/Group';
|
|
5
|
+
import { IconPlus, IconEdit, IconTrash, IconDeviceFloppy } from '@tabler/icons-react';
|
|
6
|
+
import { spacing } from '../../../../constants/spacing';
|
|
4
7
|
const meta = {
|
|
5
8
|
title: 'Components/Inputs/Buttons/Button',
|
|
6
9
|
component: Button,
|
|
@@ -47,15 +50,29 @@ const meta = {
|
|
|
47
50
|
},
|
|
48
51
|
},
|
|
49
52
|
leftIcon: {
|
|
50
|
-
control: { type: '
|
|
51
|
-
|
|
53
|
+
control: { type: 'select' },
|
|
54
|
+
options: ['Plus', 'Edit', 'Trash', 'Save'],
|
|
55
|
+
mapping: {
|
|
56
|
+
Plus: _jsx(IconPlus, { size: 16 }),
|
|
57
|
+
Edit: _jsx(IconEdit, { size: 16 }),
|
|
58
|
+
Trash: _jsx(IconTrash, { size: 16 }),
|
|
59
|
+
Save: _jsx(IconDeviceFloppy, { size: 16 }),
|
|
60
|
+
},
|
|
61
|
+
description: 'Adds icon before button label - you can import any icon',
|
|
52
62
|
table: {
|
|
53
63
|
type: { summary: 'ReactNode' },
|
|
54
64
|
},
|
|
55
65
|
},
|
|
56
66
|
rightIcon: {
|
|
57
|
-
control: { type: '
|
|
58
|
-
|
|
67
|
+
control: { type: 'select' },
|
|
68
|
+
options: ['Plus', 'Edit', 'Trash', 'Save'],
|
|
69
|
+
mapping: {
|
|
70
|
+
Plus: _jsx(IconPlus, { size: 16 }),
|
|
71
|
+
Edit: _jsx(IconEdit, { size: 16 }),
|
|
72
|
+
Trash: _jsx(IconTrash, { size: 16 }),
|
|
73
|
+
Save: _jsx(IconDeviceFloppy, { size: 16 }),
|
|
74
|
+
},
|
|
75
|
+
description: 'Adds icon after button label - you can import any icon',
|
|
59
76
|
table: {
|
|
60
77
|
type: { summary: 'ReactNode' },
|
|
61
78
|
},
|
|
@@ -90,6 +107,14 @@ const meta = {
|
|
|
90
107
|
type: { summary: '() => void' },
|
|
91
108
|
},
|
|
92
109
|
},
|
|
110
|
+
toggled: {
|
|
111
|
+
control: { type: 'boolean' },
|
|
112
|
+
description: 'Toggles the button state',
|
|
113
|
+
table: {
|
|
114
|
+
type: { summary: 'boolean' },
|
|
115
|
+
defaultValue: { summary: 'false' },
|
|
116
|
+
}
|
|
117
|
+
},
|
|
93
118
|
shadow: {
|
|
94
119
|
control: { type: 'boolean' },
|
|
95
120
|
description: 'Adds shadow to the button',
|
|
@@ -110,42 +135,41 @@ export const Default = {
|
|
|
110
135
|
loading: false,
|
|
111
136
|
fullWidth: false,
|
|
112
137
|
shadow: false,
|
|
138
|
+
toggled: false,
|
|
113
139
|
leftIcon: undefined,
|
|
114
140
|
rightIcon: undefined,
|
|
115
|
-
styles:
|
|
141
|
+
styles: undefined,
|
|
116
142
|
onClick: () => { },
|
|
117
143
|
},
|
|
118
144
|
};
|
|
119
145
|
export const Variants = {
|
|
120
|
-
render: () => (_jsxs(Group, { gap:
|
|
146
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(Button, { variant: "primary", children: "Primary" }), _jsx(Button, { variant: "secondary", children: "Secondary" }), _jsx(Button, { variant: "cancel", children: "Cancel" }), _jsx(Button, { variant: "success", children: "Success" }), _jsx(Button, { variant: "warning", children: "Warning" }), _jsx(Button, { variant: "text", children: "Text" })] })),
|
|
121
147
|
};
|
|
122
148
|
export const Sizes = {
|
|
123
|
-
render: () => (_jsxs(Group, { gap:
|
|
149
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(Button, { size: "sm", children: "Small" }), _jsx(Button, { size: "md", children: "Medium" }), _jsx(Button, { size: "lg", children: "Large" })] })),
|
|
124
150
|
};
|
|
125
151
|
export const States = {
|
|
126
|
-
render: () => (_jsxs(Group, { gap:
|
|
152
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(Button, { children: "Normal" }), _jsx(Button, { disabled: true, children: "Disabled" }), _jsx(Button, { loading: true, children: "Loading" })] })),
|
|
153
|
+
};
|
|
154
|
+
export const TogglingButtons = {
|
|
155
|
+
render: () => {
|
|
156
|
+
const [toggled, setToggled] = useState(false);
|
|
157
|
+
return (_jsx(Group, { gap: spacing.lg, children: _jsx(Button, { toggled: toggled, onClick: () => setToggled(!toggled), children: toggled ? 'On' : 'Off' }) }));
|
|
158
|
+
},
|
|
127
159
|
};
|
|
128
160
|
export const CustomStyles = {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
color: 'white',
|
|
142
|
-
border: '2px solid white',
|
|
143
|
-
'&:hover': {
|
|
144
|
-
background: 'white',
|
|
145
|
-
color: 'black',
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
}, children: "Custom Border" })] })),
|
|
161
|
+
args: {
|
|
162
|
+
children: 'Custom Button',
|
|
163
|
+
styles: {
|
|
164
|
+
root: {
|
|
165
|
+
borderRadius: '20px',
|
|
166
|
+
background: 'linear-gradient(45deg, #ff6b6b, #ee5a24)',
|
|
167
|
+
'&:hover': {
|
|
168
|
+
background: 'linear-gradient(45deg, #ee5a24, #ff6b6b)',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
149
173
|
parameters: {
|
|
150
174
|
docs: {
|
|
151
175
|
source: {
|
|
@@ -160,24 +184,7 @@ export const CustomStyles = {
|
|
|
160
184
|
},
|
|
161
185
|
}}
|
|
162
186
|
>
|
|
163
|
-
|
|
164
|
-
</Button>
|
|
165
|
-
|
|
166
|
-
<Button
|
|
167
|
-
styles={{
|
|
168
|
-
root: {
|
|
169
|
-
borderRadius: '0px',
|
|
170
|
-
background: 'black',
|
|
171
|
-
color: 'white',
|
|
172
|
-
border: '2px solid white',
|
|
173
|
-
'&:hover': {
|
|
174
|
-
background: 'white',
|
|
175
|
-
color: 'black',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
}}
|
|
179
|
-
>
|
|
180
|
-
Custom Border
|
|
187
|
+
Custom Button
|
|
181
188
|
</Button>`,
|
|
182
189
|
},
|
|
183
190
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/sizes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/Button/sizes.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CAInB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { fontSize } from '../../../../constants/font';
|
|
2
|
+
import { spacing } from '../../../../constants/spacing';
|
|
2
3
|
const componentSizes = {
|
|
3
|
-
sm: { height:
|
|
4
|
-
md: { height:
|
|
5
|
-
lg: { height:
|
|
4
|
+
sm: { height: 30, ...fontSize['sm'], padding: `${spacing.sm} 18px`, minWidth: 68 },
|
|
5
|
+
md: { height: 40, ...fontSize['md'], padding: `${spacing.sm} ${spacing.xl}`, minWidth: 112 },
|
|
6
|
+
lg: { height: 48, ...fontSize['lg'], padding: `${spacing.sm} 40px`, minWidth: 152 },
|
|
6
7
|
};
|
|
7
8
|
export { componentSizes };
|
|
@@ -38,9 +38,9 @@ export const IconButton = ({ onClick, size = 'md', variant = 'primary', toggled
|
|
|
38
38
|
const style = {
|
|
39
39
|
root: {
|
|
40
40
|
borderRadius: '8px',
|
|
41
|
-
height: `${selectedSize.borderLength}
|
|
41
|
+
height: `${selectedSize.borderLength}px`,
|
|
42
42
|
padding: selectedSize.padding,
|
|
43
|
-
width: `${selectedSize.borderLength}
|
|
43
|
+
width: `${selectedSize.borderLength}px`,
|
|
44
44
|
boxShadow: shadow ? '0px 4px 6px rgba(0, 0, 0, 0.1)' : 'none',
|
|
45
45
|
...getVariantStyles(),
|
|
46
46
|
...getSubtleStyles(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAsFjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAWpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KASpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAS1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAsE1B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { IconButton } from './IconButton';
|
|
3
3
|
import { Icon12Hours, Icon24Hours, Icon360View, IconAdjustments, IconAlertCircle, IconArrowLeft, IconArrowRight, IconArrowsMaximize, IconCaretDown, IconCheck, IconClock, IconClock2, IconHistory, IconLoader2 } from '@tabler/icons-react';
|
|
4
4
|
import { Group } from '../../../Layout/Group/Group';
|
|
5
|
+
import { spacing } from '../../../../constants/spacing';
|
|
5
6
|
const meta = {
|
|
6
7
|
title: 'Components/Inputs/Buttons/IconButton',
|
|
7
8
|
component: IconButton,
|
|
@@ -103,22 +104,22 @@ export const Default = {
|
|
|
103
104
|
},
|
|
104
105
|
};
|
|
105
106
|
export const Variants = {
|
|
106
|
-
render: () => (_jsxs(Group, { gap:
|
|
107
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { variant: "primary", children: _jsx(Icon12Hours, {}) }), _jsx(IconButton, { variant: "secondary", children: _jsx(Icon24Hours, {}) }), _jsx(IconButton, { variant: "cancel", children: _jsx(IconClock, {}) }), _jsx(IconButton, { variant: "success", children: _jsx(IconCheck, {}) }), _jsx(IconButton, { variant: "warning", children: _jsx(IconAlertCircle, {}) }), _jsx(IconButton, { variant: "text", children: _jsx(IconClock2, {}) })] })),
|
|
107
108
|
};
|
|
108
109
|
export const Subtle = {
|
|
109
|
-
render: () => (_jsxs(Group, { gap:
|
|
110
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { variant: "primary", subtle: true, children: _jsx(Icon12Hours, {}) }), _jsx(IconButton, { variant: "secondary", subtle: true, children: _jsx(Icon24Hours, {}) }), _jsx(IconButton, { variant: "cancel", subtle: true, children: _jsx(IconClock, {}) }), _jsx(IconButton, { variant: "success", subtle: true, children: _jsx(IconCheck, {}) }), _jsx(IconButton, { variant: "warning", subtle: true, children: _jsx(IconAlertCircle, {}) }), _jsx(IconButton, { variant: "text", subtle: true, children: _jsx(IconClock2, {}) })] })),
|
|
110
111
|
};
|
|
111
112
|
export const Sizes = {
|
|
112
|
-
render: () => (_jsxs(Group, { gap:
|
|
113
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { size: "sm", children: _jsx(Icon360View, {}) }), _jsx(IconButton, { size: "md", children: _jsx(IconAdjustments, {}) }), _jsx(IconButton, { size: "lg", children: _jsx(IconArrowsMaximize, {}) })] })),
|
|
113
114
|
};
|
|
114
115
|
export const States = {
|
|
115
|
-
render: () => (_jsxs(Group, { gap:
|
|
116
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { children: _jsx(IconArrowLeft, {}) }), _jsx(IconButton, { disabled: true, children: _jsx(IconCaretDown, {}) }), _jsx(IconButton, { loading: true, children: _jsx(IconLoader2, {}) }), _jsx(IconButton, { shadow: true, children: _jsx(IconArrowLeft, {}) })] })),
|
|
116
117
|
};
|
|
117
118
|
export const SubtleStates = {
|
|
118
|
-
render: () => (_jsxs(Group, { gap:
|
|
119
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { subtle: true, children: _jsx(IconArrowLeft, {}) }), _jsx(IconButton, { subtle: true, disabled: true, children: _jsx(IconCaretDown, {}) }), _jsx(IconButton, { subtle: true, loading: true, children: _jsx(IconLoader2, {}) }), _jsx(IconButton, { subtle: true, shadow: true, children: _jsx(IconArrowLeft, {}) })] })),
|
|
119
120
|
};
|
|
120
121
|
export const CustomStyles = {
|
|
121
|
-
render: () => (_jsxs(Group, { gap:
|
|
122
|
+
render: () => (_jsxs(Group, { gap: spacing.lg, children: [_jsx(IconButton, { styles: {
|
|
122
123
|
root: {
|
|
123
124
|
borderRadius: '20px',
|
|
124
125
|
background: 'linear-gradient(45deg, #ff6b6b, #ee5a24)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/sizes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sizes.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/sizes.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;CAInB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { spacing } from '../../../../constants/spacing';
|
|
1
2
|
const componentSizes = {
|
|
2
|
-
sm: { borderLength:
|
|
3
|
-
md: { borderLength:
|
|
4
|
-
lg: { borderLength:
|
|
3
|
+
sm: { borderLength: 28, padding: spacing.xs, iconSize: 16 },
|
|
4
|
+
md: { borderLength: 36, padding: spacing.xs, iconSize: 20 },
|
|
5
|
+
lg: { borderLength: 48, padding: spacing.xs, iconSize: 24 },
|
|
5
6
|
};
|
|
6
7
|
export { componentSizes };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps as MantineButtonProps } from '@mantine/core';
|
|
3
|
+
import { componentSizes } from '../Button/sizes';
|
|
4
|
+
type OmittedProps = 'variant' | 'leftIcon' | 'rightIcon';
|
|
5
|
+
declare const providers: {
|
|
6
|
+
readonly google: {
|
|
7
|
+
readonly name: "Google";
|
|
8
|
+
readonly icon: import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type SSOProvider = keyof typeof providers;
|
|
12
|
+
interface SSOButtonBase extends Omit<MantineButtonProps, OmittedProps> {
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
size?: keyof typeof componentSizes;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
}
|
|
17
|
+
type WithProvider = SSOButtonBase & {
|
|
18
|
+
/** Shorthand — resolves the provider's name and icon automatically */
|
|
19
|
+
provider: SSOProvider;
|
|
20
|
+
/** Override the resolved provider name */
|
|
21
|
+
providerName?: string;
|
|
22
|
+
/** Override the resolved provider icon */
|
|
23
|
+
providerIcon?: React.ReactNode;
|
|
24
|
+
};
|
|
25
|
+
type WithCustomProvider = SSOButtonBase & {
|
|
26
|
+
provider?: never;
|
|
27
|
+
/** Display name of the provider (e.g. "Google", "Apple") */
|
|
28
|
+
providerName: string;
|
|
29
|
+
/** Provider icon rendered to the left of the label */
|
|
30
|
+
providerIcon: React.ReactNode;
|
|
31
|
+
};
|
|
32
|
+
export type SSOButtonProps = WithProvider | WithCustomProvider;
|
|
33
|
+
export declare const SSOButton: ({ provider, providerName, providerIcon, onClick, size, fullWidth, styles, children, ...props }: SSOButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=SSOButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSOButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/SSOButton/SSOButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA2B,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,KAAK,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;AAEzD,QAAA,MAAM,SAAS;;;;;CAEL,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,SAAS,CAAC;AAEjD,UAAU,aAAc,SAAQ,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC;IACpE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,KAAK,YAAY,GAAG,aAAa,GAAG;IAClC,sEAAsE;IACtE,QAAQ,EAAE,WAAW,CAAC;IACtB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,KAAK,kBAAkB,GAAG,aAAa,GAAG;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,kBAAkB,CAAC;AAE/D,eAAO,MAAM,SAAS,GAAI,gGAUvB,cAAc,4CAwChB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button as MantineButton } from '@mantine/core';
|
|
3
|
+
import { fontBase, fontWeight } from '../../../../constants/font';
|
|
4
|
+
import { componentSizes } from '../Button/sizes';
|
|
5
|
+
import { componentVariants } from '../shared/variants';
|
|
6
|
+
import { GoogleIcon } from '../../../../assets/icons';
|
|
7
|
+
const providers = {
|
|
8
|
+
google: { name: 'Google', icon: _jsx(GoogleIcon, { size: 18 }) },
|
|
9
|
+
};
|
|
10
|
+
export const SSOButton = ({ provider, providerName, providerIcon, onClick, size = 'md', fullWidth = false, styles, children, ...props }) => {
|
|
11
|
+
const resolved = provider ? providers[provider] : undefined;
|
|
12
|
+
const name = providerName !== null && providerName !== void 0 ? providerName : resolved === null || resolved === void 0 ? void 0 : resolved.name;
|
|
13
|
+
const icon = providerIcon !== null && providerIcon !== void 0 ? providerIcon : resolved === null || resolved === void 0 ? void 0 : resolved.icon;
|
|
14
|
+
const selectedVariant = componentVariants['secondary'];
|
|
15
|
+
const selectedSize = componentSizes[size];
|
|
16
|
+
const style = {
|
|
17
|
+
root: {
|
|
18
|
+
borderRadius: '8px',
|
|
19
|
+
width: fullWidth ? '100%' : 'fit-content',
|
|
20
|
+
height: `${selectedSize.height}rem`,
|
|
21
|
+
padding: selectedSize.padding,
|
|
22
|
+
minWidth: `${selectedSize.minWidth}rem`,
|
|
23
|
+
fontSize: selectedSize.fontSize,
|
|
24
|
+
transition: 'background 0.1s ease-in-out',
|
|
25
|
+
...selectedVariant,
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
...fontBase,
|
|
29
|
+
fontWeight: fontWeight['semibold'],
|
|
30
|
+
},
|
|
31
|
+
leftIcon: {
|
|
32
|
+
marginRight: '1rem',
|
|
33
|
+
},
|
|
34
|
+
...styles,
|
|
35
|
+
};
|
|
36
|
+
return (_jsx(MantineButton, { styles: style, size: size, onClick: onClick, leftIcon: icon, ...props, children: children !== null && children !== void 0 ? children : (name ? `Continue with ${name}` : undefined) }));
|
|
37
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { SSOButton } from './SSOButton';
|
|
3
|
+
declare const meta: Meta<typeof SSOButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SSOButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const BuiltInProvider: Story;
|
|
8
|
+
export declare const CustomProviders: Story;
|
|
9
|
+
export declare const Sizes: Story;
|
|
10
|
+
export declare const States: Story;
|
|
11
|
+
export declare const CustomLabels: Story;
|
|
12
|
+
export declare const FullWidth: Story;
|
|
13
|
+
export declare const ProviderOverride: Story;
|
|
14
|
+
//# sourceMappingURL=SSOButton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SSOButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/SSOButton/SSOButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CAmFhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAQ7B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAQpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAUvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAQ9B,CAAC"}
|