@keeper-security/keeper-js-ui 0.3.1 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.0](https://github.com/Keeper-Security/keeper-js-ui/compare/v0.4.0...v0.5.0) (2025-01-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * add Toast component ([#137](https://github.com/Keeper-Security/keeper-js-ui/issues/137)) ([3343f1e](https://github.com/Keeper-Security/keeper-js-ui/commit/3343f1ea4f58975deb49e33d2088c8de18589100))
9
+ * **Button:** add destructive button ([#138](https://github.com/Keeper-Security/keeper-js-ui/issues/138)) ([187d27f](https://github.com/Keeper-Security/keeper-js-ui/commit/187d27f8d5aef1fd40db5c3df7f8f0330108a00d))
10
+ * **Switch:** remove useDirection() ([#141](https://github.com/Keeper-Security/keeper-js-ui/issues/141)) ([4180cb0](https://github.com/Keeper-Security/keeper-js-ui/commit/4180cb07ec306a0ffbc918b9a69279ed20bb9125))
11
+
12
+ ## [0.4.0](https://github.com/Keeper-Security/keeper-js-ui/compare/v0.3.1...v0.4.0) (2025-01-08)
13
+
14
+
15
+ ### Features
16
+
17
+ * **deps:** bump react peerDependencies from 18.2.0 to 18.3.1 ([#134](https://github.com/Keeper-Security/keeper-js-ui/issues/134)) ([1553b2a](https://github.com/Keeper-Security/keeper-js-ui/commit/1553b2abaf1e015a48fb1f34ca50c2699cbf0aeb)), closes [#135](https://github.com/Keeper-Security/keeper-js-ui/issues/135)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * add font-family rules to body to override extension page defaults ([#132](https://github.com/Keeper-Security/keeper-js-ui/issues/132)) ([356f262](https://github.com/Keeper-Security/keeper-js-ui/commit/356f262c15a06960157df391a09be95ee72e6883))
23
+
3
24
  ## [0.3.1](https://github.com/Keeper-Security/keeper-js-ui/compare/v0.3.0...v0.3.1) (2024-12-20)
4
25
 
5
26
 
package/README.md CHANGED
@@ -6,7 +6,7 @@ _React components built for accessibility, consistency, and speed._
6
6
 
7
7
  - Terminal of your choice.
8
8
  - [git](https://github.com/git-guides/install-git) - Type `git -v` into your terminal to verify.
9
- - [Node.js v18](https://nodejs.org/en/download/package-manager) - Type `node -v` into your terminal to verify.
9
+ - [Node.js v20](https://nodejs.org/en/download/package-manager) - Type `node -v` into your terminal to verify.
10
10
 
11
11
  ## Recommendations
12
12
 
@@ -212,6 +212,39 @@ There is no additional code you need to write after creating a new story. Storie
212
212
 
213
213
  When you push a change up to Github, an [action will run](https://github.com/Keeper-Security/keeper-js-ui/actions/workflows/storybook-tests.yml) these tests and give you feedback to the outcome.
214
214
 
215
+ ### Skipping Tests
216
+
217
+ You can leverage [Storybook tags](https://storybook.js.org/docs/writing-stories/tags) to skip or exclude stories from the test-runner. Tags can be applied at the file level via the `meta` object or to stories individually.
218
+
219
+ - `skip-tests` is ideal for in-progress work.
220
+
221
+ - It will **not** run the story as a test.
222
+ - It will be reported as one of the skipped tests in the test results.
223
+
224
+ - `no-tests` is ideal for stories that will never have any test value.
225
+
226
+ - It will **not** run the story as a test.
227
+ - It will **not** report individual stories as a skipped test. [^ignored-test-exception]
228
+
229
+ [^ignored-test-exception] If the `no-tests` tag is applied to **all** exported stories within a `*.stories.ts(x)` file, whether via the `meta` object or individually, it **will** be reported as a `skipped` test and test suite in the test results.
230
+
231
+ ```ts
232
+ // Temporarily skip testing a story.
233
+ export const SkipTesting: Story = {
234
+ tags: ['skip-tests'],
235
+ }
236
+
237
+ // Permanently skip testing a story.
238
+ export const IgnoreTesting: Story = {
239
+ tags: ['no-tests'],
240
+ }
241
+
242
+ // Apply a tag to all exported stories.
243
+ const meta = {
244
+ tags: ['skip-tests'],
245
+ } satisfies Meta<typeof Component>
246
+ ```
247
+
215
248
  ## Committing Changes
216
249
 
217
250
  If you're familiar with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary), feel free to commit using `git commit`.
@@ -6,8 +6,31 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
6
6
  import * as React_2 from 'react';
7
7
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
8
8
  import * as SwitchPrimitives from '@radix-ui/react-switch';
9
+ import * as ToastPrimitives from '@radix-ui/react-toast';
9
10
  import { VariantProps } from 'class-variance-authority';
10
11
 
12
+ /**
13
+ * Utility type that ensures at least one of the props is present.
14
+ *
15
+ * Give it a type with required props and it will modify it so that the one present is required and the others are optional.
16
+ *
17
+ * @template T - The type with required props
18
+ *
19
+ * @example
20
+ * type ValidA11y = AtLeastOneRequired<{
21
+ * id: string
22
+ * 'aria-label': string
23
+ * 'aria-labelledby': string
24
+ * }>
25
+ * // Invalid: {}
26
+ * // Valid: { id: 'email' }
27
+ * // Valid: { 'aria-label': 'Toggle notifications' }
28
+ * // Valid: { 'aria-labelledby': 'text-desc intro-paragraph' }
29
+ */
30
+ declare type AtLeastOneRequired<T, U = {
31
+ [K in keyof T]: Pick<T, K>;
32
+ }> = Partial<T> & U[keyof U];
33
+
11
34
  export declare const Avatar: React_2.ForwardRefExoticComponent<AvatarProps & React_2.RefAttributes<HTMLSpanElement>>;
12
35
 
13
36
  export declare const AvatarFallback: React_2.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React_2.RefAttributes<HTMLSpanElement>, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
@@ -61,7 +84,7 @@ declare interface ButtonProps extends ButtonBaseProps {
61
84
 
62
85
  declare const buttonVariants: (props?: ({
63
86
  variant?: "link" | "solid" | "outline" | "plain" | null | undefined;
64
- color?: "neutral" | "primary" | "secondary" | null | undefined;
87
+ color?: "neutral" | "primary" | "secondary" | "destructive" | null | undefined;
65
88
  fullWidth?: boolean | null | undefined;
66
89
  avatar?: boolean | null | undefined;
67
90
  iconOnly?: boolean | null | undefined;
@@ -155,6 +178,46 @@ declare interface IconButtonProps extends ButtonBaseProps {
155
178
 
156
179
  export declare const Separator: React_2.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
157
180
 
158
- export declare const Switch: React_2.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
181
+ export declare const Switch: React_2.ForwardRefExoticComponent<SwitchProps & React_2.RefAttributes<HTMLButtonElement>>;
182
+
183
+ declare type SwitchProps = AtLeastOneRequired<SwitchPropsA11y> & React_2.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>;
184
+
185
+ declare type SwitchPropsA11y = {
186
+ id: string;
187
+ 'aria-labelledby': string;
188
+ 'aria-label': string;
189
+ };
190
+
191
+ export declare const Toast: () => JSX_2.Element;
192
+
193
+ declare function toast({ ...props }: ToasterProps): {
194
+ id: string;
195
+ dismiss: () => void;
196
+ update: (props: ToasterToast) => void;
197
+ };
198
+
199
+ declare const ToastAction: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
200
+
201
+ declare type ToastActionElement = React_2.ReactElement<typeof ToastAction>;
202
+
203
+ declare type ToasterProps = Omit<ToasterToast, 'id'>;
204
+
205
+ declare type ToasterToast = ToastProps & {
206
+ id: string;
207
+ title?: React_2.ReactNode;
208
+ description?: React_2.ReactNode;
209
+ action?: ToastActionElement;
210
+ icon?: React_2.ReactNode;
211
+ };
212
+
213
+ declare type ToastProps = React_2.ComponentPropsWithoutRef<typeof ToastRoot>;
214
+
215
+ declare const ToastRoot: React_2.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React_2.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ClassProp | undefined) => string> & React_2.RefAttributes<HTMLLIElement>>;
216
+
217
+ export declare function useToast(): {
218
+ toast: typeof toast;
219
+ dismiss: (toastId?: string) => void;
220
+ toasts: ToasterToast[];
221
+ };
159
222
 
160
223
  export { }