opui-css 3.3.5 → 4.0.1

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 (174) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +105 -0
  4. package/README.md +66 -29
  5. package/astro/index.ts +46 -0
  6. package/components/AGENTS.md +247 -0
  7. package/components/Accordion/Accordion.astro +42 -0
  8. package/components/Anchor/Anchor.astro +51 -0
  9. package/components/Avatar/Avatar.astro +44 -0
  10. package/components/Badge/Badge.astro +54 -0
  11. package/components/Button/Button.astro +45 -0
  12. package/components/ButtonGroup/ButtonGroup.astro +29 -0
  13. package/components/Callout/Callout.astro +75 -0
  14. package/components/Card/Card.astro +38 -0
  15. package/components/Checkbox/Checkbox.astro +76 -0
  16. package/components/Checkbox/CheckboxInput.astro +32 -0
  17. package/components/Chip/Chip.astro +37 -0
  18. package/components/ClassicSelect/ClassicSelect.astro +83 -0
  19. package/components/DescriptionList/Description.astro +12 -0
  20. package/components/DescriptionList/DescriptionList.astro +22 -0
  21. package/components/DescriptionList/Item.astro +12 -0
  22. package/components/DescriptionList/Term.astro +12 -0
  23. package/components/DescriptionList/index.ts +12 -0
  24. package/components/Dialog/Dialog.astro +43 -0
  25. package/components/Divider/Divider.astro +14 -0
  26. package/components/Drawer/Drawer.astro +49 -0
  27. package/components/Drawer/DrawerFooter.astro +14 -0
  28. package/components/Drawer/DrawerHeader.astro +31 -0
  29. package/components/FieldDescription/FieldDescription.astro +13 -0
  30. package/components/FieldGroup/FieldGroup.astro +31 -0
  31. package/components/FieldLegend/FieldLegend.astro +15 -0
  32. package/components/FieldSet/FieldSet.astro +15 -0
  33. package/components/Form/Form.astro +15 -0
  34. package/components/IconButton/IconButton.astro +26 -0
  35. package/components/List/List.astro +36 -0
  36. package/components/ListItem/ListItem.astro +118 -0
  37. package/components/Progress/Progress.astro +40 -0
  38. package/components/Radio/Radio.astro +70 -0
  39. package/components/Radio/RadioInput.astro +24 -0
  40. package/components/Range/Range.astro +136 -0
  41. package/components/Select/Select.astro +106 -0
  42. package/components/Switch/Switch.astro +101 -0
  43. package/components/Switch/SwitchInput.astro +25 -0
  44. package/components/Table/Body.astro +13 -0
  45. package/components/Table/Cell.astro +13 -0
  46. package/components/Table/Column.astro +15 -0
  47. package/components/Table/ColumnGroup.astro +13 -0
  48. package/components/Table/Head.astro +13 -0
  49. package/components/Table/HeaderCell.astro +13 -0
  50. package/components/Table/Row.astro +13 -0
  51. package/components/Table/Table.astro +15 -0
  52. package/components/Table/index.ts +20 -0
  53. package/components/Tabs/Tabs.astro +28 -0
  54. package/components/Tabs/TabsItem.astro +47 -0
  55. package/components/Tabs/TabsPanel.astro +21 -0
  56. package/components/Tabs/TabsTab.astro +19 -0
  57. package/components/Tabs/index.ts +14 -0
  58. package/components/TextField/TextField.astro +128 -0
  59. package/components/Textarea/Textarea.astro +106 -0
  60. package/components/Toast/Toast.astro +42 -0
  61. package/components/ToggleButton/ToggleButton.astro +53 -0
  62. package/components/ToggleGroup/ToggleGroup.astro +49 -0
  63. package/components/Tooltip/Tooltip.astro +30 -0
  64. package/{src/core → core}/normalize.css +194 -196
  65. package/core/palette.css +59 -0
  66. package/{src/core → core}/utils.css +71 -60
  67. package/css/components/accordion.css +174 -0
  68. package/css/components/anchor.css +27 -0
  69. package/{src/themes/theme-two → css}/components/avatar.css +65 -68
  70. package/css/components/badge.css +107 -0
  71. package/css/components/button-group.css +179 -0
  72. package/css/components/button.css +215 -0
  73. package/css/components/callout.css +109 -0
  74. package/css/components/card.css +117 -0
  75. package/css/components/checkbox.css +205 -0
  76. package/{src/themes/theme-one → css}/components/chip.css +87 -135
  77. package/{src/themes/theme-two/components/definition-list.css → css/components/description-list.css} +77 -68
  78. package/{src/themes/theme-two → css}/components/dialog.css +68 -59
  79. package/css/components/divider.css +20 -0
  80. package/css/components/drawer.css +171 -0
  81. package/css/components/form.css +146 -0
  82. package/css/components/icon-button.css +139 -0
  83. package/{src/themes/theme-two → css}/components/link.css +21 -21
  84. package/{src/themes/theme-two → css}/components/list.css +345 -318
  85. package/{src/themes/theme-one → css}/components/progress.css +97 -83
  86. package/css/components/radio.css +172 -0
  87. package/css/components/range.css +337 -0
  88. package/{src/themes/theme-two → css}/components/select.css +169 -162
  89. package/{src/themes/theme-two → css}/components/spinner.css +37 -38
  90. package/{src/themes/theme-two → css}/components/switch.css +268 -225
  91. package/css/components/table.css +179 -0
  92. package/css/components/tabs.css +77 -0
  93. package/css/components/text-field.css +450 -0
  94. package/css/components/text-input.css +64 -0
  95. package/{src/themes/theme-two → css}/components/textarea.css +24 -25
  96. package/css/components/toast.css +161 -0
  97. package/css/components/toggle-button.css +87 -0
  98. package/css/components/toggle-group.css +56 -0
  99. package/css/components/tooltip.css +67 -0
  100. package/css/components/typography.css +585 -0
  101. package/{src/themes/theme-two → css}/components.css +41 -37
  102. package/{src/themes/theme-two → css}/imports.css +16 -16
  103. package/css/js/checkbox.js +21 -0
  104. package/css/js/toast.js +94 -0
  105. package/css/theme.css +132 -0
  106. package/dist/op.css +1001 -32
  107. package/dist/op.css.map +1 -0
  108. package/dist/opui.components.css +5146 -0
  109. package/dist/opui.components.css.map +1 -0
  110. package/dist/opui.css +6615 -0
  111. package/dist/opui.css.map +1 -0
  112. package/env.d.ts +14 -0
  113. package/open-props.css +9 -0
  114. package/package.json +81 -72
  115. package/dist/theme-one/components.css +0 -3869
  116. package/dist/theme-one/theme-one.css +0 -4424
  117. package/dist/theme-two/components.css +0 -3591
  118. package/dist/theme-two/theme-two.css +0 -4141
  119. package/src/open-props.css +0 -10
  120. package/src/themes/theme-one/components/accordion.css +0 -172
  121. package/src/themes/theme-one/components/alert.css +0 -85
  122. package/src/themes/theme-one/components/avatar.css +0 -68
  123. package/src/themes/theme-one/components/badge.css +0 -101
  124. package/src/themes/theme-one/components/button-group.css +0 -69
  125. package/src/themes/theme-one/components/button.css +0 -281
  126. package/src/themes/theme-one/components/card.css +0 -82
  127. package/src/themes/theme-one/components/checkbox-radio.css +0 -123
  128. package/src/themes/theme-one/components/definition-list.css +0 -68
  129. package/src/themes/theme-one/components/dialog.css +0 -59
  130. package/src/themes/theme-one/components/divider.css +0 -7
  131. package/src/themes/theme-one/components/field-group.css +0 -83
  132. package/src/themes/theme-one/components/field.css +0 -494
  133. package/src/themes/theme-one/components/icon-button.css +0 -40
  134. package/src/themes/theme-one/components/link.css +0 -21
  135. package/src/themes/theme-one/components/list.css +0 -318
  136. package/src/themes/theme-one/components/range.css +0 -121
  137. package/src/themes/theme-one/components/rich-text.css +0 -210
  138. package/src/themes/theme-one/components/select.css +0 -163
  139. package/src/themes/theme-one/components/snackbar.css +0 -148
  140. package/src/themes/theme-one/components/spinner.css +0 -38
  141. package/src/themes/theme-one/components/switch.css +0 -225
  142. package/src/themes/theme-one/components/tab-buttons.css +0 -120
  143. package/src/themes/theme-one/components/table.css +0 -92
  144. package/src/themes/theme-one/components/text-field.css +0 -57
  145. package/src/themes/theme-one/components/textarea.css +0 -25
  146. package/src/themes/theme-one/components/toggle-button-group.css +0 -135
  147. package/src/themes/theme-one/components/tooltip.css +0 -94
  148. package/src/themes/theme-one/components/typography.css +0 -209
  149. package/src/themes/theme-one/components.css +0 -37
  150. package/src/themes/theme-one/imports.css +0 -16
  151. package/src/themes/theme-one/theme.css +0 -163
  152. package/src/themes/theme-two/components/accordion.css +0 -172
  153. package/src/themes/theme-two/components/alert.css +0 -85
  154. package/src/themes/theme-two/components/badge.css +0 -101
  155. package/src/themes/theme-two/components/button-group.css +0 -50
  156. package/src/themes/theme-two/components/button.css +0 -229
  157. package/src/themes/theme-two/components/card.css +0 -82
  158. package/src/themes/theme-two/components/checkbox-radio.css +0 -123
  159. package/src/themes/theme-two/components/chip.css +0 -135
  160. package/src/themes/theme-two/components/divider.css +0 -7
  161. package/src/themes/theme-two/components/field-group.css +0 -83
  162. package/src/themes/theme-two/components/field.css +0 -281
  163. package/src/themes/theme-two/components/icon-button.css +0 -40
  164. package/src/themes/theme-two/components/progress.css +0 -83
  165. package/src/themes/theme-two/components/range.css +0 -121
  166. package/src/themes/theme-two/components/rich-text.css +0 -210
  167. package/src/themes/theme-two/components/snackbar.css +0 -148
  168. package/src/themes/theme-two/components/tab-buttons.css +0 -120
  169. package/src/themes/theme-two/components/table.css +0 -99
  170. package/src/themes/theme-two/components/text-field.css +0 -57
  171. package/src/themes/theme-two/components/toggle-button-group.css +0 -135
  172. package/src/themes/theme-two/components/tooltip.css +0 -94
  173. package/src/themes/theme-two/components/typography.css +0 -209
  174. package/src/themes/theme-two/theme.css +0 -158
