@design-system-rte/core 1.2.1 → 1.2.2-rc1
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/common/animation.d.ts +2 -0
- package/common/animation.d.ts.map +1 -0
- package/common/animation.js +5 -0
- package/common/index.d.ts +3 -0
- package/common/index.d.ts.map +1 -0
- package/common/index.js +2 -0
- package/components/assistive-text/assistive-text.constants.d.ts +4 -0
- package/components/assistive-text/assistive-text.constants.d.ts.map +1 -0
- package/components/assistive-text/assistive-text.constants.js +5 -0
- package/components/assistive-text/assistive-text.utils.d.ts +2 -0
- package/components/assistive-text/assistive-text.utils.d.ts.map +1 -0
- package/components/assistive-text/assistive-text.utils.js +9 -0
- package/components/assistive-text/index.d.ts +4 -0
- package/components/assistive-text/index.d.ts.map +1 -0
- package/components/assistive-text/index.js +2 -0
- package/components/badge/badge.utils.d.ts +26 -0
- package/components/badge/badge.utils.d.ts.map +1 -0
- package/components/badge/badge.utils.js +41 -0
- package/components/badge/index.d.ts +3 -0
- package/components/badge/index.d.ts.map +1 -0
- package/components/badge/index.js +1 -0
- package/components/banner/index.d.ts +2 -0
- package/components/banner/index.d.ts.map +1 -0
- package/components/banner/index.js +1 -0
- package/components/breadcrumbs/breadcrumbs.constants.d.ts +2 -0
- package/components/breadcrumbs/breadcrumbs.constants.d.ts.map +1 -0
- package/components/breadcrumbs/breadcrumbs.utils.d.ts +4 -0
- package/components/breadcrumbs/breadcrumbs.utils.d.ts.map +1 -0
- package/components/breadcrumbs/breadcrumbs.utils.js +17 -0
- package/components/breadcrumbs/index.d.ts +4 -0
- package/components/breadcrumbs/index.d.ts.map +1 -0
- package/components/breadcrumbs/index.js +2 -0
- package/components/button/button.interface.d.ts +3 -5
- package/components/button/common/common-button.constants.d.ts +5 -0
- package/components/button/common/common-button.constants.d.ts.map +1 -0
- package/components/button/common/common-button.constants.js +10 -0
- package/components/button/index.d.ts +5 -0
- package/components/button/index.d.ts.map +1 -0
- package/components/button/index.js +2 -0
- package/components/card/card.constats.d.ts +3 -0
- package/components/card/card.constats.d.ts.map +1 -0
- package/components/card/card.constats.js +7 -0
- package/components/card/card.stories.shared.d.ts +52 -0
- package/components/card/card.stories.shared.d.ts.map +1 -0
- package/components/card/card.stories.shared.js +54 -0
- package/components/card/index.d.ts +4 -0
- package/components/card/index.d.ts.map +1 -0
- package/components/card/index.js +2 -0
- package/components/checkbox/index.d.ts +2 -0
- package/components/checkbox/index.d.ts.map +1 -0
- package/components/checkbox/index.js +1 -0
- package/components/checkbox-group/index.d.ts +2 -0
- package/components/checkbox-group/index.d.ts.map +1 -0
- package/components/checkbox-group/index.js +1 -0
- package/components/chip/chip.constants.d.ts +6 -0
- package/components/chip/chip.constants.d.ts.map +1 -0
- package/components/chip/chip.constants.js +5 -0
- package/components/chip/index.d.ts +3 -0
- package/components/chip/index.d.ts.map +1 -0
- package/components/chip/index.js +1 -0
- package/components/common/{common-types.ts → common-types.d.ts} +1 -0
- package/components/common/common-types.d.ts.map +1 -0
- package/components/common/common-types.js +1 -0
- package/components/divider/index.d.ts +2 -0
- package/components/divider/index.d.ts.map +1 -0
- package/components/divider/index.js +1 -0
- package/components/dropdown/DropdownManager.d.ts +13 -0
- package/components/dropdown/DropdownManager.d.ts.map +1 -0
- package/components/dropdown/DropdownManager.js +50 -0
- package/components/dropdown/dropdown.constants.d.ts +2 -0
- package/components/dropdown/dropdown.constants.d.ts.map +1 -0
- package/components/dropdown/dropdown.interface.d.ts +0 -1
- package/components/dropdown/index.d.ts +4 -0
- package/components/dropdown/index.d.ts.map +1 -0
- package/components/dropdown/index.js +2 -0
- package/components/grid/index.d.ts +2 -0
- package/components/grid/index.d.ts.map +1 -0
- package/components/grid/index.js +1 -0
- package/components/icon/icon-utils.d.ts +2 -0
- package/components/icon/icon-utils.d.ts.map +1 -0
- package/components/icon/icon-utils.js +3 -0
- package/components/icon/icon.constants.d.ts +4 -0
- package/components/icon/icon.constants.d.ts.map +1 -0
- package/components/icon/icon.constants.js +13 -0
- package/components/icon/index.d.ts +4 -0
- package/components/icon/index.d.ts.map +1 -0
- package/components/icon/index.js +2 -0
- package/components/link/index.d.ts +2 -0
- package/components/link/index.d.ts.map +1 -0
- package/components/link/index.js +1 -0
- package/components/loader/index.d.ts +3 -0
- package/components/loader/index.d.ts.map +1 -0
- package/components/loader/index.js +1 -0
- package/components/loader/loader.constants.d.ts +3 -0
- package/components/loader/loader.constants.d.ts.map +1 -0
- package/components/loader/loader.constants.js +5 -0
- package/components/modal/index.d.ts +2 -0
- package/components/modal/index.d.ts.map +1 -0
- package/components/modal/index.js +1 -0
- package/components/popover/index.d.ts +3 -0
- package/components/popover/index.d.ts.map +1 -0
- package/components/popover/index.js +1 -0
- package/components/popover/popover.constants.d.ts +3 -0
- package/components/popover/popover.constants.d.ts.map +1 -0
- package/components/radio-button/index.d.ts +3 -0
- package/components/radio-button/index.d.ts.map +1 -0
- package/components/radio-button/index.js +1 -0
- package/components/radio-button/radio-button.constants.d.ts +2 -0
- package/components/radio-button/radio-button.constants.d.ts.map +1 -0
- package/components/radio-button-group/index.d.ts +2 -0
- package/components/radio-button-group/index.d.ts.map +1 -0
- package/components/radio-button-group/index.js +1 -0
- package/components/required-indicator/index.d.ts +3 -0
- package/components/required-indicator/index.d.ts.map +1 -0
- package/components/required-indicator/index.js +2 -0
- package/components/required-indicator/required-indicator.constant.d.ts +3 -0
- package/components/required-indicator/required-indicator.constant.d.ts.map +1 -0
- package/components/required-indicator/required-indicator.constant.js +5 -0
- package/components/required-indicator/{required-indicator.interface.ts → required-indicator.interface.d.ts} +3 -3
- package/components/required-indicator/required-indicator.interface.d.ts.map +1 -0
- package/components/required-indicator/required-indicator.interface.js +1 -0
- package/components/searchbar/index.d.ts +3 -0
- package/components/searchbar/index.d.ts.map +1 -0
- package/components/searchbar/index.js +1 -0
- package/components/searchbar/searchbar.constants.d.ts +11 -0
- package/components/searchbar/searchbar.constants.d.ts.map +1 -0
- package/components/searchbar/searchbar.constants.js +15 -0
- package/components/segmented-control/index.d.ts +3 -0
- package/components/segmented-control/index.d.ts.map +1 -0
- package/components/segmented-control/index.js +1 -0
- package/components/segmented-control/segmented-control-utils.d.ts +8 -0
- package/components/segmented-control/segmented-control-utils.d.ts.map +1 -0
- package/components/segmented-control/segmented-control-utils.js +53 -0
- package/components/select/index.d.ts +3 -0
- package/components/select/index.d.ts.map +1 -0
- package/components/select/index.js +1 -0
- package/components/select/select.constants.d.ts +4 -0
- package/components/select/select.constants.d.ts.map +1 -0
- package/components/side-nav/index.d.ts +6 -0
- package/components/side-nav/index.d.ts.map +1 -0
- package/components/side-nav/index.js +2 -0
- package/components/side-nav/nav-item/nav-item.utils.d.ts +2 -0
- package/components/side-nav/nav-item/nav-item.utils.d.ts.map +1 -0
- package/components/side-nav/nav-item/{nav-item.utils.ts → nav-item.utils.js} +5 -6
- package/components/side-nav/side-nav.constants.d.ts +6 -0
- package/components/side-nav/side-nav.constants.d.ts.map +1 -0
- package/components/side-nav/side-nav.constants.js +10 -0
- package/components/split-button/index.d.ts +3 -0
- package/components/split-button/index.d.ts.map +1 -0
- package/components/split-button/index.js +1 -0
- package/components/split-button/split-button.constants.d.ts +4 -0
- package/components/split-button/split-button.constants.d.ts.map +1 -0
- package/components/split-button/split-button.constants.js +10 -0
- package/components/split-button/split-button.interface.d.ts +0 -3
- package/components/switch/index.d.ts +3 -0
- package/components/switch/index.d.ts.map +1 -0
- package/components/switch/index.js +1 -0
- package/components/switch/switch.constants.d.ts +3 -0
- package/components/switch/switch.constants.d.ts.map +1 -0
- package/components/switch/switch.interface.d.ts +0 -1
- package/components/tab/index.d.ts +3 -0
- package/components/tab/index.d.ts.map +1 -0
- package/components/tab/index.js +1 -0
- package/components/tab/tab.interface.d.ts +1 -3
- package/components/tab/tab.utils.d.ts +2 -0
- package/components/tab/tab.utils.d.ts.map +1 -0
- package/components/tab/tab.utils.js +54 -0
- package/components/tag/index.d.ts +2 -0
- package/components/tag/index.d.ts.map +1 -0
- package/components/tag/index.js +1 -0
- package/components/text-input/index.d.ts +2 -0
- package/components/text-input/index.d.ts.map +1 -0
- package/components/text-input/index.js +1 -0
- package/components/textarea/index.d.ts +3 -0
- package/components/textarea/index.d.ts.map +1 -0
- package/components/textarea/index.js +1 -0
- package/components/textarea/textarea.constants.d.ts +2 -0
- package/components/textarea/textarea.constants.d.ts.map +1 -0
- package/components/toast/index.d.ts +4 -0
- package/components/toast/index.d.ts.map +1 -0
- package/components/toast/index.js +2 -0
- package/components/toast/toast.constants.d.ts +6 -0
- package/components/toast/toast.constants.d.ts.map +1 -0
- package/components/toast/{toast.constants.ts → toast.constants.js} +3 -4
- package/components/toast/toast.utils.d.ts +5 -0
- package/components/toast/toast.utils.d.ts.map +1 -0
- package/components/toast/toast.utils.js +31 -0
- package/components/tooltip/index.d.ts +4 -0
- package/components/tooltip/index.d.ts.map +1 -0
- package/components/tooltip/index.js +2 -0
- package/components/tooltip/tooltip.constants.d.ts +5 -0
- package/components/tooltip/tooltip.constants.d.ts.map +1 -0
- package/components/tooltip/tooltip.utils.d.ts +2 -0
- package/components/tooltip/tooltip.utils.d.ts.map +1 -0
- package/components/tooltip/tooltip.utils.js +4 -0
- package/components/utils/auto-placement.d.ts +9 -0
- package/components/utils/auto-placement.d.ts.map +1 -0
- package/components/utils/auto-placement.js +167 -0
- package/components/utils/index.d.ts +2 -0
- package/components/utils/index.d.ts.map +1 -0
- package/components/utils/index.js +1 -0
- package/constants/dom/dom.constants.d.ts +4 -0
- package/constants/dom/dom.constants.d.ts.map +1 -0
- package/constants/dom/dom.constants.js +13 -0
- package/constants/dom/index.d.ts +2 -0
- package/constants/dom/index.d.ts.map +1 -0
- package/constants/dom/index.js +1 -0
- package/constants/keyboard/index.d.ts +3 -0
- package/constants/keyboard/index.d.ts.map +1 -0
- package/constants/keyboard/index.js +2 -0
- package/constants/keyboard/keyboard-test.constants.d.ts +10 -0
- package/constants/keyboard/keyboard-test.constants.d.ts.map +1 -0
- package/constants/keyboard/{keyboard-test.constants.ts → keyboard-test.constants.js} +1 -12
- package/constants/keyboard/keyboard.constants.d.ts +11 -0
- package/constants/keyboard/keyboard.constants.d.ts.map +1 -0
- package/index.d.ts +42 -0
- package/index.js +41 -0
- package/package.json +25 -16
- package/CHANGELOG.md +0 -320
- package/common/animation.ts +0 -5
- package/common/common-types.ts +0 -4
- package/components/assistive-text/assistive-text.constants.ts +0 -8
- package/components/assistive-text/assistive-text.utils.ts +0 -8
- package/components/badge/badge.utils.ts +0 -75
- package/components/badge/docs/AccessibilityTable.tsx +0 -113
- package/components/badge/docs/Badge.mdx +0 -127
- package/components/badge/docs/Behaviors.scss +0 -12
- package/components/badge/docs/Behaviors.tsx +0 -110
- package/components/badge/docs/Options.tsx +0 -90
- package/components/badge/docs/Usage.tsx +0 -30
- package/components/badge/docs/assets/doNot.svg +0 -397
- package/components/badge/stories/img/Accessibility.png +0 -0
- package/components/badge/stories/img/BadgeTypes.svg +0 -72
- package/components/badge/stories/img/Layout.svg +0 -86
- package/components/badge/stories/img/OtherComponent.svg +0 -34
- package/components/badge/stories/img/StructureComposant.svg +0 -40
- package/components/badge/stories/img/TableOfOptions.svg +0 -200
- package/components/badge/stories/img/Taille.svg +0 -79
- package/components/badge/stories/img/TextOptions.svg +0 -34
- package/components/breadcrumbs/breadcrumbs.utils.ts +0 -24
- package/components/breadcrumbs/docs/AccessibilityTable.tsx +0 -96
- package/components/breadcrumbs/docs/Behaviors.tsx +0 -129
- package/components/breadcrumbs/docs/Breadcrumbs.mdx +0 -104
- package/components/breadcrumbs/docs/Options.scss +0 -26
- package/components/breadcrumbs/docs/Options.tsx +0 -59
- package/components/breadcrumbs/docs/TabOfOptions.tsx +0 -19
- package/components/breadcrumbs/docs/Usage.scss +0 -7
- package/components/breadcrumbs/docs/Usage.tsx +0 -28
- package/components/breadcrumbs/docs/assets/doNot.svg +0 -127
- package/components/button/common/common-button.constants.ts +0 -15
- package/components/card/card.constats.ts +0 -9
- package/components/card/card.stories.shared.ts +0 -112
- package/components/chip/chip.constants.ts +0 -5
- package/components/chip/stories/img/ChipsAccessibility.png +0 -0
- package/components/chip/stories/img/ChipsInteractionsStates.svg +0 -46
- package/components/chip/stories/img/ChipsKeyboardInteractions.svg +0 -76
- package/components/chip/stories/img/ChipsLayout.svg +0 -86
- package/components/chip/stories/img/ChipsStructure.svg +0 -24
- package/components/chip/stories/img/ChipsTableOfOptions.svg +0 -146
- package/components/chip/stories/img/ChipsTaille.svg +0 -36
- package/components/chip/stories/img/ChipsTypes.svg +0 -50
- package/components/divider/stories/img/DividerAccessibility.png +0 -0
- package/components/divider/stories/img/DividerBehaviors.svg +0 -36
- package/components/divider/stories/img/DividerOrientation.svg +0 -34
- package/components/divider/stories/img/DividerStructure.png +0 -0
- package/components/divider/stories/img/DividerTableOfOptions.svg +0 -74
- package/components/divider/stories/img/DividerThickness.svg +0 -38
- package/components/dropdown/DropdownManager.ts +0 -59
- package/components/grid/grid.scss +0 -81
- package/components/grid/grid.stories.scss +0 -23
- package/components/icon/icon-utils.ts +0 -3
- package/components/icon/icon.constants.ts +0 -16
- package/components/loader/loader.constants.ts +0 -7
- package/components/loader/stories/img/LoaderAccessibility.png +0 -0
- package/components/loader/stories/img/LoaderAppearance.svg +0 -36
- package/components/loader/stories/img/LoaderBooleanOptions.svg +0 -26
- package/components/loader/stories/img/LoaderInteractions.svg +0 -36
- package/components/loader/stories/img/LoaderKeyboardInteractions.svg +0 -26
- package/components/loader/stories/img/LoaderLayout.svg +0 -56
- package/components/loader/stories/img/LoaderPosition.svg +0 -36
- package/components/loader/stories/img/LoaderSafezone.svg +0 -36
- package/components/loader/stories/img/LoaderStructure.svg +0 -21
- package/components/loader/stories/img/LoaderTableOfOptions.svg +0 -134
- package/components/loader/stories/img/LoaderTaille.svg +0 -46
- package/components/loader/stories/img/LoaderTextOptions.svg +0 -26
- package/components/required-indicator/required-indicator.constant.ts +0 -7
- package/components/searchbar/docs/AccessibilityTable.tsx +0 -119
- package/components/searchbar/docs/Behaviors.tsx +0 -130
- package/components/searchbar/docs/Options.tsx +0 -127
- package/components/searchbar/docs/Searchbar.mdx +0 -124
- package/components/searchbar/docs/Usage.tsx +0 -37
- package/components/searchbar/docs/assets/doNot.svg +0 -212
- package/components/searchbar/searchbar.constants.ts +0 -18
- package/components/segmented-control/segmented-control-utils.ts +0 -77
- package/components/segmented-control/stories/img/SegControlAccessibility.png +0 -0
- package/components/segmented-control/stories/img/SegControlAnimations.svg +0 -11
- package/components/segmented-control/stories/img/SegControlAutreHTMLNatif.svg +0 -36
- package/components/segmented-control/stories/img/SegControlBooleanOptions.svg +0 -26
- package/components/segmented-control/stories/img/SegControlContent.svg +0 -34
- package/components/segmented-control/stories/img/SegControlDoDont.svg +0 -141
- package/components/segmented-control/stories/img/SegControlFocus.svg +0 -20
- package/components/segmented-control/stories/img/SegControlIconOptions.svg +0 -42
- package/components/segmented-control/stories/img/SegControlInteractionState.svg +0 -40
- package/components/segmented-control/stories/img/SegControlKeyboardInteractions.svg +0 -56
- package/components/segmented-control/stories/img/SegControlLayout.svg +0 -36
- package/components/segmented-control/stories/img/SegControlNestedProperties.svg +0 -154
- package/components/segmented-control/stories/img/SegControlSegments.svg +0 -33
- package/components/segmented-control/stories/img/SegControlStructure.svg +0 -27
- package/components/segmented-control/stories/img/SegControlTableOfOptions.svg +0 -54
- package/components/segmented-control/stories/img/SegControlTextOptions.svg +0 -26
- package/components/select/docs/AccessibilityTable.tsx +0 -121
- package/components/select/docs/Behaviors.tsx +0 -155
- package/components/select/docs/Options.scss +0 -26
- package/components/select/docs/Options.tsx +0 -148
- package/components/select/docs/OverviewOptions.scss +0 -14
- package/components/select/docs/OverviewOptions.tsx +0 -67
- package/components/select/docs/Select.mdx +0 -132
- package/components/select/docs/Usage.scss +0 -7
- package/components/select/docs/Usage.tsx +0 -39
- package/components/select/docs/assets/doNot.svg +0 -394
- package/components/side-nav/side-nav.constants.ts +0 -16
- package/components/split-button/split-button.constants.ts +0 -13
- package/components/switch/stories/img/SwitchAccessibility.png +0 -0
- package/components/switch/stories/img/SwitchAnimations.svg +0 -20
- package/components/switch/stories/img/SwitchAppearance.svg +0 -34
- package/components/switch/stories/img/SwitchAutonomousLabel.svg +0 -27
- package/components/switch/stories/img/SwitchAutreContextuel.svg +0 -36
- package/components/switch/stories/img/SwitchBooleanOptions.svg +0 -46
- package/components/switch/stories/img/SwitchDistinctCheckbox.svg +0 -41
- package/components/switch/stories/img/SwitchFocus.svg +0 -46
- package/components/switch/stories/img/SwitchInteractionState.svg +0 -60
- package/components/switch/stories/img/SwitchKeyboardInteractions.svg +0 -46
- package/components/switch/stories/img/SwitchLayout.svg +0 -46
- package/components/switch/stories/img/SwitchStructure.svg +0 -22
- package/components/switch/stories/img/SwitchTableOfOptions.svg +0 -165
- package/components/switch/stories/img/SwitchTextOptions.svg +0 -34
- package/components/tab/tab.utils.ts +0 -60
- package/components/tag/stories/img/TagAccessibility.png +0 -0
- package/components/tag/stories/img/TagLayout.svg +0 -86
- package/components/tag/stories/img/TagStatus.svg +0 -52
- package/components/tag/stories/img/TagStructure.svg +0 -19
- package/components/tag/stories/img/TagTableOfOptions.svg +0 -178
- package/components/tag/stories/img/TagTaille.svg +0 -36
- package/components/tag/stories/img/TagTypes.svg +0 -38
- package/components/text-input/stories/img/TextInputAccessibility.png +0 -0
- package/components/text-input/stories/img/TextInputBooleanOptions.svg +0 -76
- package/components/text-input/stories/img/TextInputDoDont.svg +0 -100
- package/components/text-input/stories/img/TextInputKeyboardInteractions.svg +0 -46
- package/components/text-input/stories/img/TextInputLabelPosition.svg +0 -40
- package/components/text-input/stories/img/TextInputLayout.svg +0 -46
- package/components/text-input/stories/img/TextInputPosition.svg +0 -80
- package/components/text-input/stories/img/TextInputPrecisions.png +0 -0
- package/components/text-input/stories/img/TextInputRequiredIndicator.svg +0 -44
- package/components/text-input/stories/img/TextInputStructure.svg +0 -33
- package/components/text-input/stories/img/TextInputTableOfOptions.svg +0 -346
- package/components/text-input/stories/img/TextInputTextOptions.svg +0 -63
- package/components/textarea/stories/img/TextAreaAccessibility.png +0 -0
- package/components/textarea/stories/img/TextAreaBooleanOption.svg +0 -70
- package/components/textarea/stories/img/TextAreaDoDont.svg +0 -119
- package/components/textarea/stories/img/TextAreaKeyboardInteractions.svg +0 -46
- package/components/textarea/stories/img/TextAreaLabelPosition.svg +0 -40
- package/components/textarea/stories/img/TextAreaLayout.svg +0 -57
- package/components/textarea/stories/img/TextAreaPosition.svg +0 -80
- package/components/textarea/stories/img/TextAreaPrecisions.png +0 -0
- package/components/textarea/stories/img/TextAreaRequiredIndicator.svg +0 -44
- package/components/textarea/stories/img/TextAreaStructure.svg +0 -39
- package/components/textarea/stories/img/TextAreaTableOfOptions.svg +0 -286
- package/components/textarea/stories/img/TextAreaTextOptions.svg +0 -69
- package/components/toast/toast.utils.ts +0 -33
- package/components/tooltip/tooltip.utils.ts +0 -5
- package/components/utils/auto-placement.ts +0 -220
- package/constants/dom/dom.constants.ts +0 -13
- package/css-font-generator.ts +0 -51
- package/eslint.config.js +0 -1
- package/scripts/design-tokens/common.ts +0 -35
- package/scripts/design-tokens/generator.ts +0 -24
- package/scripts/design-tokens/primitives-generator.spec.ts +0 -84
- package/scripts/design-tokens/primitives-generator.ts +0 -66
- package/scripts/design-tokens/sourceFiles/primitives.json +0 -2075
- package/scripts/design-tokens/sourceFiles/tokens.json +0 -10561
- package/scripts/design-tokens/tokens-generator.spec.ts +0 -184
- package/scripts/design-tokens/tokens-generator.ts +0 -155
- package/scripts/design-tokens/tokens-generators/colors.ts +0 -142
- package/scripts/design-tokens/tokens-generators/layout.ts +0 -22
- package/scripts/design-tokens/tokens-generators/opacity.ts +0 -14
- package/scripts/design-tokens/tokens-generators/shadows.ts +0 -18
- package/scripts/design-tokens/tokens-generators/typography.ts +0 -58
- package/scripts/design-tokens/tokens-generators/zIndex.ts +0 -18
- package/tsconfig.json +0 -12
- /package/components/breadcrumbs/{breadcrumbs.constants.ts → breadcrumbs.constants.js} +0 -0
- /package/components/dropdown/{dropdown.constants.ts → dropdown.constants.js} +0 -0
- /package/components/popover/{popover.constants.ts → popover.constants.js} +0 -0
- /package/components/radio-button/{radio-button.constants.ts → radio-button.constants.js} +0 -0
- /package/components/select/{select.constants.ts → select.constants.js} +0 -0
- /package/components/switch/{switch.constants.ts → switch.constants.js} +0 -0
- /package/components/textarea/{textarea.constants.ts → textarea.constants.js} +0 -0
- /package/components/tooltip/{tooltip.constants.ts → tooltip.constants.js} +0 -0
- /package/constants/keyboard/{keyboard.constants.ts → keyboard.constants.js} +0 -0
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export const getToastPriority = (toast: {
|
|
2
|
-
hasActionButton: boolean;
|
|
3
|
-
type: "info" | "success" | "warning" | "error" | "neutral";
|
|
4
|
-
}) => {
|
|
5
|
-
const { hasActionButton: hasButtonAction, type } = toast;
|
|
6
|
-
if (hasButtonAction) {
|
|
7
|
-
switch (type) {
|
|
8
|
-
case "error":
|
|
9
|
-
return 1;
|
|
10
|
-
case "warning":
|
|
11
|
-
return 3;
|
|
12
|
-
case "success":
|
|
13
|
-
return 5;
|
|
14
|
-
case "info":
|
|
15
|
-
return 6;
|
|
16
|
-
default:
|
|
17
|
-
return 7;
|
|
18
|
-
}
|
|
19
|
-
} else {
|
|
20
|
-
switch (type) {
|
|
21
|
-
case "error":
|
|
22
|
-
return 2;
|
|
23
|
-
case "warning":
|
|
24
|
-
return 4;
|
|
25
|
-
case "success":
|
|
26
|
-
return 8;
|
|
27
|
-
case "info":
|
|
28
|
-
return 9;
|
|
29
|
-
default:
|
|
30
|
-
return 10;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { Alignment, Position } from "../common/common-types";
|
|
2
|
-
|
|
3
|
-
export const getAutoPlacement = (
|
|
4
|
-
hostElement: HTMLElement,
|
|
5
|
-
castedElement: Element,
|
|
6
|
-
defaultPosition: Exclude<Position, "auto">,
|
|
7
|
-
offset: number = 0,
|
|
8
|
-
hasParent: boolean = false,
|
|
9
|
-
): Exclude<Position, "auto"> => {
|
|
10
|
-
let sides: Record<Exclude<Position, "auto">, boolean>;
|
|
11
|
-
const triggerRect = hostElement.getBoundingClientRect();
|
|
12
|
-
if (hasParent) {
|
|
13
|
-
const triggerParent = hostElement.parentElement;
|
|
14
|
-
if (!triggerParent) {
|
|
15
|
-
return defaultPosition;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const maxWidth = parseInt(getComputedStyle(castedElement).getPropertyValue("max-width"));
|
|
19
|
-
const maxHeight = parseInt(getComputedStyle(castedElement).getPropertyValue("max-height"));
|
|
20
|
-
const parentRect = triggerParent.getBoundingClientRect();
|
|
21
|
-
sides = {
|
|
22
|
-
top: triggerRect.top - parentRect.top > maxHeight + offset,
|
|
23
|
-
right: parentRect.right - triggerRect.right > maxWidth + offset,
|
|
24
|
-
bottom: parentRect.bottom - triggerRect.bottom >= maxHeight + offset,
|
|
25
|
-
left: triggerRect.left - parentRect.left > maxWidth + offset,
|
|
26
|
-
} as const;
|
|
27
|
-
} else {
|
|
28
|
-
const elementRect = castedElement.getBoundingClientRect();
|
|
29
|
-
sides = {
|
|
30
|
-
top: elementRect.height + offset < triggerRect.top,
|
|
31
|
-
right: elementRect.width + offset < window.innerWidth - triggerRect.right,
|
|
32
|
-
bottom: elementRect.height + offset < window.innerHeight - triggerRect.bottom,
|
|
33
|
-
left: elementRect.width + offset < triggerRect.left,
|
|
34
|
-
} as const;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (sides.top) return "top";
|
|
38
|
-
if (sides.bottom) return "bottom";
|
|
39
|
-
if (sides.left) return "left";
|
|
40
|
-
if (sides.right) return "right";
|
|
41
|
-
|
|
42
|
-
return defaultPosition;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const getAutoPlacementDropdown = (
|
|
46
|
-
hostElement: HTMLElement,
|
|
47
|
-
castedElement: Element,
|
|
48
|
-
defaultPosition: Exclude<Position, "auto">,
|
|
49
|
-
offset: number = 0,
|
|
50
|
-
hasDropdownParent: boolean = false,
|
|
51
|
-
): Exclude<Position, "auto"> => {
|
|
52
|
-
const triggerRect = hostElement.getBoundingClientRect();
|
|
53
|
-
const elementRect = castedElement.getBoundingClientRect();
|
|
54
|
-
const sides = {
|
|
55
|
-
top: elementRect.height + offset < triggerRect.top,
|
|
56
|
-
right: elementRect.width + offset < window.innerWidth - triggerRect.right,
|
|
57
|
-
bottom: elementRect.height + offset < window.innerHeight - triggerRect.bottom,
|
|
58
|
-
left: elementRect.width + offset < triggerRect.left,
|
|
59
|
-
} as const;
|
|
60
|
-
|
|
61
|
-
if (hasDropdownParent) {
|
|
62
|
-
return getAutoPlacementDropdownWithParent(sides, defaultPosition);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return getAutoPlacementDropdownWithoutParent(sides, defaultPosition);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const getAutoPlacementDropdownWithParent = (
|
|
69
|
-
sides: Record<Exclude<Position, "auto">, boolean>,
|
|
70
|
-
defaultPosition: Exclude<Position, "auto">,
|
|
71
|
-
) => {
|
|
72
|
-
if (sides.right) return "right";
|
|
73
|
-
if (sides.left) return "left";
|
|
74
|
-
if (sides.bottom) return "bottom";
|
|
75
|
-
if (sides.top) return "top";
|
|
76
|
-
|
|
77
|
-
return defaultPosition;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const getAutoPlacementDropdownWithoutParent = (
|
|
81
|
-
sides: Record<Exclude<Position, "auto">, boolean>,
|
|
82
|
-
defaultPosition: Exclude<Position, "auto">,
|
|
83
|
-
) => {
|
|
84
|
-
if (sides.bottom) return "bottom";
|
|
85
|
-
if (sides.right) return "right";
|
|
86
|
-
if (sides.left) return "left";
|
|
87
|
-
if (sides.top) return "top";
|
|
88
|
-
|
|
89
|
-
return defaultPosition;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export const getAutoAlignment = (
|
|
93
|
-
hostElement: HTMLElement,
|
|
94
|
-
castedElement: Element,
|
|
95
|
-
position: Exclude<Position, "auto">,
|
|
96
|
-
) => {
|
|
97
|
-
const defaultPosition = "center";
|
|
98
|
-
const triggerParent = hostElement.parentElement;
|
|
99
|
-
if (!triggerParent) {
|
|
100
|
-
return defaultPosition;
|
|
101
|
-
}
|
|
102
|
-
const triggerRect = hostElement.getBoundingClientRect();
|
|
103
|
-
const castedRect = castedElement.getBoundingClientRect();
|
|
104
|
-
|
|
105
|
-
const alignments = {
|
|
106
|
-
end:
|
|
107
|
-
position === "top" || position === "bottom"
|
|
108
|
-
? triggerRect.right >= castedRect.width
|
|
109
|
-
: window.innerHeight - triggerRect.bottom >= castedRect.height,
|
|
110
|
-
start:
|
|
111
|
-
position === "top" || position === "bottom"
|
|
112
|
-
? window.innerWidth - triggerRect.left >= castedRect.width
|
|
113
|
-
: window.innerHeight - triggerRect.top >= castedRect.height,
|
|
114
|
-
} as const;
|
|
115
|
-
if (alignments.start) return "start";
|
|
116
|
-
if (alignments.end) return "end";
|
|
117
|
-
return defaultPosition;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export const getCoordinates = (
|
|
121
|
-
position: Exclude<Position, "auto">,
|
|
122
|
-
triggerElement: HTMLElement,
|
|
123
|
-
castedElement: HTMLElement,
|
|
124
|
-
offset: number = 0,
|
|
125
|
-
alignment: Alignment = "center",
|
|
126
|
-
) => {
|
|
127
|
-
const triggerElementRect = triggerElement.getBoundingClientRect();
|
|
128
|
-
const castedElementRect = castedElement.getBoundingClientRect();
|
|
129
|
-
|
|
130
|
-
if (position === "bottom") {
|
|
131
|
-
return handleBottomPosition(triggerElementRect, castedElementRect, offset, alignment);
|
|
132
|
-
} else if (position === "left") {
|
|
133
|
-
return handleLeftPosition(triggerElementRect, castedElementRect, offset, alignment);
|
|
134
|
-
} else if (position === "right") {
|
|
135
|
-
return handleRightPosition(triggerElementRect, castedElementRect, offset, alignment);
|
|
136
|
-
} else {
|
|
137
|
-
return handleTopPosition(triggerElementRect, castedElementRect, offset, alignment);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const handleBottomPosition = (
|
|
142
|
-
triggerElementRect: DOMRect,
|
|
143
|
-
castedElementRect: DOMRect,
|
|
144
|
-
offset: number,
|
|
145
|
-
alignment: Alignment,
|
|
146
|
-
) => {
|
|
147
|
-
const top = triggerElementRect.bottom + offset + window.scrollY;
|
|
148
|
-
let left = 0;
|
|
149
|
-
|
|
150
|
-
if (alignment === "start") {
|
|
151
|
-
left = triggerElementRect.left + window.scrollX;
|
|
152
|
-
} else if (alignment === "end") {
|
|
153
|
-
left = triggerElementRect.right - castedElementRect.width + window.scrollX;
|
|
154
|
-
} else {
|
|
155
|
-
left = triggerElementRect.left + triggerElementRect.width / 2 - castedElementRect.width / 2 + window.scrollX;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return { top, left };
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const handleLeftPosition = (
|
|
162
|
-
triggerElementRect: DOMRect,
|
|
163
|
-
castedElementRect: DOMRect,
|
|
164
|
-
offset: number,
|
|
165
|
-
alignment: Alignment,
|
|
166
|
-
) => {
|
|
167
|
-
const left = triggerElementRect.left - castedElementRect.width - offset + window.scrollX;
|
|
168
|
-
let top = 0;
|
|
169
|
-
|
|
170
|
-
if (alignment === "start") {
|
|
171
|
-
top = triggerElementRect.top + window.scrollY;
|
|
172
|
-
} else if (alignment === "end") {
|
|
173
|
-
top = triggerElementRect.bottom - castedElementRect.height + window.scrollY;
|
|
174
|
-
} else {
|
|
175
|
-
top = triggerElementRect.top + triggerElementRect.height / 2 - castedElementRect.height / 2 + window.scrollY;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return { top, left };
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const handleRightPosition = (
|
|
182
|
-
triggerElementRect: DOMRect,
|
|
183
|
-
castedElementRect: DOMRect,
|
|
184
|
-
offset: number,
|
|
185
|
-
alignment: Alignment,
|
|
186
|
-
) => {
|
|
187
|
-
const left = triggerElementRect.right + offset + window.scrollX;
|
|
188
|
-
let top = 0;
|
|
189
|
-
|
|
190
|
-
if (alignment === "start") {
|
|
191
|
-
top = triggerElementRect.top + window.scrollY;
|
|
192
|
-
} else if (alignment === "end") {
|
|
193
|
-
top = triggerElementRect.bottom - castedElementRect.height + window.scrollY;
|
|
194
|
-
} else {
|
|
195
|
-
top = triggerElementRect.top + triggerElementRect.height / 2 - castedElementRect.height / 2 + window.scrollY;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
return { top, left };
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const handleTopPosition = (
|
|
202
|
-
triggerElementRect: DOMRect,
|
|
203
|
-
castedElementRect: DOMRect,
|
|
204
|
-
offset: number,
|
|
205
|
-
alignment: Alignment,
|
|
206
|
-
) => {
|
|
207
|
-
const top = triggerElementRect.top - castedElementRect.height - offset + window.scrollY;
|
|
208
|
-
|
|
209
|
-
let left = 0;
|
|
210
|
-
|
|
211
|
-
if (alignment === "start") {
|
|
212
|
-
left = triggerElementRect.left + window.scrollX;
|
|
213
|
-
} else if (alignment === "end") {
|
|
214
|
-
left = triggerElementRect.right - castedElementRect.width + window.scrollX;
|
|
215
|
-
} else {
|
|
216
|
-
left = triggerElementRect.left + triggerElementRect.width / 2 - castedElementRect.width / 2 + window.scrollX;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return { top, left };
|
|
220
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const FOCUSABLE_ELEMENTS = [
|
|
2
|
-
"button",
|
|
3
|
-
"a[href]",
|
|
4
|
-
"input",
|
|
5
|
-
"select",
|
|
6
|
-
"textarea",
|
|
7
|
-
"details",
|
|
8
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
export const FOCUSABLE_ELEMENTS_QUERY = FOCUSABLE_ELEMENTS.map(
|
|
12
|
-
(element) => element + ":not([disabled]):not([aria-hidden])",
|
|
13
|
-
).join(",");
|
package/css-font-generator.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import sass from "sass";
|
|
5
|
-
|
|
6
|
-
const outputDir = path.resolve(__dirname, "css");
|
|
7
|
-
|
|
8
|
-
if (!fs.existsSync(outputDir)) {
|
|
9
|
-
fs.mkdirSync(outputDir);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const fontFile = `
|
|
13
|
-
@font-face {
|
|
14
|
-
font-display: swap;
|
|
15
|
-
font-family: 'Nunito';
|
|
16
|
-
font-style: normal;
|
|
17
|
-
font-weight: 300;
|
|
18
|
-
src: url('@design-system-rte/core/assets/fonts/nunito-light-300.woff2') format('woff2');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@font-face {
|
|
22
|
-
font-display: swap;
|
|
23
|
-
font-family: 'Nunito';
|
|
24
|
-
font-style: normal;
|
|
25
|
-
font-weight: 400;
|
|
26
|
-
src: url('@design-system-rte/core/assets/fonts/nunito-regular-400.woff2') format('woff2');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@font-face {
|
|
30
|
-
font-display: swap;
|
|
31
|
-
font-family: 'Nunito';
|
|
32
|
-
font-style: normal;
|
|
33
|
-
font-weight: 600;
|
|
34
|
-
src: url('@design-system-rte/core/assets/fonts/nunito-semi-bold-600.woff2') format('woff2');
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
@font-face {
|
|
38
|
-
font-display: swap;
|
|
39
|
-
font-family: 'Nunito';
|
|
40
|
-
font-style: normal;
|
|
41
|
-
font-weight: 700;
|
|
42
|
-
src: url('@design-system-rte/core/assets/fonts/nunito-bold-700.woff2') format('woff2');
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
const fontResult = sass.compileString(fontFile, {
|
|
47
|
-
loadPaths: [path.resolve(__dirname)],
|
|
48
|
-
style: "compressed",
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
fs.writeFileSync(path.join(outputDir, "rte-fonts.css"), fontResult.css);
|
package/eslint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "../../eslint.config.js";
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path, { resolve } from "path";
|
|
3
|
-
|
|
4
|
-
export interface TokenValue {
|
|
5
|
-
$type: string;
|
|
6
|
-
$scopes: string[];
|
|
7
|
-
$value: string | number;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const UNIT = "px";
|
|
11
|
-
export const INDENT = " ".repeat(2);
|
|
12
|
-
|
|
13
|
-
export enum PrivacyLevel {
|
|
14
|
-
PUBLIC = "public",
|
|
15
|
-
PRIVATE = "private",
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const rootDir = path.join(resolve(__dirname), "../../design-tokens");
|
|
19
|
-
const tokensDir = "tokens";
|
|
20
|
-
const primitivesDir = "primitives";
|
|
21
|
-
|
|
22
|
-
export const tokensOutputDir = path.join(rootDir, tokensDir);
|
|
23
|
-
export const primitivesOutputDir = path.join(rootDir, primitivesDir);
|
|
24
|
-
|
|
25
|
-
export function buildScssVariable(variableName: string[], value: string): string {
|
|
26
|
-
return `$${variableName.join("-")}: ${value};\n`.toLowerCase();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function generateScssFile(scss: string, filePath: string) {
|
|
30
|
-
fs.writeFileSync(filePath, scss);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function buildScssFileName(collection: string): string {
|
|
34
|
-
return `_${collection.toLowerCase()}.scss`;
|
|
35
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import { resolve } from "path";
|
|
3
|
-
|
|
4
|
-
import { generatePrimitivesScssFiles } from "./primitives-generator";
|
|
5
|
-
import { generateTokensScssFiles, TokenItem } from "./tokens-generator";
|
|
6
|
-
|
|
7
|
-
console.log("🔧 Generating design tokens...\n");
|
|
8
|
-
|
|
9
|
-
const currentDir = resolve(__dirname);
|
|
10
|
-
|
|
11
|
-
const inputPrimitivesSource = resolve(currentDir, "sourceFiles/primitives.json");
|
|
12
|
-
const inputTokensSource = resolve(currentDir, "sourceFiles/tokens.json");
|
|
13
|
-
|
|
14
|
-
const rawPrimitives = JSON.parse(fs.readFileSync(inputPrimitivesSource, "utf8"));
|
|
15
|
-
console.log("📦 Generating primitives... ");
|
|
16
|
-
generatePrimitivesScssFiles(rawPrimitives);
|
|
17
|
-
console.log("✅ Primitives generated successfully.\n");
|
|
18
|
-
|
|
19
|
-
const rawTokens: TokenItem[] = JSON.parse(fs.readFileSync(inputTokensSource, "utf8"));
|
|
20
|
-
console.log("📦 Generating tokens... ");
|
|
21
|
-
generateTokensScssFiles(rawTokens);
|
|
22
|
-
console.log("✅ Tokens generated successfully.\n");
|
|
23
|
-
|
|
24
|
-
console.log("✅ All design tokens generated successfully. ");
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
|
|
3
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
4
|
-
|
|
5
|
-
import { Collection, generatePrimitivesScssFiles } from "./primitives-generator";
|
|
6
|
-
|
|
7
|
-
vi.mock("fs");
|
|
8
|
-
|
|
9
|
-
describe("primitives-generator", () => {
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
vi.clearAllMocks();
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("génère correctement les variables SCSS pour les couleurs", () => {
|
|
15
|
-
const colorCollection = [
|
|
16
|
-
{
|
|
17
|
-
collection: Collection.COLORS,
|
|
18
|
-
variables: {
|
|
19
|
-
bleu: {
|
|
20
|
-
100: { $value: "#abcdef" },
|
|
21
|
-
200: { $value: "#123456" },
|
|
22
|
-
},
|
|
23
|
-
rouge: {
|
|
24
|
-
500: { $value: "#ff0000" },
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const writeSpy = vi.spyOn(fs, "writeFileSync");
|
|
31
|
-
|
|
32
|
-
vi.spyOn(fs, "existsSync").mockReturnValue(true);
|
|
33
|
-
|
|
34
|
-
vi.spyOn(fs, "readFileSync").mockReturnValue(colorCollection.toString());
|
|
35
|
-
|
|
36
|
-
generatePrimitivesScssFiles(colorCollection);
|
|
37
|
-
|
|
38
|
-
expect(writeSpy).toHaveBeenCalledWith(
|
|
39
|
-
expect.stringContaining("_colors.scss"),
|
|
40
|
-
expect.stringContaining("$bleu-100: #abcdef;"),
|
|
41
|
-
);
|
|
42
|
-
expect(writeSpy).toHaveBeenCalledWith(
|
|
43
|
-
expect.stringContaining("_colors.scss"),
|
|
44
|
-
expect.stringContaining("$rouge-500: #ff0000;"),
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("génère correctement les variables SCSS pour la typo", () => {
|
|
49
|
-
const typoCollection = [
|
|
50
|
-
{
|
|
51
|
-
collection: Collection.TYPOGRAPHY,
|
|
52
|
-
variables: {
|
|
53
|
-
"font-weight": {
|
|
54
|
-
bold: { $value: "700" },
|
|
55
|
-
},
|
|
56
|
-
"font-family": {
|
|
57
|
-
main: { $value: "Nunito" },
|
|
58
|
-
},
|
|
59
|
-
"font-size": {
|
|
60
|
-
small: { $value: "12" },
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
const writeSpy = vi.spyOn(fs, "writeFileSync");
|
|
67
|
-
vi.spyOn(fs, "existsSync").mockReturnValue(true);
|
|
68
|
-
|
|
69
|
-
generatePrimitivesScssFiles(typoCollection);
|
|
70
|
-
|
|
71
|
-
expect(writeSpy).toHaveBeenCalledWith(
|
|
72
|
-
expect.stringContaining("_typography.scss"),
|
|
73
|
-
expect.stringContaining("$font-weight-bold: 700;"),
|
|
74
|
-
);
|
|
75
|
-
expect(writeSpy).toHaveBeenCalledWith(
|
|
76
|
-
expect.stringContaining("_typography.scss"),
|
|
77
|
-
expect.stringContaining('$font-family-main: "Nunito";'),
|
|
78
|
-
);
|
|
79
|
-
expect(writeSpy).toHaveBeenCalledWith(
|
|
80
|
-
expect.stringContaining("_typography.scss"),
|
|
81
|
-
expect.stringContaining("$font-size-small: 12px;"),
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import { generateScssFile, primitivesOutputDir, UNIT } from "./common";
|
|
5
|
-
|
|
6
|
-
export enum Collection {
|
|
7
|
-
COLORS = "Primitive : Colors",
|
|
8
|
-
TYPOGRAPHY = "Primitive : Type",
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface CollectionItem {
|
|
12
|
-
collection: Collection;
|
|
13
|
-
variables: Record<string, Record<string, { $value: string }>>;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (!fs.existsSync(primitivesOutputDir)) {
|
|
17
|
-
fs.mkdirSync(primitivesOutputDir);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function generatePrimitivesScssFiles(json: CollectionItem[]) {
|
|
21
|
-
for (const tokenItem of json) {
|
|
22
|
-
let scss = "// This file is auto-generated. Do not edit directly.\n\n";
|
|
23
|
-
let filename = "";
|
|
24
|
-
switch (tokenItem.collection) {
|
|
25
|
-
case Collection.COLORS:
|
|
26
|
-
filename = "_colors.scss";
|
|
27
|
-
scss += extractColors(tokenItem);
|
|
28
|
-
generateScssFile(scss, path.join(primitivesOutputDir, filename));
|
|
29
|
-
break;
|
|
30
|
-
|
|
31
|
-
case Collection.TYPOGRAPHY:
|
|
32
|
-
filename = "_typography.scss";
|
|
33
|
-
scss += extractTypography(tokenItem);
|
|
34
|
-
generateScssFile(scss, path.join(primitivesOutputDir, filename));
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function extractColors(colorCollection: CollectionItem): string {
|
|
41
|
-
let scss = "";
|
|
42
|
-
for (const color in colorCollection.variables) {
|
|
43
|
-
for (const colorValue in colorCollection.variables[color]) {
|
|
44
|
-
const colorVariable = colorCollection.variables[color][colorValue];
|
|
45
|
-
scss += `$${color}-${colorValue}: ${colorVariable.$value};\n`.toLowerCase();
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return scss;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function extractTypography(typographyCollection: CollectionItem): string {
|
|
52
|
-
let scss = "";
|
|
53
|
-
for (const category in typographyCollection.variables) {
|
|
54
|
-
for (const subCategory in typographyCollection.variables[category]) {
|
|
55
|
-
const typographyVariable = typographyCollection.variables[category][subCategory];
|
|
56
|
-
if (category === "font-weight") {
|
|
57
|
-
scss += `$${category}-${subCategory}: ${typographyVariable.$value};\n`.toLowerCase();
|
|
58
|
-
} else if (category === "font-family") {
|
|
59
|
-
scss += `$${category}-${subCategory}: "${typographyVariable.$value}";\n`;
|
|
60
|
-
} else {
|
|
61
|
-
scss += `$${category}-${subCategory}: ${typographyVariable.$value}${UNIT};\n`.toLowerCase();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return scss;
|
|
66
|
-
}
|