@solfacil/girassol 0.1.3 → 0.1.5

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 (54) hide show
  1. package/.vscode/extensions.json +2 -1
  2. package/.vscode/settings.json +9 -0
  3. package/README.md +1 -1
  4. package/cli/src/commands/create:component.ts +91 -0
  5. package/cli/src/commands/generate:plugin.ts +1 -1
  6. package/cli/src/commands/generate:types.ts +1 -1
  7. package/cli/src/commands/girassol.ts +1 -1
  8. package/cli/src/extensions/cli-extension.ts +1 -1
  9. package/cli/src/templates/components/component.spec.ts.ejs +20 -0
  10. package/cli/src/templates/components/component.stories.mdx.ejs +74 -0
  11. package/cli/src/templates/components/component.vue.ejs +23 -0
  12. package/cli/src/templates/components/index.ts.ejs +10 -0
  13. package/dist/girassol.es.js +979 -131
  14. package/dist/girassol.umd.js +5 -5
  15. package/dist/style.css +1 -1
  16. package/dist/theme/solfacil/colors.d.ts +2 -2
  17. package/dist/theme/solfacil/index.d.ts +2 -0
  18. package/dist/theme/solfacil/utilities.d.ts +2 -0
  19. package/dist/types/components/dropdown/Dropdown.vue.d.ts +75 -0
  20. package/dist/types/components/dropdown/dropdown.spec.d.ts +1 -0
  21. package/dist/types/components/dropdown/index.d.ts +2 -0
  22. package/dist/types/components/forms/button/Button.vue.d.ts +4 -4
  23. package/dist/types/components/forms/checkbox/CheckboxGroup.vue.d.ts +1 -1
  24. package/dist/types/components/forms/checkbox/checkbox-type.d.ts +2 -2
  25. package/dist/types/components/forms/checkbox/index.d.ts +1 -1
  26. package/dist/types/components/forms/input/index.d.ts +1 -1
  27. package/dist/types/components/forms/radio/RadioGroup.vue.d.ts +1 -1
  28. package/dist/types/components/forms/radio/index.d.ts +1 -1
  29. package/dist/types/components/forms/radio/radio-type.d.ts +2 -2
  30. package/dist/types/components/forms/switch/index.d.ts +1 -1
  31. package/dist/types/components/forms/textarea/Textarea.vue.d.ts +50 -0
  32. package/dist/types/components/forms/textarea/index.d.ts +2 -0
  33. package/dist/types/components/forms/textarea/textarea.spec.d.ts +1 -0
  34. package/dist/types/components/forms/textfield/Textfield.vue.d.ts +1 -1
  35. package/dist/types/components/forms/textfield/index.d.ts +1 -1
  36. package/dist/types/composables/use-toast/Toast.vue.d.ts +66 -0
  37. package/dist/types/composables/use-toast/index.d.ts +9 -0
  38. package/dist/types/composables/use-toast/types.d.ts +23 -0
  39. package/dist/types/composables/use-toast/use-toast.spec.d.ts +1 -0
  40. package/dist/types/composables/use-toast/useTimer.d.ts +9 -0
  41. package/dist/types/composables/use-toast/useTransition.d.ts +57 -0
  42. package/dist/types/index.d.ts +4 -1
  43. package/dist/vite.config.d.ts +1 -1
  44. package/package.json +62 -31
  45. package/theme/solfacil/borders.ts +2 -2
  46. package/theme/solfacil/colors.ts +4 -4
  47. package/theme/solfacil/effects.ts +3 -3
  48. package/theme/solfacil/index.ts +4 -2
  49. package/theme/solfacil/miscs.ts +2 -2
  50. package/theme/solfacil/spacing.ts +1 -1
  51. package/theme/solfacil/typography.ts +2 -2
  52. package/theme/solfacil/utilities.ts +71 -3
  53. package/vite.config.ts +17 -5
  54. package/windi.config.ts +5 -3
@@ -12,6 +12,7 @@
12
12
  "formulahendry.auto-close-tag",
13
13
  "wix.vscode-import-cost",
14
14
  "syler.sass-indented",
15
- "streetsidesoftware.code-spell-checker"
15
+ "streetsidesoftware.code-spell-checker",
16
+ "ZixuanChen.vitest-explorer"
16
17
  ]
17
18
  }
