fulldev-ui 0.5.0-beta.1 → 0.5.0-beta.11

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 (78) hide show
  1. package/.env.example +3 -0
  2. package/CONTRIBUTING.md +10 -4
  3. package/astro.config.ts +2 -13
  4. package/package.json +8 -4
  5. package/pnpm-lock.yaml +82 -130
  6. package/src/blocks/Article.astro +31 -12
  7. package/src/blocks/Banner.astro +2 -1
  8. package/src/blocks/Contact.astro +7 -30
  9. package/src/blocks/Excerpt.astro +14 -0
  10. package/src/blocks/Intro.astro +3 -1
  11. package/src/blocks/Product.astro +55 -22
  12. package/src/components/Card.astro +11 -5
  13. package/src/components/Cart.astro +38 -0
  14. package/src/components/CartForm.astro +121 -0
  15. package/src/components/CartList.astro +134 -0
  16. package/src/components/CartSummary.astro +147 -0
  17. package/src/components/Drawer.astro +128 -52
  18. package/src/components/Footer.astro +6 -3
  19. package/src/components/Form.astro +49 -0
  20. package/src/components/Header.astro +19 -14
  21. package/src/components/Image.astro +0 -1
  22. package/src/components/Input.astro +6 -0
  23. package/src/components/Menu.astro +56 -0
  24. package/src/components/Price.astro +7 -11
  25. package/src/components/Search.astro +1 -4
  26. package/src/components/Section.astro +2 -1
  27. package/src/components/Sidebar.astro +61 -111
  28. package/src/components/Social.astro +7 -0
  29. package/src/components/ThemeSelect.astro +3 -0
  30. package/src/components/Toc.astro +33 -94
  31. package/src/components/docs/PropsTable.astro +1 -1
  32. package/src/components/experimental/Form.astro +31 -5
  33. package/src/components/experimental/Gallery.astro +50 -126
  34. package/src/components/experimental/Prose.astro +32 -0
  35. package/src/content/pages/base/select.mdx +0 -8
  36. package/src/content/pages/base/textarea.mdx +0 -5
  37. package/src/content/pages/blocks/_product.mdx +73 -2
  38. package/src/content/pages/index.mdx +0 -3
  39. package/src/content/pages/layouts/_layout.mdx +14 -0
  40. package/src/content/pages/layouts/docslayout.mdx +10 -1
  41. package/src/content/pages/overview/components.mdx +5 -0
  42. package/src/content/pages/overview/content-collections.mdx +139 -0
  43. package/src/content/pages/overview/installation.mdx +25 -26
  44. package/src/content/pages/overview/introduction.mdx +16 -10
  45. package/src/content/pages/overview/theming.mdx +69 -0
  46. package/src/content/pages/schemas/page.mdx +6 -0
  47. package/src/content/presets/base.yml +56 -43
  48. package/src/content/presets/blocks.yml +0 -3
  49. package/src/content/presets/docs.yml +3 -62
  50. package/src/env.d.ts +1 -1
  51. package/src/integration/index.ts +63 -34
  52. package/src/layouts/DocsLayout.astro +23 -35
  53. package/src/layouts/Layout.astro +37 -21
  54. package/src/layouts/OverviewLayout.astro +17 -10
  55. package/src/layouts/PostLayout.astro +7 -7
  56. package/src/layouts/ProductLayout.astro +5 -2
  57. package/src/schemas/components/footer.ts +1 -0
  58. package/src/schemas/components/header.ts +1 -0
  59. package/src/schemas/components/menu.ts +13 -0
  60. package/src/schemas/components/sidebar.ts +15 -0
  61. package/src/schemas/components/toc.ts +3 -0
  62. package/src/schemas/pageSchema.ts +72 -34
  63. package/src/schemas/presetSchema.ts +2 -28
  64. package/src/schemas/utils/navigation.ts +6 -51
  65. package/src/stores/cart.ts +23 -0
  66. package/src/utils/cart.ts +32 -0
  67. package/src/utils/{getChildPages.ts → getFolderChildren.ts} +3 -1
  68. package/src/utils/{getCategoryPages.ts → getReferenceChildren.ts} +6 -3
  69. package/tsconfig.json +1 -3
  70. package/src/components/experimental/GalleryVertical.astro +0 -161
  71. package/src/content/pages/layouts/layout.mdx +0 -21
  72. package/src/content/pages/layouts/pagelayout.mdx +0 -21
  73. package/src/content/pages/overview/content-layer.mdx +0 -128
  74. package/src/content/pages/overview/customization.mdx +0 -83
  75. package/src/layouts/ContentLayout.astro +0 -16
  76. package/src/layouts/PageLayout.astro +0 -15
  77. /package/src/schemas/utils/{categories.ts → parents.ts} +0 -0
  78. /package/src/types/{global-props.d.ts → global-props.ts} +0 -0
