@youversion/design-system-components 0.6.1 → 0.7.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 +6 -0
- package/dist/Dialog/Dialog.d.ts +56 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -0
- package/dist/Dialog/index.d.ts +2 -0
- package/dist/Dialog/index.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +558 -486
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HtmlHTMLAttributes } from 'react';
|
|
2
|
+
import { AllCapsVariant } from '../Button';
|
|
3
|
+
type ConfirmationOptions = Omit<AllCapsVariant, 'children'> & {
|
|
4
|
+
label: string;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
};
|
|
7
|
+
export interface DialogProps extends HtmlHTMLAttributes<HTMLDialogElement> {
|
|
8
|
+
/** Focus on first focusable element in scope. Defaults to `true`. */
|
|
9
|
+
autoFocus?: boolean;
|
|
10
|
+
/** Array of buttons that may be added to confirmation type dialog. */
|
|
11
|
+
confirmationButtons?: Array<ConfirmationOptions>;
|
|
12
|
+
/** Either `'confirmation'` or `'modal'`. Defaults to `'modal'`. */
|
|
13
|
+
dialogType?: 'confirmation' | 'modal';
|
|
14
|
+
/** The heading of the dialog. */
|
|
15
|
+
heading?: string;
|
|
16
|
+
/** Boolean that allows the modal to be closed by clicking outside of it. Defaults to `true`. */
|
|
17
|
+
isDismissableOnOutsideClick?: boolean;
|
|
18
|
+
/** Called when close button is pressed. Needs to set the isOpen state to false. */
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A Dialog is a type of modal window that appears in front of app content to provide critical information or ask for a decision.
|
|
23
|
+
*
|
|
24
|
+
* Accepts {@link DialogProps}.
|
|
25
|
+
*
|
|
26
|
+
* @returns A styled Dialog with an overlay.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* import { Button, Dialog, Text } from '@youversion/design-system-components';
|
|
31
|
+
* import { useState } from 'react';
|
|
32
|
+
*
|
|
33
|
+
* function MyComponent() {
|
|
34
|
+
* const [isOpen, setIsOpen] = useState(true);
|
|
35
|
+
* const handleClose = () => setIsOpen(false);
|
|
36
|
+
* const handleOpen = () => setIsOpen(true);
|
|
37
|
+
*
|
|
38
|
+
* return (
|
|
39
|
+
* <>
|
|
40
|
+
* <Button onClick={handleOpen}>Open Dialog</Button>
|
|
41
|
+
* {isOpen ?
|
|
42
|
+
* <Dialog
|
|
43
|
+
* dialogType="modal"
|
|
44
|
+
* onClose={handleClose}
|
|
45
|
+
* >
|
|
46
|
+
* <Text>Contents of the Dialog.</Text>
|
|
47
|
+
* </Dialog>
|
|
48
|
+
* : null}
|
|
49
|
+
* </>
|
|
50
|
+
* )
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDialogElement>>;
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAE,cAAc,EAAU,MAAM,WAAW,CAAC;AAMnD,KAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IAC5D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,kBAAkB,CAAC,iBAAiB,CAAC;IACxE,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACjD,mEAAmE;IACnE,UAAU,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;IACtC,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gGAAgG;IAChG,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,mFAAmF;IACnF,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAoED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,MAAM,2GAA8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Dialog/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9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