@clicktap/ui 0.41.1 → 0.42.1
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/assets/react-number-format.es-LSEUnuG5.js +1 -0
- package/components/Accordion/Accordion.js +1 -1
- package/components/Accordion.d.ts +1 -0
- package/components/Accordion.js +1 -0
- package/components/AssetRenderer/renderers/DownloadLink.d.ts +1 -1
- package/components/AssetRenderer/renderers.d.ts +1 -0
- package/components/AssetRenderer/renderers.js +1 -0
- package/components/AssetRenderer.d.ts +1 -0
- package/components/AssetRenderer.js +1 -0
- package/components/Avatar/Avatar.js +1 -1
- package/components/Avatar.d.ts +1 -0
- package/components/Avatar.js +1 -0
- package/components/Badge/Badge.js +1 -1
- package/components/Badge.d.ts +1 -0
- package/components/Badge.js +1 -0
- package/components/Breadcrumbs/BreadcrumbLink.js +1 -1
- package/components/Breadcrumbs.d.ts +1 -0
- package/components/Breadcrumbs.js +1 -0
- package/components/Button/Button.js +1 -1
- package/components/Button/ButtonLoadingContent.js +1 -1
- package/components/Button/index.js +1 -1
- package/components/Button.d.ts +1 -0
- package/components/Button.js +1 -0
- package/components/Card.d.ts +1 -0
- package/components/Card.js +1 -0
- package/components/Checkbox/Checkbox.js +1 -1
- package/components/Checkbox.d.ts +1 -0
- package/components/Checkbox.js +1 -0
- package/components/Collapsible.d.ts +1 -0
- package/components/Collapsible.js +1 -0
- package/components/Collection/AttributeDataProvider.d.ts +1 -0
- package/components/Collection/AttributeDataProvider.js +1 -0
- package/components/Collection/CollectionFilterChips/CollectionFilterChips.js +1 -1
- package/components/Collection/CollectionFilterChips/index.js +1 -1
- package/components/Collection/CollectionFilterChips.d.ts +1 -0
- package/components/Collection/CollectionFilterChips.js +1 -0
- package/components/Collection/CollectionFilters/CollectionFilters.js +1 -1
- package/components/Collection/CollectionFilters/index.js +1 -1
- package/components/Collection/CollectionFilters.d.ts +1 -0
- package/components/Collection/CollectionFilters.js +1 -0
- package/components/Collection/CollectionToolbar/CollectionToolbar.js +1 -1
- package/components/Collection/CollectionToolbar/index.js +1 -1
- package/components/Collection/CollectionToolbar.d.ts +1 -0
- package/components/Collection/CollectionToolbar.js +1 -0
- package/components/Collection/EmptyResults/EmptyResults.js +1 -1
- package/components/Collection/EmptyResults.d.ts +1 -0
- package/components/Collection/EmptyResults.js +1 -0
- package/components/Collection/FilterAccordionTitle/FilterAccordionTitle.js +1 -1
- package/components/Collection/FilterAccordionTitle.d.ts +1 -0
- package/components/Collection/FilterAccordionTitle.js +1 -0
- package/components/Collection/FilterRenderer/Renderer/Boolean.js +1 -1
- package/components/Collection/FilterRenderer/Renderer/Option.js +1 -1
- package/components/Collection/FilterRenderer/Renderer/Range.js +1 -1
- package/components/Collection/FilterRenderer/Renderer/Swatch/SwatchColor.js +1 -1
- package/components/Collection/FilterRenderer/Renderer/Swatch/SwatchImage.js +1 -1
- package/components/Collection/FilterRenderer/Renderer/Swatch/SwatchText.js +1 -1
- package/components/Collection/FilterRenderer/Renderer.d.ts +1 -0
- package/components/Collection/FilterRenderer/Renderer.js +1 -0
- package/components/Collection/FilterRenderer.d.ts +1 -0
- package/components/Collection/FilterRenderer.js +1 -0
- package/components/Collection/ProductCardSwatches/ProductCardSwatches.js +1 -1
- package/components/Collection/ProductCardSwatches.d.ts +1 -0
- package/components/Collection/ProductCardSwatches.js +1 -0
- package/components/Collection/ProductPrice.d.ts +1 -0
- package/components/Collection/ProductPrice.js +1 -0
- package/components/Collection/index.js +1 -1
- package/components/Collection.d.ts +1 -0
- package/components/Collection.js +1 -0
- package/components/Container.d.ts +1 -0
- package/components/Container.js +1 -0
- package/components/ContextMenu/ContextMenu.js +1 -1
- package/components/ContextMenu.d.ts +1 -0
- package/components/ContextMenu.js +1 -0
- package/components/CreditCardExpirationInput/CreditCardExpirationInput.js +1 -1
- package/components/CreditCardExpirationInput/index.js +1 -1
- package/components/CreditCardExpirationInput.d.ts +1 -0
- package/components/CreditCardExpirationInput.js +1 -0
- package/components/CreditCardInput/CreditCardInput.js +1 -1
- package/components/CreditCardInput/index.js +1 -1
- package/components/CreditCardInput.d.ts +1 -0
- package/components/CreditCardInput.js +1 -0
- package/components/DateInput/DateInput.js +1 -1
- package/components/DateInput.d.ts +1 -0
- package/components/DateInput.js +1 -0
- package/components/DateTimeFormat/DateTimeFormat.d.ts +1 -1
- package/components/DateTimeFormat.d.ts +1 -0
- package/components/DateTimeFormat.js +1 -0
- package/components/Dialog/Dialog.js +1 -1
- package/components/Dialog.d.ts +1 -0
- package/components/Dialog.js +1 -0
- package/components/DialogTrigger.d.ts +1 -0
- package/components/DialogTrigger.js +1 -0
- package/components/Divider.d.ts +1 -0
- package/components/Divider.js +1 -0
- package/components/DobInput/DobInput.js +1 -1
- package/components/DobInput/index.js +1 -1
- package/components/DobInput.d.ts +1 -0
- package/components/DobInput.js +1 -0
- package/components/Drawer/Drawer.js +1 -1
- package/components/Drawer.d.ts +1 -0
- package/components/Drawer.js +1 -0
- package/components/FeatureGate/AccessDenied.d.ts +2 -2
- package/components/FeatureGate/AccessDenied.js +1 -1
- package/components/FeatureGate/FeatureGate.d.ts +1 -1
- package/components/FeatureGate/FeatureGate.js +1 -1
- package/components/FeatureGate/PermissionRequired.d.ts +1 -1
- package/components/FeatureGate/PermissionRequired.js +1 -1
- package/components/FeatureGate/UpgradePrompt.d.ts +1 -1
- package/components/FeatureGate/UpgradePrompt.js +1 -1
- package/components/Icon/NoEntryIcon.js +1 -1
- package/components/Icon/StarIcon.js +1 -1
- package/components/Icon.d.ts +1 -0
- package/components/Icon.js +1 -0
- package/components/Image/Image.d.ts +44 -3
- package/components/Image/Image.js +1 -1
- package/components/Image/ImageContext.d.ts +30 -0
- package/components/Image/ImageContext.js +1 -0
- package/components/Image/imageShared.d.ts +74 -0
- package/components/Image/imageShared.js +1 -0
- package/components/Image/index.d.ts +3 -1
- package/components/Image/index.js +1 -1
- package/components/Image.d.ts +1 -0
- package/components/Image.js +1 -0
- package/components/Input/Input.js +1 -1
- package/components/Input.d.ts +1 -0
- package/components/Input.js +1 -0
- package/components/Link/Link.js +1 -1
- package/components/Link.d.ts +1 -0
- package/components/Link.js +1 -0
- package/components/LinkAsButton/LinkAsButton.js +1 -1
- package/components/LinkAsButton/index.js +1 -1
- package/components/LinkAsButton.d.ts +1 -0
- package/components/LinkAsButton.js +1 -0
- package/components/Loader/CircularEasing.js +1 -1
- package/components/Loader/Pulse.js +1 -1
- package/components/Loader/index.js +1 -1
- package/components/Loader.d.ts +1 -0
- package/components/Loader.js +1 -0
- package/components/Menu.d.ts +1 -0
- package/components/Menu.js +1 -0
- package/components/Meter/Meter.js +1 -1
- package/components/Meter.d.ts +1 -0
- package/components/Meter.js +1 -0
- package/components/Modal.d.ts +1 -0
- package/components/Modal.js +1 -0
- package/components/ModalOverlay.d.ts +1 -0
- package/components/ModalOverlay.js +1 -0
- package/components/NumberFormat/NumberFormat.d.ts +1 -1
- package/components/NumberFormat.d.ts +1 -0
- package/components/NumberFormat.js +1 -0
- package/components/NumberInput/NumberInput.js +1 -1
- package/components/NumberInput.d.ts +1 -0
- package/components/NumberInput.js +1 -0
- package/components/NumberTicker.d.ts +1 -0
- package/components/NumberTicker.js +1 -0
- package/components/Pagination/Pagination.js +1 -1
- package/components/Pagination.d.ts +1 -0
- package/components/Pagination.js +1 -0
- package/components/PasswordCheck/PasswordCheck.js +1 -1
- package/components/PasswordCheck.d.ts +1 -0
- package/components/PasswordCheck.js +1 -0
- package/components/PhoneInput/PhoneInput.js +1 -1
- package/components/PhoneInput.d.ts +1 -0
- package/components/PhoneInput.js +1 -0
- package/components/PinInput/PinInput.js +1 -1
- package/components/PinInput.d.ts +1 -0
- package/components/PinInput.js +1 -0
- package/components/Progressbar/LinearProgressbar.js +1 -1
- package/components/Progressbar.d.ts +1 -0
- package/components/Progressbar.js +1 -0
- package/components/Radio/Radio.js +1 -1
- package/components/Radio.d.ts +1 -0
- package/components/Radio.js +1 -0
- package/components/RadioGroup/RadioGroup.js +1 -1
- package/components/RadioGroup.d.ts +1 -0
- package/components/RadioGroup.js +1 -0
- package/components/ResendCode.d.ts +1 -0
- package/components/ResendCode.js +1 -0
- package/components/Select/ButtonSelect.js +1 -1
- package/components/Select/ComboBoxSelect.js +1 -1
- package/components/Select/MultiButtonSelect.js +1 -1
- package/components/Select/Select.js +1 -1
- package/components/Select/index.js +1 -1
- package/components/Select/parts.js +1 -1
- package/components/Select.d.ts +1 -0
- package/components/Select.js +1 -0
- package/components/Skeleton.d.ts +1 -0
- package/components/Skeleton.js +1 -0
- package/components/Slider/Slider.js +1 -1
- package/components/Slider.d.ts +1 -0
- package/components/Slider.js +1 -0
- package/components/Switch/Switch.js +1 -1
- package/components/Switch.d.ts +1 -0
- package/components/Switch.js +1 -0
- package/components/Table.d.ts +1 -0
- package/components/Table.js +1 -0
- package/components/Tabs/Tab.js +1 -1
- package/components/Tabs/TabList.js +1 -1
- package/components/Tabs.d.ts +1 -0
- package/components/Tabs.js +1 -0
- package/components/Time.d.ts +1 -0
- package/components/Time.js +1 -0
- package/components/TimeInput/TimeInput.js +1 -1
- package/components/TimeInput.d.ts +1 -0
- package/components/TimeInput.js +1 -0
- package/components/Timezone.d.ts +1 -0
- package/components/Timezone.js +1 -0
- package/components/ToggleButton/ToggleButton.js +1 -1
- package/components/ToggleButton.d.ts +1 -0
- package/components/ToggleButton.js +1 -0
- package/components/Tooltip.d.ts +1 -0
- package/components/Tooltip.js +1 -0
- package/components/UploadImage/UploadImage.js +1 -1
- package/components/UploadImage/index.js +1 -1
- package/components/UploadImage.d.ts +1 -0
- package/components/UploadImage.js +1 -0
- package/docs/migrations/2026/04/2026-04-24-image-placeholder-frontend-fallback.md +3 -3
- package/docs/migrations/2026/04/2026-04-30-prune-invalid-pdp-selections.md +2 -2
- package/docs/migrations/2026/04/2026-04-30-top-down-pdp-option-dependency.md +2 -2
- package/docs/migrations/2026/08/2026-08-06-clicktap-ui-image-next-subpath.md +101 -0
- package/docs/migrations/2026/08/2026-08-06-clicktap-ui-loaders-drop-framer-motion.md +77 -0
- package/docs/migrations/2026/08/2026-08-06-clicktap-ui-semantic-tokens.md +106 -0
- package/docs/migrations/2026/08/2026-08-07-ui-peer-contract-form-graphql-optional-peers.md +62 -0
- package/docs/migrations/README.md +1 -0
- package/hooks/useCollectionState.d.ts +1 -0
- package/hooks/useCollectionState.js +1 -0
- package/hooks/useRoute/RouteContext.d.ts +8 -0
- package/hooks/useRoute/index.js +1 -1
- package/hooks/useRoute/useRoute.js +1 -1
- package/hooks/useRoute.d.ts +1 -0
- package/hooks/useRoute.js +1 -0
- package/next/Image.d.ts +11 -0
- package/next/Image.js +1 -0
- package/next/index.d.ts +8 -0
- package/next/index.js +1 -0
- package/package.json +97 -9
- package/theme.css +162 -0
- package/utils/collection.d.ts +1 -0
- package/utils/collection.js +1 -0
- package/utils/variantOptions.d.ts +1 -0
- package/utils/variantOptions.js +1 -0
- package/assets/react-number-format.es-Bf_lGveD.js +0 -1
- package/tailwind.config.js +0 -6
|
@@ -2,6 +2,14 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
export type RouteProviderConfig = {
|
|
3
3
|
/** Whether the user is currently logged in */
|
|
4
4
|
isLoggedIn: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Current pathname, supplied reactively by the consumer's router (e.g. Next's
|
|
7
|
+
* `usePathname()`). Used only by `useRoute(..., { returnHere: true })`. Keeping
|
|
8
|
+
* it in config — rather than importing `next/navigation` inside the hook — is
|
|
9
|
+
* what lets `@clicktap/ui` stay framework-agnostic (CTAP-1125). Omitted → the
|
|
10
|
+
* `returnHere` redirect falls back to `/`.
|
|
11
|
+
*/
|
|
12
|
+
pathname?: string;
|
|
5
13
|
};
|
|
6
14
|
type RouteProviderProps = {
|
|
7
15
|
children: ReactNode;
|
package/hooks/useRoute/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildPath as
|
|
1
|
+
import{buildPath as u,resolveParams as i,useRoute as m}from"./useRoute.js";import{RouteProvider as s,useRouteConfig as a}from"./RouteContext.js";import"react";import"react/jsx-runtime";export{s as RouteProvider,u as buildPath,i as resolveParams,m as useRoute,a as useRouteConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useMemo as f}from"react";import{
|
|
1
|
+
"use client";import{useMemo as f}from"react";import{useRouteConfig as d}from"./RouteContext.js";import"react/jsx-runtime";const m="/account/authenticate";function c(e,r){return r?e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,(o,t)=>{const n=r[t];if(n===void 0)throw new Error(`useRoute: missing required param "${t}" for path "${e}"`);return encodeURIComponent(n)}):e}function h(e){return/:([a-zA-Z_][a-zA-Z0-9_]*)/.test(e)}function R(e,r){return c(e.path,r)}function _(e,r,o){const{isLoggedIn:t,pathname:n}=d();return f(()=>{const{path:u,isProtected:s,name:a="unknown"}=e;if(h(u)&&!r)throw new Error(`useRoute: params required for route "${a}" with path "${u}"`);const i=c(u,r);return o?.returnHere?`${i}?redirect=${encodeURIComponent(n??"/")}`:s&&!t?`${m}?redirect=${encodeURIComponent(i)}`:i},[e,r,o?.returnHere,n,t])}export{R as buildPath,c as resolveParams,_ as useRoute};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useRoute/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useRoute/index.js';
|
package/next/Image.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageProps as NextImageProps } from 'next/image';
|
|
2
|
+
export type ExtendedImageProps = NextImageProps & {
|
|
3
|
+
/** Reduce opacity to 50% (e.g., while waiting for data) */
|
|
4
|
+
dimmed?: boolean;
|
|
5
|
+
/** Hide image completely — opacity 0 (e.g., before grid rearrange) */
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
/** Fires when a new image has loaded after a src change */
|
|
8
|
+
onReady?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function Image({ src, className, style, dimmed, hidden, onReady, onLoad: externalOnLoad, ...rest }: ExtendedImageProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Image;
|
package/next/Image.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import R from"next/image";import{useState as x,useRef as z,Component as T}from"react";import{cn as K}from"../utils/cn.js";import{useManagedOpacity as L,useImageStyle as j,getSrcKey as c,resolveSrc as u}from"../components/Image/imageShared.js";const m=new Set;class B extends T{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){if(this.state.hasError){m.add(c(this.props.src));const{src:i,alt:n,className:a,style:s,width:h,height:r}=this.props;return o("img",{src:u(i),alt:n??"",className:a,style:s,width:h,height:r,loading:"lazy"})}return this.props.children}}function P({src:e,className:i,style:n,dimmed:a,hidden:s,onReady:h,onLoad:r,...t}){const[g,p]=x(null),l=z(),{managed:f,setLoadingImg:y,onReadyRef:S,opacityStyle:w}=L({src:e,dimmed:a,hidden:s,onReady:h}),E="width"in t&&"height"in t&&!("fill"in t),d=j(n,E),v=c(e);return g===e||m.has(v)?o("img",{src:u(e),alt:t.alt??"",className:i,style:d,width:"width"in t?t.width:void 0,height:"height"in t?t.height:void 0,loading:"lazy"}):o(B,{src:e,alt:t.alt,className:i,style:d,width:"width"in t?t.width:void 0,height:"height"in t?t.height:void 0,children:o(R,{src:e,className:K(f&&"transition-opacity duration-200 ease-in-out",i),style:{...d,...w},onError:()=>{l.current=setTimeout(()=>p(e),2e3)},onLoad:I=>{clearTimeout(l.current),y(!1),S.current?.(),typeof r=="function"&&r(I)},...t})})}export{P as Image,P as default};
|
package/next/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next-specific entry point (CTAP-1125).
|
|
3
|
+
*
|
|
4
|
+
* Everything in here imports from `next/*`. It is the ONLY part of the package
|
|
5
|
+
* that does, which is what lets `next` be an optional peer: a consumer that
|
|
6
|
+
* never imports `@clicktap/ui/next` gets zero `next` in its dependency tree.
|
|
7
|
+
*/
|
|
8
|
+
export { Image, type ExtendedImageProps } from './Image';
|
package/next/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Image as a}from"./Image.js";import"react/jsx-runtime";import"next/image";import"react";import"../utils/cn.js";import"../components/Image/imageShared.js";export{a as Image};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clicktap/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Clicktap",
|
|
6
6
|
"description": "A library of React UI components and low-level hooks.",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"type": "module",
|
|
18
18
|
"exports": {
|
|
19
|
+
"./theme.css": "./theme.css",
|
|
19
20
|
"./components/*": {
|
|
20
21
|
"types": [
|
|
21
22
|
"./components/*.d.ts",
|
|
@@ -26,6 +27,24 @@
|
|
|
26
27
|
"./components/*/index.js"
|
|
27
28
|
]
|
|
28
29
|
},
|
|
30
|
+
"./next": {
|
|
31
|
+
"types": [
|
|
32
|
+
"./next/index.d.ts"
|
|
33
|
+
],
|
|
34
|
+
"import": [
|
|
35
|
+
"./next/index.js"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"./next/*": {
|
|
39
|
+
"types": [
|
|
40
|
+
"./next/*.d.ts",
|
|
41
|
+
"./next/*/index.d.ts"
|
|
42
|
+
],
|
|
43
|
+
"import": [
|
|
44
|
+
"./next/*.js",
|
|
45
|
+
"./next/*/index.js"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
29
48
|
"./hooks/*": {
|
|
30
49
|
"types": [
|
|
31
50
|
"./hooks/*.d.ts",
|
|
@@ -55,27 +74,47 @@
|
|
|
55
74
|
"./assets/*": "./assets/*"
|
|
56
75
|
},
|
|
57
76
|
"dependencies": {
|
|
58
|
-
"@radix-ui/react-navigation-menu": "^1.1.4",
|
|
59
77
|
"@react-aria/interactions": "^3.21.1",
|
|
60
78
|
"@react-stately/utils": "^3.9.1",
|
|
61
|
-
"clsx": "2.1
|
|
79
|
+
"clsx": "^1.2.1",
|
|
62
80
|
"jwt-decode": "^4.0.0",
|
|
63
|
-
"next": "^14.2.3",
|
|
64
81
|
"react-number-format": "^5.4.0",
|
|
65
|
-
"tailwind-merge": "2.
|
|
82
|
+
"tailwind-merge": "^2.6.1"
|
|
66
83
|
},
|
|
67
84
|
"devDependencies": {
|
|
85
|
+
"@floating-ui/react": "^0.27.20",
|
|
86
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
87
|
+
"@heroui/accordion": "^2.2.0",
|
|
88
|
+
"@heroui/badge": "^2.2.0",
|
|
89
|
+
"@heroui/pagination": "^2.2.0",
|
|
90
|
+
"@heroui/tooltip": "^2.2.0",
|
|
91
|
+
"@nx/react": "20.5.0",
|
|
92
|
+
"@nx/vite": "20.5.0",
|
|
68
93
|
"@storybook/addon-actions": "^8.0.6",
|
|
69
94
|
"@storybook/react": "7.4.5",
|
|
95
|
+
"@storybook/react-webpack5": "^8.6.18",
|
|
96
|
+
"@testing-library/react": "15.0.6",
|
|
97
|
+
"@vitejs/plugin-react": "4.5.2",
|
|
70
98
|
"framer-motion": "^11.18.0",
|
|
71
99
|
"glob": "^11.0.0",
|
|
100
|
+
"graphql-request": "^6.1.0",
|
|
101
|
+
"next": "14.2.35",
|
|
102
|
+
"react": "18.3.1",
|
|
72
103
|
"react-aria": "^3.46.0",
|
|
73
104
|
"react-aria-components": "^1.15.0",
|
|
105
|
+
"react-hook-form": "^7.71.1",
|
|
106
|
+
"react-international-phone": "^4.7.0",
|
|
74
107
|
"react-stately": "^3.46.0",
|
|
75
|
-
"
|
|
108
|
+
"rollup-preserve-directives": "^1.1.3",
|
|
109
|
+
"tailwindcss": "^4.3.3",
|
|
110
|
+
"vite": "^7.3.1",
|
|
111
|
+
"vite-plugin-dts": "4.5.4",
|
|
112
|
+
"vite-plugin-static-copy": "^3.2.0",
|
|
113
|
+
"webpack": "5.105.0"
|
|
76
114
|
},
|
|
77
115
|
"peerDependencies": {
|
|
78
116
|
"@floating-ui/react": "^0.27.0",
|
|
117
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
79
118
|
"@heroui/accordion": "^2.2.0",
|
|
80
119
|
"@heroui/badge": "^2.2.0",
|
|
81
120
|
"@heroui/pagination": "^2.2.0",
|
|
@@ -84,14 +123,63 @@
|
|
|
84
123
|
"@heroui/tooltip": "^2.2.0",
|
|
85
124
|
"@types/react": "^18.0.0",
|
|
86
125
|
"framer-motion": "^11.18.0",
|
|
126
|
+
"graphql-request": "^6.1.0",
|
|
127
|
+
"next": ">=14",
|
|
87
128
|
"react": "^18.0.0",
|
|
88
129
|
"react-aria": "^3.46.0",
|
|
89
130
|
"react-aria-components": "^1.15.0",
|
|
90
|
-
"react-stately": "^3.36.0",
|
|
91
131
|
"react-dom": "^18.0.0",
|
|
92
|
-
"react-
|
|
132
|
+
"react-hook-form": "^7.71.1",
|
|
133
|
+
"react-international-phone": "^4.3.0",
|
|
134
|
+
"react-stately": "^3.36.0"
|
|
135
|
+
},
|
|
136
|
+
"peerDependenciesMeta": {
|
|
137
|
+
"@floating-ui/react": {
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"@graphql-typed-document-node/core": {
|
|
141
|
+
"optional": true
|
|
142
|
+
},
|
|
143
|
+
"@heroui/accordion": {
|
|
144
|
+
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"@heroui/badge": {
|
|
147
|
+
"optional": true
|
|
148
|
+
},
|
|
149
|
+
"@heroui/pagination": {
|
|
150
|
+
"optional": true
|
|
151
|
+
},
|
|
152
|
+
"@heroui/system": {
|
|
153
|
+
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"@heroui/theme": {
|
|
156
|
+
"optional": true
|
|
157
|
+
},
|
|
158
|
+
"@heroui/tooltip": {
|
|
159
|
+
"optional": true
|
|
160
|
+
},
|
|
161
|
+
"framer-motion": {
|
|
162
|
+
"optional": true
|
|
163
|
+
},
|
|
164
|
+
"graphql-request": {
|
|
165
|
+
"optional": true
|
|
166
|
+
},
|
|
167
|
+
"next": {
|
|
168
|
+
"optional": true
|
|
169
|
+
},
|
|
170
|
+
"react-aria": {
|
|
171
|
+
"optional": true
|
|
172
|
+
},
|
|
173
|
+
"react-hook-form": {
|
|
174
|
+
"optional": true
|
|
175
|
+
},
|
|
176
|
+
"react-international-phone": {
|
|
177
|
+
"optional": true
|
|
178
|
+
},
|
|
179
|
+
"react-stately": {
|
|
180
|
+
"optional": true
|
|
181
|
+
}
|
|
93
182
|
},
|
|
94
|
-
"tailwind": "./tailwind.config.js",
|
|
95
183
|
"scripts": {
|
|
96
184
|
"preinstall": "case \"$INIT_CWD/\" in \"$PWD\"/*) echo 'ERROR: Run pnpm install from the monorepo root, not inside this lib or a subdirectory. A nested install creates a rogue node_modules and drifts dependency versions (CTAP-717).' && exit 1 ;; esac"
|
|
97
185
|
}
|
package/theme.css
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @clicktap/ui semantic design tokens (CTAP-1123).
|
|
3
|
+
*
|
|
4
|
+
* One line in your CSS entry, after `@import 'tailwindcss'`:
|
|
5
|
+
*
|
|
6
|
+
* @import '@clicktap/ui/theme.css';
|
|
7
|
+
*
|
|
8
|
+
* That is the whole contract. There is no preset to add and no Tailwind config
|
|
9
|
+
* to edit: `@theme` both defines the variables AND registers the utilities that
|
|
10
|
+
* read them, so `text-fg` and `border-border-subtle` exist as soon as this file
|
|
11
|
+
* is imported. It composes with a JS config too — if your app still uses
|
|
12
|
+
* `@config`, the two merge, so this import works before, during, or after a
|
|
13
|
+
* CSS-first migration.
|
|
14
|
+
*
|
|
15
|
+
* ── Why custom properties ────────────────────────────────────────────────────
|
|
16
|
+
* Components used to hardcode literal palette classes (`text-slate-900`,
|
|
17
|
+
* `border-slate-300`). That worked for consumers only because slate and red are
|
|
18
|
+
* Tailwind DEFAULTS — every config has them — and it meant a dark-themed app got
|
|
19
|
+
* a white box with dark text and could only fix it by overriding every state.
|
|
20
|
+
*
|
|
21
|
+
* Re-theming is now a runtime override of the token, no rebuild and no config
|
|
22
|
+
* surgery, under a class, an attribute, or a media query:
|
|
23
|
+
*
|
|
24
|
+
* :root[data-theme='dark'] {
|
|
25
|
+
* --color-fg: oklch(98% 0 0);
|
|
26
|
+
* --color-surface-subtle: oklch(25% 0.02 260);
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* ── Why `@theme static` ─────────────────────────────────────────────────────
|
|
30
|
+
* Plain `@theme` PRUNES any token no utility happens to reference, which is the
|
|
31
|
+
* wrong default for a published token set: a consumer writing
|
|
32
|
+
* `color: var(--color-fg)` in hand-authored CSS, or overriding a token this app
|
|
33
|
+
* does not itself use, would silently get nothing. `static` emits all of them.
|
|
34
|
+
*
|
|
35
|
+
* ── On `border-border-subtle` ───────────────────────────────────────────────
|
|
36
|
+
* v4 has a single `--color-*` namespace feeding every colour utility, so a token
|
|
37
|
+
* named `border-subtle` necessarily yields `border-border-subtle` — Tailwind
|
|
38
|
+
* prefixes the utility itself. The doubling is real and it is the ecosystem
|
|
39
|
+
* convention (shadcn/ui ships `border-border`, `bg-background`). Taking it keeps
|
|
40
|
+
* one mechanism and a vocabulary a new developer already recognises; the same
|
|
41
|
+
* token also reads correctly as `outline-border-subtle` and `ring-border-subtle`,
|
|
42
|
+
* which is where these values are used just as often.
|
|
43
|
+
*
|
|
44
|
+
* ── Defaults are today's exact values ───────────────────────────────────────
|
|
45
|
+
* Each value below is the literal Tailwind v4 palette entry the components used
|
|
46
|
+
* before the sweep, copied from `tailwindcss/theme.css`. That is deliberate: a
|
|
47
|
+
* 550-occurrence rewrite is only reviewable if the rendering is unchanged, so any
|
|
48
|
+
* visual difference is a bug rather than a judgement call. Re-theming is the
|
|
49
|
+
* consumer's decision, not a side effect of adopting tokens.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/* Scan the published package for token classes. These are the DIST paths, which
|
|
53
|
+
* do not exist in this repo — a glob that matches nothing is a no-op, verified,
|
|
54
|
+
* so this is safe in both layouts. In-repo the consuming app already scans
|
|
55
|
+
* ../../libs/ui/**. */
|
|
56
|
+
@source './components/**/*.js';
|
|
57
|
+
@source './next/**/*.js';
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Loader animations (CTAP-1156). These live here rather than in framer-motion so
|
|
61
|
+
* that `Button` — the most likely first import — installs from the core tier: it
|
|
62
|
+
* reached framer-motion only through `ButtonLoadingContent` → `Loader`, for two
|
|
63
|
+
* decorative infinite animations a stylesheet does perfectly well.
|
|
64
|
+
*
|
|
65
|
+
* A side benefit: framer-motion 11.x's complex-value parser could crash in
|
|
66
|
+
* `mixObject` when an ancestor `AnimatePresence` remeasured mid-flow, which is
|
|
67
|
+
* why the old components carefully used numeric primitives instead of transform
|
|
68
|
+
* strings. CSS keyframes have no such failure mode.
|
|
69
|
+
*
|
|
70
|
+
* Top-level rather than inside `@theme` so they are emitted unconditionally; the
|
|
71
|
+
* `--animate-*` entries below name the utilities that reference them.
|
|
72
|
+
*/
|
|
73
|
+
@keyframes ct-loader-spin {
|
|
74
|
+
to {
|
|
75
|
+
transform: rotate(360deg);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@keyframes ct-loader-dash {
|
|
80
|
+
0% {
|
|
81
|
+
stroke-dasharray: 1, 200;
|
|
82
|
+
stroke-dashoffset: 0;
|
|
83
|
+
}
|
|
84
|
+
50% {
|
|
85
|
+
stroke-dasharray: 89, 200;
|
|
86
|
+
stroke-dashoffset: -35;
|
|
87
|
+
}
|
|
88
|
+
100% {
|
|
89
|
+
stroke-dasharray: 89, 200;
|
|
90
|
+
stroke-dashoffset: -124;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@keyframes ct-loader-pulse {
|
|
95
|
+
0%,
|
|
96
|
+
25%,
|
|
97
|
+
75%,
|
|
98
|
+
100% {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
transform: scale(1);
|
|
101
|
+
}
|
|
102
|
+
50% {
|
|
103
|
+
opacity: 0.7;
|
|
104
|
+
transform: scale(0.1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@theme static {
|
|
109
|
+
/* Loader animations — see the keyframes above. Durations and easings match the
|
|
110
|
+
* framer-motion transitions they replace exactly, so nothing changes visually.
|
|
111
|
+
* `ease-in-out` is the same curve framer calls `easeInOut`
|
|
112
|
+
* (cubic-bezier(0.42, 0, 0.58, 1)), including as framer's keyframe default. */
|
|
113
|
+
--animate-ct-loader-spin: ct-loader-spin 2s linear infinite;
|
|
114
|
+
--animate-ct-loader-dash: ct-loader-dash 1.5s ease-in-out infinite;
|
|
115
|
+
--animate-ct-loader-pulse: ct-loader-pulse 0.75s ease-in-out infinite;
|
|
116
|
+
|
|
117
|
+
/* Foreground — three emphases, from the measured usage. */
|
|
118
|
+
--color-fg: oklch(20.8% 0.042 265.755); /* was slate-900 (50 uses) */
|
|
119
|
+
--color-fg-muted: oklch(55.4% 0.046 257.417); /* was slate-500 (48) */
|
|
120
|
+
--color-fg-subtle: oklch(70.4% 0.04 256.788); /* was slate-400 (27) */
|
|
121
|
+
--color-fg-inverse: #fff;
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* Border — a real three-step interaction ladder, not inconsistency. The
|
|
125
|
+
* components use these consistently: 200 for disabled and low-emphasis
|
|
126
|
+
* containers, 300 at rest on inputs and controls, 400 on hover/focus.
|
|
127
|
+
*/
|
|
128
|
+
--color-border-subtle: oklch(92.9% 0.013 255.508); /* was slate-200 (40) */
|
|
129
|
+
--color-border: oklch(86.9% 0.022 252.894); /* was slate-300 (36) */
|
|
130
|
+
--color-border-emphasis: oklch(70.4% 0.04 256.788); /* was slate-400 (43) */
|
|
131
|
+
|
|
132
|
+
/* Surface. */
|
|
133
|
+
--color-surface: #fff;
|
|
134
|
+
--color-surface-subtle: oklch(96.8% 0.007 247.896); /* was slate-100 (29) */
|
|
135
|
+
--color-surface-inverse: oklch(20.8% 0.042 265.755); /* was slate-900 (13) */
|
|
136
|
+
|
|
137
|
+
/* Danger — the second-largest cluster after the neutrals (107 uses). */
|
|
138
|
+
--color-danger: oklch(57.7% 0.245 27.325); /* was red-600 */
|
|
139
|
+
--color-danger-soft: oklch(63.7% 0.237 25.331); /* was red-500 */
|
|
140
|
+
/* 'soft', not 'border': red-500 is used as text 20 times and as a border 15,
|
|
141
|
+
* so a border-specific name would read wrong at most of its call sites. The
|
|
142
|
+
* neutral ladder can afford `border-*` names because it really is border-only;
|
|
143
|
+
* this one cannot. */
|
|
144
|
+
--color-danger-surface: oklch(93.6% 0.032 17.717); /* was red-100 */
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Three roles the first pass missed. Each is one distinct job with a value the
|
|
148
|
+
* ladders above do not already carry — the bar for a new token, deliberately.
|
|
149
|
+
* Roles that only needed an existing VALUE under a nicer name did NOT get one:
|
|
150
|
+
* an alias defined as `var(--color-border-subtle)` resolves at `:root`, so a
|
|
151
|
+
* consumer's `.dark` override of the source would not propagate to it, and
|
|
152
|
+
* duplicating the literal instead just invites the two copies to drift.
|
|
153
|
+
*/
|
|
154
|
+
--color-fg-strong: oklch(12.9% 0.042 264.695); /* was slate-950 (7) */
|
|
155
|
+
--color-surface-inverse-hover: oklch(27.9% 0.041 260.031); /* was slate-800 (16) */
|
|
156
|
+
--color-danger-ring: oklch(88.5% 0.062 18.334); /* was red-200 (11), invalid focus ring */
|
|
157
|
+
|
|
158
|
+
/* Status — small but present (22 uses between them). */
|
|
159
|
+
--color-success: oklch(62.7% 0.194 149.214); /* was green-600 */
|
|
160
|
+
--color-warning: oklch(68.1% 0.162 75.834); /* was yellow-600 */
|
|
161
|
+
--color-info: oklch(54.6% 0.245 262.881); /* was blue-600 */
|
|
162
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './collection/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './collection/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './variantOptions/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './variantOptions/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import j,{useRef as R,useState as oe,useEffect as q,useMemo as Ae,useLayoutEffect as xe}from"react";function be(e,t){var n={};for(var u in e)Object.prototype.hasOwnProperty.call(e,u)&&t.indexOf(u)<0&&(n[u]=e[u]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,u=Object.getOwnPropertySymbols(e);i<u.length;i++)t.indexOf(u[i])<0&&Object.prototype.propertyIsEnumerable.call(e,u[i])&&(n[u[i]]=e[u[i]]);return n}var k;(function(e){e.event="event",e.props="prop"})(k||(k={}));function _(){}function we(e){var t,n=void 0;return function(){for(var u=[],i=arguments.length;i--;)u[i]=arguments[i];return t&&u.length===t.length&&u.every(function(d,m){return d===t[m]})||(t=u,n=e.apply(void 0,u)),n}}function Y(e){return!!(e||"").match(/\d/)}function D(e){return e==null}function Te(e){return typeof e=="number"&&isNaN(e)}function Ee(e){return D(e)||Te(e)||typeof e=="number"&&!isFinite(e)}function ne(e){var t=R(e);t.current=e;var n=R(function(){for(var u=[],i=arguments.length;i--;)u[i]=arguments[i];return t.current.apply(t,u)});return n.current}function ae(e,t){return Array(t+1).join(e)}function Me(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var u=t.split(/[eE]/g),i=u[0],d=u[1];if(d=Number(d),!d)return n+i;i=i.replace(".","");var m=1+d,V=i.length;return m<0?i="0."+ae("0",Math.abs(m))+i:m>=V?i=i+ae("0",m-V):i=(i.substring(0,m)||"0")+"."+i.substring(m),n+i}function ue(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var Oe=we(function(e,t){for(var n=0,u=0,i=e.length,d=t.length;e[n]===t[n]&&n<i;)n++;for(;e[i-1-u]===t[d-1-u]&&d-u>n&&i-u>n;)u++;return{from:{start:n,end:i-u},to:{start:n,end:d-u}}}),Ne=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function Be(e,t,n){return Math.min(Math.max(e,t),n)}function X(e){return Math.max(e.selectionStart,e.selectionEnd)}function _e(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function Re(e){var t=e.currentValue,n=e.formattedValue,u=e.currentValueIndex,i=e.formattedValueIndex;return t[u]===n[i]}function Fe(e,t,n,u,i,d,m){m===void 0&&(m=Re);var V=i.findIndex(function(z){return z}),p=e.slice(0,V);!t&&!n.startsWith(p)&&(t=p,n=p+n,u=u+p.length);for(var I=n.length,O=e.length,T={},h=new Array(I),S=0;S<I;S++){h[S]=-1;for(var l=0,A=O;l<A;l++){var C=m({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:S,formattedValueIndex:l});if(C&&T[l]!==!0){h[S]=l,T[l]=!0;break}}}for(var s=u;s<I&&(h[s]===-1||!d(n[s]));)s++;var x=s===I||h[s]===-1?O:h[s];for(s=u-1;s>0&&h[s]===-1;)s--;var b=s===-1||h[s]===-1?0:h[s]+1;return b>x?x:u-b<x-u?b:x}function ie(e,t,n,u){var i=e.length;if(t=Be(t,0,i),u==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function Le(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,u=t.length;n<u;n++)t[n]=!!(Y(e[n])||Y(e[n-1]));return t}function je(e,t,n,u,i,d){d===void 0&&(d=_);var m=ne(function(l,A){var C,s;return Ee(l)?(s="",C=""):typeof l=="number"||A?(s=typeof l=="number"?Me(l):l,C=u(s)):(s=i(l,void 0),C=u(s)),{formattedValue:C,numAsString:s}}),V=oe(function(){return m(D(e)?t:e,n)}),p=V[0],I=V[1],O=ne(function(l,A){l.formattedValue!==p.formattedValue&&I({formattedValue:l.formattedValue,numAsString:l.value}),d(l,A)}),T=e,h=n;D(e)&&(T=p.numAsString,h=!0);var S=m(T,h);return Ae(function(){I(S)},[S.formattedValue]),q(function(){if(!D(t)&&D(e)&&p.formattedValue!==""){var l=parseFloat(p.numAsString);O({formattedValue:p.formattedValue,value:p.numAsString,floatValue:isNaN(l)?void 0:l},{event:void 0,source:k.props})}},[]),[p,O]}function De(e){return e.replace(/[^0-9]/g,"")}function ke(e){return e}function Ke(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var u=e.customInput,i=e.renderText,d=e.getInputRef,m=e.format;m===void 0&&(m=ke);var V=e.removeFormatting;V===void 0&&(V=De);var p=e.defaultValue,I=e.valueIsNumericString,O=e.onValueChange,T=e.isAllowed,h=e.onChange;h===void 0&&(h=_);var S=e.onKeyDown;S===void 0&&(S=_);var l=e.onMouseUp;l===void 0&&(l=_);var A=e.onFocus;A===void 0&&(A=_);var C=e.onBlur;C===void 0&&(C=_);var s=e.value,x=e.getCaretBoundary;x===void 0&&(x=Le);var b=e.isValidInputCharacter;b===void 0&&(b=Y);var z=e.isCharacterSame,W=be(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),Z=je(s,p,!!I,m,V,O),$=Z[0],g=$.formattedValue,U=$.numAsString,fe=Z[1],K=R(),P=R({formattedValue:g,numAsString:U}),ee=function(r,a){P.current={formattedValue:r.formattedValue,numAsString:r.value},fe(r,a)},te=oe(!1),le=te[0],ve=te[1],F=R(null),N=R({setCaretTimeout:null,focusTimeout:null});q(function(){return ve(!0),function(){clearTimeout(N.current.setCaretTimeout),clearTimeout(N.current.focusTimeout)}},[]);var ce=m,G=function(r,a){var o=parseFloat(a);return{formattedValue:r,value:a,floatValue:isNaN(o)?void 0:o}},B=function(r,a,o){r.selectionStart===0&&r.selectionEnd===r.value.length||(ue(r,a),N.current.setCaretTimeout=setTimeout(function(){r.value===o&&r.selectionStart!==a&&ue(r,a)},0))},L=function(r,a,o){return ie(r,a,x(r),o)},H=function(r,a,o){var v=x(a),y=Fe(a,g,r,o,v,b,z);return y=ie(a,y,v),y},se=function(r){var a=r.formattedValue;a===void 0&&(a="");var o=r.input,v=r.source,y=r.event,c=r.numAsString,f;if(o){var w=r.inputValue||o.value,E=X(o);o.value=a,f=H(w,a,E),f!==void 0&&B(o,f,a)}a!==g&&ee(G(a,c),{event:y,source:v})};q(function(){var r=P.current,a=r.formattedValue,o=r.numAsString;(g!==a||U!==o)&&ee(G(g,U),{event:void 0,source:k.props})},[g,U]);var de=F.current?X(F.current):void 0,me=typeof window<"u"?xe:q;me(function(){var r=F.current;if(g!==P.current.formattedValue&&r){var a=H(P.current.formattedValue,g,de);r.value=g,B(r,a,g)}},[g]);var ge=function(r,a,o){var v=a.target,y=K.current?Ne(K.current,v.selectionEnd):Oe(g,r),c=Object.assign(Object.assign({},y),{lastValue:g}),f=V(r,c),w=ce(f);if(f=V(w,void 0),T&&!T(G(w,f))){var E=a.target,M=X(E),Q=H(r,g,M);return E.value=g,B(E,Q,g),!1}return se({formattedValue:w,numAsString:f,inputValue:r,event:a,source:o,input:a.target}),!0},J=function(r,a){a===void 0&&(a=0);var o=r.selectionStart,v=r.selectionEnd;K.current={selectionStart:o,selectionEnd:v+a}},he=function(r){var a=r.target,o=a.value,v=ge(o,r,k.event);v&&h(r),K.current=void 0},pe=function(r){var a=r.target,o=r.key,v=a.selectionStart,y=a.selectionEnd,c=a.value;c===void 0&&(c="");var f;o==="ArrowLeft"||o==="Backspace"?f=Math.max(v-1,0):o==="ArrowRight"?f=Math.min(v+1,c.length):o==="Delete"&&(f=v);var w=0;o==="Delete"&&v===y&&(w=1);var E=o==="ArrowLeft"||o==="ArrowRight";if(f===void 0||v!==y&&!E){S(r),J(a,w);return}var M=f;if(E){var Q=o==="ArrowLeft"?"left":"right";M=L(c,f,Q),M!==f&&r.preventDefault()}else o==="Delete"&&!b(c[f])?M=L(c,f,"right"):o==="Backspace"&&!b(c[f])&&(M=L(c,f,"left"));M!==f&&B(a,M,c),S(r),J(a,w)},ye=function(r){var a=r.target,o=function(){var v=a.selectionStart,y=a.selectionEnd,c=a.value;if(c===void 0&&(c=""),v===y){var f=L(c,v);f!==v&&B(a,f,c)}};o(),requestAnimationFrame(function(){o()}),l(r),J(a)},Ve=function(r){r.persist&&r.persist();var a=r.target,o=r.currentTarget;F.current=a,N.current.focusTimeout=setTimeout(function(){var v=a.selectionStart,y=a.selectionEnd,c=a.value;c===void 0&&(c="");var f=L(c,v);f!==v&&!(v===0&&y===c.length)&&B(a,f,c),A(Object.assign(Object.assign({},r),{currentTarget:o}))},0)},Se=function(r){F.current=null,clearTimeout(N.current.focusTimeout),clearTimeout(N.current.setCaretTimeout),C(r)},Ce=le&&_e()?"numeric":void 0,re=Object.assign({inputMode:Ce},W,{type:t,value:g,onChange:he,onKeyDown:pe,onMouseUp:ye,onFocus:Ve,onBlur:Se});if(n==="text")return i?j.createElement(j.Fragment,null,i(g,W)||null):j.createElement("span",Object.assign({},W,{ref:d}),g);if(u){var Ie=u;return j.createElement(Ie,Object.assign({},re,{ref:d}))}return j.createElement("input",Object.assign({},re,{ref:d}))}export{Ke as N};
|