@santi020k/lumen-astro 0.3.0 → 1.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 (158) hide show
  1. package/README.md +100 -2
  2. package/components/Accordion.astro +4 -4
  3. package/components/Affix.astro +2 -2
  4. package/components/Agenda.astro +3 -2
  5. package/components/Alert.astro +9 -9
  6. package/components/AlertDialog.astro +7 -13
  7. package/components/Anchor.astro +29 -3
  8. package/components/AnimatedLogo.astro +2 -1
  9. package/components/AnimatedNumber.astro +5 -2
  10. package/components/AnimatedPortrait.astro +46 -36
  11. package/components/AspectRatio.astro +10 -8
  12. package/components/Attachment.astro +24 -24
  13. package/components/Autocomplete.astro +3 -2
  14. package/components/Avatar.astro +4 -3
  15. package/components/BackToTop.astro +2 -2
  16. package/components/Badge.astro +9 -9
  17. package/components/BarChart.astro +211 -0
  18. package/components/Breadcrumb.astro +3 -3
  19. package/components/Bubble.astro +7 -7
  20. package/components/Button.astro +18 -16
  21. package/components/ButtonGroup.astro +3 -3
  22. package/components/ButtonLink.astro +9 -3
  23. package/components/Calendar.astro +43 -31
  24. package/components/Callout.astro +2 -2
  25. package/components/Card.astro +12 -10
  26. package/components/CardContent.astro +26 -0
  27. package/components/CardDescription.astro +26 -0
  28. package/components/CardFooter.astro +26 -0
  29. package/components/CardHeader.astro +26 -0
  30. package/components/CardTitle.astro +26 -0
  31. package/components/Carousel.astro +6 -6
  32. package/components/Cascader.astro +10 -4
  33. package/components/Chart.astro +32 -6
  34. package/components/Checkbox.astro +3 -2
  35. package/components/CheckboxGroup.astro +39 -0
  36. package/components/Code.astro +55 -52
  37. package/components/CodeTabs.astro +6 -6
  38. package/components/Collapsible.astro +3 -3
  39. package/components/ColorPicker.astro +3 -2
  40. package/components/Combobox.astro +4 -5
  41. package/components/Command.astro +6 -6
  42. package/components/Container.astro +29 -0
  43. package/components/ContextMenu.astro +7 -13
  44. package/components/CopyButton.astro +55 -0
  45. package/components/CoverImage.astro +19 -9
  46. package/components/DataTable.astro +50 -49
  47. package/components/DatePicker.astro +20 -17
  48. package/components/DateRangePicker.astro +3 -2
  49. package/components/Descriptions.astro +3 -3
  50. package/components/Dialog.astro +8 -14
  51. package/components/Direction.astro +3 -3
  52. package/components/Drawer.astro +7 -13
  53. package/components/DropdownMenu.astro +7 -13
  54. package/components/Empty.astro +6 -6
  55. package/components/ErrorSummary.astro +54 -0
  56. package/components/Eyebrow.astro +2 -2
  57. package/components/Field.astro +7 -6
  58. package/components/FieldError.astro +29 -0
  59. package/components/FileUpload.astro +2 -2
  60. package/components/FloatingBadge.astro +2 -2
  61. package/components/Form.astro +33 -0
  62. package/components/FormattedDate.astro +2 -2
  63. package/components/GradientDivider.astro +2 -2
  64. package/components/Grid.astro +46 -0
  65. package/components/HoverCard.astro +7 -13
  66. package/components/Icon.astro +8 -6
  67. package/components/Image.astro +2 -1
  68. package/components/Input.astro +6 -5
  69. package/components/InputGroup.astro +3 -3
  70. package/components/InputOTP.astro +5 -3
  71. package/components/Item.astro +11 -8
  72. package/components/Kbd.astro +3 -3
  73. package/components/Label.astro +3 -2
  74. package/components/LanguageToggle.astro +2 -2
  75. package/components/LineChart.astro +244 -0
  76. package/components/Link.astro +6 -5
  77. package/components/ListBox.astro +154 -0
  78. package/components/Marker.astro +6 -6
  79. package/components/Mentions.astro +30 -10
  80. package/components/Menubar.astro +7 -13
  81. package/components/Message.astro +5 -5
  82. package/components/MessageScroller.astro +6 -6
  83. package/components/Meter.astro +1 -0
  84. package/components/NativeSelect.astro +4 -5
  85. package/components/NavigationMenu.astro +9 -14
  86. package/components/Note.astro +1 -1
  87. package/components/NumberField.astro +3 -2
  88. package/components/Pagination.astro +3 -3
  89. package/components/Particles.astro +58 -2
  90. package/components/PasswordField.astro +73 -0
  91. package/components/PhoneInput.astro +5 -7
  92. package/components/PieChart.astro +141 -0
  93. package/components/Pill.astro +15 -9
  94. package/components/Popconfirm.astro +8 -3
  95. package/components/Popover.astro +7 -13
  96. package/components/Progress.astro +12 -4
  97. package/components/Prose.astro +2 -2
  98. package/components/QRCode.astro +13 -5
  99. package/components/RadioGroup.astro +3 -3
  100. package/components/Rating.astro +3 -1
  101. package/components/Resizable.astro +8 -7
  102. package/components/RevealGroup.astro +4 -2
  103. package/components/RichTextEditor.astro +3 -2
  104. package/components/Schedule.astro +3 -2
  105. package/components/ScrollArea.astro +6 -6
  106. package/components/ScrollProgress.astro +38 -0
  107. package/components/ScrollReveal.astro +4 -2
  108. package/components/SearchField.astro +3 -2
  109. package/components/Segmented.astro +4 -6
  110. package/components/Select.astro +23 -14
  111. package/components/Separator.astro +5 -5
  112. package/components/Sheet.astro +7 -13
  113. package/components/Sidebar.astro +9 -14
  114. package/components/Skeleton.astro +4 -3
  115. package/components/SkipLink.astro +2 -2
  116. package/components/Slider.astro +3 -2
  117. package/components/Sonner.astro +3 -3
  118. package/components/Sparkline.astro +72 -0
  119. package/components/SpeedDial.astro +3 -3
  120. package/components/Spinner.astro +4 -3
  121. package/components/Stack.astro +46 -0
  122. package/components/Stat.astro +14 -8
  123. package/components/StatDescription.astro +16 -0
  124. package/components/StatIcon.astro +15 -0
  125. package/components/StatLabel.astro +16 -0
  126. package/components/StatTrend.astro +28 -0
  127. package/components/StatValue.astro +16 -0
  128. package/components/Stepper.astro +11 -8
  129. package/components/Switch.astro +3 -2
  130. package/components/Table.astro +7 -6
  131. package/components/Tabs.astro +6 -6
  132. package/components/TagGroup.astro +3 -2
  133. package/components/Textarea.astro +3 -2
  134. package/components/ThemeBuilder.astro +3 -2
  135. package/components/ThemeToggle.astro +5 -3
  136. package/components/TimeField.astro +3 -2
  137. package/components/Timeline.astro +2 -1
  138. package/components/TimelineItem.astro +2 -1
  139. package/components/Toast.astro +10 -16
  140. package/components/Toggle.astro +3 -2
  141. package/components/ToggleGroup.astro +3 -3
  142. package/components/Toolbar.astro +2 -2
  143. package/components/Tooltip.astro +3 -3
  144. package/components/Tour.astro +3 -3
  145. package/components/Transfer.astro +16 -5
  146. package/components/Tree.astro +3 -2
  147. package/components/TreeGrid.astro +3 -2
  148. package/components/TreeSelect.astro +10 -4
  149. package/components/Typography.astro +3 -3
  150. package/components/VirtualList.astro +3 -2
  151. package/components/VisuallyHidden.astro +27 -0
  152. package/components/Watermark.astro +11 -7
  153. package/forms.ts +46 -0
  154. package/index.ts +31 -0
  155. package/package.json +12 -8
  156. package/runtime/UIPrimitives.astro +3764 -3142
  157. package/runtime/controllers/motion.ts +13 -16
  158. package/index.d.ts +0 -126
