@shipfox/react-ui 0.32.0 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/components/alert/alert.d.ts +1 -1
  2. package/dist/components/alert/alert.js +1 -1
  3. package/dist/components/avatar/avatar.d.ts +1 -1
  4. package/dist/components/avatar/avatar.js +1 -1
  5. package/dist/components/command/command.d.ts +2 -2
  6. package/dist/components/command/command.js +1 -1
  7. package/dist/components/dashboard/components/charts/bar-chart.js +4 -0
  8. package/dist/components/dashboard/components/charts/chart-tooltip.js +1 -1
  9. package/dist/components/dashboard/components/charts/line-chart.js +4 -0
  10. package/dist/components/dropdown-menu/dropdown-menu.d.ts +2 -2
  11. package/dist/components/dropdown-menu/dropdown-menu.js +1 -1
  12. package/dist/components/form/form.d.ts +1 -1
  13. package/dist/components/form/form.js +1 -1
  14. package/dist/components/index.d.ts +0 -1
  15. package/dist/components/index.js +0 -1
  16. package/dist/components/inline-tips/inline-tips.d.ts +1 -1
  17. package/dist/components/inline-tips/inline-tips.js +1 -1
  18. package/dist/components/modal/modal.d.ts +2 -2
  19. package/dist/components/modal/modal.js +1 -1
  20. package/dist/components/popover/popover.d.ts +1 -1
  21. package/dist/components/popover/popover.js +1 -1
  22. package/dist/components/select/select.d.ts +2 -2
  23. package/dist/components/select/select.js +1 -1
  24. package/dist/components/sheet/sheet.d.ts +2 -2
  25. package/dist/components/sheet/sheet.js +1 -1
  26. package/dist/components/shiny-text/shiny-text.d.ts +1 -1
  27. package/dist/components/shipql-editor/lexical/shipql-plugin.d.ts +1 -1
  28. package/dist/components/shipql-editor/lexical/shipql-plugin.js +2 -2
  29. package/dist/components/shipql-editor/suggestions/shipql-range-facet-panel.js +18 -15
  30. package/dist/components/shipql-editor/suggestions/types.d.ts +4 -2
  31. package/dist/components/table/table.d.ts +1 -1
  32. package/dist/components/table/table.js +1 -1
  33. package/dist/components/tabs/tabs.d.ts +1 -1
  34. package/dist/components/tabs/tabs.js +1 -1
  35. package/dist/components/toast/toast.d.ts +1 -1
  36. package/dist/components/toast/toast.js +1 -1
  37. package/dist/components/tooltip/tooltip.d.ts +1 -1
  38. package/dist/components/tooltip/tooltip.js +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/utils/format/bytes.d.ts +2 -0
  41. package/dist/utils/format/bytes.js +14 -0
  42. package/dist/utils/format/index.d.ts +1 -0
  43. package/dist/utils/format/index.js +1 -0
  44. package/package.json +6 -6
  45. package/dist/components/dropdown-input/dropdown-input.d.ts +0 -25
  46. package/dist/components/dropdown-input/dropdown-input.js +0 -188
  47. package/dist/components/dropdown-input/index.d.ts +0 -2
  48. package/dist/components/dropdown-input/index.js +0 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipfox/react-ui",
3
3
  "license": "MIT",
4
- "version": "0.32.0",
4
+ "version": "0.32.2",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "./dist/styles.css": "./dist/styles.css"
28
28
  },
29
29
  "dependencies": {
30
- "@lexical/react": "^0.40.0",
30
+ "@lexical/react": "^0.42.0",
31
31
  "@radix-ui/react-accordion": "^1.2.12",
32
32
  "@radix-ui/react-alert-dialog": "^1.1.15",
33
33
  "@radix-ui/react-avatar": "^1.1.10",
@@ -54,8 +54,8 @@
54
54
  "cmdk": "^1.1.1",
55
55
  "framer-motion": "^12.23.24",
56
56
  "gsap": "^3.13.0",
57
- "lexical": "^0.40.0",
58
- "lucide-react": "^0.575.0",
57
+ "lexical": "^0.42.0",
58
+ "lucide-react": "^0.577.0",
59
59
  "react-day-picker": "^9.5.1",
60
60
  "recharts": "^3.1.0",
61
61
  "shiki": "^3.15.0",
@@ -101,11 +101,11 @@
101
101
  "vite": "^7.1.7",
102
102
  "vitest": "^4.0.8",
103
103
  "zod": "^4.1.12",
104
+ "@shipfox/ts-config": "1.3.5",
105
+ "@shipfox/vite": "1.2.2",
104
106
  "@shipfox/biome": "1.8.0",
105
107
  "@shipfox/swc": "1.2.3",
106
- "@shipfox/ts-config": "1.3.5",
107
108
  "@shipfox/typescript": "1.1.2",
108
- "@shipfox/vite": "1.2.2",
109
109
  "@shipfox/vitest": "1.2.0"
110
110
  },
