@scbt-ecom/ui 0.0.27 → 0.0.30
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/.env +2 -0
- package/.eslintrc.cjs +134 -0
- package/.github/workflows/npm-publish.yml +22 -0
- package/.github/workflows/publish.yml +49 -0
- package/.github/workflows/setup-node/action.yml +22 -0
- package/.husky/pre-commit +1 -0
- package/.prettierrc +19 -0
- package/.storybook/main.ts +44 -0
- package/.storybook/preview.tsx +37 -0
- package/chromatic.config.json +5 -0
- package/index.html +13 -0
- package/lib/client.ts +80 -0
- package/lib/configs/index.ts +1 -0
- package/lib/configs/tailwindConfigBase.ts +110 -0
- package/lib/server.ts +2 -0
- package/lib/shared/constants/api.ts +2 -0
- package/lib/shared/constants/designSystem/colors.ts +117 -0
- package/lib/shared/constants/designSystem/index.ts +3 -0
- package/lib/shared/constants/designSystem/others.ts +18 -0
- package/lib/shared/constants/designSystem/typography.ts +88 -0
- package/lib/shared/constants/index.ts +2 -0
- package/lib/shared/hooks/index.ts +4 -0
- package/lib/shared/hooks/useBoolean.ts +12 -0
- package/lib/shared/hooks/useClickOutside.ts +19 -0
- package/lib/shared/hooks/useControlledForm.ts +16 -0
- package/lib/shared/hooks/useDebounce.ts +38 -0
- package/lib/shared/style.css +74 -0
- package/lib/shared/ui/Badge.tsx +20 -0
- package/lib/shared/ui/Breadcrumbs.tsx +57 -0
- package/lib/shared/ui/ButtonIcon.tsx +52 -0
- package/lib/shared/ui/CustomLink.tsx +70 -0
- package/lib/shared/ui/Document.tsx +51 -0
- package/lib/shared/ui/Heading.tsx +33 -0
- package/lib/shared/ui/Hint.tsx +62 -0
- package/lib/shared/ui/Loader.tsx +58 -0
- package/lib/shared/ui/PhoneView.tsx +23 -0
- package/lib/shared/ui/Portal.tsx +9 -0
- package/lib/shared/ui/ProgressBar.tsx +43 -0
- package/lib/shared/ui/ResponsiveContainer.tsx +11 -0
- package/lib/shared/ui/Section.tsx +15 -0
- package/lib/shared/ui/Skeleton.tsx +9 -0
- package/lib/shared/ui/TabsSwitcher.tsx +80 -0
- package/lib/shared/ui/accordion/Accordion.tsx +36 -0
- package/lib/shared/ui/accordion/index.ts +1 -0
- package/lib/shared/ui/accordion/model/types.ts +20 -0
- package/lib/shared/ui/accordion/ui/AccordionHeader.tsx +35 -0
- package/lib/shared/ui/brandLogos.tsx +14 -0
- package/lib/shared/ui/button/Button.tsx +111 -0
- package/lib/shared/ui/button/index.ts +1 -0
- package/lib/shared/ui/button/model/helpers.ts +16 -0
- package/lib/shared/ui/calendar/Calendar.tsx +228 -0
- package/lib/shared/ui/calendar/index.ts +231 -0
- package/lib/shared/ui/calendar/model/animation.ts +112 -0
- package/lib/shared/ui/calendar/model/classes.ts +34 -0
- package/lib/shared/ui/calendar/model/helpers.ts +51 -0
- package/lib/shared/ui/calendar/model/hooks/index.ts +2 -0
- package/lib/shared/ui/calendar/model/hooks/useCalendarDropdowns.ts +38 -0
- package/lib/shared/ui/calendar/model/hooks/useDatePicker.ts +103 -0
- package/lib/shared/ui/calendar/ui/CalendarHeader.tsx +54 -0
- package/lib/shared/ui/calendar/ui/Dropdown.tsx +75 -0
- package/lib/shared/ui/calendar/ui/NavigationArrows.tsx +23 -0
- package/lib/shared/ui/calendar/ui/Weekdays.tsx +16 -0
- package/lib/shared/ui/calendar/ui/index.ts +2 -0
- package/lib/shared/ui/formControlElements/CheckboxControl.tsx +92 -0
- package/lib/shared/ui/formControlElements/FormControl.tsx +5 -0
- package/lib/shared/ui/formControlElements/InputControl.tsx +68 -0
- package/lib/shared/ui/formControlElements/InputControlMask.tsx +80 -0
- package/lib/shared/ui/formControlElements/RadioControl.tsx +130 -0
- package/lib/shared/ui/formControlElements/SelectControl.tsx +185 -0
- package/lib/shared/ui/formControlElements/SwitchControl.tsx +79 -0
- package/lib/shared/ui/formControlElements/TextareaControl.tsx +92 -0
- package/lib/shared/ui/formControlElements/calendarControl/CalendarControl.tsx +175 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/index.ts +2 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendar.tsx +86 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.ts +38 -0
- package/{dist/shared/ui/formControlElements/calendarControl/index.d.ts → lib/shared/ui/formControlElements/calendarControl/index.ts} +1 -1
- package/lib/shared/ui/formControlElements/calendarControl/model/helpers.ts +60 -0
- package/lib/shared/ui/formControlElements/calendarControl/model/types.ts +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.tsx +53 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.tsx +28 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Dropdown.tsx +62 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Header.tsx +51 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Navigation.tsx +32 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/OptionsList.tsx +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/index.ts +4 -0
- package/lib/shared/ui/formControlElements/dadata/DadataInputControl.tsx +132 -0
- package/{dist/shared/ui/formControlElements/dadata/index.d.ts → lib/shared/ui/formControlElements/dadata/index.ts} +1 -1
- package/lib/shared/ui/formControlElements/dadata/model/api.ts +25 -0
- package/lib/shared/ui/formControlElements/dadata/model/helpers.ts +76 -0
- package/lib/shared/ui/formControlElements/dadata/model/types.ts +52 -0
- package/lib/shared/ui/formControlElements/dadata/model/useDadata.ts +25 -0
- package/{dist/shared/ui/formControlElements/index.d.ts → lib/shared/ui/formControlElements/index.ts} +10 -10
- package/lib/shared/ui/formControlElements/model/classes-types.ts +22 -0
- package/lib/shared/ui/formControlElements/model/index.ts +2 -0
- package/lib/shared/ui/formControlElements/model/props-types.ts +26 -0
- package/lib/shared/ui/formControlElements/ui/FieldAttachment.tsx +66 -0
- package/lib/shared/ui/formControlElements/ui/FieldContainer.tsx +36 -0
- package/lib/shared/ui/formControlElements/ui/FieldWrapper.tsx +55 -0
- package/lib/shared/ui/formControlElements/ui/MessageView.tsx +37 -0
- package/lib/shared/ui/formControlElements/ui/index.ts +4 -0
- package/lib/shared/ui/icon/Icon.tsx +43 -0
- package/{dist/shared/ui/icon/index.d.ts → lib/shared/ui/icon/index.ts} +2 -2
- package/lib/shared/ui/icon/sprite.gen.ts +121 -0
- package/lib/shared/ui/index.ts +56 -0
- package/lib/shared/ui/popover/Popover.tsx +77 -0
- package/lib/shared/ui/popover/index.ts +1 -0
- package/lib/shared/ui/table/Table.tsx +143 -0
- package/lib/shared/ui/table/index.ts +1 -0
- package/lib/shared/ui/table/type.ts +30 -0
- package/lib/shared/utils/capitalize.ts +6 -0
- package/lib/shared/utils/cn.ts +6 -0
- package/lib/shared/utils/deepCompare.ts +1 -0
- package/lib/shared/utils/formatToDate.ts +5 -0
- package/lib/shared/utils/index.ts +5 -0
- package/lib/shared/utils/isClient.ts +1 -0
- package/lib/shared/validation/index.ts +3 -0
- package/lib/shared/validation/messages.ts +12 -0
- package/lib/shared/validation/regExp.ts +5 -0
- package/lib/shared/validation/zodValidation/calendar.ts +32 -0
- package/lib/shared/validation/zodValidation/dadataFio.ts +67 -0
- package/lib/shared/validation/zodValidation/index.ts +2 -0
- package/lib/vite-env.d.ts +2 -0
- package/lib/widgets/Advantages.tsx +45 -0
- package/lib/widgets/banner/Banner.tsx +62 -0
- package/lib/widgets/banner/index.ts +1 -0
- package/lib/widgets/banner/model/helpers.ts +44 -0
- package/lib/widgets/banner/money.png +0 -0
- package/lib/widgets/banner/ui/BannerButtonsGroup.tsx +30 -0
- package/{dist/widgets/index.d.ts → lib/widgets/index.ts} +3 -3
- package/lib/widgets/pageHeader/PageHeader.tsx +54 -0
- package/{dist/widgets/pageHeader/index.d.ts → lib/widgets/pageHeader/index.ts} +1 -1
- package/package.json +10 -12
- package/postcss.config.mjs +8 -0
- package/src/App.tsx +9 -0
- package/src/app/providers/RootProvider.tsx +11 -0
- package/src/app/providers/index.ts +1 -0
- package/src/app/providers/model/types.ts +5 -0
- package/src/app/providers/ui/ToasterProvider.tsx +23 -0
- package/src/app/providers/ui/index.ts +1 -0
- package/src/configs/setup.ts +9 -0
- package/src/configs/storybook.config.ts +23 -0
- package/src/main.tsx +10 -0
- package/src/stories/primitives/Accordion.stories.tsx +66 -0
- package/src/stories/primitives/Badge.stories.tsx +28 -0
- package/src/stories/primitives/Breadcrumbs.stories.tsx +29 -0
- package/src/stories/primitives/Button/Button.stories.tsx +149 -0
- package/src/stories/primitives/Button/Button.test.tsx +150 -0
- package/src/stories/primitives/ButtonIcon.stories.tsx +75 -0
- package/src/stories/primitives/CustomLink.stories.tsx +64 -0
- package/src/stories/primitives/Document.stories.tsx +36 -0
- package/src/stories/primitives/Heading.stories.tsx +29 -0
- package/src/stories/primitives/Hint.stories.tsx +82 -0
- package/src/stories/primitives/Icon.stories.tsx +36 -0
- package/src/stories/primitives/Loader.stories.tsx +39 -0
- package/src/stories/primitives/PhoneView.stories.tsx +22 -0
- package/src/stories/primitives/Popover.stories.tsx +41 -0
- package/src/stories/primitives/ProgressBar.stories.tsx +68 -0
- package/src/stories/primitives/Skeleton.stories.tsx +21 -0
- package/src/stories/primitives/Table.stories.tsx +44 -0
- package/src/stories/primitives/TabsSwitcher.stories.tsx +34 -0
- package/src/stories/primitives/formControl/Calendar.stories.tsx +61 -0
- package/src/stories/primitives/formControl/CalendarControl.stories.tsx +39 -0
- package/src/stories/primitives/formControl/CheckboxControl.stories.tsx +64 -0
- package/src/stories/primitives/formControl/DadataInputControl.stories.tsx +83 -0
- package/src/stories/primitives/formControl/FormControlAllFields.stories.tsx +25 -0
- package/src/stories/primitives/formControl/InputControl.stories.tsx +77 -0
- package/src/stories/primitives/formControl/RadioContol.stories.tsx +63 -0
- package/src/stories/primitives/formControl/SelectControl.stories.tsx +117 -0
- package/src/stories/primitives/formControl/SwitchControl.stories.tsx +51 -0
- package/src/stories/primitives/formControl/TextareaControl.stories.tsx +55 -0
- package/src/stories/primitives/formControl/inputControlMask.stories.tsx +69 -0
- package/src/stories/widgets/Advantages.stories.tsx +42 -0
- package/src/stories/widgets/Banner.stories.tsx +40 -0
- package/src/stories/widgets/PageHeader.stories.tsx +33 -0
- package/src/storybookHelpers/actions.tsx +5 -0
- package/src/storybookHelpers/index.ts +2 -0
- package/src/storybookHelpers/reactHookForm/index.ts +3 -0
- package/src/storybookHelpers/reactHookForm/model/mockData.ts +21 -0
- package/src/storybookHelpers/reactHookForm/model/mocks.tsx +71 -0
- package/src/storybookHelpers/reactHookForm/model/types.ts +62 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFieldsMapper.tsx +76 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFormProvider.tsx +43 -0
- package/src/storybookHelpers/reactHookForm/ui/index.ts +2 -0
- package/src/storybookHelpers/table/utils/defaultValue.ts +51 -0
- package/static/arrows/arrowCircle.svg +18 -0
- package/static/arrows/arrowLink.svg +3 -0
- package/static/arrows/arrowRight.svg +3 -0
- package/static/brandLogos/logoBlack.svg +14 -0
- package/static/brandLogos/logoBusiness.svg +80 -0
- package/static/brandLogos/logoGray.svg +56 -0
- package/static/brandLogos/logoInsurance.svg +124 -0
- package/static/brandLogos/logoMain.svg +14 -0
- package/static/brandLogos/logoWhite.svg +56 -0
- package/static/files/documentFilled.svg +4 -0
- package/static/files/documentOutline.svg +4 -0
- package/static/general/calendar.svg +3 -0
- package/static/general/check.svg +6 -0
- package/static/general/close.svg +12 -0
- package/static/info/warningCircle.svg +5 -0
- package/tailwind.config.ts +9 -0
- package/tsconfig.json +33 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +63 -0
- package/vitest.config.mjs +12 -0
- package/dist/ExampleContainer.d.ts +0 -5
- package/dist/configs/index.d.ts +0 -1
- package/dist/configs/tailwindConfigBase.d.ts +0 -2
- package/dist/index.d.ts +0 -8
- package/dist/shared/constants/api.d.ts +0 -2
- package/dist/shared/constants/designSystem/colors.d.ts +0 -120
- package/dist/shared/constants/designSystem/index.d.ts +0 -3
- package/dist/shared/constants/designSystem/others.d.ts +0 -16
- package/dist/shared/constants/designSystem/typography.d.ts +0 -75
- package/dist/shared/constants/index.d.ts +0 -2
- package/dist/shared/hooks/index.d.ts +0 -4
- package/dist/shared/hooks/useBoolean.d.ts +0 -3
- package/dist/shared/hooks/useClickOutside.d.ts +0 -2
- package/dist/shared/hooks/useControlledForm.d.ts +0 -7
- package/dist/shared/hooks/useDebounce.d.ts +0 -3
- package/dist/shared/ui/Badge.d.ts +0 -6
- package/dist/shared/ui/Breadcrumbs.d.ts +0 -15
- package/dist/shared/ui/ButtonIcon.d.ts +0 -17
- package/dist/shared/ui/CustomLink.d.ts +0 -15
- package/dist/shared/ui/Document.d.ts +0 -13
- package/dist/shared/ui/Heading.d.ts +0 -12
- package/dist/shared/ui/Hint.d.ts +0 -21
- package/dist/shared/ui/Loader.d.ts +0 -21
- package/dist/shared/ui/PhoneView.d.ts +0 -12
- package/dist/shared/ui/Portal.d.ts +0 -7
- package/dist/shared/ui/ProgressBar.d.ts +0 -18
- package/dist/shared/ui/ResponsiveContainer.d.ts +0 -6
- package/dist/shared/ui/Section.d.ts +0 -6
- package/dist/shared/ui/Skeleton.d.ts +0 -4
- package/dist/shared/ui/TabsSwitcher.d.ts +0 -33
- package/dist/shared/ui/accordion/Accordion.d.ts +0 -13
- package/dist/shared/ui/accordion/index.d.ts +0 -1
- package/dist/shared/ui/accordion/model/types.d.ts +0 -17
- package/dist/shared/ui/accordion/ui/AccordionHeader.d.ts +0 -8
- package/dist/shared/ui/brandLogos.d.ts +0 -5
- package/dist/shared/ui/button/Button.d.ts +0 -17
- package/dist/shared/ui/button/index.d.ts +0 -1
- package/dist/shared/ui/button/model/helpers.d.ts +0 -2
- package/dist/shared/ui/calendar/Calendar.d.ts +0 -20
- package/dist/shared/ui/calendar/index.d.ts +0 -1
- package/dist/shared/ui/calendar/model/animation.d.ts +0 -18
- package/dist/shared/ui/calendar/model/classes.d.ts +0 -24
- package/dist/shared/ui/calendar/model/helpers.d.ts +0 -9
- package/dist/shared/ui/calendar/model/hooks/index.d.ts +0 -2
- package/dist/shared/ui/calendar/model/hooks/useCalendarDropdowns.d.ts +0 -9
- package/dist/shared/ui/calendar/model/hooks/useDatePicker.d.ts +0 -19
- package/dist/shared/ui/calendar/ui/CalendarHeader.d.ts +0 -15
- package/dist/shared/ui/calendar/ui/Dropdown.d.ts +0 -10
- package/dist/shared/ui/calendar/ui/NavigationArrows.d.ts +0 -5
- package/dist/shared/ui/calendar/ui/Weekdays.d.ts +0 -1
- package/dist/shared/ui/calendar/ui/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/CheckboxControl.d.ts +0 -13
- package/dist/shared/ui/formControlElements/FormControl.d.ts +0 -3
- package/dist/shared/ui/formControlElements/InputControl.d.ts +0 -6
- package/dist/shared/ui/formControlElements/InputControlMask.d.ts +0 -10
- package/dist/shared/ui/formControlElements/RadioControl.d.ts +0 -26
- package/dist/shared/ui/formControlElements/SelectControl.d.ts +0 -27
- package/dist/shared/ui/formControlElements/SwitchControl.d.ts +0 -16
- package/dist/shared/ui/formControlElements/TextareaControl.d.ts +0 -11
- package/dist/shared/ui/formControlElements/calendarControl/CalendarControl.d.ts +0 -13
- package/dist/shared/ui/formControlElements/calendarControl/hooks/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendar.d.ts +0 -16
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.d.ts +0 -9
- package/dist/shared/ui/formControlElements/calendarControl/model/helpers.d.ts +0 -24
- package/dist/shared/ui/formControlElements/calendarControl/model/types.d.ts +0 -33
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.d.ts +0 -10
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.d.ts +0 -6
- package/dist/shared/ui/formControlElements/calendarControl/ui/Dropdown.d.ts +0 -11
- package/dist/shared/ui/formControlElements/calendarControl/ui/Header.d.ts +0 -14
- package/dist/shared/ui/formControlElements/calendarControl/ui/Navigation.d.ts +0 -9
- package/dist/shared/ui/formControlElements/calendarControl/ui/OptionsList.d.ts +0 -5
- package/dist/shared/ui/formControlElements/calendarControl/ui/index.d.ts +0 -4
- package/dist/shared/ui/formControlElements/dadata/DadataInputControl.d.ts +0 -14
- package/dist/shared/ui/formControlElements/dadata/model/api.d.ts +0 -2
- package/dist/shared/ui/formControlElements/dadata/model/helpers.d.ts +0 -7
- package/dist/shared/ui/formControlElements/dadata/model/types.d.ts +0 -42
- package/dist/shared/ui/formControlElements/dadata/model/useDadata.d.ts +0 -7
- package/dist/shared/ui/formControlElements/model/classes-types.d.ts +0 -18
- package/dist/shared/ui/formControlElements/model/index.d.ts +0 -2
- package/dist/shared/ui/formControlElements/model/props-types.d.ts +0 -20
- package/dist/shared/ui/formControlElements/ui/FieldAttachment.d.ts +0 -13
- package/dist/shared/ui/formControlElements/ui/FieldContainer.d.ts +0 -14
- package/dist/shared/ui/formControlElements/ui/FieldWrapper.d.ts +0 -14
- package/dist/shared/ui/formControlElements/ui/MessageView.d.ts +0 -13
- package/dist/shared/ui/formControlElements/ui/index.d.ts +0 -4
- package/dist/shared/ui/icon/Icon.d.ts +0 -10
- package/dist/shared/ui/icon/sprite.gen.d.ts +0 -17
- package/dist/shared/ui/index.d.ts +0 -21
- package/dist/shared/ui/popover/Popover.d.ts +0 -23
- package/dist/shared/ui/popover/index.d.ts +0 -1
- package/dist/shared/ui/table/Table.d.ts +0 -17
- package/dist/shared/ui/table/index.d.ts +0 -1
- package/dist/shared/ui/table/type.d.ts +0 -21
- package/dist/shared/utils/capitalize.d.ts +0 -1
- package/dist/shared/utils/cn.d.ts +0 -2
- package/dist/shared/utils/deepCompare.d.ts +0 -1
- package/dist/shared/utils/formatToDate.d.ts +0 -1
- package/dist/shared/utils/index.d.ts +0 -5
- package/dist/shared/utils/isClient.d.ts +0 -1
- package/dist/shared/validation/index.d.ts +0 -3
- package/dist/shared/validation/messages.d.ts +0 -12
- package/dist/shared/validation/regExp.d.ts +0 -3
- package/dist/shared/validation/zodValidation/calendar.d.ts +0 -2
- package/dist/shared/validation/zodValidation/dadataFio.d.ts +0 -6
- package/dist/shared/validation/zodValidation/index.d.ts +0 -2
- package/dist/style.css +0 -1
- package/dist/ui.es.js +0 -25268
- package/dist/ui.umd.js +0 -85
- package/dist/widgets/Advantages.d.ts +0 -17
- package/dist/widgets/banner/Banner.d.ts +0 -28
- package/dist/widgets/banner/index.d.ts +0 -1
- package/dist/widgets/banner/model/helpers.d.ts +0 -4
- package/dist/widgets/banner/ui/BannerButtonsGroup.d.ts +0 -12
- package/dist/widgets/pageHeader/PageHeader.d.ts +0 -16
- /package/{dist → public}/sprites/arrows.svg +0 -0
- /package/{dist → public}/sprites/brandLogos.svg +0 -0
- /package/{dist → public}/sprites/common.svg +0 -0
- /package/{dist → public}/sprites/files.svg +0 -0
- /package/{dist → public}/sprites/general.svg +0 -0
- /package/{dist → public}/sprites/info.svg +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const allowedBorderRadius = {
|
|
2
|
+
none: '0',
|
|
3
|
+
sm: '4px',
|
|
4
|
+
md: '8px',
|
|
5
|
+
lg: '16px',
|
|
6
|
+
full: '9999px'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const allowedBackgroundDeg = {
|
|
10
|
+
30: '30deg',
|
|
11
|
+
45: '45deg',
|
|
12
|
+
80: '80deg',
|
|
13
|
+
90: '90deg',
|
|
14
|
+
110: '110deg',
|
|
15
|
+
180: '180deg'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { allowedBorderRadius, allowedBackgroundDeg }
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const allowedFontSize = {
|
|
2
|
+
12: '12px',
|
|
3
|
+
14: '14px',
|
|
4
|
+
16: '16px',
|
|
5
|
+
18: '18px',
|
|
6
|
+
20: '20px',
|
|
7
|
+
24: '24px',
|
|
8
|
+
28: '28px',
|
|
9
|
+
32: '32px',
|
|
10
|
+
40: '40px'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const allowedLineHeight = {
|
|
14
|
+
16: '16px',
|
|
15
|
+
20: '20px',
|
|
16
|
+
22: '22px',
|
|
17
|
+
24: '24px',
|
|
18
|
+
30: '30px',
|
|
19
|
+
32: '32px',
|
|
20
|
+
40: '40px',
|
|
21
|
+
48: '48px'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const allowedTextStyles = {
|
|
25
|
+
/* # Headline */
|
|
26
|
+
'.mob-headline-bold-m': {
|
|
27
|
+
'@apply font-bold text-28 leading-32': ''
|
|
28
|
+
},
|
|
29
|
+
'.mob-headline-bold-s': {
|
|
30
|
+
'@apply font-bold text-24 leading-30': ''
|
|
31
|
+
},
|
|
32
|
+
/* # Title */
|
|
33
|
+
'.mob-title-bold-l': {
|
|
34
|
+
'@apply font-bold text-20 leading-24': ''
|
|
35
|
+
},
|
|
36
|
+
'.mob-title-bold-m': {
|
|
37
|
+
'@apply font-bold text-18 leading-22': ''
|
|
38
|
+
},
|
|
39
|
+
/* # Body */
|
|
40
|
+
'.mob-body-medium-l': {
|
|
41
|
+
'@apply font-medium text-16 leading-22': ''
|
|
42
|
+
},
|
|
43
|
+
'.mob-body-regular-l': {
|
|
44
|
+
'@apply font-normal text-16 leading-22': ''
|
|
45
|
+
},
|
|
46
|
+
'.mob-body-medium-m': {
|
|
47
|
+
'@apply font-medium text-14 leading-20': ''
|
|
48
|
+
},
|
|
49
|
+
'.mob-body-regular-m': {
|
|
50
|
+
'@apply font-normal text-14 leading-20': ''
|
|
51
|
+
},
|
|
52
|
+
'.mob-body-regular-s': {
|
|
53
|
+
'@apply font-normal text-12 leading-20': ''
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/* -------- Desktop Typography -------- */
|
|
57
|
+
/* # Headline */
|
|
58
|
+
'.desk-headline-bold-l': {
|
|
59
|
+
'@apply font-bold text-40 leading-48': ''
|
|
60
|
+
},
|
|
61
|
+
'.desk-headline-bold-m': {
|
|
62
|
+
'@apply font-bold text-32 leading-40': ''
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/* # Title */
|
|
66
|
+
'.desk-title-bold-l': {
|
|
67
|
+
'@apply font-bold text-24 leading-30': ''
|
|
68
|
+
},
|
|
69
|
+
'.desk-title-bold-s': {
|
|
70
|
+
'@apply font-bold text-18 leading-22': ''
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/* # Body */
|
|
74
|
+
'.desk-body-medium-l': {
|
|
75
|
+
'@apply font-medium text-16 leading-22': ''
|
|
76
|
+
},
|
|
77
|
+
'.desk-body-regular-l': {
|
|
78
|
+
'@apply font-normal text-16 leading-22': ''
|
|
79
|
+
},
|
|
80
|
+
'.desk-body-regular-m': {
|
|
81
|
+
'@apply font-normal text-14 leading-20': ''
|
|
82
|
+
},
|
|
83
|
+
'.desk-body-regular-s': {
|
|
84
|
+
'@apply font-normal text-12 leading-16': ''
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { allowedLineHeight, allowedFontSize, allowedTextStyles }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
type UseBooleanReturn = [value: boolean, action: (val?: boolean) => void]
|
|
6
|
+
|
|
7
|
+
export const useBoolean = (initialValue = false): UseBooleanReturn => {
|
|
8
|
+
const [value, setValue] = React.useState(initialValue)
|
|
9
|
+
const action = (val?: boolean) => setValue((prevValue) => val ?? !prevValue)
|
|
10
|
+
|
|
11
|
+
return [value, action]
|
|
12
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
export const useClickOutside = (ref: React.RefObject<HTMLElement>, callback: () => void) => {
|
|
6
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
7
|
+
if (ref.current && !ref.current.contains(event.target as Node)) {
|
|
8
|
+
callback()
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
document.addEventListener('mousedown', handleClickOutside)
|
|
14
|
+
return () => {
|
|
15
|
+
document.removeEventListener('mousedown', handleClickOutside)
|
|
16
|
+
}
|
|
17
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
+
}, [ref, callback])
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { useForm, type UseFormProps } from 'react-hook-form'
|
|
4
|
+
import { zodResolver } from '@hookform/resolvers/zod'
|
|
5
|
+
import { type TypeOf, type ZodTypeAny } from 'zod'
|
|
6
|
+
|
|
7
|
+
interface UseControlledForm<T extends ZodTypeAny> extends UseFormProps<TypeOf<T>> {
|
|
8
|
+
schema: T
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const useControlledForm = <T extends ZodTypeAny>({ schema, ...formConfig }: UseControlledForm<T>) => {
|
|
12
|
+
return useForm({
|
|
13
|
+
...formConfig,
|
|
14
|
+
resolver: zodResolver(schema)
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
export const debounce = <Params extends unknown[]>(
|
|
6
|
+
callback: (...args: Params) => void,
|
|
7
|
+
delay: number
|
|
8
|
+
): ((...args: Params) => void) => {
|
|
9
|
+
let timer: ReturnType<typeof setTimeout>
|
|
10
|
+
|
|
11
|
+
return function (...args: Params) {
|
|
12
|
+
clearTimeout(timer)
|
|
13
|
+
timer = setTimeout(() => callback(...args), delay)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const useDebounceCallback = <Params extends unknown[], Return>(callback: (...args: Params) => Return, delay: number) => {
|
|
18
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
+
const debounced = React.useMemo(() => debounce(callback, delay), [delay])
|
|
20
|
+
|
|
21
|
+
return debounced
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useDebounceValue = <Value>(value: Value, delay: number) => {
|
|
25
|
+
const previousValueRef = React.useRef(value)
|
|
26
|
+
const [debouncedValue, setDebounceValue] = React.useState(value)
|
|
27
|
+
|
|
28
|
+
const debouncedSetState = useDebounceCallback(setDebounceValue, delay)
|
|
29
|
+
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (previousValueRef.current === value) return
|
|
32
|
+
debouncedSetState(value)
|
|
33
|
+
previousValueRef.current = value
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [value])
|
|
36
|
+
|
|
37
|
+
return debouncedValue
|
|
38
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');
|
|
2
|
+
|
|
3
|
+
@tailwind base;
|
|
4
|
+
@tailwind components;
|
|
5
|
+
@tailwind utilities;
|
|
6
|
+
|
|
7
|
+
@layer utilities {
|
|
8
|
+
.text-balance {
|
|
9
|
+
text-wrap: balance;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:root {
|
|
14
|
+
--ff-roboto: 'Roboto', sans-serif;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@layer components {
|
|
18
|
+
/* # Custom scroll */
|
|
19
|
+
.customScrollbar-y::-webkit-scrollbar {
|
|
20
|
+
width: 4px;
|
|
21
|
+
height: 4px;
|
|
22
|
+
}
|
|
23
|
+
.customScrollbar-y::-webkit-scrollbar-track {
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
background: #d4dbe2;
|
|
26
|
+
}
|
|
27
|
+
.customScrollbar-y::-webkit-scrollbar-thumb {
|
|
28
|
+
background: #a9b6c5;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
}
|
|
31
|
+
.scrollHidden::-webkit-scrollbar {
|
|
32
|
+
width: 0;
|
|
33
|
+
height: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.progressBar-apply {
|
|
37
|
+
background-image: repeating-linear-gradient(-33deg, #d4dbe2, #d4dbe2 5px, #f3f4f7 0, #f3f4f7 14px);
|
|
38
|
+
background-size: 2000% 2000%;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.skeleton-apply {
|
|
42
|
+
background: linear-gradient(80deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
|
|
43
|
+
background-size: 200% 100%;
|
|
44
|
+
animation: 1.5s shine linear infinite;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rdp-vhidden {
|
|
48
|
+
@apply hidden;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
* {
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
padding: 0;
|
|
55
|
+
margin: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
body,
|
|
59
|
+
html {
|
|
60
|
+
font-family: var(--ff-roboto);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input:-webkit-autofill,
|
|
64
|
+
input:-webkit-autofill:hover,
|
|
65
|
+
input:-webkit-autofill:focus,
|
|
66
|
+
input:-webkit-autofill:active {
|
|
67
|
+
transition: background-color 5000s ease-in-out 0s;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@keyframes shine {
|
|
71
|
+
to {
|
|
72
|
+
background-position-x: -200%;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactElement } from 'react'
|
|
2
|
+
import { cn } from '$/shared/utils'
|
|
3
|
+
|
|
4
|
+
export interface IBadgeProps {
|
|
5
|
+
children: ReactElement | string
|
|
6
|
+
className?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Badge = ({ children, className }: IBadgeProps) => {
|
|
10
|
+
return (
|
|
11
|
+
<span
|
|
12
|
+
className={cn(
|
|
13
|
+
'min-h-6 min-w-6 px-2 py-1 flex items-center justify-center rounded-full desk-body-regular-s bg-color-primary-default text-color-white text-nowrap',
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</span>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cn } from '../utils'
|
|
2
|
+
import { Icon } from './icon/Icon'
|
|
3
|
+
|
|
4
|
+
export interface IBreadcrumbLink {
|
|
5
|
+
label: string
|
|
6
|
+
path: string
|
|
7
|
+
isDisabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
interface IBreadcrumbLinkWithoutPath {
|
|
10
|
+
label: string
|
|
11
|
+
isDisabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type TLinksList = [...IBreadcrumbLink[], IBreadcrumbLinkWithoutPath]
|
|
15
|
+
|
|
16
|
+
export interface IBreadcrumbsProps {
|
|
17
|
+
linksList: TLinksList
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Breadcrumbs = ({ linksList }: IBreadcrumbsProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<div aria-label='Breadcrumb' className='max-w-[840px] flex items-center gap-2'>
|
|
23
|
+
{linksList.map((link) => (
|
|
24
|
+
<>
|
|
25
|
+
{'path' in link ? (
|
|
26
|
+
<div
|
|
27
|
+
className={cn(
|
|
28
|
+
'flex items-center gap-1 px-1 border-2 border-solid border-transparent rounded-sm focus-within:border-primary-focus',
|
|
29
|
+
{ '!border-transparent pointer-events-none': link?.isDisabled }
|
|
30
|
+
)}
|
|
31
|
+
>
|
|
32
|
+
<a
|
|
33
|
+
href={link.path}
|
|
34
|
+
target='_blank'
|
|
35
|
+
rel='noreferrer'
|
|
36
|
+
className={cn(
|
|
37
|
+
'desk-body-regular-m text-color-primary-default hover:text-color-primary-hover outline-none focus:text-color-primary-default',
|
|
38
|
+
{ '!text-color-disabled': link?.isDisabled }
|
|
39
|
+
)}
|
|
40
|
+
>
|
|
41
|
+
{link.label}
|
|
42
|
+
</a>
|
|
43
|
+
<Icon
|
|
44
|
+
name='arrows/arrowRight'
|
|
45
|
+
className={cn('text-icon-primary-default size-4', { '!text-icon-disabled': link?.isDisabled })}
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
) : (
|
|
49
|
+
<div aria-current='page' className='text-color-blue-grey-600 desk-body-regular-m'>
|
|
50
|
+
{link.label}
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
</>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { type ComponentProps, forwardRef, type ReactElement } from 'react'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { cn } from '$/shared/utils'
|
|
6
|
+
|
|
7
|
+
type TButtonClasses = {
|
|
8
|
+
button: string
|
|
9
|
+
icon: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const buttonConfig = cva(
|
|
13
|
+
'group flex items-center justify-center cursor-pointer rounded-full outline-offset-[3px] outline-transparent outline-2 transition duration-12 active:scale-[0.97] disabled:pointer-events-none',
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
intent: {
|
|
17
|
+
primary:
|
|
18
|
+
'text-icon-white bg-color-primary-default hover:bg-color-primary-hover active:bg-color-primary-hover focus:bg-color-primary-hover focus:outline-primary-focus disabled:bg-color-primary-disabled',
|
|
19
|
+
secondary:
|
|
20
|
+
'text-icon-primary-default bg-color-transparent border border-solid outline-offset-4 border-primary-default hover:bg-color-primary-tr-hover hover:text-icon-primary-default hover:border-primary-hover active:bg-color-primary-tr-pressed active:border-primary-hover active:text-icon-primary-hover focus:bg-color-primary-tr-focus focus:outline-primary-focus disabled:bg-color-blue-grey-200 disabled:border-transparent disabled:text-icon-primary-disabled',
|
|
21
|
+
ghost:
|
|
22
|
+
'text-icon-primary-default bg-color-transparent hover:bg-color-primary-tr-hover focus:bg-color-primary-tr-focus focus:outline-primary-focus active:text-icon-primary-hover active:bg-color-primary-tr-pressed disabled:bg-color-transparent disabled:text-icon-primary-disabled'
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
sm: 'size-8',
|
|
26
|
+
md: 'size-10',
|
|
27
|
+
lg: 'size-12'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
intent: 'primary',
|
|
32
|
+
size: 'lg'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
type TButtonProps = VariantProps<typeof buttonConfig>
|
|
38
|
+
|
|
39
|
+
export interface IButtonIconProps extends ComponentProps<'button'>, TButtonProps {
|
|
40
|
+
children: ReactElement
|
|
41
|
+
classes?: Partial<TButtonClasses>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const ButtonIcon = forwardRef<HTMLButtonElement, IButtonIconProps>(
|
|
45
|
+
({ size, intent, children, classes, type = 'button', ...props }, ref) => {
|
|
46
|
+
return (
|
|
47
|
+
<button ref={ref} type={type} className={cn(buttonConfig({ intent, size }), classes?.button)} {...props}>
|
|
48
|
+
<span className={cn(classes?.icon)}>{children}</span>
|
|
49
|
+
</button>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { cn } from '../utils'
|
|
4
|
+
import { Icon, type TAllowedIcons } from './icon/Icon'
|
|
5
|
+
|
|
6
|
+
const customLinkConfig = cva(
|
|
7
|
+
'group desk-body-regular-l underline underline-offset-4 outline-none p-[2px] rounded-sm border border-solid border-transparent',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
intent: {
|
|
11
|
+
blue: 'text-color-primary-default hover:text-color-primary-hover focus:text-color-primary-default focus:border-primary-focus',
|
|
12
|
+
white: 'text-color-white hover:text-color-footer focus:text-color-white focus:border-primary-focus'
|
|
13
|
+
},
|
|
14
|
+
withIcon: {
|
|
15
|
+
true: 'flex items-center gap-1',
|
|
16
|
+
false: ''
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
true: '!text-color-primary-disabled pointer-events-none !border-transparent',
|
|
20
|
+
false: ''
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
intent: 'blue',
|
|
25
|
+
withIcon: true,
|
|
26
|
+
disabled: false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
const linkArrowConfig = cva('size-6', {
|
|
32
|
+
variants: {
|
|
33
|
+
intent: {
|
|
34
|
+
blue: 'text-icon-primary-default group-hover:text-icon-primary-hover group-focus:text-icon-primary-default ',
|
|
35
|
+
white: 'text-icon-white group-hover:text-icon-footer group-focus:text-icon-white'
|
|
36
|
+
},
|
|
37
|
+
disabled: {
|
|
38
|
+
true: '!text-icon-primary-disabled pointer-events-none',
|
|
39
|
+
false: ''
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
intent: 'blue',
|
|
44
|
+
disabled: false
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
type TCustomLinkConfig = VariantProps<typeof customLinkConfig>
|
|
49
|
+
|
|
50
|
+
export interface ICustomLinkProps extends TCustomLinkConfig, ComponentProps<'a'> {
|
|
51
|
+
Component: 'a'
|
|
52
|
+
icon?: TAllowedIcons
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const CustomLink = ({
|
|
56
|
+
Component,
|
|
57
|
+
intent,
|
|
58
|
+
children,
|
|
59
|
+
withIcon,
|
|
60
|
+
disabled,
|
|
61
|
+
icon = 'arrows/arrowLink',
|
|
62
|
+
...props
|
|
63
|
+
}: ICustomLinkProps) => {
|
|
64
|
+
return (
|
|
65
|
+
<Component className={cn(customLinkConfig({ intent, withIcon, disabled }))} {...props}>
|
|
66
|
+
{children}
|
|
67
|
+
{withIcon && <Icon name={icon} className={cn(linkArrowConfig({ intent, disabled }))} />}
|
|
68
|
+
</Component>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
+
import { Icon, type TAllowedIcons } from './icon'
|
|
3
|
+
import { cn } from '$/shared/utils'
|
|
4
|
+
|
|
5
|
+
const iconConfig = cva('size-8 transition-colors', {
|
|
6
|
+
variants: {
|
|
7
|
+
intent: {
|
|
8
|
+
outline: 'text-icon-secondary-dark-default group-hover:text-icon-secondary-dark-hover',
|
|
9
|
+
filled: 'text-icon-primary-default group-hover:text-icon-primary-hover'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
intent: 'outline'
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
type TIconConfig = VariantProps<typeof iconConfig>
|
|
18
|
+
|
|
19
|
+
const iconVariant: Record<NonNullable<TIconConfig['intent']>, TAllowedIcons> = {
|
|
20
|
+
filled: 'files/documentFilled',
|
|
21
|
+
outline: 'files/documentOutline'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface IDocumentProps extends TIconConfig {
|
|
25
|
+
text: string
|
|
26
|
+
size: number
|
|
27
|
+
sizeType: 'КБ' | 'МБ'
|
|
28
|
+
href: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Document = ({ text, size, sizeType, href, intent = 'outline' }: IDocumentProps) => {
|
|
32
|
+
return (
|
|
33
|
+
<a
|
|
34
|
+
href={href}
|
|
35
|
+
target='_blank'
|
|
36
|
+
rel='noreferrer'
|
|
37
|
+
tabIndex={0}
|
|
38
|
+
className={cn(
|
|
39
|
+
'flex items-center gap-2 cursor-pointer group outline outline-2 outline-transparent transition-colors focus-within:outline-primary-focus rounded-sm p-1 max-w-[288px] desktop:max-w-[592px]'
|
|
40
|
+
)}
|
|
41
|
+
>
|
|
42
|
+
<Icon name={iconVariant[intent!]} className={cn(iconConfig({ intent }))} />
|
|
43
|
+
<div className={cn('flex flex-col flex-1')}>
|
|
44
|
+
<p className={cn('desk-body-medium-l text-color-dark ')}>{text}</p>
|
|
45
|
+
<div className={cn('desk-body-regular-m text-color-disabled')}>
|
|
46
|
+
{size} {sizeType}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</a>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
3
|
+
import { cn } from '$/shared/utils'
|
|
4
|
+
|
|
5
|
+
const headingConfig = cva('', {
|
|
6
|
+
variants: {
|
|
7
|
+
as: {
|
|
8
|
+
h1: 'mob-headline-bold-m desktop:desk-headline-bold-l',
|
|
9
|
+
h2: 'mob-headline-bold-s desktop:desk-headline-bold-m',
|
|
10
|
+
h3: 'mob-title-bold-l desktop:desk-title-bold-l',
|
|
11
|
+
h4: 'mob-title-bold-m desktop:desk-title-bold-s'
|
|
12
|
+
// # add h5 and h6 if need
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
as: 'h2'
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export interface IHeadingProps extends VariantProps<typeof headingConfig> {
|
|
21
|
+
children: ReactNode
|
|
22
|
+
className?: string
|
|
23
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Heading = ({ as = 'h2', children, className, ...props }: IHeadingProps) => {
|
|
27
|
+
const Element = as
|
|
28
|
+
return (
|
|
29
|
+
<Element className={cn(headingConfig({ as }), className)} {...props}>
|
|
30
|
+
{children}
|
|
31
|
+
</Element>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type { TooltipContentProps } from '@radix-ui/react-tooltip'
|
|
5
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip'
|
|
6
|
+
import { cn } from '$/shared/utils'
|
|
7
|
+
|
|
8
|
+
type TAdditionalClasses = {
|
|
9
|
+
content: string
|
|
10
|
+
arrow: string
|
|
11
|
+
trigger: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IHintContentProps extends TooltipContentProps {
|
|
15
|
+
delayDuration?: number
|
|
16
|
+
sideOffset?: number
|
|
17
|
+
align?: 'end' | 'center' | 'start'
|
|
18
|
+
side?: 'top' | 'right' | 'bottom' | 'left'
|
|
19
|
+
defaultOpen?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface IHintProps extends IHintContentProps {
|
|
23
|
+
triggerElement: React.ReactElement
|
|
24
|
+
children: React.ReactElement | string
|
|
25
|
+
classes?: Partial<TAdditionalClasses>
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const Hint = ({
|
|
29
|
+
triggerElement,
|
|
30
|
+
children,
|
|
31
|
+
delayDuration = 250,
|
|
32
|
+
sideOffset = 6,
|
|
33
|
+
align = 'center',
|
|
34
|
+
side = 'top',
|
|
35
|
+
defaultOpen = false,
|
|
36
|
+
classes,
|
|
37
|
+
...contentProps
|
|
38
|
+
}: IHintProps) => {
|
|
39
|
+
return (
|
|
40
|
+
<TooltipPrimitive.Provider>
|
|
41
|
+
<TooltipPrimitive.Root defaultOpen={defaultOpen} delayDuration={delayDuration}>
|
|
42
|
+
<TooltipPrimitive.Trigger asChild className={cn('cursor-pointer', classes?.trigger)}>
|
|
43
|
+
{triggerElement}
|
|
44
|
+
</TooltipPrimitive.Trigger>
|
|
45
|
+
<TooltipPrimitive.Content
|
|
46
|
+
onPointerDownOutside={(event) => event.preventDefault()}
|
|
47
|
+
className={cn(
|
|
48
|
+
'bg-color-white text-color-dark desk-body-regular-m w-48 p-4 rounded-sm origin-center shadow-sm animate-scale-in',
|
|
49
|
+
classes?.content
|
|
50
|
+
)}
|
|
51
|
+
sideOffset={sideOffset}
|
|
52
|
+
align={align}
|
|
53
|
+
side={side}
|
|
54
|
+
{...contentProps}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
<TooltipPrimitive.Arrow width={12} height={6} className={cn('fill-white', classes?.arrow)} />
|
|
58
|
+
</TooltipPrimitive.Content>
|
|
59
|
+
</TooltipPrimitive.Root>
|
|
60
|
+
</TooltipPrimitive.Provider>
|
|
61
|
+
)
|
|
62
|
+
}
|