@youversion/design-system-components 0.0.4 → 0.0.5

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,15 @@
1
1
  # @youversion/design-system-components
2
2
 
3
+ ## 0.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 6134287: - Updated **ListItem** to support _startAction_ and _endAction_
8
+ - Added RTL support to storybook
9
+ - Updated RTL styling in **Input**
10
+ - 5031ce0: Added `LinkButton` component.
11
+ Updated `Button` component's variable naming and logic.
12
+
3
13
  ## 0.0.4
4
14
 
5
15
  ### Patch Changes
@@ -1,13 +1,29 @@
1
1
  import { ElementType } from 'react';
2
2
  import { AllHTMLAttributes, ForwardedRef } from 'react';
3
- export declare const variantClasses: {
3
+ export type IconPosition = 'start' | 'end' | undefined;
4
+ export declare const buttonSizeOptions: {
4
5
  lg: string;
5
6
  md: string;
6
7
  sm: string;
7
8
  xl: string;
8
9
  xs: string;
9
10
  };
10
- export declare const themeClasses: {
11
+ export declare const determineSizeClasses: (iconPosition: IconPosition) => {
12
+ lg: string;
13
+ md: string;
14
+ sm: string;
15
+ xl: string;
16
+ xs: string;
17
+ };
18
+ export declare const iconSizes: {
19
+ lg: number;
20
+ md: number;
21
+ sm: number;
22
+ xl: number;
23
+ xs: number;
24
+ };
25
+ export declare const defaultButtonClasses = "items-center leading-default font-bold ease-in-out duration-100 focus:outline-2 focus:outline-info-light dark:focus:outline-info-dark flex w-full max-w-fit";
26
+ export declare const variantClasses: {
11
27
  all_caps: string;
12
28
  borderless: string;
13
29
  brand: string;
@@ -19,16 +35,16 @@ export declare const themeClasses: {
19
35
  export interface BaseButtonProps extends Omit<AllHTMLAttributes<HTMLButtonElement>, 'size'> {
20
36
  children: React.ReactNode;
21
37
  icon?: ElementType;
22
- iconPosition?: 'start' | 'end';
38
+ iconPosition?: IconPosition;
23
39
  type?: 'button' | 'submit' | 'reset';
24
40
  }
25
41
  export interface BaseVariants extends BaseButtonProps {
26
- theme: 'secondary' | 'primary' | 'stroked' | 'borderless' | 'risk' | 'brand';
27
- variant: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
42
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
43
+ variant?: 'secondary' | 'primary' | 'stroked' | 'borderless' | 'risk' | 'brand';
28
44
  }
29
45
  export interface AllCapsVariant extends BaseButtonProps {
30
- theme: 'all_caps';
31
- variant: 'xs' | 'sm' | 'md';
46
+ size?: 'xs' | 'sm' | 'md';
47
+ variant?: 'all_caps';
32
48
  }
33
49
  export type ButtonProps = BaseVariants | AllCapsVariant;
34
50
  /**
@@ -37,8 +53,8 @@ export type ButtonProps = BaseVariants | AllCapsVariant;
37
53
  * @param children - Content of the Button.
38
54
  * @param icon - An Icon Element.
39
55
  * @param iconPosition - If and Where the Icon will be placed.
40
- * @param theme - The look of the button.
41
- * @param variant - The size of the button.
56
+ * @param variant - The look of the button.
57
+ * @param size - The size of the button.
42
58
  *
43
59
  * @returns A Button with content and styling.
44
60
  *
@@ -50,13 +66,13 @@ export type ButtonProps = BaseVariants | AllCapsVariant;
50
66
  * function MyComponent() {
51
67
  * return (
52
68
  * <>
53
- * <Button variant='sm' theme='primary' >Press Me!</Button>
69
+ * <Button>Press Me!</Button>
54
70
  * <Button icon={TriangleDownStroked} iconPosition='start' size='md' variant='secondary' >Press Me Too!</Button>
55
71
  * </>
56
72
  * )
57
73
  * }
58
74
  * ```
59
75
  */
60
- export declare const ButtonComponent: ({ className, children, disabled, icon, iconPosition, variant, theme, ...rest }: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => JSX.Element;
76
+ export declare const ButtonComponent: ({ className, children, disabled, icon, iconPosition, size, variant, ...rest }: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) => JSX.Element;
61
77
  export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
62
78
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAc,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAExD,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC;AAUF,eAAO,MAAM,YAAY;;;;;;;;CAexB,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACzF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC/B,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;CACtC;AAED,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;IAC7E,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3C;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,eAAO,MAAM,eAAe,mFACyE,WAAW,OACzG,aAAa,iBAAiB,CAAC,gBA+BrC,CAAC;AAEF,eAAO,MAAM,MAAM,2GAA8B,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAc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8B,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { ElementType, ForwardedRef } from 'react';
2
+ import { AllCapsVariant, BaseVariants } from '../Button';
3
+ export interface LinkButtonAllCapsWithComponentProps extends AllCapsVariant {
4
+ component: ElementType;
5
+ href?: string;
6
+ }
7
+ export interface LinkButtonWithComponentProps extends BaseVariants {
8
+ component: ElementType;
9
+ href?: string;
10
+ }
11
+ export interface LinkButtonAllCapsWithoutComponentProps extends AllCapsVariant {
12
+ component?: never;
13
+ href: string;
14
+ }
15
+ export interface LinkButtonWithoutComponentProps extends BaseVariants {
16
+ component?: never;
17
+ href: string;
18
+ }
19
+ export type LinkButtonProps = LinkButtonAllCapsWithComponentProps | LinkButtonWithComponentProps | LinkButtonAllCapsWithoutComponentProps | LinkButtonWithoutComponentProps;
20
+ export declare const LinkButtonComponent: ({ className, children, component, icon, iconPosition, variant, size, ...rest }: LinkButtonProps, ref: ForwardedRef<HTMLAnchorElement>) => JSX.Element;
21
+ /**
22
+ * The **LinkButton** is used to display a Button as a Link.
23
+ *
24
+ * Accepts {@link LinkButtonProps}.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * import { LinkButton } from '@youversion/design-system-components';
29
+ * import { TriangleDownStroked } from '@youversion/design-system-icons/index';
30
+ *
31
+ * function MyComponent() {
32
+ * return (
33
+ * <>
34
+ * <LinkButton href="https://www.bible.com" >Press Me!</LinkButton>
35
+ * <LinkButton href="https://www.bible.com" icon={TriangleDownStroked} iconPosition='start' size='md' variant='secondary' >Press Me Too!</LinkButton>
36
+ * </>
37
+ * )
38
+ * }
39
+ * ```
40
+ */
41
+ export declare const LinkButton: import("react").ForwardRefExoticComponent<LinkButtonProps & import("react").RefAttributes<HTMLAnchorElement>>;
42
+ //# sourceMappingURL=LinkButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LinkButton.d.ts","sourceRoot":"","sources":["../../../src/LinkButton/LinkButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAE,YAAY,EAAc,MAAM,OAAO,CAAC;AAE7E,OAAO,EACL,cAAc,EACd,YAAY,EAKb,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,mCAAoC,SAAQ,cAAc;IACzE,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,4BAA6B,SAAQ,YAAY;IAChE,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sCAAuC,SAAQ,cAAc;IAC5E,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,+BAAgC,SAAQ,YAAY;IACnE,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,eAAe,GACvB,mCAAmC,GACnC,4BAA4B,GAC5B,sCAAsC,GACtC,+BAA+B,CAAC;AAEpC,eAAO,MAAM,mBAAmB,mFAU3B,eAAe,OACb,aAAa,iBAAiB,CAAC,gBAiCrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU,+GAAkC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './LinkButton';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/LinkButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -1,11 +1,33 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
- export interface ListItemProps extends HTMLAttributes<HTMLLIElement> {
2
+ interface StartIconWithActionProps {
3
+ /** Action to take when clicking the startIcon. */
4
+ startAction: () => void;
5
+ startIcon: React.ReactNode;
6
+ }
7
+ interface StartIconWithOutActionProps {
8
+ startAction?: never;
9
+ startIcon?: React.ReactNode;
10
+ }
11
+ interface EndIconWithActionProps {
12
+ /** Action to take when clicking the endIcon. */
13
+ endAction: () => void;
14
+ endIcon: React.ReactNode;
15
+ }
16
+ interface EndIconWithoutActionProps {
17
+ endAction?: never;
18
+ endIcon?: React.ReactNode;
19
+ }
20
+ type StartIconAndActionProps = StartIconWithActionProps | StartIconWithOutActionProps;
21
+ type EndIconAndActionProps = EndIconWithActionProps | EndIconWithoutActionProps;
22
+ type AllIconAndActionProps = StartIconAndActionProps & EndIconAndActionProps;
23
+ interface ListItemPropsBase extends HTMLAttributes<HTMLLIElement> {
3
24
  children: React.ReactNode;
4
25
  className?: string;
26
+ /** Display a divider between ListItems. */
5
27
  divider?: boolean;
6
- endIcon?: React.ReactNode;
7
- startIcon?: React.ReactNode;
28
+ onClick?: () => void;
8
29
  }
30
+ export type ListItemProps = ListItemPropsBase & AllIconAndActionProps;
9
31
  /**
10
32
  * The **ListItem** component is to be used inside of the **List** component. This will be each item inside the list.
11
33
  *
@@ -32,4 +54,5 @@ export interface ListItemProps extends HTMLAttributes<HTMLLIElement> {
32
54
  * ```
33
55
  */
34
56
  export declare const ListItem: React.ForwardRefExoticComponent<ListItemProps & React.RefAttributes<HTMLLIElement>>;
57
+ export {};
35
58
  //# sourceMappingURL=ListItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/ListItem/ListItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAA4B,cAAc,EAAE,MAAM,OAAO,CAAC;AAExE,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,aAAa,CAAC;IAClE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AA2BD;;;;;;;;;;;;;;;;;;;;;;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Text.d.ts","sourceRoot":"","sources":["../../../src/ListItemText/ListItemText.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,kCAA0C,oBAAoB,gBAMtF,CAAC"}
1
+ {"version":3,"file":"ListItemText.d.ts","sourceRoot":"","sources":["../../../src/ListItemText/ListItemText.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,kCAA0C,oBAAoB,gBAMtF,CAAC"}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './Button';
3
3
  export * from './IconButton';
4
4
  export * from './IconLinkButton';
5
5
  export * from './Input';
6
+ export * from './LinkButton';
6
7
  export * from './List';
7
8
  export * from './ListItem';
8
9
  export * from './ListItemText';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}