@@ -1,151 +1,101 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
3
- import Button from 'fulldev-ui/components/Button.astro'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
4
3
  import Element from 'fulldev-ui/components/Element.astro'
5
4
  import Logo from 'fulldev-ui/components/experimental/Logo.astro'
6
- import Heading from 'fulldev-ui/components/Heading.astro'
7
- import Search from 'fulldev-ui/components/Search.astro'
5
+ import Menu from 'fulldev-ui/components/Menu.astro'
8
6
  import ThemeSelect from 'fulldev-ui/components/ThemeSelect.astro'
9
7
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
8
+ import Heading from './Heading.astro'
9
+ import Toc from './Toc.astro'
10
10
 
11
11
  interface Props extends GlobalProps, HTMLAttributes<'aside'> {
12
- size?: 'sm' | 'md' | 'lg' | undefined
13
- search?: boolean | undefined
14
- logo?: string | undefined
15
- company?: string | undefined
16
- buttons?: any[] | undefined
17
- open?: boolean | undefined
12
+ menu?: ComponentProps<typeof Menu>['groups']
13
+ heading?: ComponentProps<typeof Heading>['text']
14
+ render?: ComponentProps<typeof Toc>['render']
15
+ logo?: ComponentProps<typeof Logo>
16
+ toc?: ComponentProps<typeof Toc>['heading']
17
+ company?: ComponentProps<typeof Logo>['company']
18
+ themeselect?: boolean | undefined
18
19
  }
19
20
 
20
21
  const {
21
22
  size = 'sm',
22
- open = false,
23
23
  logo,
24
24
  company,
25
- buttons,
26
- search,
25
+ render,
26
+ themeselect,
27
+ menu,
28
+ toc,
29
+ heading,
30
+ ...rest
27
31
  } = Astro.props
28
32
  ---
29
33
 
30
- <input
31
- id="sidebar"
32
- class="sidebar-checkbox"
33
- type="checkbox"
34
- />
35
-
36
34
  <Element
37
35
  class:list="sidebar"
38
36
  as="aside"
39
37
  {size}
40
- {open}
38
+ {...rest}
41
39
  >
42
- <Logo
43
- src={logo}
44
- company={company}
45
- />
46
- {search && <Search />}
47
- <Element class:list="buttons">
48
- {
49
- buttons?.map(({ heading, slug, href, text, buttons }) => (
50
- <>
51
- <Heading
52
- level={6}
53
- text={heading}
54
- />
55
- <Button
56
- variant="link"
57
- {slug}
58
- {href}
59
- {text}
60
- />
61
- {buttons?.map((button: any) => (
62
- <Button
63
- variant="link"
64
- {...button}
65
- />
66
- ))}
67
- </>
68
- ))
69
- }
70
- <ThemeSelect />
40
+ <Element
41
+ class:list="sidebar-header"
42
+ as="header"
43
+ >
44
+ <Logo
45
+ {company}
46
+ {...logo}
47
+ />
48
+ <Heading
49
+ level={4}
50
+ text={heading}
51
+ />
52
+ <slot name="header" />
53
+ </Element>
54
+ <Element class:list="sidebar-content">
55
+ <Menu groups={menu} />
56
+ <ThemeSelect if={themeselect} />
57
+ <slot />
71
58
  </Element>
