@koide-labs/ui 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -3
- package/{src/-types.ts → dist/-types.d.ts} +1 -6
- package/dist/-types.js +1 -0
- package/dist/-utils.d.ts +19 -0
- package/dist/-utils.js +33 -0
- package/dist/Button-DrPFFzo7.js +31 -0
- package/dist/CompositeRoot-CVk5a-pR.js +233 -0
- package/dist/DirectionContext-C2o_MF_i.js +9 -0
- package/dist/FieldItemContext-DAvk99to.js +11 -0
- package/dist/FloatingPortal-tWyuKRSN.js +435 -0
- package/dist/FloatingPortalLite-DVyq6YhV.js +28 -0
- package/dist/InternalBackdrop-jYAiOJ8v.js +574 -0
- package/dist/LabelableContext-BMvjVwor.js +169 -0
- package/dist/ToolbarRootContext-CvvL0Tk1.js +9 -0
- package/dist/clamp-D0KDAQIz.js +6 -0
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/accordion/index.d.ts +12 -0
- package/dist/components/accordion/index.js +699 -0
- package/dist/components/alert-dialog/index.d.ts +26 -0
- package/dist/components/alert-dialog/index.js +136 -0
- package/dist/components/anchor/index.d.ts +8 -0
- package/dist/components/anchor/index.js +38 -0
- package/dist/components/avatar/index.d.ts +21 -0
- package/dist/components/avatar/index.js +161 -0
- package/dist/components/badge/index.d.ts +16 -0
- package/dist/components/badge/index.js +40 -0
- package/dist/components/button/index.d.ts +24 -0
- package/dist/components/button/index.js +47 -0
- package/dist/components/checkbox/index.d.ts +9 -0
- package/dist/components/checkbox/index.js +269 -0
- package/dist/components/code/index.d.ts +9 -0
- package/dist/components/code/index.js +10 -0
- package/dist/components/collapse/index.d.ts +11 -0
- package/dist/components/collapse/index.js +41 -0
- package/dist/components/command/index.d.ts +14 -0
- package/dist/components/command/index.js +1695 -0
- package/dist/components/context-menu/index.d.ts +42 -0
- package/dist/components/context-menu/index.js +1444 -0
- package/dist/components/dialog/index.d.ts +48 -0
- package/dist/components/dialog/index.js +138 -0
- package/dist/components/heading/index.d.ts +44 -0
- package/dist/components/heading/index.js +56 -0
- package/dist/components/icon/icon-names.d.ts +1 -0
- package/dist/components/icon/icon-names.js +1 -0
- package/dist/components/icon/index.d.ts +24 -0
- package/dist/components/icon/index.js +43 -0
- package/dist/components/icon-button/index.d.ts +12 -0
- package/dist/components/icon-button/index.js +45 -0
- package/dist/components/inline-code/index.d.ts +6 -0
- package/dist/components/inline-code/index.js +22 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.js +119 -0
- package/dist/components/meter/index.d.ts +18 -0
- package/dist/components/meter/index.js +165 -0
- package/dist/components/multiline-input/index.d.ts +6 -0
- package/dist/components/multiline-input/index.js +100 -0
- package/dist/components/number-input/index.d.ts +10 -0
- package/dist/components/number-input/index.js +1169 -0
- package/dist/components/password-input/index.d.ts +2 -0
- package/dist/components/password-input/index.js +29 -0
- package/dist/components/pill/index.d.ts +13 -0
- package/dist/components/pill/index.js +38 -0
- package/dist/components/popover/index.d.ts +21 -0
- package/dist/components/popover/index.js +636 -0
- package/dist/components/preview-card/index.d.ts +17 -0
- package/dist/components/preview-card/index.js +402 -0
- package/dist/components/radio/index.d.ts +13 -0
- package/dist/components/radio/index.js +404 -0
- package/dist/components/search-bar/index.d.ts +12 -0
- package/dist/components/search-bar/index.js +48 -0
- package/dist/components/select/index.d.ts +16 -0
- package/dist/components/select/index.js +1263 -0
- package/dist/components/separator/index.d.ts +7 -0
- package/dist/components/separator/index.js +6 -0
- package/dist/components/slider/index.d.ts +5 -0
- package/dist/components/slider/index.js +902 -0
- package/dist/components/spinner/index.d.ts +2 -0
- package/dist/components/spinner/index.js +13 -0
- package/dist/components/stacked-avatars/index.d.ts +14 -0
- package/dist/components/stacked-avatars/index.js +92 -0
- package/dist/components/status-banner/index.d.ts +17 -0
- package/dist/components/status-banner/index.js +69 -0
- package/dist/components/surface/index.d.ts +27 -0
- package/dist/components/surface/index.js +41 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.js +196 -0
- package/dist/components/tabs/index.d.ts +18 -0
- package/dist/components/tabs/index.js +509 -0
- package/dist/components/text/index.d.ts +26 -0
- package/dist/components/text/index.js +51 -0
- package/dist/components/theme-provider/index.d.ts +2 -0
- package/dist/components/theme-provider/index.js +6 -0
- package/dist/components/theme-provider/theme-context.d.ts +9 -0
- package/dist/components/theme-provider/theme-context.js +13 -0
- package/dist/components/theme-provider/theme-provider.d.ts +17 -0
- package/dist/components/theme-provider/theme-provider.js +30 -0
- package/dist/components/timestamp/index.d.ts +23 -0
- package/dist/components/timestamp/index.js +1392 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +7 -0
- package/dist/components/toast/toast.d.ts +2 -0
- package/dist/components/toast/toast.js +878 -0
- package/dist/components/toast/use-toast-manager.d.ts +27 -0
- package/dist/components/toast/use-toast-manager.js +4 -0
- package/dist/components/tooltip/index.d.ts +14 -0
- package/dist/components/tooltip/index.js +712 -0
- package/dist/components/tooltip/tooltip-arrow.d.ts +3 -0
- package/dist/components/tooltip/tooltip-arrow.js +6 -0
- package/dist/components/view/index.d.ts +30 -0
- package/dist/components/view/index.js +84 -0
- package/dist/components/visually-hidden/index.d.ts +1 -0
- package/dist/components/visually-hidden/index.js +4 -0
- package/dist/composite-Bx7Szd_T.js +208 -0
- package/dist/composite-C9L5QmZL.js +66 -0
- package/dist/createBaseUIEventDetails-D8M2Yl-a.js +59 -0
- package/dist/detectBrowser-I-s3yzIE.js +43 -0
- package/dist/dialog.css +1 -0
- package/dist/dialog.module-BeF-6XAo.js +415 -0
- package/dist/element-CZEOj04G.js +80 -0
- package/dist/event-CKoGyQEJ.js +30 -0
- package/dist/floating-ui.utils-C7pRWMZ_.js +128 -0
- package/dist/floating-ui.utils.dom-C7FS5id0.js +135 -0
- package/dist/formatErrorMessage-BqPuTBN-.js +7 -0
- package/dist/formatNumber-1UNwjeqf.js +25 -0
- package/dist/getDisabledMountTransitionStyles-YfHPge6T.js +1510 -0
- package/dist/index-BX1XbbRk.js +1206 -0
- package/dist/index-CeuccO-T.js +109 -0
- package/dist/index-DN9Bn1qm.js +29 -0
- package/dist/index-FMoPxlJ2.js +52 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +108 -0
- package/dist/index10.css +1 -0
- package/dist/index11.css +1 -0
- package/dist/index12.css +1 -0
- package/dist/index13.css +1 -0
- package/dist/index14.css +1 -0
- package/dist/index15.css +1 -0
- package/dist/index16.css +1 -0
- package/dist/index17.css +1 -0
- package/dist/index18.css +1 -0
- package/dist/index19.css +1 -0
- package/dist/index2.css +1 -0
- package/dist/index20.css +1 -0
- package/dist/index21.css +1 -0
- package/dist/index22.css +1 -0
- package/dist/index23.css +1 -0
- package/dist/index24.css +1 -0
- package/dist/index25.css +1 -0
- package/dist/index26.css +1 -0
- package/dist/index27.css +1 -0
- package/dist/index28.css +1 -0
- package/dist/index29.css +1 -0
- package/dist/index3.css +1 -0
- package/dist/index30.css +1 -0
- package/dist/index31.css +1 -0
- package/dist/index32.css +1 -0
- package/dist/index33.css +1 -0
- package/dist/index34.css +1 -0
- package/dist/index35.css +1 -0
- package/dist/index36.css +1 -0
- package/dist/index37.css +1 -0
- package/dist/index4.css +1 -0
- package/dist/index5.css +1 -0
- package/dist/index6.css +1 -0
- package/dist/index7.css +1 -0
- package/dist/index8.css +1 -0
- package/dist/index9.css +1 -0
- package/dist/inertValue-BCYGsdmf.js +7 -0
- package/dist/input.css +1 -0
- package/dist/input.module-DDQY_Ij6.js +7 -0
- package/dist/integrations/react-markdown/index.d.ts +5 -0
- package/dist/integrations/react-markdown/index.js +6895 -0
- package/dist/integrations/remix/index.d.ts +9 -0
- package/{src/integrations/remix.ts → dist/integrations/remix/index.js} +7 -4
- package/dist/integrations/tailwind.css +1 -0
- package/dist/integrations/twemoij/index.d.ts +3 -0
- package/dist/integrations/twemoij/index.js +18 -0
- package/dist/isElementDisabled-Cbd8W9kH.js +6 -0
- package/dist/owner-rKN292Q9.js +6 -0
- package/dist/safePolygon-DWy1dGKJ.js +308 -0
- package/dist/styles/core.css +1 -0
- package/dist/styles/tokens.d.ts +400 -0
- package/{src/styles/tokens.ts → dist/styles/tokens.js} +54 -96
- package/dist/toast.css +1 -0
- package/dist/tooltip-arrow-C1qXdi5T.js +24 -0
- package/dist/tooltip-arrow.css +1 -0
- package/dist/transitions.css +1 -0
- package/dist/transitions.module-CWX8e5cx.js +1343 -0
- package/dist/use-toast-manager-Dq-44AuW.js +37 -0
- package/dist/useAnimationFrame-451ugS_6.js +68 -0
- package/dist/useBaseUiId-B7WyxtIE.js +7 -0
- package/dist/useButton-DfIwsdb8.js +127 -0
- package/dist/useCompositeListItem-OkcAim_1.js +148 -0
- package/dist/useControlled-Du4sJyMj.js +31 -0
- package/dist/useHoverReferenceInteraction-SfOBPoXM.js +264 -0
- package/dist/useId-C5kyn6tA.js +22 -0
- package/dist/useIsoLayoutEffect-CIDbvm3Q.js +6 -0
- package/dist/useLabelableId-Ci_jDvmv.js +29 -0
- package/dist/useOnMount-VRW6CK2u.js +8 -0
- package/dist/useOpenChangeComplete-Dse9kY9E.js +61 -0
- package/dist/usePopupAutoResize-CNR6Ekmx.js +85 -0
- package/dist/useRender-CLx7dR_1.js +7 -0
- package/dist/useRenderElement-DwToLA61.js +244 -0
- package/dist/useRole-oDBdbuwQ.js +77 -0
- package/dist/useStableCallback-CkTrVkNX.js +29 -0
- package/dist/useSyncedFloatingRootContext-Dorsv-jf.js +167 -0
- package/dist/useTimeout-CflX-kz3.js +32 -0
- package/dist/useTransitionStatus-CUfcuGAV.js +42 -0
- package/dist/useTypeahead-D85V2IUx.js +333 -0
- package/dist/useValueAsRef-HURLzret.js +19 -0
- package/dist/useValueChanged-DL757-yD.js +14 -0
- package/dist/valueToPercent-DaP9qN4u.js +6 -0
- package/dist/view.css +1 -0
- package/dist/view.module-DfDLgJE0.js +6 -0
- package/dist/visuallyHidden-CpJ-mhai.js +16 -0
- package/dist/warn-CKtX8MLJ.js +11 -0
- package/package.json +18 -2
- package/.husky/pre-commit +0 -1
- package/.storybook/main.ts +0 -25
- package/.storybook/preview-head.html +0 -6
- package/.storybook/preview.tsx +0 -48
- package/.storybook/vitest.setup.ts +0 -8
- package/eslint.config.mjs +0 -29
- package/lint-staged.config.js +0 -15
- package/pnpm-workspace.yaml +0 -2
- package/postcss.config.mjs +0 -7
- package/prettier.config.mjs +0 -24
- package/scripts/build-icon-types.ts +0 -38
- package/src/-utils.tsx +0 -64
- package/src/components/accordion/accordion.module.css +0 -44
- package/src/components/accordion/accordion.stories.tsx +0 -36
- package/src/components/accordion/index.tsx +0 -67
- package/src/components/alert-dialog/alert-dialog.module.css +0 -5
- package/src/components/alert-dialog/alert-dialog.stories.tsx +0 -53
- package/src/components/alert-dialog/index.tsx +0 -138
- package/src/components/anchor/anchor.module.css +0 -18
- package/src/components/anchor/anchor.stories.tsx +0 -28
- package/src/components/anchor/index.tsx +0 -45
- package/src/components/avatar/avatar.module.css +0 -56
- package/src/components/avatar/avatar.stories.tsx +0 -61
- package/src/components/avatar/index.tsx +0 -82
- package/src/components/badge/badge.module.css +0 -35
- package/src/components/badge/badge.stories.tsx +0 -60
- package/src/components/badge/index.tsx +0 -71
- package/src/components/button/button.module.css +0 -42
- package/src/components/button/button.stories.tsx +0 -108
- package/src/components/button/index.tsx +0 -63
- package/src/components/checkbox/checkbox.module.css +0 -36
- package/src/components/checkbox/checkbox.stories.tsx +0 -21
- package/src/components/checkbox/index.tsx +0 -41
- package/src/components/code/code.module.css +0 -20
- package/src/components/code/code.stories.tsx +0 -42
- package/src/components/code/index.tsx +0 -73
- package/src/components/collapse/collapse.module.css +0 -27
- package/src/components/collapse/collapse.stories.tsx +0 -27
- package/src/components/collapse/index.tsx +0 -59
- package/src/components/command/command.module.css +0 -95
- package/src/components/command/command.stories.tsx +0 -38
- package/src/components/command/index.tsx +0 -108
- package/src/components/context-menu/context-menu.module.css +0 -36
- package/src/components/context-menu/context-menu.stories.tsx +0 -99
- package/src/components/context-menu/index.tsx +0 -242
- package/src/components/dialog/dialog.module.css +0 -71
- package/src/components/dialog/dialog.stories.tsx +0 -29
- package/src/components/dialog/index.tsx +0 -148
- package/src/components/heading/heading.module.css +0 -3
- package/src/components/heading/heading.stories.tsx +0 -52
- package/src/components/heading/index.tsx +0 -112
- package/src/components/icon/icon-names.ts +0 -3189
- package/src/components/icon/icon.module.css +0 -36
- package/src/components/icon/icon.stories.tsx +0 -40
- package/src/components/icon/index.tsx +0 -60
- package/src/components/icon-button/icon-button.module.css +0 -33
- package/src/components/icon-button/icon-button.stories.tsx +0 -59
- package/src/components/icon-button/index.tsx +0 -48
- package/src/components/inline-code/index.tsx +0 -29
- package/src/components/inline-code/inline-code.module.css +0 -13
- package/src/components/inline-code/inline-code.stories.tsx +0 -31
- package/src/components/input/index.tsx +0 -22
- package/src/components/input/input.module.css +0 -23
- package/src/components/input/input.stories.tsx +0 -52
- package/src/components/meter/index.tsx +0 -55
- package/src/components/meter/meter.module.css +0 -23
- package/src/components/meter/meter.stories.tsx +0 -31
- package/src/components/multiline-input/index.tsx +0 -58
- package/src/components/multiline-input/multiline-input.stories.tsx +0 -26
- package/src/components/number-input/index.tsx +0 -74
- package/src/components/number-input/number-input.module.css +0 -41
- package/src/components/number-input/number-input.stories.tsx +0 -24
- package/src/components/password-input/index.tsx +0 -24
- package/src/components/password-input/password-input.module.css +0 -10
- package/src/components/password-input/password-input.stories.tsx +0 -24
- package/src/components/pill/index.tsx +0 -45
- package/src/components/pill/pill.module.css +0 -22
- package/src/components/pill/pill.stories.tsx +0 -83
- package/src/components/popover/index.tsx +0 -94
- package/src/components/popover/popover.module.css +0 -8
- package/src/components/popover/popover.stories.tsx +0 -53
- package/src/components/preview-card/index.tsx +0 -68
- package/src/components/preview-card/preview-card.module.css +0 -5
- package/src/components/preview-card/preview-card.stories.tsx +0 -58
- package/src/components/radio/index.tsx +0 -67
- package/src/components/radio/radio-group.module.css +0 -5
- package/src/components/radio/radio.module.css +0 -36
- package/src/components/radio/radio.stories.tsx +0 -27
- package/src/components/search-bar/index.tsx +0 -60
- package/src/components/search-bar/search-bar.module.css +0 -29
- package/src/components/search-bar/search-bar.stories.tsx +0 -37
- package/src/components/select/index.tsx +0 -132
- package/src/components/select/select.module.css +0 -63
- package/src/components/select/select.stories.tsx +0 -49
- package/src/components/separator/index.tsx +0 -28
- package/src/components/separator/separator.module.css +0 -24
- package/src/components/separator/separator.stories.tsx +0 -40
- package/src/components/slider/index.tsx +0 -28
- package/src/components/slider/slider.module.css +0 -52
- package/src/components/slider/slider.stories.tsx +0 -53
- package/src/components/spinner/index.tsx +0 -14
- package/src/components/spinner/spinner.module.css +0 -13
- package/src/components/spinner/spinner.stories.tsx +0 -17
- package/src/components/stacked-avatars/index.tsx +0 -88
- package/src/components/stacked-avatars/stacked-avatars.module.css +0 -79
- package/src/components/stacked-avatars/stacked-avatars.stories.tsx +0 -48
- package/src/components/status-banner/index.tsx +0 -96
- package/src/components/status-banner/status-banner.module.css +0 -52
- package/src/components/status-banner/status-banner.stories.tsx +0 -44
- package/src/components/surface/index.tsx +0 -83
- package/src/components/surface/surface.module.css +0 -35
- package/src/components/surface/surface.stories.tsx +0 -84
- package/src/components/switch/index.tsx +0 -23
- package/src/components/switch/switch.module.css +0 -45
- package/src/components/switch/switch.stories.tsx +0 -48
- package/src/components/tabs/index.tsx +0 -126
- package/src/components/tabs/tabs.module.css +0 -134
- package/src/components/tabs/tabs.stories.tsx +0 -88
- package/src/components/text/index.tsx +0 -69
- package/src/components/text/text.module.css +0 -76
- package/src/components/text/text.stories.tsx +0 -107
- package/src/components/theme-provider/index.ts +0 -2
- package/src/components/theme-provider/theme-context.tsx +0 -18
- package/src/components/theme-provider/theme-provider.stories.tsx +0 -47
- package/src/components/theme-provider/theme-provider.tsx +0 -77
- package/src/components/timestamp/index.tsx +0 -131
- package/src/components/timestamp/timestamp.module.css +0 -8
- package/src/components/timestamp/timestamp.stories.tsx +0 -37
- package/src/components/toast/index.ts +0 -2
- package/src/components/toast/toast.module.css +0 -163
- package/src/components/toast/toast.stories.tsx +0 -53
- package/src/components/toast/toast.tsx +0 -104
- package/src/components/toast/use-toast-manager.ts +0 -63
- package/src/components/tooltip/index.tsx +0 -61
- package/src/components/tooltip/tooltip-arrow.tsx +0 -17
- package/src/components/tooltip/tooltip.module.css +0 -44
- package/src/components/tooltip/tooltip.stories.tsx +0 -76
- package/src/components/view/index.tsx +0 -137
- package/src/components/view/view.module.css +0 -11
- package/src/components/view/view.stories.tsx +0 -131
- package/src/components/view/view_colorway.module.css +0 -280
- package/src/components/view/view_interactive.module.css +0 -127
- package/src/components/view/view_loading.module.css +0 -58
- package/src/components/visually-hidden/index.ts +0 -1
- package/src/index.ts +0 -49
- package/src/integrations/react-markdown/index.tsx +0 -134
- package/src/integrations/react-markdown/react-markdown.module.css +0 -62
- package/src/integrations/react-markdown/react-markdown.stories.tsx +0 -31
- package/src/integrations/tailwind.css +0 -173
- package/src/integrations/twemoij/index.tsx +0 -13
- package/src/integrations/twemoij/twemoji.module.css +0 -7
- package/src/integrations/twemoij/twemoji.stories.tsx +0 -40
- package/src/stories/components/all-variants.tsx +0 -40
- package/src/stories/data.ts +0 -72
- package/src/stories/utils.ts +0 -20
- package/src/styles/core.css +0 -153
- package/src/styles/themes/dark.css +0 -86
- package/src/styles/themes/light.css +0 -86
- package/src/styles/transitions.module.css +0 -31
- package/stylelint.config.mjs +0 -29
- package/tsconfig.app.json +0 -35
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -103
- package/vitest.shims.d.ts +0 -1
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { jsx as g, jsxs as U } from "react/jsx-runtime";
|
|
2
|
+
import { c as z } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import * as n from "react";
|
|
4
|
+
import { Fragment as rt } from "react";
|
|
5
|
+
import { tokens as it } from "../../styles/tokens.js";
|
|
6
|
+
import { Button as ut } from "../button/index.js";
|
|
7
|
+
import { Icon as ct } from "../icon/index.js";
|
|
8
|
+
import { S as lt } from "../../index-FMoPxlJ2.js";
|
|
9
|
+
import { View as j } from "../view/index.js";
|
|
10
|
+
import { u as dt } from "../../useControlled-Du4sJyMj.js";
|
|
11
|
+
import { u as F } from "../../useIsoLayoutEffect-CIDbvm3Q.js";
|
|
12
|
+
import { u as O } from "../../useStableCallback-CkTrVkNX.js";
|
|
13
|
+
import { u as $, b as ft } from "../../useRenderElement-DwToLA61.js";
|
|
14
|
+
import { C as bt, u as pt } from "../../useCompositeListItem-OkcAim_1.js";
|
|
15
|
+
import { u as mt } from "../../DirectionContext-C2o_MF_i.js";
|
|
16
|
+
import { f as tt } from "../../formatErrorMessage-BqPuTBN-.js";
|
|
17
|
+
import { u as et } from "../../useBaseUiId-B7WyxtIE.js";
|
|
18
|
+
import { u as _t, A as gt, C as vt } from "../../CompositeRoot-CVk5a-pR.js";
|
|
19
|
+
import { o as J } from "../../owner-rKN292Q9.js";
|
|
20
|
+
import { c as Q, n as X } from "../../createBaseUIEventDetails-D8M2Yl-a.js";
|
|
21
|
+
import { u as Tt } from "../../useButton-DfIwsdb8.js";
|
|
22
|
+
import { h as ht, f as Ct } from "../../element-CZEOj04G.js";
|
|
23
|
+
import '../../index26.css';const K = /* @__PURE__ */ n.createContext(void 0);
|
|
24
|
+
process.env.NODE_ENV !== "production" && (K.displayName = "TabsRootContext");
|
|
25
|
+
function Y() {
|
|
26
|
+
const t = n.useContext(K);
|
|
27
|
+
if (t === void 0)
|
|
28
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>." : tt(64));
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
let Et = /* @__PURE__ */ (function(t) {
|
|
32
|
+
return t.activationDirection = "data-activation-direction", t.orientation = "data-orientation", t;
|
|
33
|
+
})({});
|
|
34
|
+
const W = {
|
|
35
|
+
tabActivationDirection: (t) => ({
|
|
36
|
+
[Et.activationDirection]: t
|
|
37
|
+
})
|
|
38
|
+
}, nt = /* @__PURE__ */ n.forwardRef(function(o, u) {
|
|
39
|
+
const {
|
|
40
|
+
className: f,
|
|
41
|
+
defaultValue: e = 0,
|
|
42
|
+
onValueChange: c,
|
|
43
|
+
orientation: a = "horizontal",
|
|
44
|
+
render: _,
|
|
45
|
+
value: b,
|
|
46
|
+
...v
|
|
47
|
+
} = o, T = mt(), E = Object.hasOwn(o, "defaultValue"), R = n.useRef([]), [x, l] = n.useState(() => /* @__PURE__ */ new Map()), [d, h] = dt({
|
|
48
|
+
controlled: b,
|
|
49
|
+
default: e,
|
|
50
|
+
name: "Tabs",
|
|
51
|
+
state: "value"
|
|
52
|
+
}), N = b !== void 0, [i, P] = n.useState(() => /* @__PURE__ */ new Map()), [D, I] = n.useState("none"), M = O((s, m) => {
|
|
53
|
+
c?.(s, m), !m.isCanceled && (h(s), I(m.activationDirection));
|
|
54
|
+
}), p = O((s, m) => {
|
|
55
|
+
l((r) => {
|
|
56
|
+
if (r.get(s) === m)
|
|
57
|
+
return r;
|
|
58
|
+
const C = new Map(r);
|
|
59
|
+
return C.set(s, m), C;
|
|
60
|
+
});
|
|
61
|
+
}), w = O((s, m) => {
|
|
62
|
+
l((r) => {
|
|
63
|
+
if (!r.has(s) || r.get(s) !== m)
|
|
64
|
+
return r;
|
|
65
|
+
const C = new Map(r);
|
|
66
|
+
return C.delete(s), C;
|
|
67
|
+
});
|
|
68
|
+
}), A = n.useCallback((s) => x.get(s), [x]), y = n.useCallback((s) => {
|
|
69
|
+
for (const m of i.values())
|
|
70
|
+
if (s === m?.value)
|
|
71
|
+
return m?.id;
|
|
72
|
+
}, [i]), B = n.useCallback((s) => {
|
|
73
|
+
if (s === void 0)
|
|
74
|
+
return null;
|
|
75
|
+
for (const [m, r] of i.entries())
|
|
76
|
+
if (r != null && s === (r.value ?? r.index))
|
|
77
|
+
return m;
|
|
78
|
+
return null;
|
|
79
|
+
}, [i]), S = n.useMemo(() => ({
|
|
80
|
+
direction: T,
|
|
81
|
+
getTabElementBySelectedValue: B,
|
|
82
|
+
getTabIdByPanelValue: y,
|
|
83
|
+
getTabPanelIdByValue: A,
|
|
84
|
+
onValueChange: M,
|
|
85
|
+
orientation: a,
|
|
86
|
+
registerMountedTabPanel: p,
|
|
87
|
+
setTabMap: P,
|
|
88
|
+
unregisterMountedTabPanel: w,
|
|
89
|
+
tabActivationDirection: D,
|
|
90
|
+
value: d
|
|
91
|
+
}), [T, B, y, A, M, a, p, P, w, D, d]), k = n.useMemo(() => {
|
|
92
|
+
for (const s of i.values())
|
|
93
|
+
if (s != null && s.value === d)
|
|
94
|
+
return s;
|
|
95
|
+
}, [i, d]), L = n.useMemo(() => {
|
|
96
|
+
for (const s of i.values())
|
|
97
|
+
if (s != null && !s.disabled)
|
|
98
|
+
return s.value;
|
|
99
|
+
}, [i]);
|
|
100
|
+
F(() => {
|
|
101
|
+
if (N || i.size === 0)
|
|
102
|
+
return;
|
|
103
|
+
const s = k?.disabled, m = k == null && d !== null;
|
|
104
|
+
if (E && s && d === e || !s && !m)
|
|
105
|
+
return;
|
|
106
|
+
const C = L ?? null;
|
|
107
|
+
d !== C && (h(C), I("none"));
|
|
108
|
+
}, [e, L, E, N, k, I, h, i, d]);
|
|
109
|
+
const H = $("div", o, {
|
|
110
|
+
state: {
|
|
111
|
+
orientation: a,
|
|
112
|
+
tabActivationDirection: D
|
|
113
|
+
},
|
|
114
|
+
ref: u,
|
|
115
|
+
props: v,
|
|
116
|
+
stateAttributesMapping: W
|
|
117
|
+
});
|
|
118
|
+
return /* @__PURE__ */ g(K.Provider, {
|
|
119
|
+
value: S,
|
|
120
|
+
children: /* @__PURE__ */ g(bt, {
|
|
121
|
+
elementsRef: R,
|
|
122
|
+
children: H
|
|
123
|
+
})
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
process.env.NODE_ENV !== "production" && (nt.displayName = "TabsRoot");
|
|
127
|
+
const q = /* @__PURE__ */ n.createContext(void 0);
|
|
128
|
+
process.env.NODE_ENV !== "production" && (q.displayName = "TabsListContext");
|
|
129
|
+
function Mt() {
|
|
130
|
+
const t = n.useContext(q);
|
|
131
|
+
if (t === void 0)
|
|
132
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>." : tt(65));
|
|
133
|
+
return t;
|
|
134
|
+
}
|
|
135
|
+
const ot = /* @__PURE__ */ n.forwardRef(function(o, u) {
|
|
136
|
+
const {
|
|
137
|
+
className: f,
|
|
138
|
+
disabled: e = !1,
|
|
139
|
+
render: c,
|
|
140
|
+
value: a,
|
|
141
|
+
id: _,
|
|
142
|
+
nativeButton: b = !0,
|
|
143
|
+
...v
|
|
144
|
+
} = o, {
|
|
145
|
+
value: T,
|
|
146
|
+
getTabPanelIdByValue: E,
|
|
147
|
+
orientation: R
|
|
148
|
+
} = Y(), {
|
|
149
|
+
activateOnFocus: x,
|
|
150
|
+
highlightedTabIndex: l,
|
|
151
|
+
onTabActivation: d,
|
|
152
|
+
setHighlightedTabIndex: h,
|
|
153
|
+
tabsListElement: N
|
|
154
|
+
} = Mt(), i = et(_), P = n.useMemo(() => ({
|
|
155
|
+
disabled: e,
|
|
156
|
+
id: i,
|
|
157
|
+
value: a
|
|
158
|
+
}), [e, i, a]), {
|
|
159
|
+
compositeProps: D,
|
|
160
|
+
compositeRef: I,
|
|
161
|
+
index: M
|
|
162
|
+
// hook is used instead of the CompositeItem component
|
|
163
|
+
// because the index is needed for Tab internals
|
|
164
|
+
} = _t({
|
|
165
|
+
metadata: P
|
|
166
|
+
}), p = a === T, w = n.useRef(!1);
|
|
167
|
+
F(() => {
|
|
168
|
+
if (w.current) {
|
|
169
|
+
w.current = !1;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (!(p && M > -1 && l !== M))
|
|
173
|
+
return;
|
|
174
|
+
const r = N;
|
|
175
|
+
if (r != null) {
|
|
176
|
+
const C = ht(J(r));
|
|
177
|
+
if (C && Ct(r, C))
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
e || h(M);
|
|
181
|
+
}, [p, M, l, h, e, N]);
|
|
182
|
+
const {
|
|
183
|
+
getButtonProps: A,
|
|
184
|
+
buttonRef: y
|
|
185
|
+
} = Tt({
|
|
186
|
+
disabled: e,
|
|
187
|
+
native: b,
|
|
188
|
+
focusableWhenDisabled: !0
|
|
189
|
+
}), B = E(a), S = n.useRef(!1), k = n.useRef(!1);
|
|
190
|
+
function L(r) {
|
|
191
|
+
p || e || d(a, Q(X, r.nativeEvent, void 0, {
|
|
192
|
+
activationDirection: "none"
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
function G(r) {
|
|
196
|
+
p || (M > -1 && !e && h(M), !e && x && (!S.current || // keyboard or touch focus
|
|
197
|
+
S.current && k.current) && d(a, Q(X, r.nativeEvent, void 0, {
|
|
198
|
+
activationDirection: "none"
|
|
199
|
+
})));
|
|
200
|
+
}
|
|
201
|
+
function H(r) {
|
|
202
|
+
if (p || e)
|
|
203
|
+
return;
|
|
204
|
+
S.current = !0;
|
|
205
|
+
function C() {
|
|
206
|
+
S.current = !1, k.current = !1;
|
|
207
|
+
}
|
|
208
|
+
(!r.button || r.button === 0) && (k.current = !0, J(r.currentTarget).addEventListener("pointerup", C, {
|
|
209
|
+
once: !0
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
const s = n.useMemo(() => ({
|
|
213
|
+
disabled: e,
|
|
214
|
+
active: p,
|
|
215
|
+
orientation: R
|
|
216
|
+
}), [e, p, R]);
|
|
217
|
+
return $("button", o, {
|
|
218
|
+
state: s,
|
|
219
|
+
ref: [u, y, I],
|
|
220
|
+
props: [D, {
|
|
221
|
+
role: "tab",
|
|
222
|
+
"aria-controls": B,
|
|
223
|
+
"aria-selected": p,
|
|
224
|
+
id: i,
|
|
225
|
+
onClick: L,
|
|
226
|
+
onFocus: G,
|
|
227
|
+
onPointerDown: H,
|
|
228
|
+
[gt]: p ? "" : void 0,
|
|
229
|
+
onKeyDownCapture() {
|
|
230
|
+
w.current = !0;
|
|
231
|
+
}
|
|
232
|
+
}, v, A]
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
process.env.NODE_ENV !== "production" && (ot.displayName = "TabsTab");
|
|
236
|
+
let xt = /* @__PURE__ */ (function(t) {
|
|
237
|
+
return t.index = "data-index", t.activationDirection = "data-activation-direction", t.orientation = "data-orientation", t.hidden = "data-hidden", t;
|
|
238
|
+
})({});
|
|
239
|
+
const at = /* @__PURE__ */ n.forwardRef(function(o, u) {
|
|
240
|
+
const {
|
|
241
|
+
className: f,
|
|
242
|
+
value: e,
|
|
243
|
+
render: c,
|
|
244
|
+
keepMounted: a = !1,
|
|
245
|
+
..._
|
|
246
|
+
} = o, {
|
|
247
|
+
value: b,
|
|
248
|
+
getTabIdByPanelValue: v,
|
|
249
|
+
orientation: T,
|
|
250
|
+
tabActivationDirection: E,
|
|
251
|
+
registerMountedTabPanel: R,
|
|
252
|
+
unregisterMountedTabPanel: x
|
|
253
|
+
} = Y(), l = et(), d = n.useMemo(() => ({
|
|
254
|
+
id: l,
|
|
255
|
+
value: e
|
|
256
|
+
}), [l, e]), {
|
|
257
|
+
ref: h,
|
|
258
|
+
index: N
|
|
259
|
+
} = pt({
|
|
260
|
+
metadata: d
|
|
261
|
+
}), i = e !== b, P = v(e), D = n.useMemo(() => ({
|
|
262
|
+
hidden: i,
|
|
263
|
+
orientation: T,
|
|
264
|
+
tabActivationDirection: E
|
|
265
|
+
}), [i, T, E]), I = $("div", o, {
|
|
266
|
+
state: D,
|
|
267
|
+
ref: [u, h],
|
|
268
|
+
props: [{
|
|
269
|
+
"aria-labelledby": P,
|
|
270
|
+
hidden: i,
|
|
271
|
+
id: l ?? void 0,
|
|
272
|
+
role: "tabpanel",
|
|
273
|
+
tabIndex: i ? -1 : 0,
|
|
274
|
+
[xt.index]: N
|
|
275
|
+
}, _],
|
|
276
|
+
stateAttributesMapping: W
|
|
277
|
+
});
|
|
278
|
+
return F(() => {
|
|
279
|
+
if (!(i && !a) && l != null)
|
|
280
|
+
return R(e, l), () => {
|
|
281
|
+
x(e, l);
|
|
282
|
+
};
|
|
283
|
+
}, [i, a, e, l, R, x]), !i || a ? I : null;
|
|
284
|
+
});
|
|
285
|
+
process.env.NODE_ENV !== "production" && (at.displayName = "TabsPanel");
|
|
286
|
+
const st = /* @__PURE__ */ n.forwardRef(function(o, u) {
|
|
287
|
+
const {
|
|
288
|
+
activateOnFocus: f = !1,
|
|
289
|
+
className: e,
|
|
290
|
+
loopFocus: c = !0,
|
|
291
|
+
render: a,
|
|
292
|
+
..._
|
|
293
|
+
} = o, {
|
|
294
|
+
getTabElementBySelectedValue: b,
|
|
295
|
+
onValueChange: v,
|
|
296
|
+
orientation: T,
|
|
297
|
+
value: E,
|
|
298
|
+
setTabMap: R,
|
|
299
|
+
tabActivationDirection: x
|
|
300
|
+
} = Y(), [l, d] = n.useState(0), [h, N] = n.useState(null), i = Rt(
|
|
301
|
+
E,
|
|
302
|
+
// the old value
|
|
303
|
+
T,
|
|
304
|
+
h,
|
|
305
|
+
b
|
|
306
|
+
), P = O((p, w) => {
|
|
307
|
+
if (p !== E) {
|
|
308
|
+
const A = i(p);
|
|
309
|
+
w.activationDirection = A, v(p, w);
|
|
310
|
+
}
|
|
311
|
+
}), D = n.useMemo(() => ({
|
|
312
|
+
orientation: T,
|
|
313
|
+
tabActivationDirection: x
|
|
314
|
+
}), [T, x]), I = {
|
|
315
|
+
"aria-orientation": T === "vertical" ? "vertical" : void 0,
|
|
316
|
+
role: "tablist"
|
|
317
|
+
}, M = n.useMemo(() => ({
|
|
318
|
+
activateOnFocus: f,
|
|
319
|
+
highlightedTabIndex: l,
|
|
320
|
+
onTabActivation: P,
|
|
321
|
+
setHighlightedTabIndex: d,
|
|
322
|
+
tabsListElement: h,
|
|
323
|
+
value: E
|
|
324
|
+
}), [f, l, P, d, h, E]);
|
|
325
|
+
return /* @__PURE__ */ g(q.Provider, {
|
|
326
|
+
value: M,
|
|
327
|
+
children: /* @__PURE__ */ g(vt, {
|
|
328
|
+
render: a,
|
|
329
|
+
className: e,
|
|
330
|
+
state: D,
|
|
331
|
+
refs: [u, N],
|
|
332
|
+
props: [I, _],
|
|
333
|
+
stateAttributesMapping: W,
|
|
334
|
+
highlightedIndex: l,
|
|
335
|
+
enableHomeAndEndKeys: !0,
|
|
336
|
+
loopFocus: c,
|
|
337
|
+
orientation: T,
|
|
338
|
+
onHighlightedIndexChange: d,
|
|
339
|
+
onMapChange: R,
|
|
340
|
+
disabledIndices: ft
|
|
341
|
+
})
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
process.env.NODE_ENV !== "production" && (st.displayName = "TabsList");
|
|
345
|
+
function Z(t, o) {
|
|
346
|
+
const {
|
|
347
|
+
left: u,
|
|
348
|
+
top: f
|
|
349
|
+
} = t.getBoundingClientRect(), {
|
|
350
|
+
left: e,
|
|
351
|
+
top: c
|
|
352
|
+
} = o.getBoundingClientRect(), a = u - e, _ = f - c;
|
|
353
|
+
return {
|
|
354
|
+
left: a,
|
|
355
|
+
top: _
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function Rt(t, o, u, f) {
|
|
359
|
+
const [e, c] = n.useState(null);
|
|
360
|
+
return F(() => {
|
|
361
|
+
if (t == null || u == null) {
|
|
362
|
+
c(null);
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const a = f(t);
|
|
366
|
+
if (a == null) {
|
|
367
|
+
c(null);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const {
|
|
371
|
+
left: _,
|
|
372
|
+
top: b
|
|
373
|
+
} = Z(a, u);
|
|
374
|
+
c(o === "horizontal" ? _ : b);
|
|
375
|
+
}, [o, f, u, t]), n.useCallback((a) => {
|
|
376
|
+
if (a === t)
|
|
377
|
+
return "none";
|
|
378
|
+
if (a == null)
|
|
379
|
+
return c(null), "none";
|
|
380
|
+
if (a != null && u != null) {
|
|
381
|
+
const _ = f(a);
|
|
382
|
+
if (_ != null) {
|
|
383
|
+
const {
|
|
384
|
+
left: b,
|
|
385
|
+
top: v
|
|
386
|
+
} = Z(_, u);
|
|
387
|
+
if (e == null)
|
|
388
|
+
return c(o === "horizontal" ? b : v), "none";
|
|
389
|
+
if (o === "horizontal") {
|
|
390
|
+
if (b < e)
|
|
391
|
+
return c(b), "left";
|
|
392
|
+
if (b > e)
|
|
393
|
+
return c(b), "right";
|
|
394
|
+
} else {
|
|
395
|
+
if (v < e)
|
|
396
|
+
return c(v), "up";
|
|
397
|
+
if (v > e)
|
|
398
|
+
return c(v), "down";
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return "none";
|
|
403
|
+
}, [f, o, e, u, t]);
|
|
404
|
+
}
|
|
405
|
+
const Nt = "_tabs_1w9kt_5", Pt = "_tabs__list_1w9kt_9", Dt = "_tabs_variant_default_1w9kt_16", It = "_tabs__separator_1w9kt_21", wt = "_tabs__trigger_1w9kt_25", kt = "_tabs_variant_progress_1w9kt_46", V = {
|
|
406
|
+
tabs: Nt,
|
|
407
|
+
tabs__list: Pt,
|
|
408
|
+
tabs_variant_default: Dt,
|
|
409
|
+
tabs__separator: It,
|
|
410
|
+
tabs__trigger: wt,
|
|
411
|
+
tabs_variant_progress: kt,
|
|
412
|
+
"tabs__trigger-complete": "_tabs__trigger-complete_1w9kt_70",
|
|
413
|
+
"tabs_variant_button-group": "_tabs_variant_button-group_1w9kt_82"
|
|
414
|
+
}, At = /* @__PURE__ */ new Set(["default", "progress"]);
|
|
415
|
+
function ae({
|
|
416
|
+
variant: t = "default",
|
|
417
|
+
disabled: o = !1,
|
|
418
|
+
tabs: u,
|
|
419
|
+
className: f,
|
|
420
|
+
children: e,
|
|
421
|
+
...c
|
|
422
|
+
}) {
|
|
423
|
+
return /* @__PURE__ */ U(
|
|
424
|
+
j,
|
|
425
|
+
{
|
|
426
|
+
render: /* @__PURE__ */ g(
|
|
427
|
+
nt,
|
|
428
|
+
{
|
|
429
|
+
className: z(
|
|
430
|
+
V.tabs,
|
|
431
|
+
V[`tabs_variant_${t}`],
|
|
432
|
+
f
|
|
433
|
+
),
|
|
434
|
+
...c
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ g(Vt, { children: u.map((a, _) => /* @__PURE__ */ U(rt, { children: [
|
|
439
|
+
/* @__PURE__ */ g(St, { disabled: o, ...a }),
|
|
440
|
+
_ + 1 < u.length && At.has(t) ? /* @__PURE__ */ g(
|
|
441
|
+
yt,
|
|
442
|
+
{
|
|
443
|
+
orientation: t === "progress" ? "horizontal" : "vertical"
|
|
444
|
+
}
|
|
445
|
+
) : null
|
|
446
|
+
] }, a.value)) }),
|
|
447
|
+
e
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
function St({
|
|
453
|
+
value: t,
|
|
454
|
+
className: o,
|
|
455
|
+
complete: u,
|
|
456
|
+
children: f,
|
|
457
|
+
...e
|
|
458
|
+
}) {
|
|
459
|
+
return /* @__PURE__ */ U(
|
|
460
|
+
ut,
|
|
461
|
+
{
|
|
462
|
+
interactive: "list-item",
|
|
463
|
+
className: z(V.tabs__trigger, o),
|
|
464
|
+
render: /* @__PURE__ */ g(ot, { value: t }),
|
|
465
|
+
...e,
|
|
466
|
+
children: [
|
|
467
|
+
u ? /* @__PURE__ */ g(
|
|
468
|
+
ct,
|
|
469
|
+
{
|
|
470
|
+
color: it.positiveDefault,
|
|
471
|
+
name: "check-line",
|
|
472
|
+
className: V["tabs__trigger-complete"]
|
|
473
|
+
}
|
|
474
|
+
) : null,
|
|
475
|
+
f
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
function Vt({ className: t, ...o }) {
|
|
481
|
+
return /* @__PURE__ */ g(
|
|
482
|
+
j,
|
|
483
|
+
{
|
|
484
|
+
render: /* @__PURE__ */ g(
|
|
485
|
+
st,
|
|
486
|
+
{
|
|
487
|
+
className: z(V.tabs__list, t),
|
|
488
|
+
...o
|
|
489
|
+
}
|
|
490
|
+
)
|
|
491
|
+
}
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
function yt({ className: t, ...o }) {
|
|
495
|
+
return /* @__PURE__ */ g(
|
|
496
|
+
lt,
|
|
497
|
+
{
|
|
498
|
+
className: z(V.tabs__separator, t),
|
|
499
|
+
...o
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
function se({ children: t, ...o }) {
|
|
504
|
+
return /* @__PURE__ */ g(at, { ...o, children: /* @__PURE__ */ g(j, { children: t }) });
|
|
505
|
+
}
|
|
506
|
+
export {
|
|
507
|
+
ae as Tabs,
|
|
508
|
+
se as TabsPanel
|
|
509
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useRender } from '@base-ui/react';
|
|
2
|
+
import { Size } from '../../styles/tokens';
|
|
3
|
+
type ColorVariants = "inherit" | "default" | "dimmer" | "dimmest";
|
|
4
|
+
export interface TextProps extends Omit<useRender.ComponentProps<"span">, "color"> {
|
|
5
|
+
/**
|
|
6
|
+
* The color variant of the text.
|
|
7
|
+
* Defaults to "default".
|
|
8
|
+
*/
|
|
9
|
+
color?: ColorVariants;
|
|
10
|
+
/**
|
|
11
|
+
* The size variant of the text.
|
|
12
|
+
* Defaults to "md".
|
|
13
|
+
*/
|
|
14
|
+
size?: Size;
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of lines that should be displayed.
|
|
17
|
+
* Defaults to 1 (the minimum).
|
|
18
|
+
*/
|
|
19
|
+
maxLines?: number;
|
|
20
|
+
/**
|
|
21
|
+
* A convenient shorthand that has the same effect as setting maxLines to Infinity
|
|
22
|
+
*/
|
|
23
|
+
multiline?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function Text({ color, size, maxLines, multiline, render, ...props }: TextProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { c as i } from "../../clsx-OuTLNxxd.js";
|
|
2
|
+
import { s as c } from "../../view.module-DfDLgJE0.js";
|
|
3
|
+
import { u as m } from "../../useRender-CLx7dR_1.js";
|
|
4
|
+
import { m as r } from "../../useRenderElement-DwToLA61.js";
|
|
5
|
+
import '../../index16.css';const n = "_text_ghwl6_1", a = "_text_color_inherit_ghwl6_25", z = "_text_color_default_ghwl6_29", g = "_text_color_dimmer_ghwl6_33", h = "_text_color_dimmest_ghwl6_37", d = "_text_size_sm_ghwl6_42", p = "_text_size_md_ghwl6_48", w = "_text_size_lg_ghwl6_54", f = "_text_size_xl_ghwl6_60", u = "_text_size_2xl_ghwl6_66", y = "_text_size_3xl_ghwl6_72", t = {
|
|
6
|
+
text: n,
|
|
7
|
+
"text_clip-line": "_text_clip-line_ghwl6_8",
|
|
8
|
+
"text_clamp-lines": "_text_clamp-lines_ghwl6_15",
|
|
9
|
+
text_color_inherit: a,
|
|
10
|
+
text_color_default: z,
|
|
11
|
+
text_color_dimmer: g,
|
|
12
|
+
text_color_dimmest: h,
|
|
13
|
+
text_size_sm: d,
|
|
14
|
+
text_size_md: p,
|
|
15
|
+
text_size_lg: w,
|
|
16
|
+
text_size_xl: f,
|
|
17
|
+
text_size_2xl: u,
|
|
18
|
+
text_size_3xl: y
|
|
19
|
+
};
|
|
20
|
+
function P({
|
|
21
|
+
color: l = "default",
|
|
22
|
+
size: s = "md",
|
|
23
|
+
maxLines: _ = 1,
|
|
24
|
+
multiline: e,
|
|
25
|
+
render: x,
|
|
26
|
+
...o
|
|
27
|
+
}) {
|
|
28
|
+
return m({
|
|
29
|
+
defaultTagName: "span",
|
|
30
|
+
render: x,
|
|
31
|
+
props: r(
|
|
32
|
+
{
|
|
33
|
+
className: i(
|
|
34
|
+
c.view,
|
|
35
|
+
t.text,
|
|
36
|
+
t[`text_color_${l}`],
|
|
37
|
+
t[`text_size_${s}`],
|
|
38
|
+
!e && t["text_clip-line"],
|
|
39
|
+
!e && _ > 1 && t["text_clamp-lines"]
|
|
40
|
+
),
|
|
41
|
+
style: {
|
|
42
|
+
"--text-max-lines": Math.max(_, 1)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
o
|
|
46
|
+
)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
P as Text
|
|
51
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface ThemeContextType {
|
|
2
|
+
/** Current theme */
|
|
3
|
+
theme: string;
|
|
4
|
+
/** Set a new current theme */
|
|
5
|
+
setTheme: (theme: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ThemeContext: import('react').Context<ThemeContextType>;
|
|
8
|
+
export declare function useThemeContext(): ThemeContextType;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViewProps } from '../view';
|
|
2
|
+
export type ThemeProviderProps = ViewProps & {
|
|
3
|
+
/** Override theme. */
|
|
4
|
+
value?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Default theme if you don't want to manage it yourself.
|
|
7
|
+
* Defaults to user preferences and then light.
|
|
8
|
+
*/
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Override theme set on body.
|
|
12
|
+
* This prevents mismatched themes on overscroll.
|
|
13
|
+
* Defaults to true.
|
|
14
|
+
*/
|
|
15
|
+
overrideBody?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function ThemeProvider({ value, defaultValue, overrideBody, ...props }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as s } from "react";
|
|
3
|
+
import { View as a } from "../view/index.js";
|
|
4
|
+
import { ThemeContext as u } from "./theme-context.js";
|
|
5
|
+
function x({
|
|
6
|
+
value: e,
|
|
7
|
+
defaultValue: n,
|
|
8
|
+
overrideBody: r = !0,
|
|
9
|
+
...i
|
|
10
|
+
}) {
|
|
11
|
+
const m = e !== void 0, [c, d] = f(
|
|
12
|
+
() => n || l()
|
|
13
|
+
), t = m ? e : c, h = d;
|
|
14
|
+
return s(() => {
|
|
15
|
+
r && (document.body.dataset.theme = t);
|
|
16
|
+
}, [t, r]), /* @__PURE__ */ o(u.Provider, { value: { theme: t, setTheme: h }, children: /* @__PURE__ */ o(a, { "data-theme": t, ...i }) });
|
|
17
|
+
}
|
|
18
|
+
function l() {
|
|
19
|
+
if (typeof window > "u")
|
|
20
|
+
return "light";
|
|
21
|
+
try {
|
|
22
|
+
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
}
|
|
26
|
+
return "light";
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
x as ThemeProvider
|
|
30
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TextProps } from '../text';
|
|
2
|
+
export declare const A_LONG_TIME_AGO_DATE: Date;
|
|
3
|
+
export interface TimestampProps {
|
|
4
|
+
date: string | number | Date;
|
|
5
|
+
/**
|
|
6
|
+
* By default (`'relative'`), the timestamp will show a relative
|
|
7
|
+
* date and an absolute date on hover.
|
|
8
|
+
*
|
|
9
|
+
* Passing `'absolute'` will show the absolute date instead. During server
|
|
10
|
+
* side rendering, this option is not respected, it will use relative date/time
|
|
11
|
+
* instead to avoid hydration issues.
|
|
12
|
+
*
|
|
13
|
+
* This value can also be set to `'switch'` which will show the relative
|
|
14
|
+
* date but allow the user to switch to absolute by clicking on the component
|
|
15
|
+
* by clicking on the timestamp, all "switch" timestamps are synchronized
|
|
16
|
+
* with a global boolean.
|
|
17
|
+
*/
|
|
18
|
+
dateFormat?: "relative" | "absolute" | "switch";
|
|
19
|
+
color?: TextProps["color"];
|
|
20
|
+
size?: TextProps["size"];
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const Timestamp: ({ date, dateFormat: initialDateFormat, color, size, className, }: TimestampProps) => import("react/jsx-runtime").JSX.Element;
|