@@ -1,15 +1,15 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  type DataTableCell =
7
- | boolean
8
- | null
9
- | number
10
- | string
11
- | undefined
12
- | {
7
+ | boolean |
8
+ null |
9
+ number |
10
+ string |
11
+ undefined |
12
+ {
13
13
  label?: boolean | null | number | string
14
14
  sortValue?: boolean | null | number | string
15
15
  value?: boolean | null | number | string
@@ -51,15 +51,15 @@ const {
51
51
  } = Astro.props
52
52
 
53
53
  const hasData = columns.length > 0
54
+
54
55
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
55
- 'ui-data-table',
56
- glass && 'ui-data-table--glass',
57
- glass === 'subtle' && 'ui-glass-subtle',
58
- glass === 'strong' && 'ui-glass-strong'
56
+ 'ui-data-table',
57
+ glass && 'ui-data-table--glass',
58
+ glass === 'subtle' && 'ui-glass-subtle',
59
+ glass === 'strong' && 'ui-glass-strong'
59
60
  ], classProp, className)
60
61
 
61
- const isCellObject = (cell: DataTableCell): cell is Exclude<DataTableCell, boolean | null | number | string | undefined> =>
62
- typeof cell === 'object' && cell !== null
62
+ const isCellObject = (cell: DataTableCell): cell is Exclude<DataTableCell, boolean | null | number | string | undefined> => typeof cell === 'object' && cell !== null
63
63
 
