@adaptive-sm/astro-ui 0.3.0 → 0.4.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.
@@ -5,6 +5,7 @@ import { classesButtonDisabled } from "./classesButtonDisabled"
5
5
 
6
6
  export type ButtonVariant = keyof typeof buttonVariant
7
7
  export const buttonVariant = {
8
+ none: "none",
8
9
  // transparent bg
9
10
  outline: "outline",
10
11
  ghost: "ghost",
@@ -54,6 +55,7 @@ const variantClasses = {
54
55
  //
55
56
  // transparent bg
56
57
  //
58
+ none: "",
57
59
  outline: classArr(
58
60
  "bg-transparent dark:bg-transparent",
59
61
  "dark:text-slate-100", // text
@@ -0,0 +1 @@
1
+ export const iconApple = "M 12.1267 7.74663 C 11.3367 7.74663 10.1142 6.8483 8.82669 6.87997 C 7.1267 6.90247 5.56838 7.8658 4.69255 9.39162 C 2.9284 12.4541 4.23756 16.9774 5.95838 19.4666 C 6.80254 20.6782 7.79837 22.0415 9.11836 21.999 C 10.385 21.9449 10.86 21.1765 12.3975 21.1765 C 13.9233 21.1765 14.3558 21.999 15.6975 21.9665 C 17.0616 21.9449 17.9275 20.7332 18.7608 19.5099 C 19.7241 18.1032 20.1241 16.7391 20.1458 16.6641 C 20.1133 16.6532 17.4941 15.6466 17.4625 12.6166 C 17.4408 10.0833 19.5291 8.87162 19.6266 8.81746 C 18.4358 7.0758 16.6075 6.8808 15.9683 6.83747 C 14.3017 6.70747 12.9058 7.7458 12.1267 7.7458 Z M 14.9417 5.19165 C 15.6441 4.34832 16.1083 3.16916 15.9791 2 C 14.9733 2.04333 13.7608 2.67083 13.0358 3.51499 C 12.3858 4.26165 11.8242 5.46331 11.975 6.60997 C 13.09 6.69664 14.2375 6.03664 14.9408 5.19248"
@@ -0,0 +1,2 @@
1
+ export const iconGooglePlay =
2
+ "m20.35 13.08-3.266 1.848-2.929-2.911 2.953-2.934 3.242 1.835c.3896.2204.6305.6333.6305 1.081s-.2409.8605-.6305 1.081zm-17.23-10.31c-.06184.1501-.09356.311-.09334.4733v17.51c0 .1809.0375.3492.1033.5001l9.296-9.239zm10.17 8.388 2.715-2.698-11.13-6.297c-.2385-.137-.5163-.1896-.7883-.1492zm0 1.723-9.167 9.111c.2483.03.51-.0133.755-.1525l11.1-6.283z"
package/lib/img/Img.astro CHANGED
@@ -4,6 +4,7 @@ import { classesImgZoomInOnHover10 } from "./classesImgZoomInOnHover10"
4
4
  import { classMerge } from "~ui/utils/classMerge"
5
5
 
6
6
  interface Props {
7
+ id?: string
7
8
  alt: string
8
9
  src: string
9
10
  zoomIn?: boolean
@@ -19,6 +20,7 @@ const p = Astro.props
19
20
  ---
20
21
 
21
22
  <img
23
+ id={p.id}
22
24
  src={p.src}
23
25
  alt={p.alt}
24
26
  class={classMerge(p.zoomIn && classesImgZoomInOnHover10, p.class)}
@@ -6,6 +6,7 @@ import type { ImageType } from "./ImageType"
6
6
  import Img from "./Img.astro"
7
7
 
8
8
  interface Props {
9
+ id?: string
9
10
  img: ImageType
10
11
  zoomIn?: boolean
11
12
  invertColorsInDarkMode?: boolean
@@ -19,6 +20,7 @@ const imageUrl = (p.srcPrefix ? p.srcPrefix : "") + p.img.path
19
20
  ---
20
21
 
21
22
  <Img
23
+ id={p.id}
22
24
  src={imageUrl}
23
25
  alt={p.img.alt}
24
26
  class={classArr(p.invertColorsInDarkMode ? classInvertBlack : "", p.class)}
@@ -4,6 +4,7 @@ import type { ImageType } from "./ImageType"
4
4
  import TypedImg from "~ui/img/TypedImg.astro"
5
5
 
6
6
  interface Props {
7
+ id?: string
7
8
  img: ImageType
8
9
  zoomIn?: boolean
9
10
  invertColorsInDarkMode?: boolean
@@ -14,6 +15,7 @@ const p = Astro.props
14
15
  ---
15
16
 
16
17
  <TypedImg
18
+ id={p.id}
17
19
  img={p.img}
18
20
  srcPrefix="/media-b2/"
19
21
  zoomIn={p.zoomIn}
@@ -1,9 +1,9 @@
1
1
  ---
2
- import "./Modal.module.css"
2
+ import Button from "~ui/button/Button.astro"
3
+ import { buttonVariant, type ButtonSize, type ButtonVariant } from "~ui/button/buttonCva"
3
4
  import { classesTextHeader } from "~ui/text/classesTextHeader"
4
5
  import { classMerge } from "~ui/utils/classMerge"
5
- import { buttonVariant } from "~ui/button/buttonCva"
6
- import Button from "~ui/button/Button.astro"
6
+ import "./Modal.module.css"
7
7
 
8
8
  /**
9
9
  * https://github.com/markteekman/accessible-astro-components/blob/main/Modal.astro
@@ -13,16 +13,25 @@ interface Props {
13
13
  title: string
14
14
  titleClass?: string
15
15
  closeText?: string
16
+
17
+ close?: {
18
+ text?: string
19
+ variant?: ButtonVariant
20
+ size?: ButtonSize
21
+ class?: string
22
+ icon?: string
23
+ iconClass?: string
24
+ }
25
+
16
26
  class?: string
17
27
  classContentArea?: string
18
28
  }
19
29
 
20
- const props = Astro.props
21
- const triggerId = props.triggerId
22
- const title = props.title
23
- const titleClass = props.titleClass
24
- const closeText = props.closeText ?? "Close"
25
- const classContentArea = props.classContentArea
30
+ const p = Astro.props
31
+ const triggerId = p.triggerId
32
+ const title = p.title
33
+ const titleClass = p.titleClass
34
+ const classContentArea = p.classContentArea
26
35
  const closeId = `${triggerId}-close`
27
36
  ---
28
37
 
@@ -33,7 +42,7 @@ const closeId = `${triggerId}-close`
33
42
  "max-w-5xl",
34
43
  "bg-white dark:bg-gray-900 text-black dark:text-white", // bg
35
44
  "border-1 border-black p-4 rounded-xl", // border
36
- props.class,
45
+ p.class,
37
46
  )}
38
47
  aria-labelledby={triggerId}
39
48
  >
@@ -43,7 +52,14 @@ const closeId = `${triggerId}-close`
43
52
  {title}
44
53
  </h2>
45
54
  <slot>Modal description</slot>
46
- <Button id={closeId} variant={buttonVariant.outline} class="modal-close w-full">{closeText}</Button>
55
+ <Button
56
+ id={closeId}
57
+ icon={p.close?.icon}
58
+ iconClass={p.close?.iconClass}
59
+ size={p.close?.size}
60
+ variant={p.close?.variant ?? buttonVariant.outline}
61
+ class={classMerge("modal-close w-full", p.close?.class)}>{p.close?.text ?? "Close"}</Button
62
+ >
47
63
  </div>
48
64
  </div>
49
65
  </dialog>
@@ -1,9 +1,9 @@
1
1
  ---
2
+ import Button from "~ui/button/Button.astro"
2
3
  import type { ButtonSize, ButtonVariant } from "~ui/button/buttonCva"
3
- import Modal from "./Modal.astro"
4
4
  import { classesTextGray } from "~ui/text/classesTextGray"
5
5
  import { classArr } from "~ui/utils/classArr"
6
- import Button from "~ui/button/Button.astro"
6
+ import Modal from "./Modal.astro"
7
7
 
8
8
  interface Props {
9
9
  button: {
@@ -16,8 +16,17 @@ interface Props {
16
16
  iconClass?: string
17
17
  class?: string
18
18
  }
19
+ close?: {
20
+ text?: string
21
+ variant?: ButtonVariant
22
+ size?: ButtonSize
23
+ class?: string
24
+ icon?: string
25
+ iconClass?: string
26
+ }
19
27
  id?: string
20
28
  title?: string
29
+ titleClass?: string
21
30
  class?: string
22
31
  classContentArea?: string
23
32
  }
@@ -46,9 +55,10 @@ const classContentArea = p.classContentArea
46
55
  <Modal
47
56
  triggerId={id}
48
57
  title={title}
49
- titleClass={classArr(classesTextGray, "text-xl", "mb-2")}
58
+ titleClass={classArr(classesTextGray, "text-xl", "mb-2", p.titleClass)}
50
59
  class={p.class}
51
60
  classContentArea={classContentArea}
61
+ close={p.close}
52
62
  >
53
63
  <slot />
54
64
  </Modal>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptive-sm/astro-ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "scripts": {
5
5
  "astro": "astro",
6
6
  "dev": "nice -5 astro dev",