@@ -2,8 +2,13 @@
2
2
  "cSpell.words": [
3
3
  "antfu",
4
4
  "attributify",
5
+ "composables",
6
+ "describedby",
5
7
  "esnext",
8
+ "gluegun",
6
9
  "iconify",
10
+ "IIFE",
11
+ "nuxt",
7
12
  "solfacil",
8
13
  "Solfácil",
9
14
  "textfield",
@@ -11,6 +16,10 @@
11
16
  "theming",
12
17
  "unplugin",
13
18
  "vitejs",
19
+ "vitest",
20
+ "vue",
21
+ "vue.js",
22
+ "vuejs",
14
23
  "vueuse",
15
24
  "windi",
16
25
  "windicss"
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/solfacil/girassol/develop/public/girassol.svg?token=GHSAT0AAAAAABRQP4AJEP625ZKYT2QDG3NSYSXE5HQ" />
2
+ <img src="http://girassol.solfacil.tech/public/girassol.svg" />
3
3
  </div>
4
4
 
5
5
  Girassol design system
@@ -0,0 +1,91 @@
1
+ import type { GluegunToolbox } from 'gluegun'
2
+ import { resolve } from 'path'
3
+ const COMPONENTS_PATH_GIRASSOL = resolve(__dirname, '../../../src/components')
4
+
5
+ const pascalToKebab = (str: string) =>
6
+ str.replace(
7
+ /[A-Z]/g,
8
+ (letter, match) => `${match !== 0 ? '-' : ''}${letter.toLowerCase()}`
9
+ )
10
+
11
+ module.exports = {
12
+ name: 'create:component',
13
+ description: 'Create a component, unit test and docs file',
14
+ run: async (toolbox: GluegunToolbox) => {
15
+ const {
16
+ prompt,
17
+ template,
18
+ print: { highlight, info, success, error },
19
+ } = toolbox
20
+
21
+ const askFolder = {
22
+ type: 'input',
23
+ name: 'folder',
24
+ message: 'Gostaria de criar dentro de alguma pasta?',
25
+ hint: 'forms | forms/specials',
26
+ }
27
+
28
+ const askName = {
29
+ type: 'input',
30
+ name: 'name',
31
+ message: 'Qual o nome do componente?',
32
+ hint: 'Textfield | Button',
33
+ }
34
+
35
+ const { folder, name } = await prompt.ask([askFolder, askName])
36
+
37
+ const path = folder.endsWith('/')
38
+ ? `${folder}${pascalToKebab(name)}`
39
+ : `${folder}/${pascalToKebab(name)}`
40
+
41
+ const fullPath = `${COMPONENTS_PATH_GIRASSOL}/${path}/`
42
+
43
+ console.log(folder, name)
44
+
45
+ info('Isto ira criar:')
46
+
47
+ highlight(`
48
+ components/
49
+ ├── ${path}
50
+ └── ${name}.vue
51
+ └── ${pascalToKebab(name)}.spec.ts
52
+ └── ${name}.stories.mdx
53
+ └── index.ts
54
+ `)
55
+
56
+ try {
57
+ const canWrite = await prompt.confirm('Esta configuração esta correta?')
58
+
59
+ if (canWrite) {
60
+ info('Gerando arquivos...')
61
+ await template.generate({
62
+ props: { name, folder, nameClass: pascalToKebab(name) },
63
+ template: 'components/component.vue.ejs',
64
+ target: `${fullPath}${name}.vue`,
65
+ })
66
+
67
+ await template.generate({
68
+ props: { name, folder, nameClass: pascalToKebab(name) },
69
+ template: 'components/component.spec.ts.ejs',
70
+ target: `${fullPath}${pascalToKebab(name)}.spec.ts`,
71
+ })
72
+
73
+ await template.generate({
74
+ props: { name, folder, nameClass: pascalToKebab(name) },
75
+ template: 'components/component.stories.mdx.ejs',
76
+ target: `${fullPath}${name}.stories.mdx`,
77
+ })
78
+
79
+ await template.generate({
80
+ props: { name },
81
+ template: 'components/index.ts.ejs',
82
+ target: `${fullPath}index.ts`,
83
+ })
84
+
85
+ success('Arquivos gerados com sucesso!')
86
+ }
87
+ } catch (er) {
88
+ error('Error inesperado')
89
+ }
90
+ },
91
+ }
@@ -1,4 +1,4 @@
1
- import { GluegunToolbox } from 'gluegun'
1
+ import type { GluegunToolbox } from 'gluegun'
2
2
  const RELATIVE_ROOT_PROJECT = './'
3
3
 
4
4
  import { componentsNames } from '../../../dist/girassol.umd'
@@ -1,4 +1,4 @@
1
- import { GluegunToolbox } from 'gluegun'
1
+ import type { GluegunToolbox } from 'gluegun'
2
2
  const RELATIVE_ROOT_PROJECT = './'
3
3
 
4
4
  import { componentsNames } from '../../../dist/girassol.umd'
@@ -1,4 +1,4 @@
1
- import { GluegunCommand } from 'gluegun'
1
+ import type { GluegunCommand } from 'gluegun'
2
2
 
3
3
  const command: GluegunCommand = {
4
4
  name: 'girassol',
@@ -1,4 +1,4 @@
1
- import { GluegunToolbox } from 'gluegun'
1
+ import type { GluegunToolbox } from 'gluegun'
2
2
 
3
3
  // add your CLI-specific functionality here, which will then be accessible
4
4
  // to your commands
@@ -0,0 +1,20 @@
1
+ import '@testing-library/jest-dom'
2
+ import userEvent from '@testing-library/user-event'
3
+
4
+ import { render, screen } from '@testing-library/vue'
5
+
6
+ import <%- props.name %> from './<%- props.name %>.vue'
7
+
8
+ describe('[<%- props.folder %>] <%- props.name %>', () => {
9
+ it('Renders text <%- props.name %> pass by label prop', () => {
10
+ const label = 'awesome!'
11
+
12
+ render(<%- props.name %>, {
13
+ props: {
14
+ label
15
+ },
16
+ })
17
+
18
+ screen.getByText(label)
19
+ })
20
+ })
@@ -0,0 +1,74 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs'
2
+ import { withDesign } from 'storybook-addon-designs'
3
+
4
+ import <%- props.name %> from './<%- props.name %>.vue'
5
+
6
+ <Meta
7
+ title="Componentes/<%- props.folder %>/<%- props.name %>"
8
+ component={<%- props.name %>}
9
+ decorators={[withDesign]}
10
+ parameters={{
11
+ design: {
12
+ type: 'figma',
13
+ url: '',
14
+ },
15
+ }}
16
+ argTypes={{
17
+ label: 'hi!'
18
+ }}
19
+ />
20
+
21
+ export const Template = ({ label,...args }) => ({
22
+ components: { <%- props.name %> },
23
+ setup() {
24
+ return { args, label }
25
+ },
26
+ template: `<<%- props.name %> v-bind="args" id="teste"></<%- props.name %>>`,
27
+ })
28
+
29
+ # <%- props.name %>
30
+
31
+ ## Melhores praticas
32
+
33
+
34
+ ## Acessibilidade
35
+
36
+
37
+ ## Importar localmente
38
+
39
+ ```js dark
40
+ import { Sol<%- props.name %> } from '@solfacil/girassol'
41
+ ```
42
+
43
+ ## Variants
44
+ <Canvas>
45
+ <Story
46
+ name="Default"
47
+ args={{
48
+ label: 'default',
49
+ }}
50
+ >
51
+ {Template.bind({})}
52
+ </Story>
53
+ </Canvas>
54
+
55
+ ## Exemplos de uso
56
+
57
+ ```html dark
58
+ <Sol<%- props.name %> id="just-test">Awesome component!</Sol<%- props.name %>>
59
+ ```
60
+
61
+ ## Playground
62
+
63
+ <Canvas>
64
+ <Story
65
+ name="Playground"
66
+ args={{
67
+ label: 'its work fine!',
68
+ }}
69
+ >
70
+ {Template.bind({})}
71
+ </Story>
72
+ </Canvas>
73
+
74
+ <ArgsTable story="Playground" />
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ id: string
4
+ label?: string
5
+ }>()
6
+
7
+ const emit = defineEmits<{
8
+ (e: 'change', value: string): void
9
+ }>()
10
+
11
+ </script>
12
+
13
+ <template>
14
+ <div class="sol-<%- props.nameClass %>-core" >
15
+ {{ label }}
16
+ </div>
17
+ </template>
18
+
19
+ <style lang="scss">
20
+ .sol-<%- props.nameClass %>-core {
21
+ @apply bg-brand-primary-medium px-2xs;
22
+ }
23
+ </style>
@@ -0,0 +1,10 @@
1
+ import type { App } from 'vue'
2
+ import Sol<%- props.name %> from './<%- props.name %>.vue'
3
+
4
+ Sol<%- props.name %>.install = (app: App) => {
5
+ app.component('Sol<%- props.name %>', Sol<%- props.name %>)
6
+ }
7
+
8
+ export {
9
+ Sol<%- props.name %>,
10
+ }