64
64
  const formatCell = (cell: DataTableCell): string => {
65
65
  const value = isCellObject(cell) ? cell.label ?? cell.value : cell
@@ -73,8 +73,7 @@ const getSortValue = (cell: DataTableCell): string | undefined => {
73
73
  return String(cell.sortValue)
74
74
  }
75
75
 
76
- const getRowValue = (row: DataTableRow, index: number): string =>
77
- String(row.rowValue ?? row.value ?? row.id ?? index)
76
+ const getRowValue = (row: DataTableRow, index: number): string => String(row.rowValue ?? row.value ?? row.id ?? index)
78
77
  ---
79
78
 
80
79
  <div
@@ -85,38 +84,40 @@ const getRowValue = (row: DataTableRow, index: number): string =>
85
84
  data-ui-glass-track={glass ? true : undefined}
86
85
  {...passthrough}
87
86
  >
88
- {hasData ? (
89
- <table>
90
- <thead>
91
- <tr>
92
- {columns.map(column => (
93
- <th
94
- data-ui-datatable-sort-type={column.sort}
95
- data-ui-datatable-sortable={column.sortable ? 'true' : undefined}
96
- scope="col"
97
- >
98
- {column.header ?? column.label ?? column.key}
99
- </th>
100
- ))}
101
- </tr>
102
- </thead>
103
- <tbody>
104
- {rows.map((row, rowIndex) => (
105
- <tr data-ui-datatable-row data-value={getRowValue(row, rowIndex)}>
106
- {columns.map(column => {
107
- const cell = row[column.key]
108
-
109
- return (
110
- <td data-sort-value={getSortValue(cell)}>
111
- {formatCell(cell)}
112
- </td>
113
- )
114
- })}
87
+ {hasData ?
88
+ (
89
+ <table>
90
+ <thead>
91
+ <tr>
92
+ {columns.map(column => (
93
+ <th
94
+ data-ui-datatable-sort-type={column.sort}
95
+ data-ui-datatable-sortable={column.sortable ? 'true' : undefined}
96
+ scope="col"
97
+ >
98
+ {column.header ?? column.label ?? column.key}
99
+ </th>
100
+ ))}
115
101
  </tr>
116
- ))}
117
- </tbody>
118
- </table>
119
- ) : (
120
- <slot />
121
- )}
102
+ </thead>
103
+ <tbody>
104
+ {rows.map((row, rowIndex) => (
105
+ <tr data-ui-datatable-row data-value={getRowValue(row, rowIndex)}>
106
+ {columns.map(column => {
107
+ const cell = row[column.key]
108
+
109
+ return (
110
+ <td data-sort-value={getSortValue(cell)}>
111
+ {formatCell(cell)}
112
+ </td>
113
+ )
114
+ })}
115
+ </tr>
116
+ ))}
117
+ </tbody>
118
+ </table>
119
+ ) :
120
+ (
121
+ <slot />
122
+ )}
122
123
  </div>
@@ -1,8 +1,9 @@
1
1
  ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
2
4
  import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
- import Calendar from './Calendar.astro'
4
5
 
5
- import type { HTMLAttributes } from 'astro/types'
6
+ import Calendar from './Calendar.astro'
6
7
 
7
8
  interface Props extends HTMLAttributes<'input'> {
8
9
  class?: string | null
@@ -32,26 +33,28 @@ const triggerId = `${datePickerId}-trigger`
32
33
  const popoverId = `${datePickerId}-popover`
33
34
 
34
35
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
35
- 'ui-date-picker-field',
36
- glass && 'ui-date-picker-field--glass',
37
- glass === 'subtle' && 'ui-glass-subtle',
38
- glass === 'strong' && 'ui-glass-strong'
36
+ 'ui-date-picker-field',
37
+ glass && 'ui-date-picker-field--glass',
38
+ glass === 'subtle' && 'ui-glass-subtle',
39
+ glass === 'strong' && 'ui-glass-strong'
39
40
  ], classProp, className)
