@shipfox/react-ui 0.31.1 → 0.32.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.
Files changed (57) 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 +1 -1
  15. package/dist/components/index.js +1 -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/index.d.ts +1 -1
  28. package/dist/components/shipql-editor/lexical/shipql-leaf-node.d.ts +3 -2
  29. package/dist/components/shipql-editor/lexical/shipql-leaf-node.js +8 -4
  30. package/dist/components/shipql-editor/lexical/shipql-plugin.d.ts +2 -1
  31. package/dist/components/shipql-editor/lexical/shipql-plugin.js +7 -3
  32. package/dist/components/shipql-editor/shipql-editor-inner.d.ts +1 -1
  33. package/dist/components/shipql-editor/shipql-editor-inner.js +7 -2
  34. package/dist/components/shipql-editor/shipql-editor.d.ts +3 -2
  35. package/dist/components/shipql-editor/shipql-editor.js +7 -1
  36. package/dist/components/shipql-editor/suggestions/generate-suggestions.js +1 -1
  37. package/dist/components/shipql-editor/suggestions/shipql-range-facet-panel.js +101 -62
  38. package/dist/components/shipql-editor/suggestions/shipql-suggestions-plugin.js +17 -1
  39. package/dist/components/shipql-editor/suggestions/types.d.ts +4 -0
  40. package/dist/components/switch/index.d.ts +2 -0
  41. package/dist/components/switch/index.js +3 -0
  42. package/dist/components/switch/switch.d.ts +12 -0
  43. package/dist/components/switch/switch.js +48 -0
  44. package/dist/components/table/table.d.ts +1 -1
  45. package/dist/components/table/table.js +1 -1
  46. package/dist/components/tabs/tabs.d.ts +1 -1
  47. package/dist/components/tabs/tabs.js +1 -1
  48. package/dist/components/toast/toast.d.ts +1 -1
  49. package/dist/components/toast/toast.js +1 -1
  50. package/dist/components/tooltip/tooltip.d.ts +1 -1
  51. package/dist/components/tooltip/tooltip.js +1 -1
  52. package/dist/styles.css +1 -1
  53. package/package.json +7 -6
  54. package/dist/components/dropdown-input/dropdown-input.d.ts +0 -25
  55. package/dist/components/dropdown-input/dropdown-input.js +0 -188
  56. package/dist/components/dropdown-input/index.d.ts +0 -2
  57. 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.31.1",
4
+ "version": "0.32.1",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -27,6 +27,7 @@
27
27
  "./dist/styles.css": "./dist/styles.css"
28
28
  },
29
29
  "dependencies": {
30
+ "@lexical/react": "^0.40.0",
30
31
  "@radix-ui/react-accordion": "^1.2.12",
31
32
  "@radix-ui/react-alert-dialog": "^1.1.15",
32
33
  "@radix-ui/react-avatar": "^1.1.10",
@@ -41,16 +42,19 @@
41
42
  "@radix-ui/react-select": "^2.2.6",
42
43
  "@radix-ui/react-slider": "^1.3.6",
43
44
  "@radix-ui/react-slot": "^1.2.3",
45
+ "@radix-ui/react-switch": "^1.2.6",
44
46
  "@radix-ui/react-tabs": "^1.1.13",
45
47
  "@radix-ui/react-tooltip": "^1.2.8",
46
48
  "@radix-ui/react-use-controllable-state": "^1.2.2",
47
49
  "@remixicon/react": "^4.6.0",
50
+ "@swc/helpers": "^0.5.17",
48
51
  "canvas-confetti": "^1.9.4",
49
52
  "class-variance-authority": "^0.7.1",
50
- "cmdk": "^1.1.1",
51
53
  "clsx": "^2.1.1",
54
+ "cmdk": "^1.1.1",
52
55
  "framer-motion": "^12.23.24",
53
56
  "gsap": "^3.13.0",
57
+ "lexical": "^0.40.0",
54
58
  "lucide-react": "^0.575.0",
55
59
  "react-day-picker": "^9.5.1",
56
60
  "recharts": "^3.1.0",
@@ -59,9 +63,6 @@
59
63
  "sonner": "^2.0.7",
60
64
  "tailwind-merge": "^3.2.0",
61
65
  "vaul": "^1.1.1",
62
- "@swc/helpers": "^0.5.17",
63
- "lexical": "^0.40.0",
64
- "@lexical/react": "^0.40.0",
65
66
  "@shipfox/shipql-parser": "0.2.0"
66
67
  },
67
68
  "peerDependencies": {
@@ -100,7 +101,7 @@
100
101
  "vite": "^7.1.7",
101
102
  "vitest": "^4.0.8",
102
103
  "zod": "^4.1.12",
103
- "@shipfox/biome": "1.7.0",
104
+ "@shipfox/biome": "1.8.0",
104
105
  "@shipfox/swc": "1.2.3",
105
106
  "@shipfox/ts-config": "1.3.5",
106
107
  "@shipfox/typescript": "1.1.2",
@@ -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