111
111
  "scripts": {
@@ -1,25 +0,0 @@
1
- import { Input } from '../../components/input';
2
- import type { ComponentProps } from 'react';
3
- import { type ReactNode } from 'react';
4
- export type DropdownInputItem<T = unknown> = {
5
- id: string | number;
6
- label: string;
7
- value: T;
8
- };
9
- type InputBaseProps = Omit<ComponentProps<typeof Input>, 'value' | 'onChange' | 'onSelect'>;
10
- export type DropdownInputProps<T = unknown> = InputBaseProps & {
11
- value: string;
12
- onValueChange: (value: string) => void;
13
- onSelect?: (item: DropdownInputItem<T>) => void;
14
- items: DropdownInputItem<T>[];
15
- emptyPlaceholder?: string | ReactNode;
16
- open: boolean;
17
- onOpenChange: (open: boolean) => void;
18
- focusedIndex: number;
19
- onFocusedIndexChange: (index: number) => void;
20
- selectedItem?: DropdownInputItem<T> | null;
21
- dropdownClassName?: string;
22
- };
23
- export declare function DropdownInput<T = unknown>({ value, onValueChange, onSelect, items, emptyPlaceholder, open, onOpenChange, focusedIndex, onFocusedIndexChange, selectedItem, dropdownClassName, className, ...inputProps }: DropdownInputProps<T>): import("react/jsx-runtime").JSX.Element;
24
- export {};
25
- //# sourceMappingURL=dropdown-input.d.ts.map
@@ -1,188 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button } from '../../components/button/index.js';
3
- import { Input } from '../../components/input/index.js';
4
- import { Popover, PopoverContent, PopoverTrigger } from '../../components/popover/index.js';
5
- import { useCallback, useEffect, useRef } from 'react';
6
- import { cn } from '../../utils/cn.js';
7
- export function DropdownInput({ value, onValueChange, onSelect, items = [], emptyPlaceholder, open, onOpenChange, focusedIndex, onFocusedIndexChange, selectedItem, dropdownClassName, className, ...inputProps }) {
8
- const inputRef = useRef(null);
9
- const blurTimeoutRef = useRef(null);
10
- const popoverContentRef = useRef(null);
11
- const itemRefs = useRef([]);
12
- const isDisabled = Boolean(inputProps.disabled);
13
- const hasResults = items.length > 0;
14
- const shouldShowDropdown = open && !isDisabled;
15
- const handleOpenChange = useCallback((nextOpen)=>{
16
- if (isDisabled) {
17
- if (!nextOpen) onOpenChange(false);
18
- return;
19
- }
20
- onOpenChange(nextOpen);
21
- }, [
22
- isDisabled,
23
- onOpenChange
24
- ]);
25
- const handleSelect = useCallback((item)=>{
26
- onValueChange(item.label);
27
- onSelect?.(item);
28
- onOpenChange(false);
29
- inputRef.current?.blur();
30
- }, [
31
- onValueChange,
32
- onOpenChange,
33
- onSelect
34
- ]);
35
- const handleInputChange = useCallback((e)=>{
36
- onValueChange(e.target.value);
37
- onFocusedIndexChange(-1);
38
- if (!open && !isDisabled) {
39
- onOpenChange(true);
40
- }
41
- }, [
42
- onValueChange,
43
- onFocusedIndexChange,
44
- open,
45
- isDisabled,
46
- onOpenChange
47
- ]);
48
- const handleInputKeyDown = useCallback((e)=>{
49
- if (!shouldShowDropdown || items.length === 0) return;
50
- if (e.key === 'ArrowDown') {
51
- e.preventDefault();
52
- onFocusedIndexChange(focusedIndex < items.length - 1 ? focusedIndex + 1 : 0);
53
- } else if (e.key === 'ArrowUp') {
54
- e.preventDefault();
55
- onFocusedIndexChange(focusedIndex > 0 ? focusedIndex - 1 : items.length - 1);
56
- } else if (e.key === 'Enter' && focusedIndex >= 0) {
57
- e.preventDefault();
58
- const item = items[focusedIndex];
59
- if (item) {
60
- handleSelect(item);
61
- }
62
- } else if (e.key === 'Escape') {
63
- e.preventDefault();
64
- onOpenChange(false);
65
- }
66
- }, [
67
- shouldShowDropdown,
68
- items,
69
- focusedIndex,
70
- onFocusedIndexChange,
71
- handleSelect,
72
- onOpenChange
73
- ]);
74
- const handleInputBlur = useCallback(()=>{
75
- if (blurTimeoutRef.current) {
76
- clearTimeout(blurTimeoutRef.current);
77
- }
78
- blurTimeoutRef.current = setTimeout(()=>{
79
- const activeElement = document.activeElement;
80
- const popoverContent = activeElement?.closest('[data-radix-popper-content-wrapper]');
81
- if (!popoverContent) {
82
- onOpenChange(false);
83
- }
84
- }, 200);
85
- }, [
86
- onOpenChange
87
- ]);
88
- useEffect(()=>{
89
- return ()=>{
90
- if (blurTimeoutRef.current) {
91
- clearTimeout(blurTimeoutRef.current);
92
- }
93
- };
94
- }, []);
95
- useEffect(()=>{
96
- if (focusedIndex >= 0 && itemRefs.current[focusedIndex]) {
97
- itemRefs.current[focusedIndex]?.scrollIntoView({
98
- block: 'nearest'
99
- });
100
- }
101
- }, [
102
- focusedIndex
103
- ]);
104
- const handlePointerDownOutside = useCallback((e)=>{
105
- const target = e.target;
106
- if (target && popoverContentRef.current?.contains(target)) {
107
- e.preventDefault();
108
- }
109
- }, []);
110
- return /*#__PURE__*/ _jsxs(Popover, {
111
- open: shouldShowDropdown,
112
- onOpenChange: handleOpenChange,
113
- children: [
114
- /*#__PURE__*/ _jsx(PopoverTrigger, {
115
- asChild: true,
116
- children: /*#__PURE__*/ _jsx("div", {
117
- className: "w-full",
118
- children: /*#__PURE__*/ _jsx(Input, {
119
- ref: inputRef,
120
- value: value,
121
- onChange: handleInputChange,
122
- onKeyDown: handleInputKeyDown,
123
- onBlur: handleInputBlur,
124
- onFocus: ()=>{
125
- if (blurTimeoutRef.current) {
126
- clearTimeout(blurTimeoutRef.current);
127
- blurTimeoutRef.current = null;
128
- }
129
- if (!open && !isDisabled && value.length > 0 && hasResults) {
130
- onOpenChange(true);
131
- }
132
- },
133
- className: className,
134
- ...inputProps
135
- })
136
- })
137
- }),
138
- /*#__PURE__*/ _jsx(PopoverContent, {
139
- align: "start",
140
- sideOffset: 8,
141
- className: cn('w-(--radix-popover-trigger-width) rounded-8 bg-background-components-base p-4 shadow-tooltip', dropdownClassName),
142
- onOpenAutoFocus: (e)=>e.preventDefault(),
143
- onPointerDownOutside: handlePointerDownOutside,
144
- onInteractOutside: handlePointerDownOutside,
145
- children: /*#__PURE__*/ _jsx("div", {
146
- ref: popoverContentRef,
147
- className: "max-h-200 overflow-y-auto overscroll-contain scrollbar",
148
- onWheel: (e)=>e.stopPropagation(),
149
- onTouchStart: (e)=>e.stopPropagation(),
150
- onTouchMove: (e)=>e.stopPropagation(),
151
- children: hasResults ? /*#__PURE__*/ _jsxs("div", {
152
- className: "flex flex-col gap-4 p-4",
153
- children: [
154
- /*#__PURE__*/ _jsx("div", {
155
- className: "p-4 text-xs leading-20 text-foreground-neutral-muted",
156
- children: "Select a repository"
157
- }),
158
- items.map((item, index)=>{
159
- const isSelected = selectedItem?.id === item.id;
160
- const isFocused = focusedIndex === index;
161
- return /*#__PURE__*/ _jsx(Button, {
162
- type: "button",
163
- variant: "transparent",
164
- ref: (el)=>{
165
- itemRefs.current[index] = el;
166
- },
167
- onClick: ()=>handleSelect(item),
168
- onMouseDown: (e)=>e.preventDefault(),
169
- onMouseEnter: ()=>onFocusedIndexChange(index),
170
- className: cn('!px-8 w-full text-left text-foreground-neutral-subtle', (isSelected || isFocused) && 'bg-background-components-hover text-foreground-neutral-base'),
171
- children: /*#__PURE__*/ _jsx("span", {
172
- className: "flex-1 truncate",
173
- children: item.label
174
- })
175
- }, item.id);
176
- })
177
- ]
178
- }) : /*#__PURE__*/ _jsx("div", {
179
- className: "p-4 text-xs leading-20 text-foreground-neutral-muted",
180
- children: emptyPlaceholder ? emptyPlaceholder : null
181
- })
182
- })
183
- })
184
- ]
185
- });
186
- }
187
-
188
- //# sourceMappingURL=dropdown-input.js.map
@@ -1,2 +0,0 @@
1
- export * from './dropdown-input';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from './dropdown-input.js';
2
-
3
- //# sourceMappingURL=index.js.map