40
41
 
41
42
  const selectedValue = value === undefined || value === null ? undefined : String(value)
42
43
  const hasSelectedValue = selectedValue !== undefined && selectedValue !== ''
43
44
  const placeholderText = placeholder ?? 'Choose a date'
44
- const selectedDate = hasSelectedValue
45
- ? new Date(`${selectedValue}T00:00:00.000Z`)
46
- : undefined
47
- const displayValue = selectedDate && !Number.isNaN(selectedDate.getTime())
48
- ? new Intl.DateTimeFormat('en', {
49
- day: 'numeric',
50
- month: 'short',
51
- timeZone: 'UTC',
52
- year: 'numeric'
53
- }).format(selectedDate)
54
- : placeholderText
45
+
46
+ const selectedDate = hasSelectedValue ?
47
+ new Date(`${selectedValue}T00:00:00.000Z`) :
48
+ undefined
49
+
50
+ const displayValue = selectedDate && !Number.isNaN(selectedDate.getTime()) ?
51
+ new Intl.DateTimeFormat('en', {
52
+ day: 'numeric',
53
+ month: 'short',
54
+ timeZone: 'UTC',
55
+ year: 'numeric'
56
+ }).format(selectedDate) :
57
+ placeholderText
55
58
  ---
56
59
 
57
60
  <div
@@ -1,14 +1,15 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'div'> {
7
7
  class?: string | null
8
8
  className?: string
9
9
  }
10
10
 
11
11
  const { class: classProp = '', className = '', ...rest } = Astro.props
12
+
12
13
  const { classList, passthrough } = resolveLumenAstroProps(rest, ['ui-date-range-picker'
13
14
  ], classProp, className)
14
15
  ---
@@ -1,9 +1,9 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
6
- type DescriptionItem = { label: string; value: string }
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
+ interface DescriptionItem { label: string, value: string }
7
7
 
