@waveso/ui 0.9.1 → 0.10.0

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.
@@ -13,6 +13,17 @@ interface ActionBarEntry {
13
13
  /** Discard this form's changes. */
14
14
  onReset: () => void;
15
15
  }
16
+ /** Overridable button + status strings, for internationalization. */
17
+ interface ActionBarLabels {
18
+ /** Save button. @default "Save" */
19
+ save?: string;
20
+ /** Save button while a save is in progress. @default "Saving" */
21
+ saving?: string;
22
+ /** Reset button. @default "Reset" */
23
+ reset?: string;
24
+ /** Status shown when a save fails. @default "Couldn't save your changes" */
25
+ saveError?: string;
26
+ }
16
27
  interface ActionBarProviderProps {
17
28
  children: React.ReactNode;
18
29
  /** Message when one form has changes. */
@@ -24,6 +35,8 @@ interface ActionBarProviderProps {
24
35
  * users get) when guarded navigation is blocked.
25
36
  */
26
37
  blockedMessage?: string;
38
+ /** Overridable button + status strings (for i18n). Merged over the English defaults. */
39
+ labels?: ActionBarLabels;
27
40
  /** Additional className for the bar's inner content box (`data-slot="action-bar-content"`). */
28
41
  className?: string;
29
42
  }
@@ -56,6 +69,7 @@ declare function ActionBarProvider({
56
69
  message,
57
70
  pluralMessage,
58
71
  blockedMessage,
72
+ labels,
59
73
  className
60
74
  }: ActionBarProviderProps): _$react_jsx_runtime0.JSX.Element;
61
75
  /**
@@ -83,4 +97,4 @@ declare function useActionBar(id: string, entry: ActionBarEntry): void;
83
97
  */
84
98
  declare function useActionBarGuard(navigate: (href: string) => void): (href: string) => boolean;
85
99
  //#endregion
86
- export { type ActionBarEntry, ActionBarProvider, type ActionBarProviderProps, useActionBar, useActionBarGuard };
100
+ export { type ActionBarEntry, type ActionBarLabels, ActionBarProvider, type ActionBarProviderProps, useActionBar, useActionBarGuard };
@@ -48,7 +48,14 @@ const ActionBarContext = React.createContext(null);
48
48
  * useActionBar('profile', { hasChanges, saving, onSave, onReset });
49
49
  * ```
50
50
  */
51
- function ActionBarProvider({ children, message = "You have unsaved changes", pluralMessage = (count) => `${count} unsaved changes`, blockedMessage = "Save or reset your changes before leaving this page", className }) {
51
+ function ActionBarProvider({ children, message = "You have unsaved changes", pluralMessage = (count) => `${count} unsaved changes`, blockedMessage = "Save or reset your changes before leaving this page", labels, className }) {
52
+ const text = {
53
+ save: "Save",
54
+ saving: "Saving",
55
+ reset: "Reset",
56
+ saveError: "Couldn't save your changes",
57
+ ...labels
58
+ };
52
59
  const entriesRef = React.useRef(/* @__PURE__ */ new Map());
53
60
  const [, forceUpdate] = React.useState(0);
54
61
  const [jiggleTransform, setJiggleTransform] = React.useState(null);
@@ -205,7 +212,7 @@ function ActionBarProvider({ children, message = "You have unsaved changes", plu
205
212
  children: [/* @__PURE__ */ jsx("span", {
206
213
  "data-slot": "action-bar-message",
207
214
  className: cn("whitespace-nowrap text-sm font-medium", saveError ? "text-destructive" : "text-contrast"),
208
- children: saveError ? "Couldn't save your changes" : displayMessage
215
+ children: saveError ? text.saveError : displayMessage
209
216
  }), /* @__PURE__ */ jsxs("div", {
210
217
  "data-slot": "action-bar-actions",
211
218
  className: "flex items-center gap-1.5",
@@ -215,14 +222,14 @@ function ActionBarProvider({ children, message = "You have unsaved changes", plu
215
222
  disabled: anySaving,
216
223
  onClick: handleResetAll,
217
224
  className: "h-9 px-3 text-sm hover:text-destructive",
218
- children: "Reset"
225
+ children: text.reset
219
226
  }), /* @__PURE__ */ jsx(Button, {
220
227
  type: "button",
221
228
  variant: "default",
222
229
  disabled: anySaving,
223
230
  onClick: handleSaveAll,
224
231
  className: "h-9 px-4 text-sm",
225
- children: anySaving ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spinner, { className: "mr-1.5 h-3.5 w-3.5" }), "Saving"] }) : /* @__PURE__ */ jsxs(Fragment, { children: ["Save", /* @__PURE__ */ jsx(Kbd, {
232
+ children: anySaving ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Spinner, { className: "mr-1.5 h-3.5 w-3.5" }), text.saving] }) : /* @__PURE__ */ jsxs(Fragment, { children: [text.save, /* @__PURE__ */ jsx(Kbd, {
226
233
  className: "ml-1.5",
227
234
  children: isMac ? "⌘S" : "Ctrl+S"
228
235
  })] })
package/dist/button.d.ts CHANGED
@@ -7,7 +7,7 @@ import * as _$class_variance_authority_types0 from "class-variance-authority/typ
7
7
  //#region src/button.d.ts
8
8
  declare const buttonVariants: (props?: ({
9
9
  variant?: "default" | "outline" | "link" | "destructive" | "success" | "secondary" | "ghost" | null | undefined;
10
- size?: "default" | "sm" | "xs" | "icon" | "lg" | "xl" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ size?: "default" | "sm" | "xs" | "icon" | "icon-xs" | "icon-sm" | "lg" | "xl" | "icon-lg" | null | undefined;
11
11
  } & _$class_variance_authority_types0.ClassProp) | undefined) => string;
12
12
  type ButtonProps = React.ComponentProps<typeof Button$1> & VariantProps<typeof buttonVariants>;
13
13
  declare function Button({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waveso/ui",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Wave UI component library built on Base UI and Tailwind CSS",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -51,6 +51,7 @@
51
51
  "format": "biome format --write",
52
52
  "test": "vitest run --passWithNoTests",
53
53
  "test:watch": "vitest",
54
+ "check:package": "publint && attw --pack . --ignore-rules no-resolution",
54
55
  "clean": "rm -rf dist",
55
56
  "storybook": "storybook dev -p 6006",
56
57
  "build-storybook": "storybook build",
@@ -83,6 +84,7 @@
83
84
  }
84
85
  },
85
86
  "devDependencies": {
87
+ "@arethetypeswrong/cli": "^0.18.4",
86
88
  "@base-ui/react": "^1.6.0",
87
89
  "@biomejs/biome": "2.5.2",
88
90
  "@changesets/cli": "^2.27.0",
@@ -91,6 +93,7 @@
91
93
  "@storybook/react-vite": "~10.4.0",
92
94
  "@tailwindcss/vite": "^4.2.1",
93
95
  "@testing-library/dom": "^10.4.1",
96
+ "@testing-library/jest-dom": "^6.9.1",
94
97
  "@testing-library/react": "^16.3.2",
95
98
  "@testing-library/user-event": "^14.6.1",
96
99
  "@types/react": "^19",
@@ -100,6 +103,7 @@
100
103
  "input-otp": "^1.4.2",
101
104
  "jsdom": "^29.1.1",
102
105
  "motion": "^12.31.0",
106
+ "publint": "^0.3.21",
103
107
  "react": "^19.2.0",
104
108
  "react-dom": "^19.2.0",
105
109
  "react-hook-form": "^7.66.0",