@ttt-productions/ui-core 0.11.34 → 0.11.35
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 +1 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +0 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/reload-recovery-watch.d.ts +0 -4
- package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
- package/dist/browser/reload-recovery-watch.js +0 -5
- package/dist/browser/reload-recovery-watch.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/format-numbers.d.ts +0 -6
- package/dist/lib/format-numbers.d.ts.map +1 -1
- package/dist/lib/format-numbers.js +0 -6
- package/dist/lib/format-numbers.js.map +1 -1
- package/dist/lib/reload-recovery.d.ts +1 -9
- package/dist/lib/reload-recovery.d.ts.map +1 -1
- package/dist/lib/reload-recovery.js +1 -11
- package/dist/lib/reload-recovery.js.map +1 -1
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +0 -3
- package/dist/lib/utils.js.map +1 -1
- package/dist/react/components/accordion.d.ts.map +1 -1
- package/dist/react/components/accordion.js.map +1 -1
- package/dist/react/components/action-row.d.ts +0 -7
- package/dist/react/components/action-row.d.ts.map +1 -1
- package/dist/react/components/action-row.js +1 -5
- package/dist/react/components/action-row.js.map +1 -1
- package/dist/react/components/button.d.ts +0 -10
- package/dist/react/components/button.d.ts.map +1 -1
- package/dist/react/components/button.js +2 -7
- package/dist/react/components/button.js.map +1 -1
- package/dist/react/components/consequence-dialog.d.ts +1 -48
- package/dist/react/components/consequence-dialog.d.ts.map +1 -1
- package/dist/react/components/consequence-dialog.js +3 -21
- package/dist/react/components/consequence-dialog.js.map +1 -1
- package/dist/react/components/date-picker.d.ts +0 -17
- package/dist/react/components/date-picker.d.ts.map +1 -1
- package/dist/react/components/date-picker.js +0 -32
- package/dist/react/components/date-picker.js.map +1 -1
- package/dist/react/components/date-time-picker.d.ts +0 -23
- package/dist/react/components/date-time-picker.d.ts.map +1 -1
- package/dist/react/components/date-time-picker.js +0 -19
- package/dist/react/components/date-time-picker.js.map +1 -1
- package/dist/react/components/dropdown-menu.d.ts +0 -8
- package/dist/react/components/dropdown-menu.d.ts.map +1 -1
- package/dist/react/components/dropdown-menu.js +1 -2
- package/dist/react/components/dropdown-menu.js.map +1 -1
- package/dist/react/components/format-control.d.ts +1 -21
- package/dist/react/components/format-control.d.ts.map +1 -1
- package/dist/react/components/format-control.js +1 -21
- package/dist/react/components/format-control.js.map +1 -1
- package/dist/react/components/input.d.ts +0 -17
- package/dist/react/components/input.d.ts.map +1 -1
- package/dist/react/components/input.js +1 -3
- package/dist/react/components/input.js.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.d.ts +0 -7
- package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
- package/dist/react/components/layout/screen-adaptive-view.js +1 -2
- package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
- package/dist/react/components/list-pagination.d.ts +0 -30
- package/dist/react/components/list-pagination.d.ts.map +1 -1
- package/dist/react/components/list-pagination.js +0 -27
- package/dist/react/components/list-pagination.js.map +1 -1
- package/dist/react/components/opener-focus.d.ts +1 -7
- package/dist/react/components/opener-focus.d.ts.map +1 -1
- package/dist/react/components/opener-focus.js +1 -7
- package/dist/react/components/opener-focus.js.map +1 -1
- package/dist/react/components/pending-guard.d.ts +0 -6
- package/dist/react/components/pending-guard.d.ts.map +1 -1
- package/dist/react/components/pending-guard.js +0 -6
- package/dist/react/components/pending-guard.js.map +1 -1
- package/dist/react/components/relative-time.d.ts +0 -8
- package/dist/react/components/relative-time.d.ts.map +1 -1
- package/dist/react/components/relative-time.js +0 -4
- package/dist/react/components/relative-time.js.map +1 -1
- package/dist/react/components/reload-recovery-notice.d.ts +0 -14
- package/dist/react/components/reload-recovery-notice.d.ts.map +1 -1
- package/dist/react/components/reload-recovery-notice.js +0 -5
- package/dist/react/components/reload-recovery-notice.js.map +1 -1
- package/dist/react/components/scroll-to-top-button.d.ts +1 -25
- package/dist/react/components/scroll-to-top-button.d.ts.map +1 -1
- package/dist/react/components/scroll-to-top-button.js.map +1 -1
- package/dist/react/components/search-dropdown.d.ts +0 -53
- package/dist/react/components/search-dropdown.d.ts.map +1 -1
- package/dist/react/components/search-dropdown.js +2 -36
- package/dist/react/components/search-dropdown.js.map +1 -1
- package/dist/react/components/select.d.ts +0 -7
- package/dist/react/components/select.d.ts.map +1 -1
- package/dist/react/components/select.js +0 -2
- package/dist/react/components/select.js.map +1 -1
- package/dist/react/components/show-more-toggle.d.ts +0 -16
- package/dist/react/components/show-more-toggle.d.ts.map +1 -1
- package/dist/react/components/show-more-toggle.js +0 -5
- package/dist/react/components/show-more-toggle.js.map +1 -1
- package/dist/react/components/spinner.d.ts +0 -14
- package/dist/react/components/spinner.d.ts.map +1 -1
- package/dist/react/components/spinner.js +0 -8
- package/dist/react/components/spinner.js.map +1 -1
- package/dist/react/components/switch.d.ts +0 -7
- package/dist/react/components/switch.d.ts.map +1 -1
- package/dist/react/components/switch.js +0 -2
- package/dist/react/components/switch.js.map +1 -1
- package/dist/react/components/table.d.ts +0 -10
- package/dist/react/components/table.d.ts.map +1 -1
- package/dist/react/components/table.js +0 -6
- package/dist/react/components/table.js.map +1 -1
- package/dist/react/components/textarea.d.ts +0 -11
- package/dist/react/components/textarea.d.ts.map +1 -1
- package/dist/react/components/textarea.js +1 -3
- package/dist/react/components/textarea.js.map +1 -1
- package/dist/react/components/toast.d.ts +0 -4
- package/dist/react/components/toast.d.ts.map +1 -1
- package/dist/react/components/toast.js +3 -24
- package/dist/react/components/toast.js.map +1 -1
- package/dist/react/components/toaster.d.ts.map +1 -1
- package/dist/react/components/toaster.js.map +1 -1
- package/dist/react/hooks/use-async-action.d.ts +1 -21
- package/dist/react/hooks/use-async-action.d.ts.map +1 -1
- package/dist/react/hooks/use-async-action.js +1 -9
- package/dist/react/hooks/use-async-action.js.map +1 -1
- package/dist/react/hooks/use-cursor-page.d.ts +0 -62
- package/dist/react/hooks/use-cursor-page.d.ts.map +1 -1
- package/dist/react/hooks/use-cursor-page.js +1 -37
- package/dist/react/hooks/use-cursor-page.js.map +1 -1
- package/dist/react/hooks/use-paged-list.d.ts +0 -43
- package/dist/react/hooks/use-paged-list.d.ts.map +1 -1
- package/dist/react/hooks/use-paged-list.js +0 -15
- package/dist/react/hooks/use-paged-list.js.map +1 -1
- package/dist/react/hooks/use-return-scroll.d.ts +0 -9
- package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
- package/dist/react/hooks/use-return-scroll.js +2 -34
- package/dist/react/hooks/use-return-scroll.js.map +1 -1
- package/dist/react/hooks/use-toast.d.ts +0 -8
- package/dist/react/hooks/use-toast.d.ts.map +1 -1
- package/dist/react/hooks/use-toast.js +1 -4
- package/dist/react/hooks/use-toast.js.map +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +0 -6
- package/dist/react/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -13,15 +13,7 @@ declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<Dropd
|
|
|
13
13
|
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
14
14
|
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
15
15
|
inset?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* The action this item started is in flight: the item ignores selection, sets
|
|
18
|
-
* `aria-disabled` and `aria-busy`, and shows the spinner in place of its `icon`. It is
|
|
19
|
-
* never natively disabled while pending (a `disabled` passed alongside applies once pending
|
|
20
|
-
* ends), so it keeps focus (FRONTEND-203). Keeping the menu
|
|
21
|
-
* open meanwhile is the caller's `onSelect` (`event.preventDefault()`, close on settle).
|
|
22
|
-
*/
|
|
23
16
|
pending?: boolean;
|
|
24
|
-
/** Leading icon. While `pending`, the spinner takes its place. */
|
|
25
17
|
icon?: React.ReactNode;
|
|
26
18
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
27
19
|
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAOvE,QAAA,MAAM,YAAY,mDAA6B,CAAC;AAChD,QAAA,MAAM,mBAAmB,0HAAgC,CAAC;AAC1D,QAAA,MAAM,iBAAiB,qHAA8B,CAAC;AACtD,QAAA,MAAM,kBAAkB,yDAA+B,CAAC;AACxD,QAAA,MAAM,eAAe,sDAA4B,CAAC;AAClD,QAAA,MAAM,sBAAsB,0HAAmC,CAAC;AAEhE,QAAA,MAAM,sBAAsB;YAGhB,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,sBAAsB,6KAY1B,CAAC;AAGH,QAAA,MAAM,mBAAmB,0KAevB,CAAC;
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AAOvE,QAAA,MAAM,YAAY,mDAA6B,CAAC;AAChD,QAAA,MAAM,mBAAmB,0HAAgC,CAAC;AAC1D,QAAA,MAAM,iBAAiB,qHAA8B,CAAC;AACtD,QAAA,MAAM,kBAAkB,yDAA+B,CAAC;AACxD,QAAA,MAAM,eAAe,sDAA4B,CAAC;AAClD,QAAA,MAAM,sBAAsB,0HAAmC,CAAC;AAEhE,QAAA,MAAM,sBAAsB;YAGhB,OAAO;wCAejB,CAAC;AAGH,QAAA,MAAM,sBAAsB,6KAY1B,CAAC;AAGH,QAAA,MAAM,mBAAmB,0KAevB,CAAC;AASH,QAAA,MAAM,gBAAgB;YAGV,OAAO;cACL,OAAO;WACV,KAAK,CAAC,SAAS;wCAyBxB,CAAC;AAGH,QAAA,MAAM,wBAAwB,+KAoB5B,CAAC;AAGH,QAAA,MAAM,qBAAqB,4KAmBzB,CAAC;AAGH,QAAA,MAAM,iBAAiB;YAGX,OAAO;wCAQjB,CAAC;AAGH,QAAA,MAAM,qBAAqB,4KASzB,CAAC;AAGH,QAAA,MAAM,oBAAoB;8BAA6B,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;;CAE3F,CAAC;AAGF,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC"}
|
|
@@ -18,8 +18,7 @@ const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) =
|
|
|
18
18
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
19
19
|
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn('z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className), ...props }) })));
|
|
20
20
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
21
|
-
// Every selection — a pointer, Enter, or Space — reaches the item as a click
|
|
22
|
-
// capture phase keeps the item's select (and an `asChild` link's navigation) from running.
|
|
21
|
+
// Every selection — a pointer, Enter, or Space — reaches the item as a click, so the capture-phase stop keeps its select from running.
|
|
23
22
|
function blockActivation(event) {
|
|
24
23
|
event.preventDefault();
|
|
25
24
|
event.stopPropagation();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,YAAY,GAAG,qBAAqB,CAAC,IAAI,CAAC;AAChD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC,OAAO,CAAC;AAC1D,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,KAAK,CAAC;AACtD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,MAAM,CAAC;AACxD,MAAM,eAAe,GAAG,qBAAqB,CAAC,GAAG,CAAC;AAClD,MAAM,sBAAsB,GAAG,qBAAqB,CAA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CAClC,KAAC,qBAAqB,CAAC,SAAS,IAC9B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACT,CACH,CAAC,CAAC;AACH,qBAAqB,CAAC,WAAW,GAAG,qBAAqB,CAAC,SAAS,CAAC,WAAW,CAAC;AAEhF,MAAM,oBAAoB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAyC,EAAE,EAAE,CAAC,CAC/F,eAAM,SAAS,EAAE,EAAE,CAAC,4CAA4C,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC5F,CAAC;AACF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,GACvB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground elevation-raised duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\n// Every selection — a pointer, Enter, or Space — reaches the item as a click; stopping it in the\n// capture phase keeps the item's select (and an `asChild` link's navigation) from running.\nfunction blockActivation(event: React.MouseEvent<HTMLElement>) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n /**\n * The action this item started is in flight: the item ignores selection, sets\n * `aria-disabled` and `aria-busy`, and shows the spinner in place of its `icon`. It is\n * never natively disabled while pending (a `disabled` passed alongside applies once pending\n * ends), so it keeps focus (FRONTEND-203). Keeping the menu\n * open meanwhile is the caller's `onSelect` (`event.preventDefault()`, close on settle).\n */\n pending?: boolean;\n /** Leading icon. While `pending`, the spinner takes its place. */\n icon?: React.ReactNode;\n }\n>(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 app-dropdown-item',\n inset && 'pl-8',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onClickCapture: blockActivation,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {/* Direct siblings, never a fragment: under `asChild` Radix Slot finds the Slottable\n among its direct children and renders the icon/spinner inside the child element. */}\n {pending ? <Spinner size=\"xs\" /> : icon}\n <Slottable>{children}</Slottable>\n </DropdownMenuPrimitive.Item>\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (\n <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />\n);\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sourceRoot":"","sources":["../../../src/react/components/dropdown-menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAA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EACtB,sBAAsB,GACvB,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\nimport { Slottable } from '@radix-ui/react-slot';\nimport { Check, ChevronRight, Circle } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n 'flex cursor-default gap-2 select-none items-center rounded-xs px-2 py-1.5 text-sm outline-hidden focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n inset && 'pl-8',\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground elevation-raised duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n 'z-50 min-w-[8rem] overflow-hidden rounded-md border !bg-card p-1 text-popover-foreground elevation-popover duration-[var(--motion-fast)] ease-[var(--motion-ease)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',\n className,\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\n// Every selection — a pointer, Enter, or Space — reaches the item as a click, so the capture-phase stop keeps its select from running.\nfunction blockActivation(event: React.MouseEvent<HTMLElement>) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n pending?: boolean;\n icon?: React.ReactNode;\n }\n>(({ className, inset, pending = false, icon, disabled, children, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center gap-2 rounded-xs px-2 py-1.5 text-sm outline-hidden transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 app-dropdown-item',\n inset && 'pl-8',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onClickCapture: blockActivation,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n >\n {/* Radix Slot finds the Slottable among its direct children, so these are siblings, never a fragment. */}\n {pending ? <Spinner size=\"xs\" /> : icon}\n <Slottable>{children}</Slottable>\n </DropdownMenuPrimitive.Item>\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n 'relative flex cursor-default select-none items-center rounded-xs py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', className)}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-muted', className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>) => (\n <span className={cn('ml-auto text-xs tracking-widest opacity-60', className)} {...props} />\n);\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n"]}
|
|
@@ -5,32 +5,12 @@ interface CallerAttributes {
|
|
|
5
5
|
'aria-required'?: boolean | 'true' | 'false';
|
|
6
6
|
'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* What a free-text control derives from its field declaration: the native length cap, and the
|
|
10
|
-
* required/invalid state assistive technology announces. A caller's own `aria-required` or
|
|
11
|
-
* `aria-invalid` wins — a form field passes the state its whole schema decided.
|
|
12
|
-
*
|
|
13
|
-
* The native cap counts the text as typed while the check counts it trimmed. Every value the
|
|
14
|
-
* field keeps can still be typed, and surrounding whitespace is dropped by the check anyway.
|
|
15
|
-
*
|
|
16
|
-
* Only a controlled value is judged, and a text that is merely too short is not marked invalid
|
|
17
|
-
* while it is being typed: an empty or half-typed required field is not yet an error, so "too
|
|
18
|
-
* short" is left to the form's submit-time validation.
|
|
19
|
-
*
|
|
20
|
-
* A read-only control shows a stored value nobody can edit there, so it is never judged: it
|
|
21
|
-
* announces neither required nor invalid (a stored value may legitimately fail the typed format).
|
|
22
|
-
*/
|
|
23
8
|
export declare function formatControlAttributes(spec: InputFormatSpec, props: CallerAttributes): {
|
|
24
9
|
maxLength: number;
|
|
25
10
|
'aria-required': boolean | "true" | "false" | undefined;
|
|
26
11
|
'aria-invalid': boolean | "true" | "false" | "grammar" | "spelling" | undefined;
|
|
27
12
|
};
|
|
28
|
-
/**
|
|
29
|
-
* Shows a free-text box's kept value once focus leaves it, delivered through the parent's own
|
|
30
|
-
* `onChange`: the native value setter plus an input event is what React hears as a typed change, so a
|
|
31
|
-
* controlled box and a react-hook-form `register` box both receive it. Nothing changes while typing.
|
|
32
|
-
* A read-only or disabled box shows a stored value nobody edits there, so it is never tidied.
|
|
33
|
-
*/
|
|
13
|
+
/** The native value setter plus an input event is what React hears as a typed change. */
|
|
34
14
|
export declare function tidyOnBlur(box: HTMLInputElement | HTMLTextAreaElement, spec: InputFormatSpec): void;
|
|
35
15
|
export {};
|
|
36
16
|
//# sourceMappingURL=format-control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-control.d.ts","sourceRoot":"","sources":["../../../src/react/components/format-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE5F,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;CACtE;AAED
|
|
1
|
+
{"version":3,"file":"format-control.d.ts","sourceRoot":"","sources":["../../../src/react/components/format-control.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAE5F,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;CACtE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB;;;;EAerF;AAED,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,mBAAmB,EAAE,IAAI,EAAE,eAAe,QAQ5F"}
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import { checkInputFormat } from '@ttt-productions/input-format-core';
|
|
2
|
-
/**
|
|
3
|
-
* What a free-text control derives from its field declaration: the native length cap, and the
|
|
4
|
-
* required/invalid state assistive technology announces. A caller's own `aria-required` or
|
|
5
|
-
* `aria-invalid` wins — a form field passes the state its whole schema decided.
|
|
6
|
-
*
|
|
7
|
-
* The native cap counts the text as typed while the check counts it trimmed. Every value the
|
|
8
|
-
* field keeps can still be typed, and surrounding whitespace is dropped by the check anyway.
|
|
9
|
-
*
|
|
10
|
-
* Only a controlled value is judged, and a text that is merely too short is not marked invalid
|
|
11
|
-
* while it is being typed: an empty or half-typed required field is not yet an error, so "too
|
|
12
|
-
* short" is left to the form's submit-time validation.
|
|
13
|
-
*
|
|
14
|
-
* A read-only control shows a stored value nobody can edit there, so it is never judged: it
|
|
15
|
-
* announces neither required nor invalid (a stored value may legitimately fail the typed format).
|
|
16
|
-
*/
|
|
17
2
|
export function formatControlAttributes(spec, props) {
|
|
18
3
|
if (props.readOnly) {
|
|
19
4
|
return {
|
|
@@ -30,12 +15,7 @@ export function formatControlAttributes(spec, props) {
|
|
|
30
15
|
'aria-invalid': props['aria-invalid'] ?? (malformed ? true : undefined),
|
|
31
16
|
};
|
|
32
17
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Shows a free-text box's kept value once focus leaves it, delivered through the parent's own
|
|
35
|
-
* `onChange`: the native value setter plus an input event is what React hears as a typed change, so a
|
|
36
|
-
* controlled box and a react-hook-form `register` box both receive it. Nothing changes while typing.
|
|
37
|
-
* A read-only or disabled box shows a stored value nobody edits there, so it is never tidied.
|
|
38
|
-
*/
|
|
18
|
+
/** The native value setter plus an input event is what React hears as a typed change. */
|
|
39
19
|
export function tidyOnBlur(box, spec) {
|
|
40
20
|
if (box.readOnly || box.disabled)
|
|
41
21
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-control.js","sourceRoot":"","sources":["../../../src/react/components/format-control.ts"],"names":[],"mappings":"AAAA,OAAO,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,IAAI,CAAC,CAAC,KAAK,CAAC;IACrD,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK;QAAE,OAAO;IAC/B,MAAM,SAAS,GACb,GAAG,YAAY,mBAAmB,CAAC,CAAC,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,gBAAgB,CAAC,SAAS,CAAC;IAClG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1E,GAAG,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC","sourcesContent":["import { checkInputFormat, type InputFormatSpec } from '@ttt-productions/input-format-core';\n\ninterface CallerAttributes {\n value?: unknown;\n readOnly?: boolean;\n 'aria-required'?: boolean | 'true' | 'false';\n 'aria-invalid'?: boolean | 'true' | 'false' | 'grammar' | 'spelling';\n}\n\nexport function formatControlAttributes(spec: InputFormatSpec, props: CallerAttributes) {\n if (props.readOnly) {\n return {\n maxLength: spec.max,\n 'aria-required': props['aria-required'],\n 'aria-invalid': props['aria-invalid'],\n };\n }\n const result = typeof props.value === 'string' ? checkInputFormat(props.value, spec) : null;\n const malformed = result !== null && !result.ok && result.issue !== 'tooShort';\n return {\n maxLength: spec.max,\n 'aria-required': props['aria-required'] ?? (spec.min > 0 ? true : undefined),\n 'aria-invalid': props['aria-invalid'] ?? (malformed ? true : undefined),\n };\n}\n\n/** The native value setter plus an input event is what React hears as a typed change. */\nexport function tidyOnBlur(box: HTMLInputElement | HTMLTextAreaElement, spec: InputFormatSpec) {\n if (box.readOnly || box.disabled) return;\n const kept = checkInputFormat(box.value, spec).value;\n if (kept === box.value) return;\n const prototype =\n box instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;\n Object.getOwnPropertyDescriptor(prototype, 'value')?.set?.call(box, kept);\n box.dispatchEvent(new Event('input', { bubbles: true }));\n}\n"]}
|
|
@@ -1,35 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { DeclaredInputFormat } from '@ttt-productions/input-format-core';
|
|
3
|
-
/**
|
|
4
|
-
* The input types whose value the browser itself formats or picks — not free text — so they take no
|
|
5
|
-
* input format. A free-text input (`type` omitted or `"text"`) takes one.
|
|
6
|
-
*/
|
|
7
3
|
export type BuiltInFormatInputType = 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'file' | 'color' | 'date' | 'datetime-local' | 'month' | 'week' | 'time' | 'range' | 'checkbox' | 'radio' | 'hidden' | 'button' | 'submit' | 'reset' | 'image';
|
|
8
4
|
type NativeInputProps = React.ComponentPropsWithoutRef<'input'>;
|
|
9
|
-
/**
|
|
10
|
-
* A free-text input: its declaration is required, and its bounds and its required state come only
|
|
11
|
-
* from that declaration (ENG-005), so `maxLength`, `minLength`, `pattern`, and `required` are not
|
|
12
|
-
* props.
|
|
13
|
-
*/
|
|
14
5
|
export type FreeTextInputProps = Omit<NativeInputProps, 'type' | 'maxLength' | 'minLength' | 'pattern' | 'required'> & {
|
|
15
6
|
type?: 'text';
|
|
16
7
|
inputFormat: DeclaredInputFormat;
|
|
17
8
|
textEntry?: never;
|
|
18
9
|
};
|
|
19
|
-
/**
|
|
20
|
-
* What a text box that is not free text holds: digits typed as text (a date-of-birth part, a share
|
|
21
|
-
* count, a one-time code) or an identifier (an account, document, or case id). Neither takes an
|
|
22
|
-
* input format; each keeps its own native `maxLength`, `pattern`, and `inputMode`, and its value is
|
|
23
|
-
* checked by its own rule (a whole-input number parse, the one-segment id rule).
|
|
24
|
-
*/
|
|
25
10
|
export type NonFreeTextEntry = 'numeric' | 'identifier';
|
|
26
|
-
/** A text box that is not free text: no input format. */
|
|
27
11
|
export type NonFreeTextInputProps = Omit<NativeInputProps, 'type'> & {
|
|
28
12
|
type?: 'text';
|
|
29
13
|
textEntry: NonFreeTextEntry;
|
|
30
14
|
inputFormat?: never;
|
|
31
15
|
};
|
|
32
|
-
/** An input whose value the browser formats: no input format. */
|
|
33
16
|
export type BuiltInFormatInputProps = Omit<NativeInputProps, 'type'> & {
|
|
34
17
|
type: BuiltInFormatInputType;
|
|
35
18
|
inputFormat?: never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/react/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/react/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,MAAM,MAAM,sBAAsB,GAC9B,UAAU,GACV,OAAO,GACP,QAAQ,GACR,KAAK,GACL,KAAK,GACL,QAAQ,GACR,MAAM,GACN,OAAO,GACP,MAAM,GACN,gBAAgB,GAChB,OAAO,GACP,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,OAAO,GACP,OAAO,CAAC;AAEZ,KAAK,gBAAgB,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EAChB,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAC5D,GAAG;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;AAExD,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,GAAG;IACrE,IAAI,EAAE,sBAAsB,CAAC;IAC7B,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,uBAAuB,CAAC;AAE9F,QAAA,MAAM,KAAK,qFAmBV,CAAC;AAGF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -3,9 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { cn } from '../../lib/utils.js';
|
|
5
5
|
import { formatControlAttributes, tidyOnBlur } from './format-control.js';
|
|
6
|
-
const Input = React.forwardRef(
|
|
7
|
-
// `textEntry` only selects the prop shape; it never reaches the DOM.
|
|
8
|
-
({ className, type, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {
|
|
6
|
+
const Input = React.forwardRef(({ className, type, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {
|
|
9
7
|
return (_jsx("input", { type: type, className: cn('flex h-10 w-full rounded-md border-2 border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', className), ref: ref, ...props, ...(inputFormat ? formatControlAttributes(inputFormat, props) : {}), onBlur: (event) => {
|
|
10
8
|
if (inputFormat)
|
|
11
9
|
tidyOnBlur(event.currentTarget, inputFormat);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/react/components/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/react/components/input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAoD1E,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACjF,OAAO,CACL,gBACE,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,oYAAoY,EACpY,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,KACL,CAAC,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACpE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,IAAI,WAAW;gBAAE,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAC9D,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { DeclaredInputFormat } from '@ttt-productions/input-format-core';\nimport { cn } from '../../lib/utils.js';\nimport { formatControlAttributes, tidyOnBlur } from './format-control.js';\n\nexport type BuiltInFormatInputType =\n | 'password'\n | 'email'\n | 'number'\n | 'tel'\n | 'url'\n | 'search'\n | 'file'\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'month'\n | 'week'\n | 'time'\n | 'range'\n | 'checkbox'\n | 'radio'\n | 'hidden'\n | 'button'\n | 'submit'\n | 'reset'\n | 'image';\n\ntype NativeInputProps = React.ComponentPropsWithoutRef<'input'>;\n\nexport type FreeTextInputProps = Omit<\n NativeInputProps,\n 'type' | 'maxLength' | 'minLength' | 'pattern' | 'required'\n> & {\n type?: 'text';\n inputFormat: DeclaredInputFormat;\n textEntry?: never;\n};\n\nexport type NonFreeTextEntry = 'numeric' | 'identifier';\n\nexport type NonFreeTextInputProps = Omit<NativeInputProps, 'type'> & {\n type?: 'text';\n textEntry: NonFreeTextEntry;\n inputFormat?: never;\n};\n\nexport type BuiltInFormatInputProps = Omit<NativeInputProps, 'type'> & {\n type: BuiltInFormatInputType;\n inputFormat?: never;\n textEntry?: never;\n};\n\nexport type InputProps = FreeTextInputProps | NonFreeTextInputProps | BuiltInFormatInputProps;\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n ({ className, type, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {\n return (\n <input\n type={type}\n className={cn(\n 'flex h-10 w-full rounded-md border-2 border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n {...(inputFormat ? formatControlAttributes(inputFormat, props) : {})}\n onBlur={(event) => {\n if (inputFormat) tidyOnBlur(event.currentTarget, inputFormat);\n onBlur?.(event);\n }}\n />\n );\n },\n);\nInput.displayName = 'Input';\n\nexport { Input };\n"]}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export type MaxWidthOption = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | 'full';
|
|
3
3
|
export interface ScreenAdaptiveViewProps {
|
|
4
|
-
/** Default content (mobile + base) */
|
|
5
4
|
children: React.ReactNode;
|
|
6
|
-
/** Optional content to use on lg and up */
|
|
7
5
|
lgContent?: React.ReactNode;
|
|
8
|
-
/** Optional content to use on xl and up */
|
|
9
6
|
xlContent?: React.ReactNode;
|
|
10
|
-
/** Max width applied at lg (>=1024px) */
|
|
11
7
|
lgMaxWidth?: MaxWidthOption;
|
|
12
|
-
/** Max width applied at xl (>=1280px) */
|
|
13
8
|
xlMaxWidth?: MaxWidthOption;
|
|
14
|
-
/** App-only escape hatch (try to avoid) */
|
|
15
9
|
className?: string;
|
|
16
|
-
/** App-only escape hatch (try to avoid) */
|
|
17
10
|
innerClassName?: string;
|
|
18
11
|
}
|
|
19
12
|
export declare function ScreenAdaptiveView({ children, lgContent, xlContent, lgMaxWidth, xlMaxWidth, className, innerClassName, }: ScreenAdaptiveViewProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-adaptive-view.d.ts","sourceRoot":"","sources":["../../../../src/react/components/layout/screen-adaptive-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,cAAc,GACxB,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9F,MAAM,WAAW,uBAAuB;IACtC,
|
|
1
|
+
{"version":3,"file":"screen-adaptive-view.d.ts","sourceRoot":"","sources":["../../../../src/react/components/layout/screen-adaptive-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,cAAc,GACxB,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9F,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAiCD,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAkB,EAClB,UAAkB,EAClB,SAAS,EACT,cAAc,GACf,EAAE,uBAAuB,qBAuBzB"}
|
|
@@ -35,8 +35,7 @@ function widthClass(opt) {
|
|
|
35
35
|
export function ScreenAdaptiveView({ children, lgContent, xlContent, lgMaxWidth = '4xl', xlMaxWidth = '6xl', className, innerClassName, }) {
|
|
36
36
|
const isLg = useMediaQuery('(min-width: 1024px)');
|
|
37
37
|
const isXl = useMediaQuery('(min-width: 1280px)');
|
|
38
|
-
// SSR-safe
|
|
39
|
-
// After hydration, swaps to lg/xl content if provided.
|
|
38
|
+
// SSR-safe: base children render until hydration, then lg/xl content swaps in.
|
|
40
39
|
const contentToShow = isXl && xlContent !== undefined && xlContent !== null
|
|
41
40
|
? xlContent
|
|
42
41
|
: isLg && lgContent !== undefined && lgContent !== null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-adaptive-view.js","sourceRoot":"","sources":["../../../../src/react/components/layout/screen-adaptive-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"screen-adaptive-view.js","sourceRoot":"","sources":["../../../../src/react/components/layout/screen-adaptive-view.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAqB/D,SAAS,UAAU,CAAC,GAA+B;IACjD,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,OAAO,mBAAmB,CAAC;QAC7B,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,IAAI;YACP,OAAO,iBAAiB,CAAC;QAC3B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,KAAK;YACR,OAAO,kBAAkB,CAAC;QAC5B,KAAK,MAAM;YACT,OAAO,mBAAmB,CAAC;QAC7B;YACE,OAAO,kBAAkB,CAAC;IAC9B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,SAAS,EACT,cAAc,GACU;IACxB,MAAM,IAAI,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAElD,+EAA+E;IAC/E,MAAM,aAAa,GACjB,IAAI,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI;QACnD,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,IAAI,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI;YACrD,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,QAAQ,CAAC;IAEjB,MAAM,SAAS,GAAG,IAAI;QACpB,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;QACxB,CAAC,CAAC,IAAI;YACJ,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;YACxB,CAAC,CAAC,mBAAmB,CAAC;IAE1B,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,YACnD,cAAK,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,SAAS,EAAE,cAAc,CAAC,YAAG,aAAa,GAAO,GACzF,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { cn } from '../../../lib/utils.js';\nimport { useMediaQuery } from '../../hooks/use-media-query.js';\n\nexport type MaxWidthOption =\n 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | 'full';\n\nexport interface ScreenAdaptiveViewProps {\n children: React.ReactNode;\n\n lgContent?: React.ReactNode;\n\n xlContent?: React.ReactNode;\n\n lgMaxWidth?: MaxWidthOption;\n\n xlMaxWidth?: MaxWidthOption;\n\n className?: string;\n\n innerClassName?: string;\n}\n\nfunction widthClass(opt: MaxWidthOption | undefined) {\n switch (opt) {\n case 'none':\n return 'screen-max-w-none';\n case 'sm':\n return 'screen-max-w-sm';\n case 'md':\n return 'screen-max-w-md';\n case 'lg':\n return 'screen-max-w-lg';\n case 'xl':\n return 'screen-max-w-xl';\n case '2xl':\n return 'screen-max-w-2xl';\n case '3xl':\n return 'screen-max-w-3xl';\n case '4xl':\n return 'screen-max-w-4xl';\n case '5xl':\n return 'screen-max-w-5xl';\n case '6xl':\n return 'screen-max-w-6xl';\n case '7xl':\n return 'screen-max-w-7xl';\n case 'full':\n return 'screen-max-w-full';\n default:\n return 'screen-max-w-6xl';\n }\n}\n\nexport function ScreenAdaptiveView({\n children,\n lgContent,\n xlContent,\n lgMaxWidth = '4xl',\n xlMaxWidth = '6xl',\n className,\n innerClassName,\n}: ScreenAdaptiveViewProps) {\n const isLg = useMediaQuery('(min-width: 1024px)');\n const isXl = useMediaQuery('(min-width: 1280px)');\n\n // SSR-safe: base children render until hydration, then lg/xl content swaps in.\n const contentToShow =\n isXl && xlContent !== undefined && xlContent !== null\n ? xlContent\n : isLg && lgContent !== undefined && lgContent !== null\n ? lgContent\n : children;\n\n const sizeClass = isXl\n ? widthClass(xlMaxWidth)\n : isLg\n ? widthClass(lgMaxWidth)\n : 'screen-max-w-full';\n\n return (\n <div className={cn('screen-adaptive-root', className)}>\n <div className={cn('screen-adaptive-inner', sizeClass, innerClassName)}>{contentToShow}</div>\n </div>\n );\n}\n"]}
|
|
@@ -1,38 +1,8 @@
|
|
|
1
1
|
import type { ListPaginationState } from '../hooks/use-paged-list.js';
|
|
2
2
|
export interface ListPaginationProps {
|
|
3
|
-
/**
|
|
4
|
-
* Page state from `usePagedList` (known total),
|
|
5
|
-
* `useCursorPage().paginationFor(hasMore)` (unknown total), or any
|
|
6
|
-
* caller-owned state of the same shape.
|
|
7
|
-
*/
|
|
8
3
|
pagination: ListPaginationState;
|
|
9
|
-
/**
|
|
10
|
-
* Makes BOTH controls unavailable while the next page is in flight, without hiding
|
|
11
|
-
* the row. Server-paged surfaces pass their query's `isFetching`; a slice-paged
|
|
12
|
-
* list has nothing to wait for and omits it.
|
|
13
|
-
*/
|
|
14
4
|
busy?: boolean;
|
|
15
|
-
/** Optional extra classes. Merged with the component's own classes. */
|
|
16
5
|
className?: string;
|
|
17
6
|
}
|
|
18
|
-
/**
|
|
19
|
-
* The ONE Previous / counter / Next control for paginated lists, in both
|
|
20
|
-
* flavors. Pair it with the hook that owns the page state (`usePagedList` for a
|
|
21
|
-
* client-side slice, `useCursorPage` — or the caller's own query state — for a
|
|
22
|
-
* cursor feed; a cursor feed passes `pager.paginationFor(hasMore)`, which binds
|
|
23
|
-
* the query's answer to these controls); this component owns only the controls,
|
|
24
|
-
* so every paginated list reads and behaves the same (ENG-002, FRONTEND-001).
|
|
25
|
-
*
|
|
26
|
-
* The counter follows the flavor: a known `totalPages` reads "2 of 5", an
|
|
27
|
-
* omitted one reads "Page 2". Everything else is identical in both flavors —
|
|
28
|
-
* which is exactly why there is one component and not two.
|
|
29
|
-
*
|
|
30
|
-
* It renders NOTHING when neither direction is available, so no call site
|
|
31
|
-
* repeats a `totalPages > 1` / `page > 1 || hasMore` guard. An unavailable control
|
|
32
|
-
* — an edge, or either control while a page loads — is `aria-disabled` and ignores
|
|
33
|
-
* activation (announced, and inert), but is never natively disabled: the control the
|
|
34
|
-
* user just pressed keeps focus when it becomes unavailable (FRONTEND-203). The
|
|
35
|
-
* counter is a `status` live region so a page change is announced to screen readers.
|
|
36
|
-
*/
|
|
37
7
|
export declare function ListPagination({ pagination, busy, className }: ListPaginationProps): import("react").JSX.Element | null;
|
|
38
8
|
//# sourceMappingURL=list-pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-pagination.d.ts","sourceRoot":"","sources":["../../../src/react/components/list-pagination.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC
|
|
1
|
+
{"version":3,"file":"list-pagination.d.ts","sourceRoot":"","sources":["../../../src/react/components/list-pagination.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,IAAY,EAAE,SAAS,EAAE,EAAE,mBAAmB,sCAwD1F"}
|
|
@@ -4,29 +4,8 @@ import { useState } from 'react';
|
|
|
4
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
5
|
import { Button } from './button.js';
|
|
6
6
|
import { cn } from '../../lib/utils.js';
|
|
7
|
-
/**
|
|
8
|
-
* The ONE Previous / counter / Next control for paginated lists, in both
|
|
9
|
-
* flavors. Pair it with the hook that owns the page state (`usePagedList` for a
|
|
10
|
-
* client-side slice, `useCursorPage` — or the caller's own query state — for a
|
|
11
|
-
* cursor feed; a cursor feed passes `pager.paginationFor(hasMore)`, which binds
|
|
12
|
-
* the query's answer to these controls); this component owns only the controls,
|
|
13
|
-
* so every paginated list reads and behaves the same (ENG-002, FRONTEND-001).
|
|
14
|
-
*
|
|
15
|
-
* The counter follows the flavor: a known `totalPages` reads "2 of 5", an
|
|
16
|
-
* omitted one reads "Page 2". Everything else is identical in both flavors —
|
|
17
|
-
* which is exactly why there is one component and not two.
|
|
18
|
-
*
|
|
19
|
-
* It renders NOTHING when neither direction is available, so no call site
|
|
20
|
-
* repeats a `totalPages > 1` / `page > 1 || hasMore` guard. An unavailable control
|
|
21
|
-
* — an edge, or either control while a page loads — is `aria-disabled` and ignores
|
|
22
|
-
* activation (announced, and inert), but is never natively disabled: the control the
|
|
23
|
-
* user just pressed keeps focus when it becomes unavailable (FRONTEND-203). The
|
|
24
|
-
* counter is a `status` live region so a page change is announced to screen readers.
|
|
25
|
-
*/
|
|
26
7
|
export function ListPagination({ pagination, busy = false, className }) {
|
|
27
8
|
const { currentPage, totalPages, canPreviousPage, canNextPage, goToPreviousPage, goToNextPage } = pagination;
|
|
28
|
-
// The control that started the in-flight page shows the spinner. Cleared when `busy`
|
|
29
|
-
// ends — a render-phase adjustment, so there is no effect and no stale frame.
|
|
30
9
|
const [clicked, setClicked] = useState(null);
|
|
31
10
|
const [wasBusy, setWasBusy] = useState(busy);
|
|
32
11
|
if (busy !== wasBusy) {
|
|
@@ -38,12 +17,6 @@ export function ListPagination({ pagination, busy = false, className }) {
|
|
|
38
17
|
const nextPending = busy && clicked === 'next';
|
|
39
18
|
const previousUnavailable = busy || !canPreviousPage;
|
|
40
19
|
const nextUnavailable = busy || !canNextPage;
|
|
41
|
-
// One visibility rule for both flavors. For a known total this is exactly
|
|
42
|
-
// `totalPages > 1`: page state is clamped into `1..totalPages`, so a
|
|
43
|
-
// single-page list has no reachable neighbour in either direction, and a
|
|
44
|
-
// multi-page list always has one. For a cursor feed it is the hand-rolled
|
|
45
|
-
// `page > 1 || hasMore`. `busy` deliberately does not hide the row — the
|
|
46
|
-
// controls grey out in place instead of vanishing mid-fetch.
|
|
47
20
|
if (!canPreviousPage && !canNextPage)
|
|
48
21
|
return null;
|
|
49
22
|
return (_jsxs("div", { className: cn('flex w-full items-center justify-between gap-4 mt-4', className), children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-pagination.js","sourceRoot":"","sources":["../../../src/react/components/list-pagination.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"list-pagination.js","sourceRoot":"","sources":["../../../src/react/components/list-pagination.tsx"],"names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EAAE;oBACZ,IAAI,mBAAmB;wBAAE,OAAO;oBAChC,UAAU,CAAC,UAAU,CAAC,CAAC;oBACvB,gBAAgB,EAAE,CAAC;gBACrB,CAAC,mBACc,mBAAmB,IAAI,SAAS,EAC/C,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,KAAC,WAAW,IAAC,SAAS,EAAC,SAAS,GAAG,EACzC,SAAS,EAAC,eAAe,yBAGlB,EACT,eAAM,SAAS,EAAC,cAAc,EAAC,IAAI,EAAC,QAAQ,YACzC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,WAAW,OAAO,UAAU,EAAE,GAChF,EACP,MAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,GAAG,EAAE;oBACZ,IAAI,eAAe;wBAAE,OAAO;oBAC5B,UAAU,CAAC,MAAM,CAAC,CAAC;oBACnB,YAAY,EAAE,CAAC;gBACjB,CAAC,mBACc,eAAe,IAAI,SAAS,EAC3C,OAAO,EAAE,WAAW,EACpB,SAAS,EAAC,eAAe,qBAGxB,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,YAAY,IAAC,SAAS,EAAC,SAAS,GAAG,IACnD,IACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { ChevronLeft, ChevronRight } from 'lucide-react';\nimport { Button } from './button.js';\nimport { cn } from '../../lib/utils.js';\nimport type { ListPaginationState } from '../hooks/use-paged-list.js';\n\nexport interface ListPaginationProps {\n pagination: ListPaginationState;\n busy?: boolean;\n className?: string;\n}\n\nexport function ListPagination({ pagination, busy = false, className }: ListPaginationProps) {\n const { currentPage, totalPages, canPreviousPage, canNextPage, goToPreviousPage, goToNextPage } =\n pagination;\n\n const [clicked, setClicked] = useState<'previous' | 'next' | null>(null);\n const [wasBusy, setWasBusy] = useState(busy);\n if (busy !== wasBusy) {\n setWasBusy(busy);\n if (!busy) setClicked(null);\n }\n const previousPending = busy && clicked === 'previous';\n const nextPending = busy && clicked === 'next';\n const previousUnavailable = busy || !canPreviousPage;\n const nextUnavailable = busy || !canNextPage;\n\n if (!canPreviousPage && !canNextPage) return null;\n\n return (\n <div className={cn('flex w-full items-center justify-between gap-4 mt-4', className)}>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => {\n if (previousUnavailable) return;\n setClicked('previous');\n goToPreviousPage();\n }}\n aria-disabled={previousUnavailable || undefined}\n pending={previousPending}\n icon={<ChevronLeft className=\"icon-xs\" />}\n className=\"h-11 min-w-11\"\n >\n Previous\n </Button>\n <span className=\"text-counter\" role=\"status\">\n {totalPages === undefined ? `Page ${currentPage}` : `${currentPage} of ${totalPages}`}\n </span>\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => {\n if (nextUnavailable) return;\n setClicked('next');\n goToNextPage();\n }}\n aria-disabled={nextUnavailable || undefined}\n pending={nextPending}\n className=\"h-11 min-w-11\"\n >\n Next\n {nextPending ? null : <ChevronRight className=\"icon-xs\" />}\n </Button>\n </div>\n );\n}\n"]}
|
|
@@ -2,13 +2,7 @@ interface OpenerFocusHandlers {
|
|
|
2
2
|
onOpenAutoFocus?: (event: Event) => void;
|
|
3
3
|
onCloseAutoFocus?: (event: Event) => void;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* Focus returns to the element that held it when an overlay opened, as the overlay closes. Radix's
|
|
7
|
-
* modal content hands close focus to its trigger only, so an overlay opened from state — no trigger —
|
|
8
|
-
* would leave focus on the page. The opener is recorded as Radix starts its open focus, before focus
|
|
9
|
-
* moves inside. The caller's own `onCloseAutoFocus` runs first; when it calls `event.preventDefault()`
|
|
10
|
-
* it has chosen the destination, and when the opener has left the page Radix's own return runs.
|
|
11
|
-
*/
|
|
5
|
+
/** Radix's modal content returns close focus only to its trigger, so an overlay opened from state records its opener. */
|
|
12
6
|
export declare function useOpenerFocus({ onOpenAutoFocus, onCloseAutoFocus, }: OpenerFocusHandlers): Required<OpenerFocusHandlers>;
|
|
13
7
|
export {};
|
|
14
8
|
//# sourceMappingURL=opener-focus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opener-focus.d.ts","sourceRoot":"","sources":["../../../src/react/components/opener-focus.ts"],"names":[],"mappings":"AAIA,UAAU,mBAAmB;IAC3B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AAED
|
|
1
|
+
{"version":3,"file":"opener-focus.d.ts","sourceRoot":"","sources":["../../../src/react/components/opener-focus.ts"],"names":[],"mappings":"AAIA,UAAU,mBAAmB;IAC3B,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC3C;AAED,yHAAyH;AACzH,wBAAgB,cAAc,CAAC,EAC7B,eAAe,EACf,gBAAgB,GACjB,EAAE,mBAAmB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAiBrD"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Focus returns to the element that held it when an overlay opened, as the overlay closes. Radix's
|
|
5
|
-
* modal content hands close focus to its trigger only, so an overlay opened from state — no trigger —
|
|
6
|
-
* would leave focus on the page. The opener is recorded as Radix starts its open focus, before focus
|
|
7
|
-
* moves inside. The caller's own `onCloseAutoFocus` runs first; when it calls `event.preventDefault()`
|
|
8
|
-
* it has chosen the destination, and when the opener has left the page Radix's own return runs.
|
|
9
|
-
*/
|
|
3
|
+
/** Radix's modal content returns close focus only to its trigger, so an overlay opened from state records its opener. */
|
|
10
4
|
export function useOpenerFocus({ onOpenAutoFocus, onCloseAutoFocus, }) {
|
|
11
5
|
const opener = React.useRef(null);
|
|
12
6
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opener-focus.js","sourceRoot":"","sources":["../../../src/react/components/opener-focus.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B
|
|
1
|
+
{"version":3,"file":"opener-focus.js","sourceRoot":"","sources":["../../../src/react/components/opener-focus.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,yHAAyH;AACzH,MAAM,UAAU,cAAc,CAAC,EAC7B,eAAe,EACf,gBAAgB,GACI;IACpB,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAqB,IAAI,CAAC,CAAC;IACtD,OAAO;QACL,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC;YACtC,MAAM,CAAC,OAAO,GAAG,MAAM,YAAY,WAAW,IAAI,MAAM,KAAK,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;YAC3F,eAAe,EAAE,CAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,gBAAgB,EAAE,CAAC,KAAK,CAAC,CAAC;YAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;YAC9B,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;YACtB,IAAI,KAAK,CAAC,gBAAgB,IAAI,CAAC,MAAM,EAAE,WAAW;gBAAE,OAAO;YAC3D,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\ninterface OpenerFocusHandlers {\n onOpenAutoFocus?: (event: Event) => void;\n onCloseAutoFocus?: (event: Event) => void;\n}\n\n/** Radix's modal content returns close focus only to its trigger, so an overlay opened from state records its opener. */\nexport function useOpenerFocus({\n onOpenAutoFocus,\n onCloseAutoFocus,\n}: OpenerFocusHandlers): Required<OpenerFocusHandlers> {\n const opener = React.useRef<HTMLElement | null>(null);\n return {\n onOpenAutoFocus: (event) => {\n const active = document.activeElement;\n opener.current = active instanceof HTMLElement && active !== document.body ? active : null;\n onOpenAutoFocus?.(event);\n },\n onCloseAutoFocus: (event) => {\n onCloseAutoFocus?.(event);\n const target = opener.current;\n opener.current = null;\n if (event.defaultPrevented || !target?.isConnected) return;\n event.preventDefault();\n target.focus();\n },\n };\n}\n"]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
/** Cancels an event and stops it in the capture phase, before any handler on the control runs. */
|
|
3
2
|
export declare function blockEvent(event: React.SyntheticEvent): void;
|
|
4
|
-
/**
|
|
5
|
-
* Stops the keys that act on a pending control — Space, Enter, ArrowUp, ArrowDown (which open a
|
|
6
|
-
* trigger) and a single printable character (a trigger's typeahead) — and lets every other key
|
|
7
|
-
* through, so Tab, Escape, function keys, and shortcuts behave as usual.
|
|
8
|
-
*/
|
|
9
3
|
export declare function blockActivationKey(event: React.KeyboardEvent): void;
|
|
10
4
|
//# sourceMappingURL=pending-guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-guard.d.ts","sourceRoot":"","sources":["../../../src/react/components/pending-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,
|
|
1
|
+
{"version":3,"file":"pending-guard.d.ts","sourceRoot":"","sources":["../../../src/react/components/pending-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,QAGrD;AAID,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,QAG5D"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
/** Cancels an event and stops it in the capture phase, before any handler on the control runs. */
|
|
2
1
|
export function blockEvent(event) {
|
|
3
2
|
event.preventDefault();
|
|
4
3
|
event.stopPropagation();
|
|
5
4
|
}
|
|
6
5
|
const ACTIVATION_KEYS = new Set([' ', 'Enter', 'ArrowUp', 'ArrowDown']);
|
|
7
|
-
/**
|
|
8
|
-
* Stops the keys that act on a pending control — Space, Enter, ArrowUp, ArrowDown (which open a
|
|
9
|
-
* trigger) and a single printable character (a trigger's typeahead) — and lets every other key
|
|
10
|
-
* through, so Tab, Escape, function keys, and shortcuts behave as usual.
|
|
11
|
-
*/
|
|
12
6
|
export function blockActivationKey(event) {
|
|
13
7
|
if (event.ctrlKey || event.metaKey || event.altKey)
|
|
14
8
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pending-guard.js","sourceRoot":"","sources":["../../../src/react/components/pending-guard.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"pending-guard.js","sourceRoot":"","sources":["../../../src/react/components/pending-guard.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,KAA2B;IACpD,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;AAExE,MAAM,UAAU,kBAAkB,CAAC,KAA0B;IAC3D,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO;IAC3D,IAAI,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type * as React from 'react';\n\nexport function blockEvent(event: React.SyntheticEvent) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst ACTIVATION_KEYS = new Set([' ', 'Enter', 'ArrowUp', 'ArrowDown']);\n\nexport function blockActivationKey(event: React.KeyboardEvent) {\n if (event.ctrlKey || event.metaKey || event.altKey) return;\n if (ACTIVATION_KEYS.has(event.key) || event.key.length === 1) blockEvent(event);\n}\n"]}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface RelativeTimeProps {
|
|
3
|
-
/** Number (ms or seconds), ISO string, Firestore Timestamp, or Date. */
|
|
4
3
|
timestamp: number | string | Date | undefined | null;
|
|
5
|
-
/** Fallback rendered before client hydration completes. Defaults to "...". */
|
|
6
4
|
placeholder?: string;
|
|
7
|
-
/** Fallback rendered when the timestamp can't be parsed. Defaults to "a while ago". */
|
|
8
5
|
fallback?: string;
|
|
9
|
-
/** Auto-refresh interval in ms. Defaults to 60000. Set to 0 to disable. */
|
|
10
6
|
refreshIntervalMs?: number;
|
|
11
7
|
}
|
|
12
|
-
/**
|
|
13
|
-
* SSR-safe relative-time component.
|
|
14
|
-
* Renders `placeholder` on the server and pre-mount, then the live value.
|
|
15
|
-
*/
|
|
16
8
|
export declare function RelativeTime({ timestamp, placeholder, fallback, refreshIntervalMs, }: RelativeTimeProps): React.JSX.Element;
|
|
17
9
|
//# sourceMappingURL=relative-time.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relative-time.d.ts","sourceRoot":"","sources":["../../../src/react/components/relative-time.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,iBAAiB;IAChC,
|
|
1
|
+
{"version":3,"file":"relative-time.d.ts","sourceRoot":"","sources":["../../../src/react/components/relative-time.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,WAAmB,EACnB,QAAwB,EACxB,iBAA0B,GAC3B,EAAE,iBAAiB,qBA8BnB"}
|