@solfacil/girassol 0.1.0 → 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 (65) hide show
  1. package/.vscode/extensions.json +2 -1
  2. package/.vscode/settings.json +15 -5
  3. package/README.md +14 -3
  4. package/cli/src/commands/create:component.ts +91 -0
  5. package/cli/src/commands/generate:plugin.ts +17 -7
  6. package/cli/src/commands/generate:types.ts +5 -4
  7. package/cli/src/commands/girassol.ts +2 -2
  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/cli/src/templates/windi.config.ts.ejs +3 -0
  14. package/dist/girassol.es.js +1022 -111
  15. package/dist/girassol.umd.js +5 -5
  16. package/dist/style.css +1 -1
  17. package/dist/theme/solfacil/colors.d.ts +2 -2
  18. package/dist/theme/solfacil/index.d.ts +2 -0
  19. package/dist/theme/solfacil/utilities.d.ts +2 -0
  20. package/dist/types/components/dropdown/Dropdown.vue.d.ts +75 -0
  21. package/dist/types/components/dropdown/dropdown.spec.d.ts +1 -0
  22. package/dist/types/components/dropdown/index.d.ts +2 -0
  23. package/dist/types/components/forms/button/Button.vue.d.ts +4 -4
  24. package/dist/types/components/forms/button/button.spec.d.ts +1 -0
  25. package/dist/types/components/forms/checkbox/CheckboxGroup.vue.d.ts +1 -1
  26. package/dist/types/components/forms/checkbox/checkbox-group.spec.d.ts +1 -0
  27. package/dist/types/components/forms/checkbox/checkbox-type.d.ts +2 -2
  28. package/dist/types/components/forms/checkbox/checkbox.spec.d.ts +1 -0
  29. package/dist/types/components/forms/checkbox/index.d.ts +1 -1
  30. package/dist/types/components/forms/input/index.d.ts +1 -1
  31. package/dist/types/components/forms/input/input.spec.d.ts +1 -0
  32. package/dist/types/components/forms/radio/RadioGroup.vue.d.ts +1 -1
  33. package/dist/types/components/forms/radio/index.d.ts +1 -1
  34. package/dist/types/components/forms/radio/radio-group.spec.d.ts +1 -0
  35. package/dist/types/components/forms/radio/radio-type.d.ts +2 -2
  36. package/dist/types/components/forms/radio/radio.spec.d.ts +1 -0
  37. package/dist/types/components/forms/switch/Switch.vue.d.ts +33 -0
  38. package/dist/types/components/forms/switch/index.d.ts +2 -0
  39. package/dist/types/components/forms/switch/switch.spec.d.ts +1 -0
  40. package/dist/types/components/forms/textarea/Textarea.vue.d.ts +50 -0
  41. package/dist/types/components/forms/textarea/index.d.ts +2 -0
  42. package/dist/types/components/forms/textarea/textarea.spec.d.ts +1 -0
  43. package/dist/types/components/forms/textfield/Textfield.vue.d.ts +1 -1
  44. package/dist/types/components/forms/textfield/index.d.ts +1 -1
  45. package/dist/types/components/forms/textfield/textfield-password.spec.d.ts +1 -0
  46. package/dist/types/components/forms/textfield/textfield.spec.d.ts +1 -0
  47. package/dist/types/composables/use-toast/Toast.vue.d.ts +66 -0
  48. package/dist/types/composables/use-toast/index.d.ts +9 -0
  49. package/dist/types/composables/use-toast/types.d.ts +23 -0
  50. package/dist/types/composables/use-toast/use-toast.spec.d.ts +1 -0
  51. package/dist/types/composables/use-toast/useTimer.d.ts +9 -0
  52. package/dist/types/composables/use-toast/useTransition.d.ts +57 -0
  53. package/dist/types/index.d.ts +6 -2
  54. package/dist/vite.config.d.ts +1 -1
  55. package/package.json +65 -32
  56. package/theme/solfacil/borders.ts +2 -2
  57. package/theme/solfacil/colors.ts +4 -4
  58. package/theme/solfacil/effects.ts +3 -3
  59. package/theme/solfacil/index.ts +4 -2
  60. package/theme/solfacil/miscs.ts +2 -2
  61. package/theme/solfacil/spacing.ts +1 -1
  62. package/theme/solfacil/typography.ts +2 -2
  63. package/theme/solfacil/utilities.ts +71 -3
  64. package/vite.config.ts +17 -5
  65. 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,17 +2,27 @@
2
2
  "cSpell.words": [
3
3
  "antfu",
4
4
  "attributify",
5
+ "composables",
6
+ "describedby",
7
+ "esnext",
8
+ "gluegun",
9
+ "iconify",
10
+ "IIFE",
11
+ "nuxt",
5
12
  "solfacil",
6
13
  "Solfácil",
7
14
  "textfield",
8
15
  "Textfield",
9
- "vitejs",
10
- "vueuse",
11
- "windicss",
12
16
  "theming",
13
- "iconify",
14
17
  "unplugin",
15
- "esnext"
18
+ "vitejs",
19
+ "vitest",
20
+ "vue",
21
+ "vue.js",
22
+ "vuejs",
23
+ "vueuse",
24
+ "windi",
25
+ "windicss"
16
26
  ],
17
27
  "prettier.enable": true,