@@ -0,0 +1,32 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ checked?: boolean
5
+ disabled?: boolean
6
+ id?: string
7
+ indeterminate?: boolean
8
+ name?: string
9
+ required?: boolean
10
+ value?: string
11
+ }
12
+
13
+ const { checked, disabled, id, indeterminate, name, required, value, ...rest } =
14
+ Astro.props
15
+ ---
16
+
17
+ <input
18
+ type="checkbox"
19
+ data-indeterminate={indeterminate || undefined}
20
+ {checked}
21
+ {disabled}
22
+ {id}
23
+ {name}
24
+ {required}
25
+ {value}
26
+ {...rest}
27
+ />
28
+
29
+ <script>
30
+ import { initCheckbox } from "../../css/js/checkbox.js"
31
+ initCheckbox()
32
+ </script>
@@ -0,0 +1,37 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ as?: "a" | "button" | "div" | string
5
+ class?: string
6
+ label?: string
7
+ multiline?: boolean
8
+ size?: "small"
9
+ variant?: "tonal" | "outlined"
10
+ }
11
+
12
+ export const title = "Chip"
13
+
14
+ const {
15
+ as: Tag = Astro.props.href ? "a" : "div",
16
+ class: className,
17
+ label,
18
+ multiline,
19
+ size,
20
+ variant = "tonal",
21
+ ...rest
22
+ } = Astro.props
23
+ ---
24
+
25
+ <!-- prettier-ignore -->
26
+ <Tag
27
+ class:list={[
28
+ "chip",
29
+ {
30
+ multiline,
31
+ },
32
+ size,
33
+ variant,
34
+ className,
35
+ ]}
36
+ {...rest}
37
+ ><slot name="start" /><slot />{label && <span class="text">{label}</span>}<slot name="end" /></Tag>
@@ -0,0 +1,83 @@
1
+ ---
2
+ type Item = {
3
+ text: string
4
+ value: any
5
+ }
6
+
7
+ type Props = {
8
+ [key: string]: any
9
+ class?: string
10
+ disabled?: boolean
11
+ critical?: boolean
12
+ id?: string
13
+ items?: Item[]
14
+ label?: string
15
+ name?: string
16
+ required?: boolean
17
+ size?: "small"
18
+ endText?: string
19
+ value?: any
20
+ variant?: "outlined" | "filled"
21
+ }
22
+
23
+ export const title = "Classic Select"
24
+
25
+ const {
26
+ class: className,
27
+ disabled,
28
+ critical,
29
+ id,
30
+ items = [],
31
+ label,
32
+ name,
33
+ required,
34
+ size,
35
+ endText,
36
+ value,
37
+ variant = "outlined",
38
+ ...rest
39
+ } = Astro.props
40
+
41
+ const { $id } = Astro.locals
42
+ const selectId = id || $id("select")
43
+ const labelId = $id("select-label")
44
+ ---
45
+
46
+ <label
47
+ class:list={[
48
+ "select",
49
+ size,
50
+ {
51
+ filled: variant === "filled",
52
+ },
53
+ className,
54
+ ]}
55
+ data-invalid={critical || undefined}
56
+ >
57
+ {
58
+ label && (
59
+ <!-- prettier-ignore -->
60
+ <span class="label" id={labelId}>{label}</span>
61
+ )
62
+ }
63
+ <span class="field">
64
+ <select
65
+ aria-labelledby={label ? labelId : undefined}
66
+ disabled={disabled}
67
+ id={selectId}
68
+ name={name}
69
+ required={required}
70
+ value={value}
71
+ {...rest}
72
+ >
73
+ {items.map((item) => <option value={item.value}>{item.text}</option>)}
74
+ <slot />
75
+ </select>
76
+ </span>
77
+ {
78
+ endText && (
79
+ <!-- prettier-ignore -->
80
+ <span class="end-text">{endText}</span>
81
+ )
82
+ }
83
+ </label>
@@ -0,0 +1,12 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ }
6
+
7
+ const { class: className, ...rest } = Astro.props
8
+ ---
9
+
10
+ <dd class:list={["description", className]} {...rest}>
11
+ <slot />
12
+ </dd>
@@ -0,0 +1,22 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ bordered?: boolean | "dotted"
5
+ class?: string
6
+ }
7
+
8
+ export const title = "Description List"
9
+
10
+ const { bordered, class: className, ...rest } = Astro.props
11
+ ---
12
+
13
+ <dl
14
+ class:list={[
15
+ "description-list",
16
+ { bordered: bordered, dotted: bordered === "dotted" },
17
+ className,
18
+ ]}
19
+ {...rest}
20
+ >
21
+ <slot />
22
+ </dl>
@@ -0,0 +1,12 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ }
6
+
7
+ const { class: className, ...rest } = Astro.props
8
+ ---
9
+
10
+ <div class:list={["item", className]} {...rest}>
11
+ <slot />
12
+ </div>
@@ -0,0 +1,12 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ }
6
+
7
+ const { class: className, ...rest } = Astro.props
8
+ ---
9
+
10
+ <dt class:list={["term", className]} {...rest}>
11
+ <slot />
12
+ </dt>
@@ -0,0 +1,12 @@
1
+ import DescriptionList from "./DescriptionList.astro"
2
+ import Item from "./Item.astro"
3
+ import Term from "./Term.astro"
4
+ import Description from "./Description.astro"
5
+
6
+ export { Item, Term, Description }
7
+
8
+ export default Object.assign(DescriptionList, {
9
+ Item,
10
+ Term,
11
+ Description,
12
+ })
@@ -0,0 +1,43 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ actions?: {
5
+ align?: "end"
6
+ }
7
+ class?: string
8
+ closedby?: "any" | "closerequest" | "none"
9
+ }
10
+
11
+ export const title = "Dialog"
12
+
13
+ const { actions, class: className, closedby, ...rest } = Astro.props
14
+ ---
15
+
16
+ <dialog
17
+ class:list={["dialog card elevated", className]}
18
+ closedby={closedby}
19
+ {...rest}
20
+ >
21
+ {
22
+ Astro.slots.has("header") && (
23
+ <hgroup>
24
+ <slot name="header" />
25
+ </hgroup>
26
+ )
27
+ }
28
+ {
29
+ Astro.slots.has("content") && (
30
+ <div class="content">
31
+ <slot name="content" />
32
+ </div>
33
+ )
34
+ }
35
+ <slot />
36
+ {
37
+ Astro.slots.has("actions") && (
38
+ <div class:list={["actions", actions?.align && `align-${actions.align}`]}>
39
+ <slot name="actions" />
40
+ </div>
41
+ )
42
+ }
43
+ </dialog>
@@ -0,0 +1,14 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ variant?: "tonal" | "filled" | "primary"
6
+ }
7
+
8
+ export const title = "Divider"
9
+
10
+ const { class: className, variant, ...rest } = Astro.props
11
+ const variantClass = variant ? `border-${variant}` : ""
12
+ ---
13
+
14
+ <hr class:list={["divider", className, variantClass]} {...rest} />
@@ -0,0 +1,49 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ backdrop?: "transparent" | "blurred"
5
+ class?: string
6
+ closedby?: "any" | "closerequest" | "none"
7
+ id?: string
8
+ scrollLock?: boolean
9
+ side?: "inline-start" | "inline-end" | "block-start" | "block-end"
10
+ }
11
+
12
+ export const title = "Drawer"
13
+
14
+ const {
15
+ backdrop = "blurred",
16
+ class: className,
17
+ closedby = "any",
18
+ id,
19
+ scrollLock = true,
20
+ side = "inline-start",
21
+ ...rest
22
+ } = Astro.props
23
+
24
+ const { $id } = Astro.locals
25
+ const drawerId = id || $id("drawer")
26
+ ---
27
+
28
+ <dialog
29
+ closedby={closedby}
30
+ class:list={[
31
+ "drawer",
32
+ side,
33
+ {
34
+ "backdrop-transparent": backdrop === "transparent",
35
+ "scroll-lock": scrollLock,
36
+ },
37
+ className,
38
+ ]}
39
+ id={drawerId}
40
+ {...rest}
41
+ >
42
+ {Astro.slots.has("header") && <slot name="header" />}
43
+
44
+ <div class="content">
45
+ <slot name="content" />
46
+ </div>
47
+
48
+ {Astro.slots.has("footer") && <slot name="footer" />}
49
+ </dialog>
@@ -0,0 +1,14 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ }
6
+
7
+ export const title = "Drawer Footer"
8
+
9
+ const { class: className, ...rest } = Astro.props
10
+ ---
11
+
12
+ <div class:list={["footer", className]} {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,31 @@
1
+ ---
2
+ import IconButton from "../IconButton/IconButton.astro"
3
+
4
+ type Props = {
5
+ [key: string]: any
6
+ class?: string
7
+ heading?: string
8
+ }
9
+
10
+ export const title = "Drawer Header"
11
+
12
+ const { class: className, heading, ...rest } = Astro.props
13
+ ---
14
+
15
+ <div class:list={["header", className]} {...rest}>
16
+ {heading && <span>{heading}</span>}
17
+ <slot />
18
+ <IconButton onclick="this.closest('dialog').close()" title="Close">
19
+ <svg
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ width="32"
22
+ height="32"
23
+ viewBox="0 0 32 32"
24
+ >
25
+ <path
26
+ fill="currentColor"
27
+ d="M26.29 4.293a1 1 0 1 1 1.414 1.414L17.413 16l10.291 10.29a1 1 0 1 1-1.414 1.414L16 17.413L5.707 27.704a1 1 0 0 1-1.414-1.414L14.585 16L4.293 5.707a1 1 0 0 1 1.414-1.414L16 14.584z"
28
+ ></path>
29
+ </svg>
30
+ </IconButton>
31
+ </div>
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ }
6
+
7
+ export const title = "Field Description"
8
+
9
+ const { class: className, ...rest } = Astro.props
10
+ ---
11
+
12
+ <!-- prettier-ignore -->
13
+ <p class:list={["field-description", className]} {...rest}><slot /></p>
@@ -0,0 +1,31 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ direction?: "row" | "column"
6
+ name?: string
7
+ }
8
+
9
+ export const title = "Field Group"
10
+
11
+ const { class: className, direction, name, ...rest } = Astro.props
12
+
13
+ const originalName = Astro.locals.currentFieldName
14
+ if (name) {
15
+ Astro.locals.currentFieldName = name
16
+ }
17
+
18
+ let html = ""
19
+ try {
20
+ html = await Astro.slots.render("default")
21
+ } finally {
22
+ Astro.locals.currentFieldName = originalName
23
+ }
24
+ ---
25
+
26
+ <div
27
+ class:list={["field-group", direction, className]}
28
+ {...rest}
29
+ role="group"
30
+ set:html={html}
31
+ />
@@ -0,0 +1,15 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ as?: "legend" | "p" | string
5
+ class?: string
6
+ }
7
+
8
+ export const title = "Field Legend"
9
+
10
+ const { as: Tag = "legend", class: className, ...rest } = Astro.props
11
+ const isLegend = Tag === "legend"
12
+ ---
13
+
14
+ <!-- prettier-ignore -->
15
+ <Tag class:list={[{ legend: !isLegend }, className]} {...rest}><slot /></Tag>
@@ -0,0 +1,15 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ as?: "fieldset" | "div" | string
5
+ class?: string
6
+ }
7
+
8
+ export const title = "Field Set"
9
+
10
+ const { as: Tag = "fieldset", class: className, ...rest } = Astro.props
11
+ ---
12
+
13
+ <Tag class:list={["fieldset", className]} {...rest}>
14
+ <slot />
15
+ </Tag>
@@ -0,0 +1,15 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ as?: "form" | "div" | string
5
+ class?: string
6
+ }
7
+
8
+ export const title = "Form"
9
+
10
+ const { as: Tag = "form", class: className, ...rest } = Astro.props
11
+ ---
12
+
13
+ <Tag class:list={["form", className]} {...rest}>
14
+ <slot />
15
+ </Tag>
@@ -0,0 +1,26 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ as?: "a" | "button" | string
5
+ class?: string
6
+ color?: "critical" | "primary"
7
+ href?: string
8
+ size?: "small"
9
+ variant?: "outlined" | "tonal" | "filled"
10
+ }
11
+
12
+ export const title = "Icon Button"
13
+
14
+ const {
15
+ as: Tag = Astro.props.href ? "a" : "button",
16
+ class: className,
17
+ color,
18
+ href,
19
+ size,
20
+ variant,
21
+ ...rest
22
+ } = Astro.props
23
+ ---
24
+
25
+ <!-- prettier-ignore -->
26
+ <Tag class:list={["icon-button", size, variant, color, className]} href={href} {...rest}><slot /></Tag>
@@ -0,0 +1,36 @@
1
+ ---
2
+ type Props = {
3
+ bordered?: boolean
4
+ dense?: boolean
5
+ gutterless?: boolean
6
+ variant?: "default" | "tonal" | "transparent"
7
+ [key: string]: any
8
+ }
9
+
10
+ export const title = "List"
11
+
12
+ const {
13
+ bordered,
14
+ class: className,
15
+ dense,
16
+ gutterless,
17
+ variant,
18
+ ...rest
19
+ } = Astro.props
20
+ ---
21
+
22
+ <ul
23
+ class:list={[
24
+ "list",
25
+ {
26
+ bordered,
27
+ dense,
28
+ gutterless,
29
+ },
30
+ variant,
31
+ className,
32
+ ]}
33
+ {...rest}
34
+ >
35
+ <slot />
36
+ </ul>
@@ -0,0 +1,118 @@
1
+ ---
2
+ type Props = {
3
+ as?: "a" | "button" | "div"
4
+ borderTop?: boolean
5
+ class?: string
6
+ description?: string
7
+ for?: string
8
+ headline?: string
9
+ inset?: boolean
10
+ type?: "checkbox" | "radio" | "switch"
11
+ [key: string]: any
12
+ }
13
+
14
+ export const title = "List Item"
15
+
16
+ const {
17
+ as: Tag,
18
+ borderTop,
19
+ class: className,
20
+ description,
21
+ for: htmlFor,
22
+ headline,
23
+ inset,
24
+ type,
25
+ ...rest
26
+ } = Astro.props
27
+
28
+ const hasLabel =
29
+ type && (type === "checkbox" || type === "radio" || type === "switch")
30
+ const labelClass = type || ""
31
+ const liProps = Tag ? {} : rest
32
+ const innerProps = Tag ? rest : {}
33
+ ---
34
+
35
+ <li
36
+ class:list={[
37
+ {
38
+ "border-top": borderTop,
39
+ inset,
40
+ },
41
+ className,
42
+ ]}
43
+ {...liProps}
44
+ >
45
+ {
46
+ // Label + checkbox/radio/switch
47
+ hasLabel ? (
48
+ <label class={labelClass} for={htmlFor}>
49
+ {Astro.slots.start && (
50
+ <div class="start">
51
+ <slot name="start" />
52
+ </div>
53
+ )}
54
+ {Astro.slots.text || headline || description ? (
55
+ <div class="text">
56
+ {headline && <p>{headline}</p>}
57
+ {description && <p>{description}</p>}
58
+ <slot name="text" />
59
+ </div>
60
+ ) : null}
61
+ {Astro.slots.end && (
62
+ <div class="end">
63
+ <slot name="end" />
64
+ </div>
65
+ )}
66
+ <slot />
67
+ </label>
68
+ ) : // With custom tag
69
+ Tag ? (
70
+ <Tag {...innerProps}>
71
+ {Astro.slots.start && (
72
+ <div class="start">
73
+ <slot name="start" />
74
+ </div>
75
+ )}
76
+ {headline || description || Astro.slots.text ? (
77
+ <div class="text">
78
+ {headline && <p>{headline}</p>}
79
+ {description && <p>{description}</p>}
80
+ <slot name="text" />
81
+ <slot />
82
+ </div>
83
+ ) : (
84
+ <slot />
85
+ )}
86
+ {Astro.slots.end && (
87
+ <div class="end">
88
+ <slot name="end" />
89
+ </div>
90
+ )}
91
+ </Tag>
92
+ ) : (
93
+ // Without custom tag
94
+ <>
95
+ {Astro.slots.start && (
96
+ <div class="start">
97
+ <slot name="start" />
98
+ </div>
99
+ )}
100
+ {headline || description || Astro.slots.text ? (
101
+ <div class="text">
102
+ {headline && <p>{headline}</p>}
103
+ {description && <p>{description}</p>}
104
+ <slot name="text" />
105
+ <slot />
106
+ </div>
107
+ ) : (
108
+ <slot />
109
+ )}
110
+ {Astro.slots.end && (
111
+ <div class="end">
112
+ <slot name="end" />
113
+ </div>
114
+ )}
115
+ </>
116
+ )
117
+ }
118
+ </li>