@koine/react 1.0.10 → 1.0.13
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/Alert/Alert.d.ts +5 -0
- package/Alert/Alert.js +10 -0
- package/Alert/index.d.ts +1 -0
- package/Alert/index.js +1 -0
- package/Alert/package.json +6 -0
- package/Animations/Reveal.d.ts +4 -0
- package/Animations/Reveal.js +17 -0
- package/Animations/Underline.d.ts +1 -0
- package/Animations/Underline.js +5 -0
- package/Animations/index.d.ts +3 -0
- package/Animations/index.js +3 -0
- package/Animations/package.json +6 -0
- package/Animations/useReveal.d.ts +33 -0
- package/Animations/useReveal.js +71 -0
- package/Autocomplete/AutocompleteDownshift.d.ts +1 -0
- package/Autocomplete/AutocompleteDownshift.js +158 -0
- package/Autocomplete/AutocompleteDownshiftMultiselect.d.ts +1 -0
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +353 -0
- package/Autocomplete/AutocompleteMui.d.ts +47 -0
- package/Autocomplete/AutocompleteMui.js +182 -0
- package/Autocomplete/AutocompleteReach.d.ts +1 -0
- package/Autocomplete/AutocompleteReach.js +112 -0
- package/Autocomplete/components.d.ts +21 -0
- package/Autocomplete/components.js +34 -0
- package/Autocomplete/helpers.d.ts +3 -0
- package/Autocomplete/helpers.js +28 -0
- package/Autocomplete/index.d.ts +2 -0
- package/Autocomplete/index.js +3 -0
- package/Autocomplete/package.json +6 -0
- package/Bg/BgColor.d.ts +36 -0
- package/Bg/BgColor.js +21 -0
- package/Bg/BgPhoto.d.ts +13 -0
- package/Bg/BgPhoto.js +16 -0
- package/Bg/BgSvg.d.ts +7 -0
- package/Bg/BgSvg.js +12 -0
- package/Bg/index.d.ts +3 -0
- package/Bg/index.js +3 -0
- package/Bg/package.json +6 -0
- package/Breadcrumbs/Breadcrumbs.d.ts +13 -0
- package/Breadcrumbs/Breadcrumbs.js +27 -0
- package/Breadcrumbs/index.d.ts +1 -0
- package/Breadcrumbs/index.js +1 -0
- package/Breadcrumbs/package.json +6 -0
- package/Buttons/Button.d.ts +18 -0
- package/Buttons/Button.js +14 -0
- package/Buttons/ButtonComposite.d.ts +23 -0
- package/Buttons/ButtonComposite.js +28 -0
- package/Buttons/ButtonFab.d.ts +7 -0
- package/Buttons/ButtonFab.js +6 -0
- package/Buttons/ButtonLink.d.ts +8 -0
- package/Buttons/ButtonLink.js +11 -0
- package/Buttons/IconButton.d.ts +11 -0
- package/Buttons/IconButton.js +7 -0
- package/Buttons/index.d.ts +5 -0
- package/Buttons/index.js +5 -0
- package/Buttons/package.json +6 -0
- package/Calendar/CalendarDaygridCell.d.ts +36 -0
- package/Calendar/CalendarDaygridCell.js +57 -0
- package/Calendar/CalendarDaygridNav.d.ts +27 -0
- package/Calendar/CalendarDaygridNav.js +23 -0
- package/Calendar/CalendarDaygridTable.d.ts +25 -0
- package/Calendar/CalendarDaygridTable.js +57 -0
- package/Calendar/CalendarLegend.d.ts +19 -0
- package/Calendar/CalendarLegend.js +16 -0
- package/Calendar/calendar-api-google.d.ts +18 -0
- package/Calendar/calendar-api-google.js +127 -0
- package/Calendar/index.d.ts +6 -0
- package/Calendar/index.js +6 -0
- package/Calendar/package.json +6 -0
- package/Calendar/types.d.ts +81 -0
- package/Calendar/types.js +1 -0
- package/Calendar/useCalendar.d.ts +49 -0
- package/Calendar/useCalendar.js +183 -0
- package/Calendar/utils.d.ts +11 -0
- package/Calendar/utils.js +202 -0
- package/Carousel/Carousel.d.ts +1 -0
- package/Carousel/Carousel.js +378 -0
- package/Carousel/CarouselCss.d.ts +47 -0
- package/Carousel/CarouselCss.js +23 -0
- package/Carousel/index.d.ts +1 -0
- package/Carousel/index.js +1 -0
- package/Carousel/package.json +6 -0
- package/Collapsable/Collapsable.d.ts +1 -0
- package/Collapsable/Collapsable.js +1 -0
- package/Collapsable/CollapsableReach.d.ts +6 -0
- package/Collapsable/CollapsableReach.js +253 -0
- package/Collapsable/index.d.ts +1 -0
- package/Collapsable/index.js +2 -0
- package/Collapsable/package.json +6 -0
- package/Debug/Debug.d.ts +4 -0
- package/Debug/Debug.js +9 -0
- package/Debug/index.d.ts +1 -0
- package/Debug/index.js +1 -0
- package/Debug/package.json +6 -0
- package/Details/Details.d.ts +114 -0
- package/Details/Details.js +65 -0
- package/Details/index.d.ts +1 -0
- package/Details/index.js +1 -0
- package/Details/package.json +6 -0
- package/Dialog/DialogMui.d.ts +139 -0
- package/Dialog/DialogMui.js +80 -0
- package/Dialog/css/bare.d.ts +145 -0
- package/Dialog/css/bare.js +21 -0
- package/Dialog/index.d.ts +2 -0
- package/Dialog/index.js +1 -0
- package/Dialog/m/bare.d.ts +56 -0
- package/Dialog/m/bare.js +52 -0
- package/Dialog/m/basic.d.ts +4 -0
- package/Dialog/m/basic.js +31 -0
- package/Dialog/m/index.d.ts +2 -0
- package/Dialog/m/index.js +4 -0
- package/Dialog/m/package.json +6 -0
- package/Dialog/package.json +6 -0
- package/Dialog/sc/bare.d.ts +105 -0
- package/Dialog/sc/bare.js +43 -0
- package/Dialog/sc/framer.d.ts +80 -0
- package/Dialog/sc/framer.js +16 -0
- package/Dialog/sc/framerMaterial.d.ts +79 -0
- package/Dialog/sc/framerMaterial.js +16 -0
- package/Dialog/sc/material.d.ts +94 -0
- package/Dialog/sc/material.js +21 -0
- package/Dialog/tw/bare.d.ts +196 -0
- package/Dialog/tw/bare.js +42 -0
- package/Dialog/tw/elegant.d.ts +244 -0
- package/Dialog/tw/elegant.js +20 -0
- package/Dialog/tw/framer.d.ts +112 -0
- package/Dialog/tw/framer.js +16 -0
- package/Dialog/tw/framerMaterial.d.ts +167 -0
- package/Dialog/tw/framerMaterial.js +16 -0
- package/Dialog/tw/material.d.ts +244 -0
- package/Dialog/tw/material.js +20 -0
- package/Editor/Editor--tiptap.d.ts +9 -0
- package/Editor/Editor--tiptap.js +26 -0
- package/Editor/components.d.ts +7 -0
- package/Editor/components.js +10 -0
- package/Editor/index.d.ts +1 -0
- package/Editor/index.js +1 -0
- package/Editor/package.json +6 -0
- package/Favicon/FaviconTags.d.ts +18 -0
- package/Favicon/FaviconTags.js +15 -0
- package/Favicon/index.d.ts +1 -0
- package/Favicon/index.js +1 -0
- package/Favicon/package.json +6 -0
- package/Form/Form.d.ts +111 -0
- package/Form/Form.js +61 -0
- package/Form/index.d.ts +1 -0
- package/Form/index.js +1 -0
- package/Form/package.json +6 -0
- package/Form/sc/bare.d.ts +33 -0
- package/Form/sc/bare.js +20 -0
- package/Forms/Checkbox/Checkbox.d.ts +11 -0
- package/Forms/Checkbox/Checkbox.js +18 -0
- package/Forms/Checkbox/index.d.ts +1 -0
- package/Forms/Checkbox/index.js +1 -0
- package/Forms/Checkbox/package.json +6 -0
- package/Forms/Feedback/Feedback.d.ts +5 -0
- package/Forms/Feedback/Feedback.js +9 -0
- package/Forms/Feedback/index.d.ts +1 -0
- package/Forms/Feedback/index.js +1 -0
- package/Forms/Feedback/package.json +6 -0
- package/Forms/Field/Field.d.ts +15 -0
- package/Forms/Field/Field.js +48 -0
- package/Forms/Field/FieldControl.d.ts +26 -0
- package/Forms/Field/FieldControl.js +47 -0
- package/Forms/Field/FieldHint.d.ts +1 -0
- package/Forms/Field/FieldHint.js +4 -0
- package/Forms/Field/index.d.ts +2 -0
- package/Forms/Field/index.js +2 -0
- package/Forms/Field/package.json +6 -0
- package/Forms/Input/Input.d.ts +9 -0
- package/Forms/Input/Input.js +17 -0
- package/Forms/Input/index.d.ts +1 -0
- package/Forms/Input/index.js +1 -0
- package/Forms/Input/package.json +6 -0
- package/Forms/InputGroup/InputGroup.d.ts +13 -0
- package/Forms/InputGroup/InputGroup.js +15 -0
- package/Forms/InputGroup/index.d.ts +1 -0
- package/Forms/InputGroup/index.js +1 -0
- package/Forms/InputGroup/package.json +6 -0
- package/Forms/Label/Label.d.ts +3 -0
- package/Forms/Label/Label.js +6 -0
- package/Forms/Label/index.d.ts +1 -0
- package/Forms/Label/index.js +1 -0
- package/Forms/Label/package.json +6 -0
- package/Forms/Password/Password.d.ts +5 -0
- package/Forms/Password/Password.js +17 -0
- package/Forms/Password/index.d.ts +1 -0
- package/Forms/Password/index.js +1 -0
- package/Forms/Password/package.json +6 -0
- package/Forms/Radio/Radio.d.ts +12 -0
- package/Forms/Radio/Radio.js +25 -0
- package/Forms/Radio/index.d.ts +1 -0
- package/Forms/Radio/index.js +1 -0
- package/Forms/Radio/package.json +6 -0
- package/Forms/Switch/Switch.d.ts +9 -0
- package/Forms/Switch/Switch.js +20 -0
- package/Forms/Switch/index.d.ts +1 -0
- package/Forms/Switch/index.js +1 -0
- package/Forms/Switch/package.json +6 -0
- package/Forms/Textarea/Textarea.d.ts +5 -0
- package/Forms/Textarea/Textarea.js +12 -0
- package/Forms/Textarea/TextareaRich.d.ts +6 -0
- package/Forms/Textarea/TextareaRich.js +28 -0
- package/Forms/Textarea/index.d.ts +2 -0
- package/Forms/Textarea/index.js +2 -0
- package/Forms/Textarea/package.json +6 -0
- package/Forms/Toggle/Toggle.d.ts +19 -0
- package/Forms/Toggle/Toggle.js +32 -0
- package/Forms/Toggle/index.d.ts +1 -0
- package/Forms/Toggle/index.js +1 -0
- package/Forms/Toggle/package.json +6 -0
- package/Forms/Toggle/useToggle.d.ts +46 -0
- package/Forms/Toggle/useToggle.js +145 -0
- package/Forms/antispam.d.ts +24 -0
- package/Forms/antispam.js +56 -0
- package/Forms/helpers.d.ts +26 -0
- package/Forms/helpers.js +45 -0
- package/Forms/index.d.ts +15 -0
- package/Forms/index.js +16 -0
- package/Forms/package.json +6 -0
- package/Forms/styles.d.ts +19 -0
- package/Forms/styles.js +29 -0
- package/Gauge/Gauge.d.ts +5 -0
- package/Gauge/Gauge.js +102 -0
- package/Grid/Grid.d.ts +64 -0
- package/Grid/Grid.js +53 -0
- package/Grid/index.d.ts +1 -0
- package/Grid/index.js +1 -0
- package/Grid/package.json +6 -0
- package/Hamburger/Hamburger.d.ts +6 -0
- package/Hamburger/Hamburger.js +52 -0
- package/Hamburger/index.d.ts +1 -0
- package/Hamburger/index.js +1 -0
- package/Hamburger/package.json +6 -0
- package/Header/index.d.ts +1 -0
- package/Header/index.js +1 -0
- package/Header/package.json +6 -0
- package/Header/useHeader.d.ts +24 -0
- package/Header/useHeader.js +30 -0
- package/Hidden/Hidden.d.ts +6 -0
- package/Hidden/Hidden.js +10 -0
- package/Hidden/index.d.ts +1 -0
- package/Hidden/index.js +1 -0
- package/Hidden/package.json +6 -0
- package/Img/index.d.ts +1 -0
- package/Img/index.js +1 -0
- package/Img/package.json +6 -0
- package/Img/sc/bare.d.ts +2 -0
- package/Img/sc/bare.js +39 -0
- package/Img/types.d.ts +9 -0
- package/Img/types.js +1 -0
- package/Link/Link.d.ts +5 -0
- package/Link/Link.js +4 -0
- package/Link/LinkBlank.d.ts +8 -0
- package/Link/LinkBlank.js +17 -0
- package/Link/index.d.ts +2 -0
- package/Link/index.js +2 -0
- package/Link/package.json +6 -0
- package/Menu/Menu.d.ts +1 -0
- package/Menu/Menu.js +4 -0
- package/Menu/index.d.ts +1 -0
- package/Menu/index.js +1 -0
- package/Menu/package.json +6 -0
- package/MenuItem/MenuItem.d.ts +4 -0
- package/MenuItem/MenuItem.js +4 -0
- package/MenuItem/index.d.ts +1 -0
- package/MenuItem/index.js +1 -0
- package/MenuItem/package.json +6 -0
- package/Meta/Meta.d.ts +14 -0
- package/Meta/Meta.js +5 -0
- package/Meta/index.d.ts +1 -0
- package/Meta/index.js +1 -0
- package/Meta/package.json +6 -0
- package/NoJs/NoJs.d.ts +2 -0
- package/NoJs/NoJs.js +6 -0
- package/NoJs/index.d.ts +1 -0
- package/NoJs/index.js +1 -0
- package/NoJs/package.json +6 -0
- package/Pagination/PaginationNav.d.ts +22 -0
- package/Pagination/PaginationNav.js +61 -0
- package/Pagination/PaginationResults.d.ts +3 -0
- package/Pagination/PaginationResults.js +11 -0
- package/Pagination/index.d.ts +2 -0
- package/Pagination/index.js +2 -0
- package/Pagination/package.json +6 -0
- package/Pill/Pill.d.ts +5 -0
- package/Pill/Pill.js +7 -0
- package/Pill/index.d.ts +1 -0
- package/Pill/index.js +1 -0
- package/Pill/package.json +6 -0
- package/Progress/ProgressCircular.d.ts +19 -0
- package/Progress/ProgressCircular.js +15 -0
- package/Progress/ProgressLinear.d.ts +22 -0
- package/Progress/ProgressLinear.js +24 -0
- package/Progress/ProgressOverlay.d.ts +4 -0
- package/Progress/ProgressOverlay.js +24 -0
- package/Progress/index.d.ts +3 -0
- package/Progress/index.js +3 -0
- package/Progress/package.json +6 -0
- package/Rating/Rating.d.ts +35 -0
- package/Rating/Rating.js +71 -0
- package/Rating/index.d.ts +11 -0
- package/Rating/index.js +49 -0
- package/Rating/package.json +6 -0
- package/Select/SelectDownshift.d.ts +5 -0
- package/Select/SelectDownshift.js +38 -0
- package/Select/components.d.ts +6 -0
- package/Select/components.js +12 -0
- package/Select/index.d.ts +2 -0
- package/Select/index.js +3 -0
- package/Select/package.json +6 -0
- package/Sidebar/Sidebar.d.ts +3 -0
- package/Sidebar/Sidebar.js +23 -0
- package/Sidebar/index.d.ts +1 -0
- package/Sidebar/index.js +1 -0
- package/Sidebar/package.json +6 -0
- package/Spacing/Spacing.d.ts +30 -0
- package/Spacing/Spacing.js +45 -0
- package/Spacing/index.d.ts +1 -0
- package/Spacing/index.js +1 -0
- package/Spacing/package.json +6 -0
- package/Sticky/Sticky.d.ts +2 -0
- package/Sticky/Sticky.js +219 -0
- package/Sticky/StickyCss.d.ts +5 -0
- package/Sticky/StickyCss.js +6 -0
- package/Sticky/index.d.ts +1 -0
- package/Sticky/index.js +1 -0
- package/Sticky/package.json +6 -0
- package/Tabs/TabsMui.d.ts +244 -0
- package/Tabs/TabsMui.js +46 -0
- package/Tabs/index.d.ts +1 -0
- package/Tabs/index.js +1 -0
- package/Tabs/package.json +6 -0
- package/Tabs/sc/bare.d.ts +5 -0
- package/Tabs/sc/bare.js +87 -0
- package/Tabs/tw/bare.d.ts +248 -0
- package/Tabs/tw/bare.js +17 -0
- package/Tabs/tw/material.d.ts +472 -0
- package/Tabs/tw/material.js +18 -0
- package/Tabs/useTabs.d.ts +43 -0
- package/Tabs/useTabs.js +44 -0
- package/Typography/CopyPasteVisible.d.ts +1 -0
- package/Typography/CopyPasteVisible.js +4 -0
- package/Typography/Native.d.ts +10 -0
- package/Typography/Native.js +14 -0
- package/Typography/ReadMore.d.ts +12 -0
- package/Typography/ReadMore.js +43 -0
- package/Typography/TextLoop.d.ts +16 -0
- package/Typography/TextLoop.js +46 -0
- package/Typography/TypeStairs.d.ts +6 -0
- package/Typography/TypeStairs.js +50 -0
- package/Typography/index.d.ts +5 -0
- package/Typography/index.js +5 -0
- package/Typography/package.json +6 -0
- package/css/index.d.ts +2 -0
- package/css/index.js +31 -0
- package/css/package.json +6 -0
- package/helpers/classed.d.ts +22 -0
- package/helpers/classed.js +68 -0
- package/helpers/extend-component.d.ts +28 -0
- package/helpers/extend-component.js +12 -0
- package/helpers/index.d.ts +3 -0
- package/helpers/index.js +2 -0
- package/helpers/package.json +6 -0
- package/hooks/index.d.ts +14 -0
- package/hooks/index.js +15 -0
- package/hooks/package.json +6 -0
- package/hooks/types.d.ts +8 -0
- package/hooks/types.js +1 -0
- package/hooks/useAsyncFn.d.ts +26 -0
- package/hooks/useAsyncFn.js +36 -0
- package/hooks/useDateLocale.d.ts +7 -0
- package/hooks/useDateLocale.js +38 -0
- package/hooks/useEffectOnce.d.ts +5 -0
- package/hooks/useEffectOnce.js +8 -0
- package/hooks/useFirstMountState.d.ts +4 -0
- package/hooks/useFirstMountState.js +12 -0
- package/hooks/useFocus.d.ts +4 -0
- package/hooks/useFocus.js +11 -0
- package/hooks/useId.d.ts +4 -0
- package/hooks/useId.js +8 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +5 -0
- package/hooks/useIsomorphicLayoutEffect.js +8 -0
- package/hooks/useMount.d.ts +4 -0
- package/hooks/useMount.js +9 -0
- package/hooks/useMountedState.d.ts +4 -0
- package/hooks/useMountedState.js +15 -0
- package/hooks/usePrevious.d.ts +1 -0
- package/hooks/usePrevious.js +8 -0
- package/hooks/useScrollPosition.d.ts +15 -0
- package/hooks/useScrollPosition.js +80 -0
- package/hooks/useScrollTo.d.ts +1 -0
- package/hooks/useScrollTo.js +21 -0
- package/hooks/useTraceUpdate.d.ts +4 -0
- package/hooks/useTraceUpdate.js +21 -0
- package/hooks/useUpdateEffect.d.ts +5 -0
- package/hooks/useUpdateEffect.js +14 -0
- package/hooks/useWindowSize.d.ts +1 -0
- package/hooks/useWindowSize.js +13 -0
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/m/MotionProvider.d.ts +37 -0
- package/m/MotionProvider.js +39 -0
- package/m/index.d.ts +6 -0
- package/m/index.js +6 -0
- package/m/lite.d.ts +2 -0
- package/m/lite.js +2 -0
- package/m/max.d.ts +2 -0
- package/m/max.js +2 -0
- package/m/package.json +6 -0
- package/package.json +6 -9
- package/sc/index.d.ts +30 -0
- package/sc/index.js +31 -0
- package/sc/package.json +6 -0
- package/scm/index.d.ts +29 -0
- package/scm/index.js +31 -0
- package/scm/package.json +6 -0
- package/shared/index.d.ts +8 -0
- package/shared/index.js +8 -0
- package/shared/package.json +6 -0
- package/styles/Body.d.ts +10 -0
- package/styles/Body.js +13 -0
- package/styles/Global.d.ts +15 -0
- package/styles/Global.js +18 -0
- package/styles/index.d.ts +7 -0
- package/styles/index.js +7 -0
- package/styles/media.d.ts +67 -0
- package/styles/media.js +155 -0
- package/styles/package.json +6 -0
- package/styles/spacing.d.ts +13 -0
- package/styles/spacing.js +45 -0
- package/styles/styled.d.ts +12 -0
- package/styles/styled.js +13 -0
- package/styles/theme--vanilla.d.ts +18 -0
- package/styles/theme--vanilla.js +55 -0
- package/styles/theme.d.ts +82 -0
- package/styles/theme.js +41 -0
- package/tw/index.d.ts +2 -0
- package/tw/index.js +31 -0
- package/tw/package.json +6 -0
- package/twm/index.d.ts +2 -0
- package/twm/index.js +31 -0
- package/twm/package.json +6 -0
- package/types.d.ts +10 -0
- package/types.js +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import { classed, extendComponent } from "../../helpers";
|
|
3
|
+
import { KoineTabs as _ } from "./bare";
|
|
4
|
+
export var Root = classed(_.Root)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["< class=\""], ["< class=\""])));
|
|
5
|
+
export var List = classed(_.List)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["< class=\"border-b-gray-200 border-b border-solid"], ["< class=\"border-b-gray-200 border-b border-solid"])));
|
|
6
|
+
export var Tab = classed(_.Tab)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["< class=\"flex-col relative py-3 px-4 uppercase"], ["< class=\"flex-col relative py-3 px-4 uppercase"]))); // ${p => p.selected ? "text-cyan-600" : ""}
|
|
7
|
+
export var Indicator = classed(_.Indicator)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["< class=\"absolute bottom-0 w-full h-[2px] ", ""], ["< class=\"absolute bottom-0 w-full h-[2px] ", ""])), function (p) {
|
|
8
|
+
return p.selected ? "bg-current" : "";
|
|
9
|
+
});
|
|
10
|
+
export var Panel = classed(_.Panel)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["< class=\"tabsPanel"], ["< class=\"tabsPanel"])));
|
|
11
|
+
export var KoineTabs = extendComponent(_, {
|
|
12
|
+
Root: Root,
|
|
13
|
+
List: List,
|
|
14
|
+
Tab: Tab,
|
|
15
|
+
Indicator: Indicator,
|
|
16
|
+
Panel: Panel,
|
|
17
|
+
});
|
|
18
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface UseTabsProps {
|
|
3
|
+
/**
|
|
4
|
+
* The value of the currently selected `Tab`.
|
|
5
|
+
* If you don't want any selected `Tab`, you can set this prop to `false`.
|
|
6
|
+
*/
|
|
7
|
+
value?: string | number | false;
|
|
8
|
+
/**
|
|
9
|
+
* The default value. Use when the component is not controlled.
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: string | number | false;
|
|
12
|
+
/**
|
|
13
|
+
* The component orientation (layout flow direction).
|
|
14
|
+
* @default 'horizontal'
|
|
15
|
+
*/
|
|
16
|
+
orientation?: "horizontal" | "vertical";
|
|
17
|
+
/**
|
|
18
|
+
* The direction of the text.
|
|
19
|
+
* @default 'ltr'
|
|
20
|
+
*/
|
|
21
|
+
direction?: "ltr" | "rtl";
|
|
22
|
+
/**
|
|
23
|
+
* Callback invoked when new value is being set.
|
|
24
|
+
*/
|
|
25
|
+
onChange?: (event: React.SyntheticEvent, value: number | string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* If `true` the selected tab changes on focus. Otherwise it only
|
|
28
|
+
* changes on activation.
|
|
29
|
+
*/
|
|
30
|
+
selectionFollowsFocus?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const useTabs: (props: UseTabsProps) => {
|
|
33
|
+
getRootProps: () => {};
|
|
34
|
+
tabsContextValue: {
|
|
35
|
+
idPrefix: string;
|
|
36
|
+
value: string | number | false;
|
|
37
|
+
onSelected: (event: React.SyntheticEvent, value: number | string) => void;
|
|
38
|
+
orientation: "horizontal" | "vertical" | undefined;
|
|
39
|
+
direction: "ltr" | "rtl" | undefined;
|
|
40
|
+
selectionFollowsFocus: boolean | undefined;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export default useTabs;
|
package/Tabs/useTabs.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback, /* useId, */ useMemo } from "react";
|
|
2
|
+
import { unstable_useControlled as useControlled } from "@mui/utils";
|
|
3
|
+
import { useId } from "../hooks/useId";
|
|
4
|
+
export var useTabs = function (props) {
|
|
5
|
+
var valueProp = props.value, defaultValue = props.defaultValue, onChange = props.onChange, orientation = props.orientation, direction = props.direction, selectionFollowsFocus = props.selectionFollowsFocus;
|
|
6
|
+
var _a = useControlled({
|
|
7
|
+
controlled: valueProp,
|
|
8
|
+
default: defaultValue,
|
|
9
|
+
name: "Tabs",
|
|
10
|
+
state: "value",
|
|
11
|
+
}), value = _a[0], setValue = _a[1];
|
|
12
|
+
var idPrefix = useId();
|
|
13
|
+
var onSelected = useCallback(function (e, newValue) {
|
|
14
|
+
setValue(newValue);
|
|
15
|
+
if (onChange) {
|
|
16
|
+
onChange(e, newValue);
|
|
17
|
+
}
|
|
18
|
+
}, [onChange, setValue]);
|
|
19
|
+
var getRootProps = function () {
|
|
20
|
+
return {};
|
|
21
|
+
};
|
|
22
|
+
var tabsContextValue = useMemo(function () {
|
|
23
|
+
return {
|
|
24
|
+
idPrefix: idPrefix,
|
|
25
|
+
value: value,
|
|
26
|
+
onSelected: onSelected,
|
|
27
|
+
orientation: orientation,
|
|
28
|
+
direction: direction,
|
|
29
|
+
selectionFollowsFocus: selectionFollowsFocus,
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
idPrefix,
|
|
33
|
+
value,
|
|
34
|
+
onSelected,
|
|
35
|
+
orientation,
|
|
36
|
+
direction,
|
|
37
|
+
selectionFollowsFocus,
|
|
38
|
+
]);
|
|
39
|
+
return {
|
|
40
|
+
getRootProps: getRootProps,
|
|
41
|
+
tabsContextValue: tabsContextValue,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default useTabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CopyPasteVisible: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
export var CopyPasteVisible = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: transparent;\n opacity: 0;\n font-size: 0;\n"], ["\n color: transparent;\n opacity: 0;\n font-size: 0;\n"])));
|
|
4
|
+
var templateObject_1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const p = "\n margin: 0 0 1em 0;\n";
|
|
2
|
+
export declare const h1: string;
|
|
3
|
+
export declare const h2 = "\n margin: 0 0 1em 0;\n font-size: 24px;\n font-weight: 800;\n line-height: var(--headingsLineHeight);\n";
|
|
4
|
+
export declare const h3 = "\n margin: 0 0 1em 0;\n font-size: 20px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
5
|
+
export declare const h4 = "\n margin: 0 0 1em 0;\n font-size: 13px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
6
|
+
export declare const P: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const H1: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const H2: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
9
|
+
export declare const H3: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const H4: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __makeTemplateObject } from "tslib";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { min } from "../styles/media";
|
|
4
|
+
export var p = "\n margin: 0 0 1em 0;\n";
|
|
5
|
+
export var h1 = "\n margin: 0 0 10px 0;\n font-size: 30px;\n font-weight: 800;\n line-height: var(--headingsLineHeight);\n ".concat(min.md, " {\n font-size: 50px;\n }\n");
|
|
6
|
+
export var h2 = "\n margin: 0 0 1em 0;\n font-size: 24px;\n font-weight: 800;\n line-height: var(--headingsLineHeight);\n";
|
|
7
|
+
export var h3 = "\n margin: 0 0 1em 0;\n font-size: 20px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
8
|
+
export var h4 = "\n margin: 0 0 1em 0;\n font-size: 13px;\n font-weight: 600;\n line-height: var(--headingsLineHeight);\n";
|
|
9
|
+
export var P = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), p);
|
|
10
|
+
export var H1 = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h1);
|
|
11
|
+
export var H2 = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h2);
|
|
12
|
+
export var H3 = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h3);
|
|
13
|
+
export var H4 = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), h4);
|
|
14
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type ReadMoreProps = React.ComponentPropsWithoutRef<"div"> & {
|
|
3
|
+
lines?: number;
|
|
4
|
+
lineHeight?: number;
|
|
5
|
+
fontSize?: number;
|
|
6
|
+
bg?: React.CSSProperties["background"];
|
|
7
|
+
/** @default "Expand" */
|
|
8
|
+
expand?: string;
|
|
9
|
+
/** @default "Collapse" */
|
|
10
|
+
collapse?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const ReadMore: ({ lines, lineHeight, fontSize, bg, expand, collapse, ...props }: ReadMoreProps) => JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useRef, useMemo } from "react";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { m, useSpring } from "framer-motion";
|
|
6
|
+
// import { CgArrowsExpandDownRight as IconExpand } from "react-icons/cg";
|
|
7
|
+
import { useIsomorphicLayoutEffect } from "../hooks";
|
|
8
|
+
var Root = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
9
|
+
var Content = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n & p:first-child {\n margin-top: 0;\n }\n"], ["\n & p:first-child {\n margin-top: 0;\n }\n"])));
|
|
10
|
+
var BtnWrap = styled.span(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-end;\n transition: transform 0.18s ease-in-out;\n text-align: right;\n transform: translateY(", ");\n opacity: ", ";\n"], ["\n display: flex;\n justify-content: flex-end;\n transition: transform 0.18s ease-in-out;\n text-align: right;\n transform: translateY(", ");\n opacity: ", ";\n"])), function (p) { return (p.$expanded ? "0" : "-100%"); }, function (p) { return (p.$expanded ? 0 : 1); });
|
|
11
|
+
var BtnFader = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 30%;\n transition: transform 0.18s ease-in-out;\n background: linear-gradient(45deg, transparent 50%, ", " 70%);\n"], ["\n width: 30%;\n transition: transform 0.18s ease-in-out;\n background: linear-gradient(45deg, transparent 50%, ", " 70%);\n"])), function (p) { return p.$bg; });
|
|
12
|
+
var Btn = styled.span(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: 0 10px 0 10px;\n line-height: ", ";\n background: var(--bodyBg);\n color: var(--grey600);\n white-space: nowrap;\n font-size: ", "px;\n cursor: pointer;\n"], ["\n padding: 0 10px 0 10px;\n line-height: ", ";\n background: var(--bodyBg);\n color: var(--grey600);\n white-space: nowrap;\n font-size: ", "px;\n cursor: pointer;\n"])), function (p) { return (p.$lineHeight ? p.$lineHeight : "inherit"); }, function (p) { return p.$fontSize; });
|
|
13
|
+
var BtnIcon = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: inline-block;\n margin: 0 0 0 4px;\n transition: transform 0.18s ease-in-out;\n ", ";\n font-size: ", "px;\n"], ["\n display: inline-block;\n margin: 0 0 0 4px;\n transition: transform 0.18s ease-in-out;\n ", ";\n font-size: ", "px;\n"])), function (p) { return (p.$expanded ? "transform: rotate(180deg);" : ""); }, function (p) { return p.$fontSize; });
|
|
14
|
+
export var ReadMore = function (_a) {
|
|
15
|
+
var _b = _a.lines, lines = _b === void 0 ? 3 : _b, _c = _a.lineHeight, lineHeight = _c === void 0 ? 1.6 : _c, _d = _a.fontSize, fontSize = _d === void 0 ? 14 : _d, _e = _a.bg, bg = _e === void 0 ? "var(--bodyBg)" : _e, _f = _a.expand, expand = _f === void 0 ? "Expand" : _f, _g = _a.collapse, collapse = _g === void 0 ? "Collapse" : _g, props = __rest(_a, ["lines", "lineHeight", "fontSize", "bg", "expand", "collapse"]);
|
|
16
|
+
var defaultMaxHeight = lines * (lineHeight * fontSize);
|
|
17
|
+
var _h = useState(false), expanded = _h[0], setExpanded = _h[1];
|
|
18
|
+
var _j = useState(defaultMaxHeight), maxHeight = _j[0], setMaxHeight = _j[1];
|
|
19
|
+
var _k = useState(0), fullHeight = _k[0], setFullHeight = _k[1];
|
|
20
|
+
var _l = useState(false), exceeds = _l[0], setExceeds = _l[1];
|
|
21
|
+
var content = useRef(null);
|
|
22
|
+
var height = useSpring(defaultMaxHeight);
|
|
23
|
+
var styles = useMemo(function () { return (exceeds ? { height: height, overflow: "hidden" } : {}); }, [exceeds, height]);
|
|
24
|
+
var handleExpandClick = function () {
|
|
25
|
+
setExpanded(function (prevExpanded) { return !prevExpanded; });
|
|
26
|
+
};
|
|
27
|
+
useIsomorphicLayoutEffect(function () {
|
|
28
|
+
if (content.current) {
|
|
29
|
+
var elementHeight = content.current.offsetHeight;
|
|
30
|
+
var newExceeds = elementHeight > maxHeight;
|
|
31
|
+
if (!newExceeds) {
|
|
32
|
+
setMaxHeight(elementHeight);
|
|
33
|
+
}
|
|
34
|
+
setExceeds(newExceeds);
|
|
35
|
+
setFullHeight(elementHeight);
|
|
36
|
+
}
|
|
37
|
+
}, [content, maxHeight]);
|
|
38
|
+
useIsomorphicLayoutEffect(function () {
|
|
39
|
+
height.set(expanded ? fullHeight : maxHeight);
|
|
40
|
+
}, [expanded, height, fullHeight, maxHeight]);
|
|
41
|
+
return (_jsxs(Root, { children: [_jsx(m.div, __assign({ style: styles }, { children: _jsx(Content, __assign({ ref: content }, props)) })), exceeds && (_jsxs(BtnWrap, __assign({ "$expanded": expanded }, { children: [_jsx(BtnFader, { "$bg": bg }), _jsxs(Btn, __assign({ "$fontSize": fontSize, "$lineHeight": lineHeight, onClick: handleExpandClick, "aria-expanded": expanded, "aria-label": expanded ? collapse : expand }, { children: [expanded ? collapse : expand, _jsx(BtnIcon, { "$expanded": expanded })] }))] })))] }));
|
|
42
|
+
};
|
|
43
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type TextLoopPieceProps = React.PropsWithChildren<{
|
|
3
|
+
text: string | number;
|
|
4
|
+
direction?: "up" | "down";
|
|
5
|
+
inline?: boolean;
|
|
6
|
+
noOverflow?: boolean;
|
|
7
|
+
delay?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const TextLoopPiece: ({ text, style, className, direction, inline, noOverflow, delay, }: TextLoopPieceProps) => JSX.Element;
|
|
12
|
+
export declare type TextLoopPrpps = Omit<TextLoopPieceProps, "text"> & {
|
|
13
|
+
texts: string[];
|
|
14
|
+
interval?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const TextLoop: ({ texts, interval, ...props }: TextLoopPrpps) => JSX.Element;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { m, AnimatePresence } from "framer-motion";
|
|
5
|
+
export var TextLoopPiece = function (_a) {
|
|
6
|
+
var _b = _a.text, text = _b === void 0 ? "" : _b, _c = _a.style, style = _c === void 0 ? {} : _c, _d = _a.className, className = _d === void 0 ? "" : _d, _e = _a.direction, direction = _e === void 0 ? "up" : _e, _f = _a.inline, inline = _f === void 0 ? true : _f, _g = _a.noOverflow, noOverflow = _g === void 0 ? true : _g, _h = _a.delay, delay = _h === void 0 ? 400 : _h;
|
|
7
|
+
var placeholderRef = useRef(null);
|
|
8
|
+
var _j = useState({ data: "", key: "" }), content = _j[0], setContent = _j[1];
|
|
9
|
+
var _k = useState(inline ? 0 : "auto"), width = _k[0], setWidth = _k[1];
|
|
10
|
+
useEffect(function () {
|
|
11
|
+
var timeoutId = setTimeout(function () {
|
|
12
|
+
if (!placeholderRef.current)
|
|
13
|
+
return;
|
|
14
|
+
placeholderRef.current.innerHTML = text + "";
|
|
15
|
+
if (inline)
|
|
16
|
+
setWidth(placeholderRef.current.offsetWidth);
|
|
17
|
+
setContent({ data: text + "", key: new Date() + "" });
|
|
18
|
+
}, delay);
|
|
19
|
+
return function () { return clearTimeout(timeoutId); };
|
|
20
|
+
}, [text, delay, inline]);
|
|
21
|
+
return (_jsxs("div", __assign({ className: className, style: __assign(__assign({}, style), { position: "relative", display: inline ? "inline-block" : "block", width: width, whiteSpace: inline ? "nowrap" : "normal" }) }, { children: [_jsx("span", { ref: placeholderRef, style: { visibility: "hidden" } }), _jsx("div", __assign({ style: {
|
|
22
|
+
overflow: noOverflow ? "hidden" : "visible",
|
|
23
|
+
display: "block",
|
|
24
|
+
position: "absolute",
|
|
25
|
+
top: 0,
|
|
26
|
+
left: 0,
|
|
27
|
+
height: "100%",
|
|
28
|
+
width: "100%",
|
|
29
|
+
} }, { children: _jsx(AnimatePresence, { children: _jsx(m.div, __assign({ style: { position: "absolute" }, initial: {
|
|
30
|
+
opacity: 0,
|
|
31
|
+
y: direction === "down" ? "-100%" : "100%",
|
|
32
|
+
}, animate: { opacity: 1, y: 0 }, exit: {
|
|
33
|
+
opacity: 0,
|
|
34
|
+
y: direction === "down" ? "100%" : "-100%",
|
|
35
|
+
} }, { children: content.data }), content.key) }) }))] })));
|
|
36
|
+
};
|
|
37
|
+
export var TextLoop = function (_a) {
|
|
38
|
+
var texts = _a.texts, _b = _a.interval, interval = _b === void 0 ? 3000 : _b, props = __rest(_a, ["texts", "interval"]);
|
|
39
|
+
var _c = useState(0), index = _c[0], setIndex = _c[1];
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
var intervalId = setInterval(function () { return setIndex(function (index) { return index + 1; }); }, interval // every 3 seconds
|
|
42
|
+
);
|
|
43
|
+
return function () { return clearTimeout(intervalId); };
|
|
44
|
+
}, [interval]);
|
|
45
|
+
return _jsx(TextLoopPiece, __assign({}, props, { text: texts[index % texts.length] }));
|
|
46
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
export var TypeStairs = forwardRef(function (_a, ref) {
|
|
5
|
+
var children = _a.children, limit = _a.limit;
|
|
6
|
+
// split in rows or just use one row if there is no limit
|
|
7
|
+
var rows = limit ? splitTextIntoRows(children, limit) : [children];
|
|
8
|
+
return rows.length > 1 ? (_jsx(_Fragment, { children: rows.map(function (row, rowIndex) {
|
|
9
|
+
return (_jsxs("span", { children: [renderRow(row, rowIndex, ref), rowIndex !== rows.length - 1 && _jsx("br", {})] }, "row-".concat(rowIndex)));
|
|
10
|
+
}) })) : (renderRow(rows[0], 0, ref));
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* every number chars find a space and break, then restart the gradient weight
|
|
14
|
+
* @see https://stackoverflow.com/a/25770787
|
|
15
|
+
*/
|
|
16
|
+
function splitTextIntoRows(input, limit) {
|
|
17
|
+
if (input === void 0) { input = ""; }
|
|
18
|
+
if (limit === void 0) { limit = 18; }
|
|
19
|
+
var rows = [];
|
|
20
|
+
var arr = input.split(" ");
|
|
21
|
+
var currow = arr[0];
|
|
22
|
+
var rowlen = currow.length;
|
|
23
|
+
for (var i = 1; i < arr.length; i++) {
|
|
24
|
+
var word = arr[i];
|
|
25
|
+
rowlen += word.length + 1;
|
|
26
|
+
if (rowlen <= limit) {
|
|
27
|
+
currow += " " + word;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
rows.push(currow);
|
|
31
|
+
currow = word;
|
|
32
|
+
rowlen = word.length;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
rows.push(currow);
|
|
36
|
+
return rows;
|
|
37
|
+
}
|
|
38
|
+
function renderRow(row, rowIndex, ref) {
|
|
39
|
+
var letters = row.split("");
|
|
40
|
+
var fontWeightIdx = 1;
|
|
41
|
+
// const fontWeight = Math.min(fontWeightIdx * 100, 800);
|
|
42
|
+
return (_jsx(_Fragment, { children: letters.map(function (letter, letterIndex) {
|
|
43
|
+
var fontWeight = Math.min(fontWeightIdx * 100, 800);
|
|
44
|
+
// don't waste a fontWeight for a white space
|
|
45
|
+
if (letter !== " ") {
|
|
46
|
+
fontWeightIdx++;
|
|
47
|
+
}
|
|
48
|
+
return (_jsx("span", __assign({ style: { fontWeight: fontWeight }, ref: ref }, { children: letter }), "letter-".concat(rowIndex, "-").concat(letterIndex)));
|
|
49
|
+
}) }));
|
|
50
|
+
}
|
package/css/index.d.ts
ADDED
package/css/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export * from "../shared";
|
|
2
|
+
// export * from "../Alert";
|
|
3
|
+
// export * from "../Animations";
|
|
4
|
+
// export * from "../Autocomplete";
|
|
5
|
+
// export * from "../Bg";
|
|
6
|
+
// export * from "../Breadcrumbs";
|
|
7
|
+
// export * from "../Buttons";
|
|
8
|
+
// export * from "../Carousel";
|
|
9
|
+
// export * from "../Collapsable";
|
|
10
|
+
// export * from "../Debug";
|
|
11
|
+
export { KoineDialog } from "../Dialog/css/bare";
|
|
12
|
+
// export * from "../Form";
|
|
13
|
+
// export * from "../Forms";
|
|
14
|
+
// export * from "../Grid";
|
|
15
|
+
// export * from "../Hamburger";
|
|
16
|
+
// export * from "../Header";
|
|
17
|
+
// export * from "../Hidden";
|
|
18
|
+
// export * from "../Img";
|
|
19
|
+
// export * from "../Link";
|
|
20
|
+
// export * from "../MenuItem";
|
|
21
|
+
// export * from "../Pagination";
|
|
22
|
+
// export * from "../Pill";
|
|
23
|
+
// export * from "../Progress";
|
|
24
|
+
// export * from "../Rating";
|
|
25
|
+
// // export * from "../Select";
|
|
26
|
+
// export * from "../Sidebar";
|
|
27
|
+
// export * from "../Spacing";
|
|
28
|
+
// export * from "../Sticky";
|
|
29
|
+
// export * from "../styles";
|
|
30
|
+
// export * from "../Tabs";
|
|
31
|
+
// export * from "../Typography";
|
package/css/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type ClassedAugmentedProps<Props> = Props & {
|
|
3
|
+
className?: string;
|
|
4
|
+
ref?: React.Ref<any>;
|
|
5
|
+
};
|
|
6
|
+
declare type ClassedFinalProps<Props, Component> = Component extends React.ReactHTML ? React.HTMLProps<Component> & ClassedAugmentedProps<Props> : ClassedAugmentedProps<Props>;
|
|
7
|
+
/**
|
|
8
|
+
* This utility allows to extend a component a là `styled-components` but for
|
|
9
|
+
* a className based styling solution like Tailwind,
|
|
10
|
+
*
|
|
11
|
+
* It also plays nicely with tailwind intellisense @see:
|
|
12
|
+
*
|
|
13
|
+
* - https://github.com/tailwindlabs/tailwindcss-intellisense#tailwindcssclassattributes
|
|
14
|
+
*
|
|
15
|
+
* For references about tagged functions:
|
|
16
|
+
* - https://javascript.plainenglish.io/how-css-in-js-libraries-work-da4145b1b6c7
|
|
17
|
+
* - https://makersden.io/blog/reverse-engineering-styled-components
|
|
18
|
+
* - https://typesafe.blog/article/the-logic-behind-javascript-tag-functions
|
|
19
|
+
* - https://flaming.codes/posts/typescript-and-javascript-tagged-template-strings
|
|
20
|
+
*/
|
|
21
|
+
export declare function classed<Props, Component extends React.ElementType = any>(component: Component): (strings: TemplateStringsArray, ...args: string[] | ((props: Props) => string)[]) => React.ForwardRefExoticComponent<React.PropsWithoutRef<ClassedFinalProps<Props, Component>> & React.RefAttributes<Component>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { createElement, forwardRef } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* This utility allows to extend a component a là `styled-components` but for
|
|
5
|
+
* a className based styling solution like Tailwind,
|
|
6
|
+
*
|
|
7
|
+
* It also plays nicely with tailwind intellisense @see:
|
|
8
|
+
*
|
|
9
|
+
* - https://github.com/tailwindlabs/tailwindcss-intellisense#tailwindcssclassattributes
|
|
10
|
+
*
|
|
11
|
+
* For references about tagged functions:
|
|
12
|
+
* - https://javascript.plainenglish.io/how-css-in-js-libraries-work-da4145b1b6c7
|
|
13
|
+
* - https://makersden.io/blog/reverse-engineering-styled-components
|
|
14
|
+
* - https://typesafe.blog/article/the-logic-behind-javascript-tag-functions
|
|
15
|
+
* - https://flaming.codes/posts/typescript-and-javascript-tagged-template-strings
|
|
16
|
+
*/
|
|
17
|
+
export function classed(component) {
|
|
18
|
+
// @ts-expect-error nevermind for now...
|
|
19
|
+
var type = component.type || component;
|
|
20
|
+
return function (strings) {
|
|
21
|
+
var args = [];
|
|
22
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23
|
+
args[_i - 1] = arguments[_i];
|
|
24
|
+
}
|
|
25
|
+
var WrappedComponent = forwardRef(function (props, ref) {
|
|
26
|
+
var _a;
|
|
27
|
+
var argResolved = args
|
|
28
|
+
.map(function (arg, index) {
|
|
29
|
+
var result = "";
|
|
30
|
+
if (typeof arg === "function") {
|
|
31
|
+
result = arg(props);
|
|
32
|
+
}
|
|
33
|
+
else if (typeof arg !== "undefined") {
|
|
34
|
+
result = arg.toString();
|
|
35
|
+
}
|
|
36
|
+
return strings[index] + result;
|
|
37
|
+
})
|
|
38
|
+
.join("");
|
|
39
|
+
var isNativeHtmlElement = typeof type === "string";
|
|
40
|
+
var propsToForward = isNativeHtmlElement
|
|
41
|
+
? {}
|
|
42
|
+
: props;
|
|
43
|
+
if (isNativeHtmlElement) {
|
|
44
|
+
for (var key in props) {
|
|
45
|
+
// like styled-components `transient` props
|
|
46
|
+
if (!key.startsWith("$")) {
|
|
47
|
+
// FIXME: for react 18 we need: @ts-expect-error
|
|
48
|
+
propsToForward[key] = props[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// get the tagged function string outcome
|
|
53
|
+
var className = argResolved || strings[0];
|
|
54
|
+
// check if we need to clean it or not from the optional structure `< class="..."`
|
|
55
|
+
className = ((_a = className.match(/class="([^"]*)/)) === null || _a === void 0 ? void 0 : _a[1]) || className;
|
|
56
|
+
// add the custom classes from props
|
|
57
|
+
className += (props === null || props === void 0 ? void 0 : props.className) ? " " + (props === null || props === void 0 ? void 0 : props.className) : "";
|
|
58
|
+
return createElement(type, __assign(__assign({}, propsToForward), {
|
|
59
|
+
// only add ot props if it is not an empty string
|
|
60
|
+
className: className || undefined,
|
|
61
|
+
// add ref to props
|
|
62
|
+
ref: ref }));
|
|
63
|
+
});
|
|
64
|
+
// FIXME: not sure if this is needed
|
|
65
|
+
// WrappedComponent.displayName = type.toString();
|
|
66
|
+
return WrappedComponent; // as unknown as React.ReactElement<typeof props>;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type ExtendableComponent<Props = any> = React.ForwardRefExoticComponent<Props> | React.ExoticComponent<Props> | React.FC<Props> | ((props: Props) => JSX.Element);
|
|
3
|
+
export declare const extendComponent: <Component extends ExtendableComponent<any>, DefaultProps extends {}>(component: Component, defaultProps: DefaultProps) => ((props: React.ComponentProps<Component>) => React.FunctionComponentElement<any>) & DefaultProps & {
|
|
4
|
+
defaultProps: DefaultProps;
|
|
5
|
+
};
|
|
6
|
+
export interface OverridableComponents {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
type: React.ElementType;
|
|
9
|
+
props: any;
|
|
10
|
+
motionable?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Type to define a component that has overridable components.
|
|
15
|
+
*
|
|
16
|
+
* Each of them can define its:
|
|
17
|
+
* - `type`: either as a native HTMLElement (the props for that element will be
|
|
18
|
+
* automatically inferred) or as a custom React component
|
|
19
|
+
* - `props`: any additional custom props
|
|
20
|
+
* - `motionable`: if that component has a possible implementation with `framer-motion`,
|
|
21
|
+
* in that case we remove some HTMLAttributes props which collides with
|
|
22
|
+
* `MotionProps` from framer.
|
|
23
|
+
*/
|
|
24
|
+
export declare type WithComponents<Props, Components extends OverridableComponents> = Props & {
|
|
25
|
+
[Name in keyof Components]: NonNullable<Components[Name]["type"] extends keyof JSX.IntrinsicElements ? React.ElementType<Components[Name]["motionable"] extends true ? Omit<React.ComponentPropsWithoutRef<Components[Name]["type"]>, HtmlAttributesCollidingWithMotionProps> & Components[Name]["props"] : React.ComponentPropsWithoutRef<Components[Name]["type"]> & Components[Name]["props"]> : Components[Name]["type"]>;
|
|
26
|
+
};
|
|
27
|
+
declare type HtmlAttributesCollidingWithMotionProps = "style" | "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart" | "onAnimationEnd";
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
export var extendComponent = function (component, defaultProps) {
|
|
4
|
+
// FIXME: check if we need to forwardRef or not
|
|
5
|
+
var NewComponent = function (props) {
|
|
6
|
+
return createElement(component, props);
|
|
7
|
+
};
|
|
8
|
+
// const NewComponent = forwardRef<React.ComponentProps<Component>, Component>(
|
|
9
|
+
// (props, ref) => createElement(component, { ...props, ref })
|
|
10
|
+
// );
|
|
11
|
+
return Object.assign(NewComponent, __assign(__assign({}, defaultProps), { defaultProps: defaultProps }));
|
|
12
|
+
};
|
package/helpers/index.js
ADDED
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from "./useAsyncFn";
|
|
2
|
+
export * from "./useDateLocale";
|
|
3
|
+
export * from "./useEffectOnce";
|
|
4
|
+
export * from "./useFirstMountState";
|
|
5
|
+
export * from "./useFocus";
|
|
6
|
+
export * from "./useId";
|
|
7
|
+
export * from "./useIsomorphicLayoutEffect";
|
|
8
|
+
export * from "./useMount";
|
|
9
|
+
export * from "./useMountedState";
|
|
10
|
+
export * from "./usePrevious";
|
|
11
|
+
export * from "./useScrollPosition";
|
|
12
|
+
export * from "./useTraceUpdate";
|
|
13
|
+
export * from "./useUpdateEffect";
|
|
14
|
+
export * from "./useWindowSize";
|
package/hooks/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./useAsyncFn";
|
|
2
|
+
export * from "./useDateLocale";
|
|
3
|
+
export * from "./useEffectOnce";
|
|
4
|
+
export * from "./useFirstMountState";
|
|
5
|
+
export * from "./useFocus";
|
|
6
|
+
export * from "./useId";
|
|
7
|
+
export * from "./useIsomorphicLayoutEffect";
|
|
8
|
+
export * from "./useMount";
|
|
9
|
+
export * from "./useMountedState";
|
|
10
|
+
export * from "./usePrevious";
|
|
11
|
+
export * from "./useScrollPosition";
|
|
12
|
+
// export * from "./useScrollTo";
|
|
13
|
+
export * from "./useTraceUpdate";
|
|
14
|
+
export * from "./useUpdateEffect";
|
|
15
|
+
export * from "./useWindowSize";
|
package/hooks/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/misc/types.ts)
|
|
3
|
+
*/
|
|
4
|
+
export declare type PromiseType<P extends Promise<any>> = P extends Promise<infer T> ? T : never;
|
|
5
|
+
/**
|
|
6
|
+
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/misc/types.ts)
|
|
7
|
+
*/
|
|
8
|
+
export declare type FunctionReturningPromise = (...args: any[]) => Promise<any>;
|
package/hooks/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { FunctionReturningPromise, PromiseType } from "./types";
|
|
3
|
+
export declare type AsyncState<T> = {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error?: undefined;
|
|
6
|
+
value?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
loading: true;
|
|
9
|
+
error?: Error | undefined;
|
|
10
|
+
value?: T;
|
|
11
|
+
} | {
|
|
12
|
+
loading: false;
|
|
13
|
+
error: Error;
|
|
14
|
+
value?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
loading: false;
|
|
17
|
+
error?: undefined;
|
|
18
|
+
value: T;
|
|
19
|
+
};
|
|
20
|
+
declare type StateFromFunctionReturningPromise<T extends FunctionReturningPromise> = AsyncState<PromiseType<ReturnType<T>>>;
|
|
21
|
+
export declare type AsyncFnReturn<T extends FunctionReturningPromise = FunctionReturningPromise> = [StateFromFunctionReturningPromise<T>, T];
|
|
22
|
+
/**
|
|
23
|
+
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useAsyncFn.ts)
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAsyncFn<T extends FunctionReturningPromise>(fn: T, deps?: React.DependencyList, initialState?: StateFromFunctionReturningPromise<T>): AsyncFnReturn<T>;
|
|
26
|
+
export {};
|