18
28
  "editor.codeActionsOnSave": {
package/README.md CHANGED
@@ -1,13 +1,24 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/solfacil/components-ui/main/public/logo-solfacil-color.svg" />
2
+ <img src="http://girassol.solfacil.tech/public/girassol.svg" />
3
3
  </div>
4
4
 
5
- Biblioteca de componentes
6
-
5
+ Girassol design system
7
6
  # Documentação
7
+ <a href="http://girassol.solfacil.tech/?path=/docs/introdu%C3%A7%C3%A3o-introdu%C3%A7%C3%A3o--page" target="_blank">Storybook</a>
8
8
 
9
9
  # Instalação
10
10
 
11
+ Basta executar:
12
+ ```bash dark
13
+ yarn add @solfacil/girassol
14
+ ```
15
+
16
+ e colocar no `scripts` dentro do `package.json` para ter acesso ao nosso CLI:
17
+
18
+ ```json dark
19
+ "girassol": "girassol"
20
+ ```
21
+
11
22
  # Licença
12
23
 
13
24
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/npm/l/buefy.svg?logo=github" /></a>
@@ -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'
@@ -18,18 +18,19 @@ module.exports = {
18
18
 
19
19
  await template.generate({
20
20
  template: 'nuxt-plugin.ejs',
21
- target: `${RELATIVE_ROOT_PROJECT}components.d.ts`,
21
+ target: `${RELATIVE_ROOT_PROJECT}/plugins/girassol.ts`,
22
22
  })
23
23
 
24
- spinnerPlugin.succeed('Plugin created!')
24
+ spinnerPlugin.succeed(`Plugin created in [/plugins/girassol.ts]!`)
25
25
  const spinnerTypes = spin('Setting types')
26
26
 
27
27
  await template.generate({
28
+ props: { componentsNames },
28
29
  template: 'components.d.ts.ejs',
29
30
  target: `${RELATIVE_ROOT_PROJECT}components.d.ts`,
30
31
  })
31
32
 
32
- spinnerTypes.succeed('Global types created!')
33
+ spinnerTypes.succeed('Global types created in [/components.d.ts]!')
33
34
  } else {
34
35
  const spinnerPlugin = spin('Setting plugin')
35
36
 
@@ -38,21 +39,30 @@ module.exports = {
38
39
  target: `${RELATIVE_ROOT_PROJECT}/src/plugins/girassol.ts`,
39
40
  })
40
41
 
41
- spinnerPlugin.succeed('Plugin created!')
42
+ spinnerPlugin.succeed(`Plugin created in [/src/plugins/girassol.ts]!`)
42
43
 
43
44
  const spinnerTypes = spin('Setting types')
44
45
 
45
46
  await template.generate({
46
- template: 'components.d.ts.ejs',
47
47
  props: { componentsNames },
48
+ template: 'components.d.ts.ejs',
48
49
  target: `${RELATIVE_ROOT_PROJECT}/src/components.d.ts`,
49
50
  })
50
51
 
51
- spinnerTypes.succeed('Global types created!')
52
+ spinnerTypes.succeed('Global types created in [/src/components.d.ts]!')
52
53
 
53
54
  info('Please, add command below to src/main.ts')
54
55
  highlight(`import girassol from 'plugins/girassol'`)
55
56
  highlight(`createApp(App).use(girassol)`)
56
57
  }
58
+
59
+ const spinnerWindi = spin('Setting plugin')
60
+
61
+ await template.generate({
62
+ template: 'windi.config.ts.ejs',
63
+ target: `${RELATIVE_ROOT_PROJECT}/windi.config.ts`,
64
+ })
65
+
66
+ spinnerWindi.succeed(`Windicss config created in [/windi.config.ts]!`)
57
67
  },
58
68
  }
@@ -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'
@@ -17,21 +17,22 @@ module.exports = {
17
17
  const spinnerTypes = spin('Setting types')
18
18
 
19
19
  await template.generate({
20
+ props: { componentsNames },
20
21
  template: 'components.d.ts.ejs',
21
22
  target: `${RELATIVE_ROOT_PROJECT}components.d.ts`,
22
23
  })
23
24
 
24
- spinnerTypes.succeed('Global types created!')
25
+ spinnerTypes.succeed(`Global types created in [/components.d.ts]!`)
25
26
  } else {
26
27
  const spinnerTypes = spin('Setting types')
27
28
 
28
29
  await template.generate({
29
- template: 'components.d.ts.ejs',
30
30
  props: { componentsNames },
31
+ template: 'components.d.ts.ejs',
31
32
  target: `${RELATIVE_ROOT_PROJECT}/src/components.d.ts`,
32
33
  })
33
34
 
34
- spinnerTypes.succeed('Global types created!')
35
+ spinnerTypes.succeed('Global types created in [/src/components.d.ts]!')
35
36
  }
36
37
  },
37
38
  }
@@ -1,11 +1,11 @@
1
- import { GluegunCommand } from 'gluegun'
1
+ import type { GluegunCommand } from 'gluegun'
2
2
 
3
3
  const command: GluegunCommand = {
4
4
  name: 'girassol',
5
5
  run: async (toolbox) => {
6
6
  const { print } = toolbox
7
7
 
8
- print.info('Welcome to your CLI')
8
+ print.info('Welcome Girassol CLI')
9
9
  },
10
10
  }
11
11
 
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ import windiconfig from '@solfacil/girassol/windi.config'
2
+
3
+ export default windiconfig