8
8
  interface Props extends HTMLAttributes<'dl'> {
9
9
  class?: string | null
@@ -1,17 +1,13 @@
1
1
  ---
2
- import { resolveLumenAstroProps, resolveLumenGlass } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'dialog'> {
7
7
  class?: string | null
8
8
  className?: string
9
9
  glass?: boolean | 'subtle' | 'strong'
10
10
  layout?: 'centered' | 'fullscreen'
11
- /**
12
- * @deprecated Use `glass` instead. `surface="glass"` maps to `glass={true}`.
13
- */
14
- surface?: 'default' | 'glass'
15
11
  }
16
12
 
17
13
  const {
@@ -19,22 +15,20 @@ const {
19
15
  className = '',
20
16
  glass = false,
21
17
  layout = 'centered',
22
- surface = 'default',
23
18
  ...rest
24
19
  } = Astro.props
25
20
 
26
- const resolvedGlass = resolveLumenGlass(glass, surface)
27
21
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
28
- 'ui-dialog',
29
- layout === 'fullscreen' && 'ui-dialog--fullscreen',
30
- resolvedGlass && 'ui-dialog--glass',
31
- glass === 'subtle' && 'ui-glass-subtle',
32
- glass === 'strong' && 'ui-glass-strong'
22
+ 'ui-dialog',
23
+ layout === 'fullscreen' && 'ui-dialog--fullscreen',
24
+ glass && 'ui-dialog--glass',
25
+ glass === 'subtle' && 'ui-glass-subtle',
26
+ glass === 'strong' && 'ui-glass-strong'
33
27
  ], classProp, className)
34
28
  ---
35
29
 
36
30
  <dialog
37
- data-surface={resolvedGlass ? 'glass' : 'default'}
31
+ data-surface={glass ? 'glass' : 'default'}
38
32
  data-layout={layout}
39
33
  data-ui-dialog
40
34
  class:list={classList}
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'div'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -17,7 +17,7 @@ const {
17
17
  } = Astro.props
18
18
 
19
19
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
20
- 'ui-direction'
20
+ 'ui-direction'
21
21
  ], classProp, className)
22
22
  ---
23
23
 
@@ -1,37 +1,31 @@
1
1
  ---
2
- import { resolveLumenAstroProps, resolveLumenGlass } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'dialog'> {
7
7
  class?: string | null
8
8
  className?: string
9
9
  glass?: boolean | 'subtle' | 'strong'
10
- /**
11
- * @deprecated Use `glass` instead. `surface="glass"` maps to `glass={true}`.
12
- */
13
- surface?: 'default' | 'glass'
14
10
  }
15
11
 
16
12
  const {
17
13
  class: classProp = '',
18
14
  className = '',
19
15
  glass = false,
20
- surface = 'default',
21
16
  ...rest
22
17
  } = Astro.props
23
18
 
24
- const resolvedGlass = resolveLumenGlass(glass, surface)
25
19
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
26
- 'ui-drawer',
27
- resolvedGlass && 'ui-drawer--glass',
28
- glass === 'subtle' && 'ui-glass-subtle',
29
- glass === 'strong' && 'ui-glass-strong'
20
+ 'ui-drawer',
21
+ glass && 'ui-drawer--glass',
22
+ glass === 'subtle' && 'ui-glass-subtle',
23
+ glass === 'strong' && 'ui-glass-strong'
30
24
  ], classProp, className)
31
25
  ---
32
26
 
33
27
  <dialog
34
- data-surface={resolvedGlass ? 'glass' : 'default'}
28
+ data-surface={glass ? 'glass' : 'default'}
35
29
  data-ui-drawer
36
30
  class:list={classList}
37
31
  {...passthrough}
@@ -1,37 +1,31 @@
1
1
  ---
2
- import { resolveLumenAstroProps, resolveLumenGlass } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'div'> {
7
7
  class?: string | null
8
8
  className?: string
9
9
  glass?: boolean | 'subtle' | 'strong'
10
- /**
11
- * @deprecated Use `glass` instead. `surface="glass"` maps to `glass={true}`.
12
- */
13
- surface?: 'default' | 'glass'
14
10
  }
15
11
 
16
12
  const {
17
13
  class: classProp = '',
18
14
  className = '',
19
15
  glass = false,
20
- surface = 'default',
21
16
  ...rest
22
17
  } = Astro.props