72
59
  </Element>
73
60
 
74
61
  <style lang="scss" is:global>
75
62
  @layer fulldev {
76
- .sidebar-checkbox {
77
- display: none;
78
- }
79
-
80
- @media (max-width: 1023.999px) {
81
- body:has(.sidebar-checkbox:checked) {
82
- overflow: hidden;
83
- }
84
- }
85
-
86
63
  .sidebar {
87
- --sidebar-width: 240px;
88
-
89
64
  display: none;
90
- position: fixed;
91
- top: var(--header-height, 0px);
92
- bottom: 0;
93
- left: 0;
94
- flex-shrink: 0;
95
- flex-direction: column;
96
- justify-content: flex-start;
97
- z-index: 10;
98
- border-style: solid;
99
- border-color: var(--color-a6);
100
- background-color: var(--base-2);
101
- padding: var(--space-md-5) var(--gutter);
102
- width: 100%;
103
- height: calc(100vh - var(--header-height, 0px));
104
- overflow-y: auto;
105
-
106
- &:is(.sidebar-checkbox:checked + &) {
107
- display: flex;
108
- }
109
65
 
110
66
  @media (min-width: 1024px) {
111
- border-right-width: 1px;
112
- padding: var(--space-md-6) var(--gutter);
113
- width: var(--sidebar-width);
114
-
115
- &.open {
116
- display: flex;
117
- position: sticky;
118
- }
119
- }
120
-
121
- .buttons {
122
67
  display: flex;
68
+ position: sticky;
69
+ top: var(--header-height, 0px);
70
+ bottom: 0;
71
+ flex-shrink: 0;
123
72
  flex-direction: column;
124
- gap: calc(var(--space-4) + var(--space-1));
73
+ justify-content: flex-start;
74
+ z-index: 10;
75
+ border-right: 1px solid var(--color-a6);
76
+ width: calc(var(--space-7) * 4);
77
+ height: calc(100vh - var(--header-height, 0px));
125
78
 
126
- .theme-select {
127
- margin-top: var(--space-5);
79
+ .sidebar-header {
80
+ display: flex;
81
+ position: sticky;
82
+ align-items: center;
83
+ border-bottom: 1px solid var(--color-a6);
84
+ padding: 0 var(--gutter);
85
+ width: 100%;
86
+ height: 56px;
128
87
  }
129
88
 
130
- .button + .heading {
131
- margin-top: var(--space-5);
89
+ .sidebar-content {
90
+ display: flex;
91
+ top: 0;
92
+ flex: 1;
93
+ flex-direction: column;
94
+ padding: var(--space-md-6) var(--gutter);
95
+ width: 100%;
96
+ overflow-y: auto;
132
97
  }
133
98
  }
134
-
135
- .logo {
136
- display: none;
137
- position: absolute;
138
- top: 0;
139
- left: var(--gutter);
140
- align-items: center;
141
- height: 56px;
142
- }
143
- }
144
-
145
- @media (min-width: 1024px) {
146
- .header:not(.open) ~ .core .sidebar .logo {
147
- display: flex;
148
- }
149
99
  }
150
100
  }
151
101
  </style>
@@ -26,3 +26,10 @@ const platform = () => {
26
26
  {variant}
27
27
  {href}
28
28
  />
29
+
30
+ <style is:global lang="scss">
31
+ .social {
32
+ padding: 0 var(--space-3);
33
+ height: calc(var(--text-2) + 2 * var(--space-3));
34
+ }
35
+ </style>
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  import Select from 'fulldev-ui/components/Select.astro'
3
3
  // const defaultTheme = fulldevConfig.colors.theme || 'light'
4
+
5
+ const { ...rest } = Astro.props
4
6
  ---
5
7
 
6
8
  <Select
@@ -9,6 +11,7 @@ import Select from 'fulldev-ui/components/Select.astro'
9
11
  options={['light', 'dark']}
10
12
  value="light"
11
13
  onchange="localStorage.setItem('theme', this.value); window.location.reload();"
14
+ {...rest}
12
15
  />
13
16
 
14
17
  <script>
@@ -1,16 +1,17 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
3
  import type { CollectionEntry } from 'astro:content'
4
4
  import Button from 'fulldev-ui/components/Button.astro'
5
5
  import Element from 'fulldev-ui/components/Element.astro'
6
6
  import Heading from 'fulldev-ui/components/Heading.astro'
7
7
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
8
8
 
9
- interface Props extends GlobalProps, HTMLAttributes<'aside'> {
9
+ interface Props extends GlobalProps, HTMLAttributes<'div'> {
10
+ heading?: ComponentProps<typeof Heading>['text']
10
11
  render?: CollectionEntry<'pages'>['render'] | undefined
11
12
  }
12
13
 
13
- const { size = 'sm', render } = Astro.props
14
+ const { size = 'sm', heading, render, ...rest } = Astro.props
14
15
 
15
16
  const headings = render ? (await render())?.headings : []
16
17
  const filteredHeadings = headings?.filter(
@@ -18,114 +19,52 @@ const filteredHeadings = headings?.filter(
18
19
  )
19
20
  ---
20
21
 
21
- <input
22
- id="toc"
23
- class="toc-checkbox"
24
- type="checkbox"
25
- />
26
-
27
22
  <Element
23
+ if={filteredHeadings?.length > 1}
28
24
  class:list="toc"
29
- as="aside"
30
25
  {size}
26
+ {...rest}
31
27
  >
28
+ <Heading
29
+ level={6}
30
+ text={heading}
31
+ />
32
32
  {
33
- filteredHeadings?.length > 0 && (
34
- <>
35
- <Heading
36
- text="On this page"
37
- level={6}
38
- />
39
- <nav class="toc-nav">
40
- <Button
41
- variant="link"
42
- href={`#${filteredHeadings[0]?.slug}`}
43
- text="Overview"
44
- class="toc-link toc-link-h2"
45
- />
46
- {filteredHeadings.map((heading: any) => (
47
- <Button
48
- variant="link"
49
- href={`#${heading.slug}`}
50
- text={heading.text}
51
- class={`toc-link toc-link-h${heading.depth}`}
52
- />
53
- ))}
54
- </nav>
55
- </>
56
- )
33
+ filteredHeadings?.map((button: any) => (
34
+ <Button
35
+ class:list={`depth-${button.depth}`}
36
+ href={`#${button.slug}`}
37
+ variant="link"
38
+ text={button.text}
39
+ />
40
+ ))
57
41
  }
58
42
  </Element>
59
43
 
60
44
  <style lang="scss" is:global>
61
45
  @layer fulldev {
62
- .toc-checkbox {
63
- display: none;
64
- }
65
-
66
- @media (max-width: 1023.999px) {
67
- body:has(.toc-checkbox:checked) {
68
- overflow: hidden;
69
- }
70
- }
71
-
72
46
  .toc {
73
- --toc-width: 240px;
74
-
75
47
  display: none;
76
- position: fixed;
77
- top: var(--header-height, 0px);
78
- right: 0;
79
- flex-shrink: 0;
80
- flex-direction: column;
81
- justify-content: flex-start;
82
- gap: calc(var(--space-4) + var(--space-1));
83
- z-index: 10;
84
- border-left-width: 1px;
85
- border-style: solid;
86
- border-color: var(--color-a6);
87
- background-color: var(--color-background);
88
- padding: var(--space-md-6) var(--gutter);
89
- width: 100%;
90
- max-height: calc(100vh - var(--header-height, 0px));
91
- overflow-y: auto;
92
-
93
- &:is(.toc-checkbox:checked + &) {
94
- display: flex;
95
- }
96
48
 
97
49
  @media (min-width: 1024px) {
98
50
  display: flex;
99
51
  position: sticky;
100
- border-left-width: 1px;
101
- width: var(--toc-width);
102
- }
103
-
104
- .button + .heading {
105
- margin-top: var(--space-5);
106
- }
107
-
108
- .toc-nav {
109
- display: flex;
52
+ top: calc(var(--header-height, 0px) + var(--space-6));
53
+ bottom: 0;
54
+ flex-shrink: 0;
110
55
  flex-direction: column;
111
- }
112
-
113
- .toc-link {
114
- text-align: left;
115
- }
116
-
117
- .toc-link-h2 {
118
- margin-top: var(--space-3);
119
- }
120
-
121
- .toc-link-h3 {
122
- margin-top: var(--space-3);
123
- margin-left: var(--space-4);
124
- }
125
-
126
- .toc-link-h4 {
127
- margin-top: var(--space-2);
128
- margin-left: var(--space-5);
56
+ justify-content: flex-start;
57
+ gap: var(--space-4);
58
+ z-index: 10;
59
+ min-width: calc(var(--space-7) * 3);
60
+
61
+ .depth-3 {
62
+ padding-left: var(--space-4);
63
+ }
64
+
65
+ .depth-4 {
66
+ padding-left: var(--space-5);
67
+ }
129
68
  }
130
69
  }
131
70
  }
@@ -3,7 +3,7 @@ import Table from 'fulldev-ui/components/Table.astro'
3
3
  import { readFileSync } from 'node:fs'
4
4
  import { pascal } from 'radash'
5
5
 
6
- const slug = Astro.url.pathname.replace(/\/$/, '').split('/').pop() || ''
6
+ const slug = Astro.params.page || 'index'
7
7
  const componentName = pascal(slug)
8
8
 
9
9
  const allComponents = import.meta.glob('/src/**/*.astro', { eager: true })
@@ -1,26 +1,52 @@
1
1
  ---
2
- import type { HTMLAttributes } from 'astro/types'
2
+ import type { ComponentProps, HTMLAttributes } from 'astro/types'
3
3
  import Element from 'fulldev-ui/components/Element.astro'
4
4
  import type { GlobalProps } from 'fulldev-ui/types/global-props'
5
+ import Button from '../Button.astro'
6
+ import Input from '../Input.astro'
7
+ import Select from '../Select.astro'
8
+ import Textarea from '../Textarea.astro'
5
9
 
6
10
  interface Props extends GlobalProps, HTMLAttributes<'form'> {
7
- structure?: 'column' | 'row' | 'group' | undefined
11
+ submit?: ComponentProps<typeof Button>['text']
12
+ fields?:
13
+ | (
14
+ | ComponentProps<typeof Input>
15
+ | ComponentProps<typeof Select>
16
+ | (ComponentProps<typeof Textarea> & { type?: 'textarea' | undefined })
17
+ )[]
18
+ | undefined
8
19
  }
9
20
 
10
- const { structure = 'column', ...rest } = Astro.props
21
+ const { fields, submit, ...rest } = Astro.props
11
22
  ---
12
23
 
13
24
  <Element
14
- class:list={`form ${structure}`}
25
+ class:list="form"
15
26
  as="form"
16
27
  {...rest}
17
28
  >
18
- <slot />
29
+ <slot>
30
+ {
31
+ fields?.map((field) => {
32
+ if ('options' in field) return <Select {...field} />
33
+ if ('type' in field && field.type === 'textarea')
34
+ return <Textarea {...field} />
35
+ return <Input {...(field as any)} />
36
+ })
37
+ }
38
+ <Button
39
+ type="submit"
40
+ text={submit}
41
+ />
42
+ </slot>
19
43
  </Element>
20
44
 
21
45
  <style is:global lang="scss">
22
46
  .form {
23
47
  display: flex;
48
+ flex-direction: column;
49
+ gap: var(--space-4);
24
50
  width: 100%;
25
51
  max-width: calc(var(--space-4) * 44);
26
52
  }