@sikka/hawa 0.0.111 → 0.0.113

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.
Files changed (49) hide show
  1. package/dist/styles.css +10 -10
  2. package/es/elements/HawaAlert.d.ts +7 -0
  3. package/es/elements/HawaButton.d.ts +2 -1
  4. package/es/elements/HawaRadio.d.ts +6 -1
  5. package/es/elements/HawaSnackbar.d.ts +7 -0
  6. package/es/index.es.js +1 -1
  7. package/es/layout/SimpleGrid.d.ts +10 -0
  8. package/es/layout/index.d.ts +1 -0
  9. package/es/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
  10. package/es/stories/LayoutStories/SimpleGrid.stories.d.ts +4 -0
  11. package/lib/elements/HawaAlert.d.ts +7 -0
  12. package/lib/elements/HawaButton.d.ts +2 -1
  13. package/lib/elements/HawaRadio.d.ts +6 -1
  14. package/lib/elements/HawaSnackbar.d.ts +7 -0
  15. package/lib/index.js +1 -1
  16. package/lib/layout/SimpleGrid.d.ts +10 -0
  17. package/lib/layout/index.d.ts +1 -0
  18. package/lib/stories/ElementsStories/Snackbar.stories.d.ts +1 -0
  19. package/lib/stories/LayoutStories/SimpleGrid.stories.d.ts +4 -0
  20. package/package.json +1 -1
  21. package/src/blocks/Account/UserSettingsForm.tsx +0 -1
  22. package/src/elements/HawaAlert.tsx +21 -0
  23. package/src/elements/HawaButton.tsx +9 -2
  24. package/src/elements/HawaRadio.tsx +7 -2
  25. package/src/elements/HawaSnackbar.tsx +24 -2
  26. package/src/elements/HawaTextField.tsx +1 -1
  27. package/src/layout/HawaContainer.tsx +2 -3
  28. package/src/layout/SimpleGrid.tsx +42 -0
  29. package/src/layout/index.ts +1 -0
  30. package/src/styles.css +10 -10
  31. package/storybook-static/51.8ca217c6882b6d3971a8.manager.bundle.js +2 -0
  32. package/storybook-static/{51.786e9bbba427ee454dc0.manager.bundle.js.LICENSE.txt → 51.8ca217c6882b6d3971a8.manager.bundle.js.LICENSE.txt} +0 -0
  33. package/storybook-static/51.aeae4f67.iframe.bundle.js +2 -0
  34. package/storybook-static/{51.acbbdb95.iframe.bundle.js.LICENSE.txt → 51.aeae4f67.iframe.bundle.js.LICENSE.txt} +0 -0
  35. package/storybook-static/669.31ae8ecc.iframe.bundle.js +2 -0
  36. package/storybook-static/{733.819a1db2.iframe.bundle.js.LICENSE.txt → 669.31ae8ecc.iframe.bundle.js.LICENSE.txt} +0 -0
  37. package/storybook-static/767.294896b3de4a98c7bd38.manager.bundle.js +2 -0
  38. package/storybook-static/{767.2f9c96fa3338c8d16078.manager.bundle.js.LICENSE.txt → 767.294896b3de4a98c7bd38.manager.bundle.js.LICENSE.txt} +0 -0
  39. package/storybook-static/iframe.html +1 -1
  40. package/storybook-static/index.html +1 -1
  41. package/storybook-static/main.5ddcc678.iframe.bundle.js +1 -0
  42. package/storybook-static/project.json +1 -1
  43. package/storybook-static/{runtime~main.25eae181fe0f96887a15.manager.bundle.js → runtime~main.118c8621e276a271ad89.manager.bundle.js} +1 -1
  44. package/storybook-static/{runtime~main.4d0bf318.iframe.bundle.js → runtime~main.4a2964ac.iframe.bundle.js} +1 -1
  45. package/storybook-static/51.786e9bbba427ee454dc0.manager.bundle.js +0 -2
  46. package/storybook-static/51.acbbdb95.iframe.bundle.js +0 -2
  47. package/storybook-static/733.819a1db2.iframe.bundle.js +0 -2
  48. package/storybook-static/767.2f9c96fa3338c8d16078.manager.bundle.js +0 -2
  49. package/storybook-static/main.e3c09016.iframe.bundle.js +0 -1