23
18
 
24
- const resolvedGlass = resolveLumenGlass(glass, surface)
25
19
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
26
- 'ui-menu',
27
- resolvedGlass && 'ui-menu--glass',
28
- glass === 'subtle' && 'ui-glass-subtle',
29
- glass === 'strong' && 'ui-glass-strong'
20
+ 'ui-menu',
21
+ glass && 'ui-menu--glass',
22
+ glass === 'subtle' && 'ui-glass-subtle',
23
+ glass === 'strong' && 'ui-glass-strong'
30
24
  ], classProp, className)
31
25
  ---
32
26
 
33
27
  <div
34
- data-surface={resolvedGlass ? 'glass' : 'default'}
28
+ data-surface={glass ? 'glass' : 'default'}
35
29
  data-ui-dropdown-menu
36
30
  class:list={classList}
37
31
  {...passthrough}
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'section'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -17,10 +17,10 @@ const {
17
17
  } = Astro.props
18
18
 
19
19
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
20
- 'ui-empty',
21
- glass && 'ui-empty--glass',
22
- glass === 'subtle' && 'ui-glass-subtle',
23
- glass === 'strong' && 'ui-glass-strong'
20
+ 'ui-empty',
21
+ glass && 'ui-empty--glass',
22
+ glass === 'subtle' && 'ui-glass-subtle',
23
+ glass === 'strong' && 'ui-glass-strong'
24
24
  ], classProp, className)
25
25
  ---
26
26
 
@@ -0,0 +1,54 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
4
+ import type { LumenFormErrorInput } from '@santi020k/lumen-core'
5
+ import { normalizeLumenFormErrors, resolveLumenAstroProps } from '@santi020k/lumen-core'
6
+
7
+ interface Props extends HTMLAttributes<'section'> {
8
+ class?: string | null
9
+ className?: string
10
+ errors?: LumenFormErrorInput
11
+ heading?: string
12
+ }
13
+
14
+ const {
15
+ class: classProp = '',
16
+ className = '',
17
+ errors,
18
+ heading = 'There is a problem',
19
+ id,
20
+ ...rest
21
+ } = Astro.props
22
+
23
+ const normalizedErrors = normalizeLumenFormErrors(errors)
24
+
25
+ const allErrors = [
26
+ ...normalizedErrors.form.map(message => ({ message })),
27
+ ...normalizedErrors.fields
28
+ ]
29
+
30
+ const summaryId = id ?? 'ui-error-summary'
31
+ const headingId = `${summaryId}-heading`
32
+ const { classList, passthrough } = resolveLumenAstroProps(rest, ['ui-error-summary'], classProp, className)
33
+ ---
34
+
35
+ <section
36
+ aria-labelledby={headingId}
37
+ class:list={classList}
38
+ data-ui-error-summary
39
+ hidden={allErrors.length === 0}
40
+ id={summaryId}
41
+ tabindex="-1"
42
+ {...passthrough}
43
+ >
44
+ <h2 id={headingId}>{heading}</h2>
45
+ <ul>
46
+ {allErrors.map(error => (
47
+ <li>
48
+ {error.controlId ?
49
+ <a href={`#${error.controlId}`}>{error.message}</a> :
50
+ error.message}
51
+ </li>
52
+ ))}
53
+ </ul>
54
+ </section>
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'p'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'div'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -22,11 +22,12 @@ const {
22
22
  } = Astro.props
23
23
 
24
24
  const { classList, passthrough } = resolveLumenAstroProps(rest, [
25
- 'ui-field',
26
- glass && 'ui-field--glass',
27
- glass === 'subtle' && 'ui-glass-subtle',
28
- glass === 'strong' && 'ui-glass-strong'
25
+ 'ui-field',
26
+ glass && 'ui-field--glass',
27
+ glass === 'subtle' && 'ui-glass-subtle',
28
+ glass === 'strong' && 'ui-glass-strong'
29
29
  ], classProp, className)
