@codefast/ui 0.5.0-canary.1 → 0.5.0-canary.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @codefast/ui
2
2
 
3
+ ## 0.5.0-canary.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies []:
8
+ - @codefast/tailwind-variants@0.5.0-canary.2
9
+
3
10
  ## 0.5.0-canary.1
4
11
 
5
12
  ### Patch Changes
@@ -61,7 +61,8 @@ function ChartTooltipContent({ __scopeChart, active, className, color, formatter
61
61
  if (hideLabel || payload.length === 0) return null;
62
62
  const item = payload[0];
63
63
  if (item === void 0) return null;
64
- const itemConfig = getPayloadConfigFromPayload(config, item, safeToString(labelKey ?? item.dataKey ?? item.name ?? "value"));
64
+ const key = safeToString(labelKey ?? item.dataKey ?? item.name ?? "value");
65
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
65
66
  const configEntry = typeof label === "string" && label in config ? config[label] : void 0;
66
67
  const value = !labelKey && typeof label === "string" ? configEntry !== void 0 ? configEntry.label ?? label : label : itemConfig?.label;
67
68
  if (labelFormatter) return /* @__PURE__ */ jsx("div", {
@@ -43,8 +43,9 @@ const [FormItemContextProvider, useFormItemContext] = createFormFieldContext("Fo
43
43
  * @since 0.3.16-canary.0
44
44
  */
45
45
  function FormItem({ __scopeFormField, className, ...props }) {
46
+ const id = useId();
46
47
  return /* @__PURE__ */ jsx(FormItemContextProvider, {
47
- id: useId(),
48
+ id,
48
49
  scope: __scopeFormField,
49
50
  children: /* @__PURE__ */ jsx("div", {
50
51
  className: cn("grid gap-2", className),
@@ -44,7 +44,9 @@ function useAnimatedValue(targetValue, duration, animate) {
44
44
  if (elapsedTime >= duration) setAnimatedValue(actualTargetValue);
45
45
  else {
46
46
  const progress = elapsedTime / duration;
47
- setAnimatedValue(currentValue + valueRange * (1 - (1 - progress) * (1 - progress)));
47
+ const easeProgress = 1 - (1 - progress) * (1 - progress);
48
+ const nextValue = currentValue + valueRange * easeProgress;
49
+ setAnimatedValue(nextValue);
48
50
  animationFrame = requestAnimationFrame(animateValue);
49
51
  }
50
52
  };
@@ -87,23 +87,29 @@ function usePagination({ currentPage, resultsPerPage, siblingPagesCount = 1, tot
87
87
  * This occurs when the current page is close to the end of the pagination
88
88
  * range.
89
89
  */
90
- if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) return [
91
- firstPage,
92
- ELLIPSIS,
93
- ...createRange(totalPages - (3 + 2 * siblingPagesCount) + 1, totalPages)
94
- ];
90
+ if (shouldShowLeftEllipsis && !shouldShowRightEllipsis) {
91
+ const rightRange = createRange(totalPages - (3 + 2 * siblingPagesCount) + 1, totalPages);
92
+ return [
93
+ firstPage,
94
+ ELLIPSIS,
95
+ ...rightRange
96
+ ];
97
+ }
95
98
  /**
96
99
  * Case 4: Both left and right ellipsis are necessary.
97
100
  * This occurs when the current page is far enough from both the start and
98
101
  * end of the pagination range.
99
102
  */
100
- if (shouldShowLeftEllipsis && shouldShowRightEllipsis) return [
101
- firstPage,
102
- ELLIPSIS,
103
- ...createRange(leftSiblingIndex, rightSiblingIndex),
104
- ELLIPSIS,
105
- lastPage
106
- ];
103
+ if (shouldShowLeftEllipsis && shouldShowRightEllipsis) {
104
+ const middleRange = createRange(leftSiblingIndex, rightSiblingIndex);
105
+ return [
106
+ firstPage,
107
+ ELLIPSIS,
108
+ ...middleRange,
109
+ ELLIPSIS,
110
+ lastPage
111
+ ];
112
+ }
107
113
  return [];
108
114
  }, [
109
115
  totalResults,
@@ -30,22 +30,32 @@ function CheckboxGroup({ __scopeCheckboxGroup, defaultValue, dir, disabled = fal
30
30
  onChange: onValueChange,
31
31
  prop: valueProperty
32
32
  });
33
+ /**
34
+ * Handles checking a checkbox item
35
+ * @param itemValue - Value of the checkbox being checked
36
+ */
37
+ const handleItemCheck = useCallback((itemValue) => {
38
+ setValue((previousValue) => [...previousValue ?? [], itemValue]);
39
+ }, [setValue]);
40
+ /**
41
+ * Handles unchecking a checkbox item
42
+ * @param itemValue - Value of the checkbox being unchecked
43
+ */
44
+ const handleItemUncheck = useCallback((itemValue) => {
45
+ setValue((previousValue) => {
46
+ const currentValue = previousValue ?? [];
47
+ if (required && currentValue.length === 1 && currentValue[0] === itemValue) return currentValue;
48
+ return currentValue.filter((inputValue) => inputValue !== itemValue);
49
+ });
50
+ }, [setValue, required]);
33
51
  return /* @__PURE__ */ jsx(CheckboxGroupContextProvider, {
34
52
  disabled,
35
53
  name,
36
54
  required,
37
55
  scope: __scopeCheckboxGroup,
38
56
  value,
39
- onItemCheck: useCallback((itemValue) => {
40
- setValue((previousValue) => [...previousValue ?? [], itemValue]);
41
- }, [setValue]),
42
- onItemUncheck: useCallback((itemValue) => {
43
- setValue((previousValue) => {
44
- const currentValue = previousValue ?? [];
45
- if (required && currentValue.length === 1 && currentValue[0] === itemValue) return currentValue;
46
- return currentValue.filter((inputValue) => inputValue !== itemValue);
47
- });
48
- }, [setValue, required]),
57
+ onItemCheck: handleItemCheck,
58
+ onItemUncheck: handleItemUncheck,
49
59
  children: /* @__PURE__ */ jsx(RovingFocus.Root, {
50
60
  asChild: true,
51
61
  ...rovingFocusGroupScope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/ui",
3
- "version": "0.5.0-canary.1",
3
+ "version": "0.5.0-canary.2",
4
4
  "description": "Core UI components library built with React and Tailwind CSS",
5
5
  "keywords": [
6
6
  "components",
@@ -526,30 +526,30 @@
526
526
  "cmdk": "^1.1.1",
527
527
  "embla-carousel-react": "^8.6.0",
528
528
  "input-otp": "^1.4.2",
529
- "lucide-react": "^1.22.0",
529
+ "lucide-react": "^1.23.0",
530
530
  "next-themes": "^0.4.6",
531
- "radix-ui": "^1.6.0",
531
+ "radix-ui": "^1.6.1",
532
532
  "react-hook-form": "^7.80.0",
533
- "react-resizable-panels": "^4.11.2",
534
- "recharts": "^3.9.0",
533
+ "react-resizable-panels": "^4.12.0",
534
+ "recharts": "^3.9.1",
535
535
  "sonner": "^2.0.7",
536
536
  "tw-animate-css": "^1.4.0",
537
537
  "vaul": "^1.1.2",
538
- "@codefast/tailwind-variants": "0.5.0-canary.1"
538
+ "@codefast/tailwind-variants": "0.5.0-canary.2"
539
539
  },
540
540
  "devDependencies": {
541
541
  "@storybook/addon-a11y": "^10.4.6",
542
542
  "@storybook/addon-docs": "^10.4.6",
543
543
  "@storybook/addon-vitest": "^10.4.6",
544
544
  "@storybook/react-vite": "^10.4.6",
545
- "@tailwindcss/postcss": "^4.3.1",
545
+ "@tailwindcss/postcss": "^4.3.2",
546
546
  "@testing-library/dom": "^10.4.1",
547
547
  "@testing-library/jest-dom": "^6.9.1",
548
548
  "@testing-library/react": "^16.3.2",
549
549
  "@testing-library/user-event": "^14.6.1",
550
550
  "@types/jest-axe": "^3.5.9",
551
- "@types/node": "^26.0.1",
552
- "@typescript/native-preview": "7.0.0-dev.20260624.1",
551
+ "@types/node": "^26.1.0",
552
+ "@typescript/native-preview": "7.0.0-dev.20260702.3",
553
553
  "@vitejs/plugin-react": "^6.0.3",
554
554
  "@vitest/browser": "^4.1.9",
555
555
  "@vitest/browser-playwright": "^4.1.9",
@@ -559,11 +559,11 @@
559
559
  "playwright": "^1.61.1",
560
560
  "postcss": "^8.5.16",
561
561
  "storybook": "^10.4.6",
562
- "tailwindcss": "^4.3.1",
562
+ "tailwindcss": "^4.3.2",
563
563
  "tsdown": "^0.22.3",
564
564
  "typescript": "^6.0.3",
565
565
  "vitest": "^4.1.9",
566
- "@codefast/typescript-config": "0.5.0-canary.1"
566
+ "@codefast/typescript-config": "0.5.0-canary.2"
567
567
  },
568
568
  "peerDependencies": {
569
569
  "@types/react": ">=19.0.0",