@@ -0,0 +1,10 @@
1
+ import { FC, ReactNode } from "react";
2
+ type TSimpleGrid = {
3
+ columns: number;
4
+ spacing?: number;
5
+ spacingX?: number;
6
+ spacingY?: number;
7
+ children?: ReactNode;
8
+ };
9
+ declare const SimpleGrid: FC<TSimpleGrid>;
10
+ export default SimpleGrid;
@@ -2,3 +2,4 @@ export * from "./Box";
2
2
  export * from "./HawaBottomAppBar";
3
3
  export * from "./HawaLayout";
4
4
  export * from "./HawaContainer";
5
+ export * from "./SimpleGrid";
@@ -6,3 +6,4 @@ export declare const Success: any;
6
6
  export declare const Warning: any;
7
7
  export declare const Info: any;
8
8
  export declare const Error: any;
9
+ export declare const WithActions: any;
@@ -0,0 +1,4 @@
1
+ import { Meta, Story } from "@storybook/react";
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const SimpleGrindComponent: Story;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sikka/hawa",
3
- "version": "0.0.111",
3
+ "version": "0.0.113",
4
4
  "description": "UI Kit",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.es.js",
@@ -13,7 +13,6 @@ export const UserSettingsForm: React.FunctionComponent<
13
13
  > = (props) => {
14
14
  return (
15
15
  <HawaContainer>
16
- {" "}
17
16
  {props.children}
18
17
  <HawaButton
19
18
  color="primary"
@@ -1,5 +1,6 @@
1
1
  import React from "react"
2
2
  import clsx from "clsx"
3
+ import { HawaButton } from "./HawaButton"
3
4
 
4
5
  let severities = {
5
6
  info: "text-blue-700 bg-blue-100 dark:bg-blue-200 dark:text-blue-800",
@@ -13,6 +14,13 @@ type AlertTypes = {
13
14
  title?: any
14
15
  text: any
15
16
  hideIcon?: any
17
+ actions?: [
18
+ {
19
+ label: string
20
+ onClick: any
21
+ variant: "contained" | "outlined"
22
+ }
23
+ ]
16
24
  }
17
25
  export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
18
26
  return (
@@ -25,6 +33,19 @@ export const HawaAlert: React.FunctionComponent<AlertTypes> = (props) => {
25
33
  >
26
34
  <span className="font-medium">{props.title}</span>
27
35
  <span>{" " + props.text}</span>
36
+ {props.actions && (
37
+ <div className="mt-2 flex flex-row gap-2">
38
+ {props.actions.map((act) => (
39
+ <HawaButton
40
+ variant={act.variant}
41
+ onClick={act.onClick()}
42
+ margins="none"
43
+ >
44
+ {act.label}
45
+ </HawaButton>
46
+ ))}
47
+ </div>
48
+ )}
28
49
  </div>
29
50
  )
30
51
  }
@@ -6,7 +6,8 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
6
  color?: "default" | "primary" | "secondary"
7
7
  width?: "full" | "normal" | "half"
8
8
  size?: "small" | "medium" | "large" | "noPadding"
9
- tooltip?: string,
9
+ margins?: "none" | "1" | "2" | "3" | "4"
10
+ tooltip?: string
10
11
  isLoading?: boolean
11
12
  }
12
13
 
@@ -59,6 +60,7 @@ export function HawaButton({
59
60
  width = "normal",
60
61
  disabled = false,
61
62
  isLoading = false,
63
+ margins = "2",
62
64
  tooltip,
63
65
  children,
64
66
  ...props
@@ -66,7 +68,12 @@ export function HawaButton({
66
68
  const [isHovered, setIsHovered] = React.useState(false)
67
69
 
68
70
  return (
69
- <div className="relative my-2">
71
+ <div
72
+ className={clsx(
73
+ "relative",
74
+ margins !== "none" ? `my-${margins}` : "my-0"
75
+ )}
76
+ >
70
77
  <button
71
78
  onMouseEnter={() => {
72
79
  setIsHovered(true)
@@ -2,7 +2,12 @@ import clsx from "clsx"
2
2
  import React, { useState } from "react"
3
3
 
4
4
  type RadioTypes = {
5
- options?: any
5
+ options?: [
6
+ {
7
+ value: any
8
+ label: any
9
+ }
10
+ ]
6
11
  onChangeTab?: any
7
12
  defaultValue?: any
8
13
  }
@@ -17,7 +22,7 @@ export const HawaRadio: React.FunctionComponent<RadioTypes> = (props) => {
17
22
  <div>
18
23
  <ul
19
24
  className={clsx(
20
- props.options.length > 2
25
+ props.options?.length > 2
21
26
  ? "flex-wrap xs:max-w-full xs:flex-nowrap"
22
27
  : "",
23
28
  "flex max-w-fit flex-row whitespace-nowrap rounded-lg bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400"
@@ -1,5 +1,6 @@
1
1
  import clsx from "clsx"
2
2
  import React, { FC } from "react"
3
+ import { HawaButton } from "./HawaButton"
3
4
 
4
5
  type THawaSnackBar = {
5
6
  severity: "info" | "warning" | "error" | "success" | "none"
@@ -12,6 +13,13 @@ type THawaSnackBar = {
12
13
  | "bottom-right"
13
14
  | "bottom-center"
14
15
  | "bottom-left"
16
+ actions?: [
17
+ {
18
+ label: string
19
+ onClick: any
20
+ variant: "contained" | "outlined"
21
+ }
22
+ ]
15
23
  }
16
24
 
17
25
  export const HawaSnackbar: FC<THawaSnackBar> = ({
@@ -19,6 +27,7 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
19
27
  description,
20
28
  severity = "info",
21
29
  position = "bottom-left",
30
+ actions,
22
31
  }) => {
23
32
  let defaultStyle =
24
33
  "fixed flex flex-row items-top p-1 w-full max-w-xs rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"
@@ -44,8 +53,21 @@ export const HawaSnackbar: FC<THawaSnackBar> = ({
44
53
  className={clsx(defaultStyle, severities[severity], positions[position])}
45
54
  >
46
55
  <div className="p-3">
47
- <div className="ml-3 text-sm font-bold">{title}</div>
48
- <div className="ml-3 text-sm font-normal">{description}</div>
56
+ <div className="text-sm font-bold">{title}</div>
57
+ <div className="text-sm font-normal">{description}</div>
58
+ {actions && (
59
+ <div className="mt-2 flex flex-row gap-2">
60
+ {actions.map((act) => (
61
+ <HawaButton
62
+ variant={act.variant}
63
+ onClick={act.onClick()}
64
+ margins="none"
65
+ >
66
+ {act.label}
67
+ </HawaButton>
68
+ ))}
69
+ </div>
70
+ )}
49
71
  </div>
50
72
  <button
51
73
  type="button"
@@ -56,7 +56,7 @@ export const HawaTextField: React.FunctionComponent<TextFieldTypes> = ({
56
56
  ) : (
57
57
  <input
58
58
  {...props}
59
- className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
59
+ className="mb-0 block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-gray-900 focus:border-blue-500 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400 dark:focus:border-blue-500 dark:focus:ring-blue-500"
60
60
  />
61
61
  )}
62
62
 
@@ -13,12 +13,11 @@ export const HawaContainer: React.FunctionComponent<ContainerTypes> = ({
13
13
  centered = false,
14
14
  ...props
15
15
  }) => {
16
- let defaultStyle =
17
- "flex w-full max-w-sm flex-col rounded-xl p-4 dark:bg-gray-600"
16
+ let defaultStyle = "flex w-full flex-col rounded-xl p-4 dark:bg-gray-600"
18
17
  let maxWidthStyles: any = {
19
18
  full: "md:max-w-xl",
20
19
  small: "md:max-w-sm w-1/3 min-w-min",
21
- normal: "md:max-w-md",
20
+ normal: "max-w-sm md:max-w-md",
22
21
  }
23
22
  let variantStyles = {
24
23
  contained: "bg-primary-300",
@@ -0,0 +1,42 @@
1
+ import { useState } from "@storybook/addons"
2
+ import clsx from "clsx"
3
+ import { FC, ReactNode } from "react"
4
+
5
+ type TSimpleGrid = {
6
+ columns: number
7
+ spacing?: number
8
+ spacingX?: number
9
+ spacingY?: number
10
+ children?: ReactNode
11
+ }
12
+
13
+ const SimpleGrid: FC<TSimpleGrid> = ({
14
+ columns = 2,
15
+ spacing,
16
+ spacingX,
17
+ spacingY,
18
+ children,
19
+ ...props
20
+ }) => {
21
+ const cols_num = "grid-cols-" + columns
22
+ const grid_spacing = "gap-" + spacing
23
+ const grid_spacing_x = "gap-x-" + spacingX
24
+ const grid_spacing_y = "gap-y-" + spacingY
25
+
26
+
27
+ return (
28
+ <div
29
+ className={clsx(
30
+ "grid",
31
+ cols_num,
32
+ spacing ?? grid_spacing,
33
+ grid_spacing_x,
34
+ grid_spacing_y
35
+ )}
36
+ >
37
+ {children}
38
+ </div>
39
+ )
40
+ }
41
+
42
+ export default SimpleGrid
@@ -3,3 +3,4 @@ export * from "./Box";
3
3
  export * from "./HawaBottomAppBar";
4
4
  export * from "./HawaLayout";
5
5
  export * from "./HawaContainer";
6
+ export * from "./SimpleGrid";
package/src/styles.css CHANGED
@@ -587,14 +587,18 @@ video {
587
587
  margin-left: 0.25rem;
588
588
  margin-right: 0.25rem;
589
589
  }
590
- .my-2 {
591
- margin-top: 0.5rem;
592
- margin-bottom: 0.5rem;
590
+ .my-0 {
591
+ margin-top: 0px;
592
+ margin-bottom: 0px;
593
593
  }
594
594
  .mx-2 {
595
595
  margin-left: 0.5rem;
596
596
  margin-right: 0.5rem;
597
597
  }
598
+ .my-2 {
599
+ margin-top: 0.5rem;
600
+ margin-bottom: 0.5rem;
601
+ }
598
602
  .my-7 {
599
603
  margin-top: 1.75rem;
600
604
  margin-bottom: 1.75rem;
@@ -603,10 +607,6 @@ video {
603
607
  margin-top: 0.125rem;
604
608
  margin-bottom: 0.125rem;
605
609
  }
606
- .my-0 {
607
- margin-top: 0px;
608
- margin-bottom: 0px;
609
- }
610
610
  .ml-auto {
611
611
  margin-left: auto;
612
612
  }
@@ -619,6 +619,9 @@ video {
619
619
  .mb-4 {
620
620
  margin-bottom: 1rem;
621
621
  }
622
+ .mt-2 {
623
+ margin-top: 0.5rem;
624
+ }
622
625
  .mb-0 {
623
626
  margin-bottom: 0px;
624
627
  }
@@ -652,9 +655,6 @@ video {
652
655
  .ml-2 {
653
656
  margin-left: 0.5rem;
654
657
  }
655
- .mt-2 {
656
- margin-top: 0.5rem;
657
- }
658
658
  .mb-5 {
659
659
  margin-bottom: 1.25rem;
660
660
  }