30
+
30
31
  const fieldDescribedBy = [ariaDescribedby, describedBy].filter(Boolean).join(' ') || undefined
31
32
  ---
32
33
 
@@ -0,0 +1,29 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
+ interface Props extends HTMLAttributes<'p'> {
7
+ class?: string | null
8
+ className?: string
9
+ message?: string
10
+ }
11
+
12
+ const {
13
+ class: classProp = '',
14
+ className = '',
15
+ message,
16
+ ...rest
17
+ } = Astro.props
18
+
19
+ const { classList, passthrough } = resolveLumenAstroProps(rest, ['ui-field-error'], classProp, className)
20
+ ---
21
+
22
+ <p
23
+ class:list={classList}
24
+ data-ui-field-error
25
+ hidden={!message}
26
+ {...passthrough}
27
+ >
28
+ <slot>{message}</slot>
29
+ </p>
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends Omit<HTMLAttributes<'input'>, 'type' | 'size'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'span'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -0,0 +1,33 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
4
+ import type { LumenFormStatus } from '@santi020k/lumen-core'
5
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
6
+
7
+ interface Props extends HTMLAttributes<'form'> {
8
+ class?: string | null
9
+ className?: string
10
+ enhance?: boolean
11
+ status?: LumenFormStatus
12
+ }
13
+
14
+ const {
15
+ class: classProp = '',
16
+ className = '',
17
+ enhance = true,
18
+ status = 'idle',
19
+ ...rest
20
+ } = Astro.props
21
+
22
+ const { classList, passthrough } = resolveLumenAstroProps(rest, ['ui-form'], classProp, className)
23
+ ---
24
+
25
+ <form
26
+ aria-busy={status === 'submitting' ? 'true' : undefined}
27
+ class:list={classList}
28
+ data-status={status}
29
+ data-ui-form={enhance ? true : undefined}
30
+ {...passthrough}
31
+ >
32
+ <slot />
33
+ </form>
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'time'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -1,8 +1,8 @@
1
1
  ---
2
- import { resolveLumenAstroProps } from '@santi020k/lumen-core'
3
-
4
2
  import type { HTMLAttributes } from 'astro/types'
5
3
 
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
6
  interface Props extends HTMLAttributes<'div'> {
7
7
  class?: string | null
8
8
  className?: string
@@ -0,0 +1,46 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
4
+ import { resolveLumenAstroProps } from '@santi020k/lumen-core'
5
+
6
+ interface Props extends HTMLAttributes<'div'> {
7
+ as?: 'div' | 'ol' | 'section' | 'ul'
8
+ class?: string | null
9
+ className?: string
10
+ columns?: 1 | 2 | 3 | 4 | 6 | 12 | 'auto'
11
+ gap?: 'lg' | 'md' | 'none' | 'sm' | 'xl'
12
+ minItemWidth?: string
13
+ }
14
+
15
+ const {
16
+ as: Tag = 'div',
17
+ class: classProp = '',
18
+ className = '',
19
+ columns = 'auto',
20
+ gap = 'md',
21
+ minItemWidth,
22
+ style,
23
+ ...rest
24
+ } = Astro.props
25
+
26
+ const gridStyle = [
27
+ typeof style === 'string' ? style : '',
28
+ minItemWidth ? `--ui-grid-min:${minItemWidth}` : ''
29
+ ].filter(Boolean).join(';')
30
+
31
+ const { classList, passthrough } = resolveLumenAstroProps(rest, [
32
+ 'ui-grid',
33
+ `ui-grid--columns-${columns}`,
34
+ `ui-grid--gap-${gap}`
35
+ ], classProp, className)
36
+ ---
37
+
38
+ <Tag
39
+ class:list={classList}
40
+ data-columns={columns}
41
+ data-ui-grid
42
+ style={gridStyle || undefined}
43
+ {...passthrough}
44
+ >
45
+ <slot />
46
+ </Tag>