@astra-kit/ui 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +21 -0
- package/README.md +330 -2
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/assets/fonts/geist-LICENSE.txt +93 -0
- package/assets/fonts/geist-latin-variable.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-400.woff2 +0 -0
- package/assets/fonts/ibm-plex-mono-latin-500.woff2 +0 -0
- package/assets/fonts/ibmplexmono-LICENSE.txt +93 -0
- package/assets/fonts/inter-LICENSE.txt +93 -0
- package/assets/fonts/inter-latin-variable.woff2 +0 -0
- package/dist/adapters/unpic-image.d.ts +3 -0
- package/dist/adapters/unpic-image.js +98 -0
- package/dist/components/account-menu.d.ts +67 -0
- package/dist/components/account-menu.js +440 -0
- package/dist/components/action-button.d.ts +25 -0
- package/dist/components/action-button.js +264 -0
- package/dist/components/alert.d.ts +31 -0
- package/dist/components/alert.js +503 -0
- package/dist/components/animated-collapse.d.ts +19 -0
- package/dist/components/animated-collapse.js +170 -0
- package/dist/components/animated-count.d.ts +13 -0
- package/dist/components/animated-count.js +105 -0
- package/dist/components/animated-list-item.d.ts +25 -0
- package/dist/components/animated-list-item.js +134 -0
- package/dist/components/animated-theme-toggler.d.ts +12 -0
- package/dist/components/animated-theme-toggler.js +200 -0
- package/dist/components/avatar.d.ts +65 -0
- package/dist/components/avatar.js +463 -0
- package/dist/components/badge.d.ts +21 -0
- package/dist/components/badge.js +297 -0
- package/dist/components/button-interaction.d.ts +23 -0
- package/dist/components/button-interaction.js +22 -0
- package/dist/components/button-label.d.ts +8 -0
- package/dist/components/button-label.js +203 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +145 -0
- package/dist/components/calendar.d.ts +47 -0
- package/dist/components/calendar.js +155 -0
- package/dist/components/card.d.ts +38 -0
- package/dist/components/card.js +904 -0
- package/dist/components/carousel.d.ts +71 -0
- package/dist/components/carousel.js +585 -0
- package/dist/components/checkbox.d.ts +15 -0
- package/dist/components/checkbox.js +324 -0
- package/dist/components/control-button.d.ts +16 -0
- package/dist/components/control-button.js +215 -0
- package/dist/components/data-table.d.ts +118 -0
- package/dist/components/data-table.js +895 -0
- package/dist/components/dialog-surface.d.ts +49 -0
- package/dist/components/dialog-surface.js +220 -0
- package/dist/components/dialog.d.ts +92 -0
- package/dist/components/dialog.js +320 -0
- package/dist/components/dropdown-menu.d.ts +58 -0
- package/dist/components/dropdown-menu.js +135 -0
- package/dist/components/field.d.ts +53 -0
- package/dist/components/field.js +710 -0
- package/dist/components/file-upload.d.ts +88 -0
- package/dist/components/file-upload.js +776 -0
- package/dist/components/filter-presets-bar.d.ts +73 -0
- package/dist/components/filter-presets-bar.js +510 -0
- package/dist/components/filter-query-bar.d.ts +21 -0
- package/dist/components/filter-query-bar.js +881 -0
- package/dist/components/filter-query-grammar.d.ts +188 -0
- package/dist/components/filter-query-grammar.js +875 -0
- package/dist/components/form.d.ts +29 -0
- package/dist/components/form.js +330 -0
- package/dist/components/highlighter.d.ts +15 -0
- package/dist/components/highlighter.js +152 -0
- package/dist/components/hover-card.d.ts +50 -0
- package/dist/components/hover-card.js +80 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.js +277 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +120 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.js +43 -0
- package/dist/components/link.d.ts +9 -0
- package/dist/components/link.js +43 -0
- package/dist/components/morph-text.d.ts +14 -0
- package/dist/components/morph-text.js +210 -0
- package/dist/components/pagination.d.ts +59 -0
- package/dist/components/pagination.js +190 -0
- package/dist/components/popover.d.ts +17 -0
- package/dist/components/popover.js +40 -0
- package/dist/components/presence-swap.d.ts +22 -0
- package/dist/components/presence-swap.js +209 -0
- package/dist/components/primitives/alert-dialog.d.ts +68 -0
- package/dist/components/primitives/alert-dialog.js +629 -0
- package/dist/components/primitives/avatar.d.ts +46 -0
- package/dist/components/primitives/avatar.js +265 -0
- package/dist/components/primitives/calendar.d.ts +37 -0
- package/dist/components/primitives/calendar.js +1250 -0
- package/dist/components/primitives/carousel.d.ts +106 -0
- package/dist/components/primitives/carousel.js +928 -0
- package/dist/components/primitives/dialog.d.ts +62 -0
- package/dist/components/primitives/dialog.js +490 -0
- package/dist/components/primitives/dropdown-menu-items.d.ts +59 -0
- package/dist/components/primitives/dropdown-menu-items.js +265 -0
- package/dist/components/primitives/dropdown-menu.d.ts +64 -0
- package/dist/components/primitives/dropdown-menu.js +560 -0
- package/dist/components/primitives/hover-card.d.ts +50 -0
- package/dist/components/primitives/hover-card.js +507 -0
- package/dist/components/primitives/pagination.d.ts +65 -0
- package/dist/components/primitives/pagination.js +373 -0
- package/dist/components/primitives/popover.d.ts +22 -0
- package/dist/components/primitives/popover.js +213 -0
- package/dist/components/primitives/select.d.ts +37 -0
- package/dist/components/primitives/select.js +428 -0
- package/dist/components/primitives/tooltip.d.ts +30 -0
- package/dist/components/primitives/tooltip.js +277 -0
- package/dist/components/progress-ring.d.ts +20 -0
- package/dist/components/progress-ring.js +53 -0
- package/dist/components/radio-group.d.ts +34 -0
- package/dist/components/radio-group.js +392 -0
- package/dist/components/reaction-button.d.ts +30 -0
- package/dist/components/reaction-button.js +189 -0
- package/dist/components/rich-link-editor.d.ts +25 -0
- package/dist/components/rich-link-editor.js +320 -0
- package/dist/components/rich-markdown-content.d.ts +10 -0
- package/dist/components/rich-markdown-content.js +56 -0
- package/dist/components/rich-text-content.d.ts +19 -0
- package/dist/components/rich-text-content.js +26 -0
- package/dist/components/select.d.ts +55 -0
- package/dist/components/select.js +188 -0
- package/dist/components/separator.d.ts +3 -0
- package/dist/components/separator.js +48 -0
- package/dist/components/sheet.d.ts +19 -0
- package/dist/components/sheet.js +420 -0
- package/dist/components/sidebar-panel-context.d.ts +17 -0
- package/dist/components/sidebar-panel-context.js +14 -0
- package/dist/components/sidebar.d.ts +195 -0
- package/dist/components/sidebar.js +2041 -0
- package/dist/components/skeleton.d.ts +23 -0
- package/dist/components/skeleton.js +334 -0
- package/dist/components/split-button.d.ts +36 -0
- package/dist/components/split-button.js +306 -0
- package/dist/components/svgs/whatsappIcon.d.ts +3 -0
- package/dist/components/svgs/whatsappIcon.js +14 -0
- package/dist/components/switch.d.ts +13 -0
- package/dist/components/switch.js +444 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.js +298 -0
- package/dist/components/tabs.d.ts +36 -0
- package/dist/components/tabs.js +636 -0
- package/dist/components/textarea.d.ts +16 -0
- package/dist/components/textarea.js +111 -0
- package/dist/components/themed-toaster.d.ts +7 -0
- package/dist/components/themed-toaster.js +86 -0
- package/dist/components/toaster.d.ts +12 -0
- package/dist/components/toaster.js +62 -0
- package/dist/components/tooltip.d.ts +43 -0
- package/dist/components/tooltip.js +65 -0
- package/dist/components/typing-animation.d.ts +34 -0
- package/dist/components/typing-animation.js +389 -0
- package/dist/constants/action-button.d.ts +20 -0
- package/dist/constants/action-button.js +17 -0
- package/dist/constants/alert.d.ts +16 -0
- package/dist/constants/alert.js +13 -0
- package/dist/constants/avatar.d.ts +38 -0
- package/dist/constants/avatar.js +32 -0
- package/dist/constants/badge.d.ts +6 -0
- package/dist/constants/badge.js +6 -0
- package/dist/constants/button.d.ts +16 -0
- package/dist/constants/button.js +16 -0
- package/dist/constants/calendar.d.ts +36 -0
- package/dist/constants/calendar.js +34 -0
- package/dist/constants/card.d.ts +23 -0
- package/dist/constants/card.js +20 -0
- package/dist/constants/carousel.d.ts +55 -0
- package/dist/constants/carousel.js +74 -0
- package/dist/constants/checkbox.d.ts +17 -0
- package/dist/constants/checkbox.js +17 -0
- package/dist/constants/dialog.d.ts +11 -0
- package/dist/constants/dialog.js +10 -0
- package/dist/constants/dropdown-menu.d.ts +17 -0
- package/dist/constants/dropdown-menu.js +48 -0
- package/dist/constants/field.d.ts +24 -0
- package/dist/constants/field.js +24 -0
- package/dist/constants/hover-card.d.ts +37 -0
- package/dist/constants/hover-card.js +85 -0
- package/dist/constants/morph-text.d.ts +13 -0
- package/dist/constants/morph-text.js +13 -0
- package/dist/constants/motion.d.ts +12 -0
- package/dist/constants/motion.js +12 -0
- package/dist/constants/pagination.d.ts +20 -0
- package/dist/constants/pagination.js +20 -0
- package/dist/constants/popover.d.ts +7 -0
- package/dist/constants/popover.js +33 -0
- package/dist/constants/radio-group.d.ts +10 -0
- package/dist/constants/radio-group.js +10 -0
- package/dist/constants/select.d.ts +7 -0
- package/dist/constants/select.js +34 -0
- package/dist/constants/sidebar.d.ts +9 -0
- package/dist/constants/sidebar.js +17 -0
- package/dist/constants/skeleton.d.ts +17 -0
- package/dist/constants/skeleton.js +17 -0
- package/dist/constants/split-button.d.ts +7 -0
- package/dist/constants/split-button.js +5 -0
- package/dist/constants/switch.d.ts +33 -0
- package/dist/constants/switch.js +41 -0
- package/dist/constants/tabs.d.ts +17 -0
- package/dist/constants/tabs.js +17 -0
- package/dist/constants/toast.d.ts +3 -0
- package/dist/constants/toast.js +3 -0
- package/dist/constants/tooltip.d.ts +13 -0
- package/dist/constants/tooltip.js +52 -0
- package/dist/hooks/use-horizontal-swipe.d.ts +23 -0
- package/dist/hooks/use-horizontal-swipe.js +80 -0
- package/dist/hooks/use-is-hydrated.d.ts +6 -0
- package/dist/hooks/use-is-hydrated.js +20 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +19 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +2 -0
- package/dist/hooks/use-prefers-reduced-motion.js +27 -0
- package/dist/hooks/use-rich-link-editor.d.ts +55 -0
- package/dist/hooks/use-rich-link-editor.js +515 -0
- package/dist/hooks/use-sidebar-persistence.d.ts +6 -0
- package/dist/hooks/use-sidebar-persistence.js +52 -0
- package/dist/hooks/use-today.d.ts +7 -0
- package/dist/hooks/use-today.js +50 -0
- package/dist/hooks/use-viewer-time-zone.d.ts +6 -0
- package/dist/hooks/use-viewer-time-zone.js +20 -0
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.js +11 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +69 -0
- package/dist/lib/browser-clipboard.d.ts +13 -0
- package/dist/lib/browser-clipboard.js +48 -0
- package/dist/lib/column-filter-value.d.ts +12 -0
- package/dist/lib/column-filter-value.js +52 -0
- package/dist/lib/file-acceptance.d.ts +43 -0
- package/dist/lib/file-acceptance.js +107 -0
- package/dist/lib/format-file-size.d.ts +16 -0
- package/dist/lib/format-file-size.js +34 -0
- package/dist/lib/fuzzy-search.d.ts +17 -0
- package/dist/lib/fuzzy-search.js +183 -0
- package/dist/lib/horizontal-swipe.d.ts +23 -0
- package/dist/lib/horizontal-swipe.js +29 -0
- package/dist/lib/image-dimensions.d.ts +2 -0
- package/dist/lib/image-dimensions.js +7 -0
- package/dist/lib/name-initials.d.ts +7 -0
- package/dist/lib/name-initials.js +11 -0
- package/dist/lib/rich-text/link-markdown-constants.d.ts +147 -0
- package/dist/lib/rich-text/link-markdown-constants.js +458 -0
- package/dist/lib/rich-text/link-markdown-types.d.ts +53 -0
- package/dist/lib/rich-text/link-markdown-types.js +1 -0
- package/dist/lib/rich-text/link-markdown.d.ts +193 -0
- package/dist/lib/rich-text/link-markdown.js +592 -0
- package/dist/lib/rich-text/rich-markdown.d.ts +41 -0
- package/dist/lib/rich-text/rich-markdown.js +105 -0
- package/dist/lib/rich-text/rich-text-editor-dom.d.ts +26 -0
- package/dist/lib/rich-text/rich-text-editor-dom.js +79 -0
- package/dist/lib/toast-layer.d.ts +24 -0
- package/dist/lib/toast-layer.js +76 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/year-month-filter.d.ts +16 -0
- package/dist/lib/year-month-filter.js +46 -0
- package/dist/motion/arc-floating-slot.d.ts +40 -0
- package/dist/motion/arc-floating-slot.js +177 -0
- package/dist/motion/arc-press.d.ts +6 -0
- package/dist/motion/arc-press.js +59 -0
- package/dist/motion/arc-swap.d.ts +22 -0
- package/dist/motion/arc-swap.js +49 -0
- package/dist/motion/arc-tokens.d.ts +53 -0
- package/dist/motion/arc-tokens.js +73 -0
- package/dist/motion/glide-indicator.d.ts +69 -0
- package/dist/motion/glide-indicator.js +309 -0
- package/dist/motion/glide-slot.d.ts +9 -0
- package/dist/motion/glide-slot.js +71 -0
- package/dist/motion/motion-slot.d.ts +12 -0
- package/dist/motion/motion-slot.js +376 -0
- package/dist/motion/overlay-warmth.d.ts +24 -0
- package/dist/motion/overlay-warmth.js +70 -0
- package/dist/motion/presence.d.ts +40 -0
- package/dist/motion/presence.js +101 -0
- package/dist/motion/surface-keyframes.d.ts +24 -0
- package/dist/motion/surface-keyframes.js +141 -0
- package/dist/motion/tokens.d.ts +81 -0
- package/dist/motion/tokens.js +67 -0
- package/dist/motion/use-attached-element.d.ts +7 -0
- package/dist/motion/use-attached-element.js +22 -0
- package/dist/motion/use-morph-width.d.ts +13 -0
- package/dist/motion/use-morph-width.js +59 -0
- package/dist/next.d.ts +14 -0
- package/dist/next.js +79 -0
- package/dist/providers/astra-ui-provider.d.ts +27 -0
- package/dist/providers/astra-ui-provider.js +100 -0
- package/dist/providers/native-provider.d.ts +4 -0
- package/dist/providers/native-provider.js +45 -0
- package/dist/sonner.d.ts +7 -0
- package/dist/sonner.js +8 -0
- package/dist/styles.css +2 -0
- package/dist/tanstack.d.ts +11 -0
- package/dist/tanstack.js +50 -0
- package/dist/theme.d.ts +3 -0
- package/dist/theme.js +1 -0
- package/dist/types/data-table.d.ts +27 -0
- package/dist/types/data-table.js +1 -0
- package/fonts.css +5 -0
- package/package.json +450 -4
- package/styles.css +4 -0
- package/theme.css +248 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
const WhatsappIcon = (props) => /* @__PURE__ */ _jsx("svg", {
|
|
3
|
+
"data-slot": "whatsapp-icon",
|
|
4
|
+
...props,
|
|
5
|
+
fill: "none",
|
|
6
|
+
viewBox: "0 0 360 362",
|
|
7
|
+
children: /* @__PURE__ */ _jsx("path", {
|
|
8
|
+
fill: "#25D366",
|
|
9
|
+
fillRule: "evenodd",
|
|
10
|
+
d: "M307.546 52.566C273.709 18.684 228.706.017 180.756 0 81.951 0 1.538 80.404 1.504 179.235c-.017 31.594 8.242 62.432 23.928 89.609L0 361.736l95.024-24.925c26.179 14.285 55.659 21.805 85.655 21.814h.077c98.788 0 179.21-80.413 179.244-179.244.017-47.898-18.608-92.926-52.454-126.807v-.008Zm-126.79 275.788h-.06c-26.73-.008-52.952-7.194-75.831-20.765l-5.44-3.231-56.391 14.791 15.05-54.981-3.542-5.638c-14.912-23.721-22.793-51.139-22.776-79.286.035-82.14 66.867-148.973 149.051-148.973 39.793.017 77.198 15.53 105.328 43.695 28.131 28.157 43.61 65.596 43.593 105.398-.035 82.149-66.867 148.982-148.982 148.982v.008Zm81.719-111.577c-4.478-2.243-26.497-13.073-30.606-14.568-4.108-1.496-7.09-2.243-10.073 2.243-2.982 4.487-11.568 14.577-14.181 17.559-2.613 2.991-5.226 3.361-9.704 1.117-4.477-2.243-18.908-6.97-36.02-22.226-13.313-11.878-22.304-26.54-24.916-31.027-2.613-4.486-.275-6.91 1.959-9.136 2.011-2.011 4.478-5.234 6.721-7.847 2.244-2.613 2.983-4.486 4.478-7.469 1.496-2.991.748-5.603-.369-7.847-1.118-2.243-10.073-24.289-13.812-33.253-3.636-8.732-7.331-7.546-10.073-7.692-2.613-.13-5.595-.155-8.586-.155-2.991 0-7.839 1.118-11.947 5.604-4.108 4.486-15.677 15.324-15.677 37.361s16.047 43.344 18.29 46.335c2.243 2.991 31.585 48.225 76.51 67.632 10.684 4.615 19.029 7.374 25.535 9.437 10.727 3.412 20.49 2.931 28.208 1.779 8.604-1.289 26.498-10.838 30.228-21.298 3.73-10.46 3.73-19.433 2.613-21.298-1.117-1.865-4.108-2.991-8.586-5.234l.008-.017Z",
|
|
11
|
+
clipRule: "evenodd"
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
export { WhatsappIcon };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
3
|
+
export type SwitchProps = ComponentProps<typeof SwitchPrimitive.Root> & {
|
|
4
|
+
/** Visible text rendered inside the control, after the track; also its `aria-label` when none is passed. */
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A binary setting that applies at once, controlled or uncontrolled like Radix's switch.
|
|
9
|
+
* @param switchProps - Every Radix switch prop, including `ref`, plus Arc's `label`.
|
|
10
|
+
* @returns The switch button, with its label inside when one is passed.
|
|
11
|
+
*/
|
|
12
|
+
declare function Switch({ className, label, checked, defaultChecked, onCheckedChange, onPointerDown, onPointerUp, onPointerLeave, onPointerCancel, onKeyDown, onKeyUp, onBlur, disabled, "aria-label": ariaLabel, ...props }: SwitchProps): import("react").JSX.Element;
|
|
13
|
+
export { Switch };
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c as _c } from "react/compiler-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Arc's Switch (https://uiarc.dev, MIT License, see THIRD_PARTY_NOTICES.md): a pill track that crossfades between its
|
|
5
|
+
* two fills while the thumb glides on a critically damped spring. Held down, the thumb widens toward the other side
|
|
6
|
+
* with its far edge anchored, like a finger on it. With a `label` the text sits inside the control; without it the
|
|
7
|
+
* switch renders the bare track, for rows that place their own label.
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useRef, useState } from "react";
|
|
10
|
+
import { Switch as SwitchPrimitive } from "radix-ui";
|
|
11
|
+
import { animate, frameData, motion, useMotionValue } from "motion/react";
|
|
12
|
+
import { SWITCH_CHANGE_STRETCH, SWITCH_PRESS_RELEASE_WINDOW_MS, SWITCH_PRESS_STRETCH_PX, SWITCH_PRIMARY_POINTER_BUTTON, SWITCH_THUMB_GEOMETRY_PX, SWITCH_THUMB_GLIDE_SPRING, SWITCH_TOGGLE_KEY } from "../constants/switch.js";
|
|
13
|
+
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
14
|
+
import { cn } from "../lib/utils.js";
|
|
15
|
+
import { ARC_SPRING_SNAPPY } from "../motion/arc-tokens.js";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
/**
|
|
18
|
+
* Arc's control recipe. The bare switch keeps the track's own box and widens its hit area with a pseudo-element, so
|
|
19
|
+
* rows that already lay it out do not grow; with a label it takes Arc's full control height. Hover only answers on
|
|
20
|
+
* hover-capable fine pointers, and keyboard focus uses the theme's focus outline.
|
|
21
|
+
*/
|
|
22
|
+
const switchClassName = "peer group/switch relative inline-flex shrink-0 cursor-pointer items-center gap-(--space-3) rounded-(--radius-pill) border-0 bg-transparent p-0 font-sans text-sm text-foreground [-webkit-tap-highlight-color:transparent] after:absolute after:-inset-x-2 after:-inset-y-2.5 disabled:cursor-not-allowed disabled:opacity-50 data-[labelled]:min-h-(--control-height-md) data-[labelled]:rounded-(--radius-control) data-[labelled]:after:hidden hover-fine:data-[state=unchecked]:not-disabled:[&_[data-slot=switch-track]]:bg-(--control-track-hover)";
|
|
23
|
+
/** Fixed box: the thumb moves inside it with transforms, so nothing around the switch shifts. */
|
|
24
|
+
const trackClassName = "relative isolate box-border flex flex-none items-center rounded-(--radius-pill) bg-(--control-track) transition-[background-color] duration-(--duration-fast) ease-(--ease-standard) before:absolute before:inset-0 before:-z-1 before:rounded-[inherit] before:bg-(--control-on) before:opacity-0 before:transition-opacity before:duration-(--duration-standard) before:ease-(--ease-standard) group-data-[state=checked]/switch:before:opacity-100 group-aria-invalid/switch:shadow-[0_0_0_1px_var(--danger)] h-6 w-[42px] p-[3px] motion-reduce:transition-none motion-reduce:before:transition-none";
|
|
25
|
+
const thumbClassName = "pointer-events-none block flex-none rounded-(--radius-pill) bg-(--control-thumb) shadow-(--control-thumb-shadow) will-change-transform transition-[background-color] duration-(--duration-standard) ease-(--ease-standard) group-data-[state=checked]/switch:bg-(--control-thumb-on) h-[18px] motion-reduce:transition-none";
|
|
26
|
+
/**
|
|
27
|
+
* Springs a thumb value to its target from where it was last painted, carrying its velocity. Motion samples a stopped
|
|
28
|
+
* animation at the current time, ahead of the last painted frame, and renders that sample right after the commit, so
|
|
29
|
+
* a reversed glide would otherwise jump by up to a frame of travel, more when frames run long.
|
|
30
|
+
* @param value - The motion value to animate.
|
|
31
|
+
* @param paintedValue - The value last written to the screen.
|
|
32
|
+
* @param target - Where the value should settle.
|
|
33
|
+
* @param transition - Spring to travel on.
|
|
34
|
+
* @returns The running animation, or `undefined` when the value already rests on its target.
|
|
35
|
+
*/
|
|
36
|
+
function glideFromPainted(value, paintedValue, target, transition) {
|
|
37
|
+
if (!value.isAnimating() && value.get() === target) return undefined;
|
|
38
|
+
const velocity = value.getVelocity();
|
|
39
|
+
value.jump(paintedValue);
|
|
40
|
+
return animate(value, [paintedValue, target], {
|
|
41
|
+
...transition,
|
|
42
|
+
velocity
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A binary setting that applies at once, controlled or uncontrolled like Radix's switch.
|
|
47
|
+
* @param switchProps - Every Radix switch prop, including `ref`, plus Arc's `label`.
|
|
48
|
+
* @returns The switch button, with its label inside when one is passed.
|
|
49
|
+
*/
|
|
50
|
+
function Switch(t0) {
|
|
51
|
+
const $ = _c(83);
|
|
52
|
+
let ariaLabel;
|
|
53
|
+
let checked;
|
|
54
|
+
let className;
|
|
55
|
+
let defaultChecked;
|
|
56
|
+
let disabled;
|
|
57
|
+
let label;
|
|
58
|
+
let onBlur;
|
|
59
|
+
let onCheckedChange;
|
|
60
|
+
let onKeyDown;
|
|
61
|
+
let onKeyUp;
|
|
62
|
+
let onPointerCancel;
|
|
63
|
+
let onPointerDown;
|
|
64
|
+
let onPointerLeave;
|
|
65
|
+
let onPointerUp;
|
|
66
|
+
let props;
|
|
67
|
+
if ($[0] !== t0) {
|
|
68
|
+
({className, label, checked, defaultChecked, onCheckedChange, onPointerDown, onPointerUp, onPointerLeave, onPointerCancel, onKeyDown, onKeyUp, onBlur, disabled, "aria-label": ariaLabel, ...props} = t0);
|
|
69
|
+
$[0] = t0;
|
|
70
|
+
$[1] = ariaLabel;
|
|
71
|
+
$[2] = checked;
|
|
72
|
+
$[3] = className;
|
|
73
|
+
$[4] = defaultChecked;
|
|
74
|
+
$[5] = disabled;
|
|
75
|
+
$[6] = label;
|
|
76
|
+
$[7] = onBlur;
|
|
77
|
+
$[8] = onCheckedChange;
|
|
78
|
+
$[9] = onKeyDown;
|
|
79
|
+
$[10] = onKeyUp;
|
|
80
|
+
$[11] = onPointerCancel;
|
|
81
|
+
$[12] = onPointerDown;
|
|
82
|
+
$[13] = onPointerLeave;
|
|
83
|
+
$[14] = onPointerUp;
|
|
84
|
+
$[15] = props;
|
|
85
|
+
} else {
|
|
86
|
+
ariaLabel = $[1];
|
|
87
|
+
checked = $[2];
|
|
88
|
+
className = $[3];
|
|
89
|
+
defaultChecked = $[4];
|
|
90
|
+
disabled = $[5];
|
|
91
|
+
label = $[6];
|
|
92
|
+
onBlur = $[7];
|
|
93
|
+
onCheckedChange = $[8];
|
|
94
|
+
onKeyDown = $[9];
|
|
95
|
+
onKeyUp = $[10];
|
|
96
|
+
onPointerCancel = $[11];
|
|
97
|
+
onPointerDown = $[12];
|
|
98
|
+
onPointerLeave = $[13];
|
|
99
|
+
onPointerUp = $[14];
|
|
100
|
+
props = $[15];
|
|
101
|
+
}
|
|
102
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
103
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked ?? false);
|
|
104
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
105
|
+
const isChecked = checked ?? uncontrolledChecked;
|
|
106
|
+
const stretch = isPressed && !reduceMotion && !disabled ? SWITCH_PRESS_STRETCH_PX : 0;
|
|
107
|
+
const targetX = isChecked ? SWITCH_THUMB_GEOMETRY_PX.travel - stretch : 0;
|
|
108
|
+
const targetWidth = SWITCH_THUMB_GEOMETRY_PX.size + stretch;
|
|
109
|
+
const x = useMotionValue(targetX);
|
|
110
|
+
const width = useMotionValue(targetWidth);
|
|
111
|
+
const scaleX = useMotionValue(1);
|
|
112
|
+
let t1;
|
|
113
|
+
if ($[16] !== targetWidth || $[17] !== targetX) {
|
|
114
|
+
t1 = {
|
|
115
|
+
x: targetX,
|
|
116
|
+
width: targetWidth,
|
|
117
|
+
scaleX: 1
|
|
118
|
+
};
|
|
119
|
+
$[16] = targetWidth;
|
|
120
|
+
$[17] = targetX;
|
|
121
|
+
$[18] = t1;
|
|
122
|
+
} else {
|
|
123
|
+
t1 = $[18];
|
|
124
|
+
}
|
|
125
|
+
const painted = useRef(t1);
|
|
126
|
+
const shownChecked = useRef(isChecked);
|
|
127
|
+
const releasedAt = useRef(-Infinity);
|
|
128
|
+
let t2;
|
|
129
|
+
let t3;
|
|
130
|
+
if ($[19] !== scaleX || $[20] !== width || $[21] !== x) {
|
|
131
|
+
t2 = () => {
|
|
132
|
+
const trackPainted = (key) => (value) => {
|
|
133
|
+
if (frameData.isProcessing) {
|
|
134
|
+
painted.current[key] = value;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const unsubscribes = [
|
|
138
|
+
x.on("change", trackPainted("x")),
|
|
139
|
+
width.on("change", trackPainted("width")),
|
|
140
|
+
scaleX.on("change", trackPainted("scaleX"))
|
|
141
|
+
];
|
|
142
|
+
return () => unsubscribes.forEach(_temp);
|
|
143
|
+
};
|
|
144
|
+
t3 = [
|
|
145
|
+
x,
|
|
146
|
+
width,
|
|
147
|
+
scaleX
|
|
148
|
+
];
|
|
149
|
+
$[19] = scaleX;
|
|
150
|
+
$[20] = width;
|
|
151
|
+
$[21] = x;
|
|
152
|
+
$[22] = t2;
|
|
153
|
+
$[23] = t3;
|
|
154
|
+
} else {
|
|
155
|
+
t2 = $[22];
|
|
156
|
+
t3 = $[23];
|
|
157
|
+
}
|
|
158
|
+
useEffect(t2, t3);
|
|
159
|
+
let t4;
|
|
160
|
+
let t5;
|
|
161
|
+
if ($[24] !== reduceMotion || $[25] !== targetWidth || $[26] !== targetX || $[27] !== width || $[28] !== x) {
|
|
162
|
+
t4 = () => {
|
|
163
|
+
if (reduceMotion) {
|
|
164
|
+
x.jump(targetX);
|
|
165
|
+
width.jump(targetWidth);
|
|
166
|
+
painted.current = {
|
|
167
|
+
...painted.current,
|
|
168
|
+
x: targetX,
|
|
169
|
+
width: targetWidth
|
|
170
|
+
};
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const xControls = glideFromPainted(x, painted.current.x, targetX, SWITCH_THUMB_GLIDE_SPRING);
|
|
174
|
+
const widthControls = glideFromPainted(width, painted.current.width, targetWidth, ARC_SPRING_SNAPPY);
|
|
175
|
+
return () => {
|
|
176
|
+
xControls?.stop();
|
|
177
|
+
widthControls?.stop();
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
t5 = [
|
|
181
|
+
targetX,
|
|
182
|
+
targetWidth,
|
|
183
|
+
reduceMotion,
|
|
184
|
+
x,
|
|
185
|
+
width
|
|
186
|
+
];
|
|
187
|
+
$[24] = reduceMotion;
|
|
188
|
+
$[25] = targetWidth;
|
|
189
|
+
$[26] = targetX;
|
|
190
|
+
$[27] = width;
|
|
191
|
+
$[28] = x;
|
|
192
|
+
$[29] = t4;
|
|
193
|
+
$[30] = t5;
|
|
194
|
+
} else {
|
|
195
|
+
t4 = $[29];
|
|
196
|
+
t5 = $[30];
|
|
197
|
+
}
|
|
198
|
+
useEffect(t4, t5);
|
|
199
|
+
let t6;
|
|
200
|
+
let t7;
|
|
201
|
+
if ($[31] !== isChecked || $[32] !== reduceMotion || $[33] !== scaleX) {
|
|
202
|
+
t6 = () => {
|
|
203
|
+
if (shownChecked.current === isChecked) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
shownChecked.current = isChecked;
|
|
207
|
+
const isFromPress = performance.now() - releasedAt.current < SWITCH_PRESS_RELEASE_WINDOW_MS;
|
|
208
|
+
if (reduceMotion || isFromPress) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const { scaleX: keyframes, ...transition } = SWITCH_CHANGE_STRETCH;
|
|
212
|
+
const [, peakScale, restingScale] = keyframes;
|
|
213
|
+
scaleX.jump(painted.current.scaleX);
|
|
214
|
+
const controls = animate(scaleX, [
|
|
215
|
+
painted.current.scaleX,
|
|
216
|
+
peakScale,
|
|
217
|
+
restingScale
|
|
218
|
+
], {
|
|
219
|
+
...transition,
|
|
220
|
+
times: [...transition.times],
|
|
221
|
+
ease: [...transition.ease]
|
|
222
|
+
});
|
|
223
|
+
return () => controls.stop();
|
|
224
|
+
};
|
|
225
|
+
t7 = [
|
|
226
|
+
isChecked,
|
|
227
|
+
reduceMotion,
|
|
228
|
+
scaleX
|
|
229
|
+
];
|
|
230
|
+
$[31] = isChecked;
|
|
231
|
+
$[32] = reduceMotion;
|
|
232
|
+
$[33] = scaleX;
|
|
233
|
+
$[34] = t6;
|
|
234
|
+
$[35] = t7;
|
|
235
|
+
} else {
|
|
236
|
+
t6 = $[34];
|
|
237
|
+
t7 = $[35];
|
|
238
|
+
}
|
|
239
|
+
useEffect(t6, t7);
|
|
240
|
+
let t8;
|
|
241
|
+
if ($[36] !== disabled || $[37] !== isPressed) {
|
|
242
|
+
t8 = () => {
|
|
243
|
+
if (isPressed && !disabled) {
|
|
244
|
+
releasedAt.current = performance.now();
|
|
245
|
+
}
|
|
246
|
+
setIsPressed(false);
|
|
247
|
+
};
|
|
248
|
+
$[36] = disabled;
|
|
249
|
+
$[37] = isPressed;
|
|
250
|
+
$[38] = t8;
|
|
251
|
+
} else {
|
|
252
|
+
t8 = $[38];
|
|
253
|
+
}
|
|
254
|
+
const release = t8;
|
|
255
|
+
const t9 = label ? "" : undefined;
|
|
256
|
+
let t10;
|
|
257
|
+
if ($[39] !== className) {
|
|
258
|
+
t10 = cn(switchClassName, className);
|
|
259
|
+
$[39] = className;
|
|
260
|
+
$[40] = t10;
|
|
261
|
+
} else {
|
|
262
|
+
t10 = $[40];
|
|
263
|
+
}
|
|
264
|
+
const t11 = ariaLabel ?? label;
|
|
265
|
+
let t12;
|
|
266
|
+
if ($[41] !== checked || $[42] !== onCheckedChange) {
|
|
267
|
+
t12 = (nextChecked) => {
|
|
268
|
+
if (checked === undefined) {
|
|
269
|
+
setUncontrolledChecked(nextChecked);
|
|
270
|
+
}
|
|
271
|
+
onCheckedChange?.(nextChecked);
|
|
272
|
+
};
|
|
273
|
+
$[41] = checked;
|
|
274
|
+
$[42] = onCheckedChange;
|
|
275
|
+
$[43] = t12;
|
|
276
|
+
} else {
|
|
277
|
+
t12 = $[43];
|
|
278
|
+
}
|
|
279
|
+
let t13;
|
|
280
|
+
if ($[44] !== onPointerDown) {
|
|
281
|
+
t13 = (event) => {
|
|
282
|
+
onPointerDown?.(event);
|
|
283
|
+
if (event.button === SWITCH_PRIMARY_POINTER_BUTTON) {
|
|
284
|
+
setIsPressed(true);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
$[44] = onPointerDown;
|
|
288
|
+
$[45] = t13;
|
|
289
|
+
} else {
|
|
290
|
+
t13 = $[45];
|
|
291
|
+
}
|
|
292
|
+
let t14;
|
|
293
|
+
if ($[46] !== onPointerUp || $[47] !== release) {
|
|
294
|
+
t14 = (event_0) => {
|
|
295
|
+
onPointerUp?.(event_0);
|
|
296
|
+
release();
|
|
297
|
+
};
|
|
298
|
+
$[46] = onPointerUp;
|
|
299
|
+
$[47] = release;
|
|
300
|
+
$[48] = t14;
|
|
301
|
+
} else {
|
|
302
|
+
t14 = $[48];
|
|
303
|
+
}
|
|
304
|
+
let t15;
|
|
305
|
+
if ($[49] !== onPointerLeave) {
|
|
306
|
+
t15 = (event_1) => {
|
|
307
|
+
onPointerLeave?.(event_1);
|
|
308
|
+
setIsPressed(false);
|
|
309
|
+
};
|
|
310
|
+
$[49] = onPointerLeave;
|
|
311
|
+
$[50] = t15;
|
|
312
|
+
} else {
|
|
313
|
+
t15 = $[50];
|
|
314
|
+
}
|
|
315
|
+
let t16;
|
|
316
|
+
if ($[51] !== onPointerCancel) {
|
|
317
|
+
t16 = (event_2) => {
|
|
318
|
+
onPointerCancel?.(event_2);
|
|
319
|
+
setIsPressed(false);
|
|
320
|
+
};
|
|
321
|
+
$[51] = onPointerCancel;
|
|
322
|
+
$[52] = t16;
|
|
323
|
+
} else {
|
|
324
|
+
t16 = $[52];
|
|
325
|
+
}
|
|
326
|
+
let t17;
|
|
327
|
+
if ($[53] !== onKeyDown) {
|
|
328
|
+
t17 = (event_3) => {
|
|
329
|
+
onKeyDown?.(event_3);
|
|
330
|
+
if (event_3.key === SWITCH_TOGGLE_KEY) {
|
|
331
|
+
setIsPressed(true);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
$[53] = onKeyDown;
|
|
335
|
+
$[54] = t17;
|
|
336
|
+
} else {
|
|
337
|
+
t17 = $[54];
|
|
338
|
+
}
|
|
339
|
+
let t18;
|
|
340
|
+
if ($[55] !== onKeyUp || $[56] !== release) {
|
|
341
|
+
t18 = (event_4) => {
|
|
342
|
+
onKeyUp?.(event_4);
|
|
343
|
+
release();
|
|
344
|
+
};
|
|
345
|
+
$[55] = onKeyUp;
|
|
346
|
+
$[56] = release;
|
|
347
|
+
$[57] = t18;
|
|
348
|
+
} else {
|
|
349
|
+
t18 = $[57];
|
|
350
|
+
}
|
|
351
|
+
let t19;
|
|
352
|
+
if ($[58] !== onBlur) {
|
|
353
|
+
t19 = (event_5) => {
|
|
354
|
+
onBlur?.(event_5);
|
|
355
|
+
setIsPressed(false);
|
|
356
|
+
};
|
|
357
|
+
$[58] = onBlur;
|
|
358
|
+
$[59] = t19;
|
|
359
|
+
} else {
|
|
360
|
+
t19 = $[59];
|
|
361
|
+
}
|
|
362
|
+
let t20;
|
|
363
|
+
if ($[60] !== scaleX || $[61] !== width || $[62] !== x) {
|
|
364
|
+
t20 = /* @__PURE__ */ _jsx("span", {
|
|
365
|
+
"data-slot": "switch-track",
|
|
366
|
+
className: trackClassName,
|
|
367
|
+
children: /* @__PURE__ */ _jsx(SwitchPrimitive.Thumb, {
|
|
368
|
+
asChild: true,
|
|
369
|
+
children: /* @__PURE__ */ _jsx(motion.span, {
|
|
370
|
+
"data-slot": "switch-thumb",
|
|
371
|
+
className: thumbClassName,
|
|
372
|
+
style: {
|
|
373
|
+
x,
|
|
374
|
+
width,
|
|
375
|
+
scaleX
|
|
376
|
+
}
|
|
377
|
+
})
|
|
378
|
+
})
|
|
379
|
+
});
|
|
380
|
+
$[60] = scaleX;
|
|
381
|
+
$[61] = width;
|
|
382
|
+
$[62] = x;
|
|
383
|
+
$[63] = t20;
|
|
384
|
+
} else {
|
|
385
|
+
t20 = $[63];
|
|
386
|
+
}
|
|
387
|
+
let t21;
|
|
388
|
+
if ($[64] !== label) {
|
|
389
|
+
t21 = label ? /* @__PURE__ */ _jsx("span", {
|
|
390
|
+
"data-slot": "switch-label",
|
|
391
|
+
className: "leading-(--leading-body)",
|
|
392
|
+
children: label
|
|
393
|
+
}) : null;
|
|
394
|
+
$[64] = label;
|
|
395
|
+
$[65] = t21;
|
|
396
|
+
} else {
|
|
397
|
+
t21 = $[65];
|
|
398
|
+
}
|
|
399
|
+
let t22;
|
|
400
|
+
if ($[66] !== disabled || $[67] !== isChecked || $[68] !== props || $[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t13 || $[73] !== t14 || $[74] !== t15 || $[75] !== t16 || $[76] !== t17 || $[77] !== t18 || $[78] !== t19 || $[79] !== t20 || $[80] !== t21 || $[81] !== t9) {
|
|
401
|
+
t22 = /* @__PURE__ */ _jsxs(SwitchPrimitive.Root, {
|
|
402
|
+
"data-slot": "switch",
|
|
403
|
+
"data-labelled": t9,
|
|
404
|
+
className: t10,
|
|
405
|
+
...props,
|
|
406
|
+
disabled,
|
|
407
|
+
checked: isChecked,
|
|
408
|
+
"aria-label": t11,
|
|
409
|
+
onCheckedChange: t12,
|
|
410
|
+
onPointerDown: t13,
|
|
411
|
+
onPointerUp: t14,
|
|
412
|
+
onPointerLeave: t15,
|
|
413
|
+
onPointerCancel: t16,
|
|
414
|
+
onKeyDown: t17,
|
|
415
|
+
onKeyUp: t18,
|
|
416
|
+
onBlur: t19,
|
|
417
|
+
children: [t20, t21]
|
|
418
|
+
});
|
|
419
|
+
$[66] = disabled;
|
|
420
|
+
$[67] = isChecked;
|
|
421
|
+
$[68] = props;
|
|
422
|
+
$[69] = t10;
|
|
423
|
+
$[70] = t11;
|
|
424
|
+
$[71] = t12;
|
|
425
|
+
$[72] = t13;
|
|
426
|
+
$[73] = t14;
|
|
427
|
+
$[74] = t15;
|
|
428
|
+
$[75] = t16;
|
|
429
|
+
$[76] = t17;
|
|
430
|
+
$[77] = t18;
|
|
431
|
+
$[78] = t19;
|
|
432
|
+
$[79] = t20;
|
|
433
|
+
$[80] = t21;
|
|
434
|
+
$[81] = t9;
|
|
435
|
+
$[82] = t22;
|
|
436
|
+
} else {
|
|
437
|
+
t22 = $[82];
|
|
438
|
+
}
|
|
439
|
+
return t22;
|
|
440
|
+
}
|
|
441
|
+
function _temp(unsubscribe) {
|
|
442
|
+
return unsubscribe();
|
|
443
|
+
}
|
|
444
|
+
export { Switch };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|