opui-css 3.3.4 → 4.0.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.
Files changed (174) hide show
  1. package/CHANGELOG.md +235 -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 +53 -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 +5135 -0
  109. package/dist/opui.components.css.map +1 -0
  110. package/dist/opui.css +6604 -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 +64 -55
  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,40 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ "aria-busy"?: "true" | "false" | boolean
5
+ "aria-describedby"?: string
6
+ "aria-label"?: string
7
+ class?: string
8
+ id?: string
9
+ max?: number | string
10
+ value?: number | string
11
+ variant?: "filled" | "default" | "tonal"
12
+ }
13
+
14
+ export const title = "Progress"
15
+
16
+ const {
17
+ "aria-busy": ariaBusy,
18
+ "aria-describedby": ariaDescribedby,
19
+ "aria-label": ariaLabel,
20
+ class: className,
21
+ id,
22
+ max,
23
+ value,
24
+ variant,
25
+ ...rest
26
+ } = Astro.props
27
+ ---
28
+
29
+ <progress
30
+ aria-busy={ariaBusy}
31
+ aria-describedby={ariaDescribedby}
32
+ aria-label={ariaLabel}
33
+ class:list={["progress", className, variant]}
34
+ id={id}
35
+ max={max}
36
+ value={value}
37
+ {...rest}
38
+ >
39
+ <slot />
40
+ </progress>
@@ -0,0 +1,70 @@
1
+ ---
2
+ import RadioInput from "./RadioInput.astro"
3
+
4
+ type Props = {
5
+ [key: string]: any
6
+ checked?: boolean
7
+ class?: string
8
+ disabled?: boolean
9
+ critical?: boolean
10
+ hideLabel?: boolean
11
+ id?: string
12
+ name?: string
13
+ required?: boolean
14
+ size?: "small" | "large"
15
+ stack?: boolean
16
+ value?: string
17
+ }
18
+
19
+ export const title = "Radio"
20
+
21
+ const {
22
+ checked,
23
+ class: className,
24
+ disabled,
25
+ critical,
26
+ hideLabel,
27
+ id,
28
+ name,
29
+ required,
30
+ size,
31
+ stack,
32
+ value,
33
+ ...rest
34
+ } = Astro.props
35
+
36
+ const { $id, currentFieldName } = Astro.locals
37
+ const endTextId = Astro.slots.has("end-text") ? $id("end-text") : undefined
38
+
39
+ const finalName = name || currentFieldName
40
+ ---
41
+
42
+ <label
43
+ class:list={[
44
+ "radio",
45
+ size,
46
+ {
47
+ stack,
48
+ },
49
+ className,
50
+ ]}
51
+ data-invalid={critical || undefined}
52
+ >
53
+ <RadioInput
54
+ aria-describedby={endTextId}
55
+ {checked}
56
+ {disabled}
57
+ {id}
58
+ name={finalName}
59
+ {required}
60
+ {value}
61
+ {...rest}
62
+ />
63
+ <!-- prettier-ignore --><span class:list={[hideLabel ? "sr-only" : "label"]}><slot /></span>
64
+ {
65
+ Astro.slots.has("end-text") && (
66
+ <!-- prettier-ignore -->
67
+ <span id={endTextId} class="end-text"><slot name="end-text" /></span>
68
+ )
69
+ }
70
+ </label>
@@ -0,0 +1,24 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ checked?: boolean
5
+ disabled?: boolean
6
+ id?: string
7
+ name?: string
8
+ required?: boolean
9
+ value?: string
10
+ }
11
+
12
+ const { checked, disabled, id, name, required, value, ...rest } = Astro.props
13
+ ---
14
+
15
+ <input
16
+ type="radio"
17
+ {checked}
18
+ {disabled}
19
+ {id}
20
+ {name}
21
+ {required}
22
+ {value}
23
+ {...rest}
24
+ />
@@ -0,0 +1,136 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ disabled?: boolean
6
+ endText?: string
7
+ id?: string
8
+ label?: string
9
+ max?: number | string
10
+ min?: number | string
11
+ name?: string
12
+ spread?: boolean
13
+ startText?: string
14
+ step?: number | string
15
+ value?: number | string
16
+ valueSuffix?: string
17
+ variant?: "filled" | "default" | "tonal"
18
+ } & (
19
+ | { list?: never; options?: never }
20
+ | {
21
+ list: string
22
+ options: (string | number | { value: string | number; label?: string })[]
23
+ }
24
+ )
25
+
26
+ export const title = "Range"
27
+
28
+ const {
29
+ class: className,
30
+ disabled,
31
+ endText,
32
+ id,
33
+ label,
34
+ list,
35
+ max,
36
+ min,
37
+ name,
38
+ options,
39
+ spread,
40
+ startText,
41
+ step,
42
+ value,
43
+ valueSuffix,
44
+ variant,
45
+ ...rest
46
+ } = Astro.props
47
+
48
+ const { $id } = Astro.locals
49
+
50
+ const hasLabel = !!label || Astro.slots.has("default")
51
+ const hasStartText = !!startText || Astro.slots.has("start-text")
52
+ const hasEndText = !!endText || Astro.slots.has("end-text")
53
+ const hasValue = valueSuffix !== undefined || Astro.slots.has("value")
54
+
55
+ const inputId = id || $id("range")
56
+ const labelId = hasLabel ? $id("range-label") : undefined
57
+ const startTextId = hasStartText ? $id("range-start") : undefined
58
+ const endTextId = hasEndText ? $id("range-end") : undefined
59
+
60
+ const describedBy = [startTextId, endTextId].filter(Boolean).join(" ") || undefined
61
+ ---
62
+
63
+ <label class:list={["range", variant, { spread }, className]}>
64
+ {
65
+ hasLabel && (
66
+ <!-- prettier-ignore -->
67
+ <span class="label" id={labelId}>{label}<slot /></span>
68
+ )
69
+ }
70
+ {
71
+ hasValue && (
72
+ <output class="value" for={inputId} data-suffix={valueSuffix}>
73
+ <slot name="value">{value}</slot>
74
+ </output>
75
+ )
76
+ }
77
+ {
78
+ hasStartText && (
79
+ <span class="start-text" id={startTextId}>
80
+ {startText}<slot name="start-text" />
81
+ </span>
82
+ )
83
+ }
84
+ <input
85
+ aria-describedby={describedBy}
86
+ aria-labelledby={labelId}
87
+ disabled={disabled}
88
+ id={inputId}
89
+ list={list}
90
+ max={max}
91
+ min={min}
92
+ name={name}
93
+ step={step}
94
+ type="range"
95
+ value={value}
96
+ {...rest}
97
+ />
98
+ {
99
+ (options || Astro.slots.has("datalist")) && (
100
+ <datalist id={list}>
101
+ {options?.map((option) =>
102
+ typeof option === "object" ? (
103
+ <option value={option.value} label={option.label} />
104
+ ) : (
105
+ <option value={option} />
106
+ )
107
+ )}
108
+ <slot name="datalist" />
109
+ </datalist>
110
+ )
111
+ }
112
+ {
113
+ hasEndText && (
114
+ <span class="end-text" id={endTextId}>
115
+ {endText}<slot name="end-text" />
116
+ </span>
117
+ )
118
+ }
119
+ </label>
120
+
121
+ <script>
122
+ // Mirror the slider's current value into its associated <output> on every
123
+ // input event. Idempotent: each .range is wired once, and ignores ranges
124
+ // without a value display.
125
+ for (const range of document.querySelectorAll<HTMLElement>(".range")) {
126
+ const input = range.querySelector<HTMLInputElement>('input[type="range"]')
127
+ const output = range.querySelector<HTMLOutputElement>(":scope > output.value")
128
+ if (!input || !output) continue
129
+ const suffix = output.dataset.suffix ?? ""
130
+ const update = () => {
131
+ output.textContent = `${input.value}${suffix}`
132
+ }
133
+ input.addEventListener("input", update)
134
+ update()
135
+ }
136
+ </script>
@@ -0,0 +1,106 @@
1
+ ---
2
+ type Item = {
3
+ text: string
4
+ value: any
5
+ }
6
+
7
+ type Props = {
8
+ [key: string]: any
9
+ class?: string
10
+ description?: string
11
+ disabled?: boolean
12
+ critical?: boolean
13
+ dense?: boolean
14
+ id?: string
15
+ items?: Item[]
16
+ label?: string
17
+ name?: string
18
+ spread?: boolean
19
+ required?: boolean
20
+ size?: "small"
21
+ endText?: string
22
+ value?: any
23
+ variant?: "outlined" | "filled"
24
+ }
25
+
26
+ export const title = "Select"
27
+
28
+ const {
29
+ class: className,
30
+ description,
31
+ disabled,
32
+ critical,
33
+ dense,
34
+ id,
35
+ items = [],
36
+ label,
37
+ name,
38
+ spread,
39
+ required,
40
+ size,
41
+ endText,
42
+ value,
43
+ variant = "outlined",
44
+ ...rest
45
+ } = Astro.props
46
+
47
+ const { $id, currentFieldName } = Astro.locals
48
+ const selectId = id || $id("select")
49
+ const fieldName = name || currentFieldName
50
+ const labelId = $id("select-label")
51
+ ---
52
+
53
+ <label
54
+ class:list={[
55
+ "select",
56
+ size,
57
+ {
58
+ filled: variant === "filled",
59
+ spread,
60
+ },
61
+ className,
62
+ ]}
63
+ data-invalid={critical || undefined}
64
+ >
65
+ {
66
+ (label || Astro.slots.has("label")) && (
67
+ <!-- prettier-ignore -->
68
+ <span class="label" id={labelId}>{label}<slot name="label" /></span>
69
+ )
70
+ }
71
+ {
72
+ (description || Astro.slots.has("description")) && (
73
+ <!-- prettier-ignore -->
74
+ <span class="start-text">{description}<slot name="description" /></span>
75
+ )
76
+ }
77
+ <span class="field">
78
+ <select
79
+ aria-labelledby={label ? labelId : undefined}
80
+ disabled={disabled}
81
+ id={selectId}
82
+ name={fieldName}
83
+ required={required}
84
+ value={value}
85
+ {...rest}
86
+ >
87
+ <button>
88
+ <selectedcontent></selectedcontent>
89
+ </button>
90
+ <div class:list={["list", { dense }]}>
91
+ {items.map((item) => <option value={item.value}>{item.text}</option>)}
92
+ <slot />
93
+ </div>
94
+ </select>
95
+ {Astro.slots.has("prefix") && <span class="prefix"><slot name="prefix" /></span>}
96
+ {Astro.slots.has("suffix") && <span class="suffix"><slot name="suffix" /></span>}
97
+ {Astro.slots.has("header") && <span class="header"><slot name="header" /></span>}
98
+ {Astro.slots.has("footer") && <span class="footer"><slot name="footer" /></span>}
99
+ </span>
100
+ {
101
+ (endText || Astro.slots.has("end-text")) && (
102
+ <!-- prettier-ignore -->
103
+ <span id={$id("end-text")} class="end-text">{endText}<slot name="end-text" /></span>
104
+ )
105
+ }
106
+ </label>
@@ -0,0 +1,101 @@
1
+ ---
2
+ import SwitchInput from "./SwitchInput.astro"
3
+
4
+ type Props = {
5
+ [key: string]: any
6
+ checked?: boolean
7
+ class?: string
8
+ disabled?: boolean
9
+ critical?: boolean
10
+ hideLabel?: boolean
11
+ id?: string
12
+ name?: string
13
+ required?: boolean
14
+ small?: boolean
15
+ spread?: boolean
16
+ stack?: boolean
17
+ value?: string
18
+ }
19
+
20
+ export const title = "Switch"
21
+
22
+ const {
23
+ checked,
24
+ class: className,
25
+ disabled,
26
+ critical,
27
+ hideLabel,
28
+ id,
29
+ name,
30
+ required,
31
+ small,
32
+ spread,
33
+ stack,
34
+ value,
35
+ ...rest
36
+ } = Astro.props
37
+
38
+ const { $id, currentFieldName } = Astro.locals
39
+ const endTextId = Astro.slots.has("end-text") ? $id("end-text") : undefined
40
+
41
+ const finalName = name || currentFieldName
42
+
43
+ if (
44
+ import.meta.env.DEV &&
45
+ !Astro.slots.has("default") &&
46
+ !Astro.props["aria-label"] &&
47
+ !Astro.props["aria-labelledby"]
48
+ ) {
49
+ console.warn(
50
+ "[OPUI Switch] Missing accessible name. Provide a default slot, `aria-label`, or `aria-labelledby`."
51
+ )
52
+ }
53
+ ---
54
+
55
+ <label
56
+ class:list={[
57
+ "switch",
58
+ {
59
+ small,
60
+ stack,
61
+ spread,
62
+ },
63
+ className,
64
+ ]}
65
+ data-invalid={critical || undefined}
66
+ >
67
+ {
68
+ Astro.slots.has("icon-unchecked") && (
69
+ <span class="icon-unchecked" aria-hidden="true">
70
+ <slot name="icon-unchecked" />
71
+ </span>
72
+ )
73
+ }
74
+ {
75
+ Astro.slots.has("icon-checked") && (
76
+ <span class="icon-checked" aria-hidden="true">
77
+ <slot name="icon-checked" />
78
+ </span>
79
+ )
80
+ }
81
+ <SwitchInput
82
+ aria-describedby={endTextId}
83
+ {checked}
84
+ {disabled}
85
+ {id}
86
+ name={finalName}
87
+ {required}
88
+ {value}
89
+ {...rest}
90
+ />
91
+ {
92
+ Astro.slots.has("default") && (
93
+ <!-- prettier-ignore --><span class:list={[hideLabel ? "sr-only" : "label"]}><slot /></span>)
94
+ }
95
+ {
96
+ Astro.slots.has("end-text") && (
97
+ <!-- prettier-ignore -->
98
+ <span id={endTextId} class="end-text"><slot name="end-text" /></span>
99
+ )
100
+ }
101
+ </label>
@@ -0,0 +1,25 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ checked?: boolean
5
+ disabled?: boolean
6
+ id?: string
7
+ name?: string
8
+ required?: boolean
9
+ value?: string
10
+ }
11
+
12
+ const { checked, disabled, id, name, required, value, ...rest } = Astro.props
13
+ ---
14
+
15
+ <input
16
+ type="checkbox"
17
+ role="switch"
18
+ {checked}
19
+ {disabled}
20
+ {id}
21
+ {name}
22
+ {required}
23
+ {value}
24
+ {...rest}
25
+ />
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Body"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <tbody {...rest}>
12
+ <slot />
13
+ </tbody>
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Cell"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <td {...rest}>
12
+ <slot />
13
+ </td>
@@ -0,0 +1,15 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ width?: string
5
+ }
6
+
7
+ export const title = "Table Column"
8
+
9
+ const { width, ...rest } = Astro.props
10
+ ---
11
+
12
+ <col
13
+ style={width ? (width.includes(":") ? width : `width: ${width}`) : undefined}
14
+ {...rest}
15
+ />
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Column Group"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <colgroup {...rest}>
12
+ <slot />
13
+ </colgroup>
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Head"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <thead {...rest}>
12
+ <slot />
13
+ </thead>
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Header Cell"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <th {...rest}>
12
+ <slot />
13
+ </th>
@@ -0,0 +1,13 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ }
5
+
6
+ export const title = "Table Row"
7
+
8
+ const { ...rest } = Astro.props
9
+ ---
10
+
11
+ <tr {...rest}>
12
+ <slot />
13
+ </tr>
@@ -0,0 +1,15 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ variant?: "dense" | "spacious"
6
+ }
7
+
8
+ export const title = "Table"
9
+
10
+ const { class: className, variant, ...rest } = Astro.props
11
+ ---
12
+
13
+ <table class:list={[className, variant]} {...rest}>
14
+ <slot />
15
+ </table>
@@ -0,0 +1,20 @@
1
+ import Table from "./Table.astro"
2
+ import Head from "./Head.astro"
3
+ import Body from "./Body.astro"
4
+ import Row from "./Row.astro"
5
+ import HeaderCell from "./HeaderCell.astro"
6
+ import Cell from "./Cell.astro"
7
+ import Column from "./Column.astro"
8
+ import ColumnGroup from "./ColumnGroup.astro"
9
+
10
+ export { Head, Body, Row, HeaderCell, Cell, Column, ColumnGroup }
11
+
12
+ export default Object.assign(Table, {
13
+ Head,
14
+ Body,
15
+ Row,
16
+ HeaderCell,
17
+ Cell,
18
+ Column,
19
+ ColumnGroup,
20
+ })
@@ -0,0 +1,28 @@
1
+ ---
2
+ type Props = {
3
+ [key: string]: any
4
+ class?: string
5
+ name?: string
6
+ }
7
+
8
+ export const title = "Tabs"
9
+
10
+ const { $id } = Astro.locals
11
+ const { class: className, name, ...rest } = Astro.props
12
+
13
+ const groupName = name || $id("tabs")
14
+
15
+ const originalGroupName = Astro.locals.tabsGroupName
16
+ Astro.locals.tabsGroupName = groupName
17
+
18
+ const html = await Astro.slots.render("default")
19
+
20
+ Astro.locals.tabsGroupName = originalGroupName
21
+ ---
22
+
23
+ <div
24
+ class:list={["tabs", className]}
25
+ role="tablist"
26
+ {...rest}
27
+ set:html={html}
28
+ />