@speckle/ui-components 2.12.666

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 (40) hide show
  1. package/.eslintrc.cjs +118 -0
  2. package/README.md +60 -0
  3. package/dist/components/SourceAppBadge.vue.d.ts +14 -0
  4. package/dist/components/common/Badge.vue.d.ts +65 -0
  5. package/dist/components/common/loading/Bar.vue.d.ts +13 -0
  6. package/dist/components/common/steps/Bullet.vue.d.ts +65 -0
  7. package/dist/components/common/steps/Number.vue.d.ts +57 -0
  8. package/dist/components/common/text/Link.vue.d.ts +106 -0
  9. package/dist/components/form/Button.vue.d.ts +256 -0
  10. package/dist/components/form/CardButton.vue.d.ts +24 -0
  11. package/dist/components/form/Checkbox.vue.d.ts +194 -0
  12. package/dist/components/form/TextArea.vue.d.ts +152 -0
  13. package/dist/components/form/TextInput.vue.d.ts +301 -0
  14. package/dist/components/form/select/Base.vue.d.ts +283 -0
  15. package/dist/components/form/select/SourceApps.vue.d.ts +126 -0
  16. package/dist/components/global/ToastRenderer.vue.d.ts +17 -0
  17. package/dist/composables/common/steps.d.ts +24 -0
  18. package/dist/composables/form/input.d.ts +6 -0
  19. package/dist/composables/form/select.d.ts +29 -0
  20. package/dist/composables/form/textInput.d.ts +44 -0
  21. package/dist/composables/layout/resize.d.ts +36 -0
  22. package/dist/helpers/common/components.d.ts +11 -0
  23. package/dist/helpers/common/validation.d.ts +23 -0
  24. package/dist/helpers/form/input.d.ts +9 -0
  25. package/dist/helpers/global/toast.d.ts +22 -0
  26. package/dist/helpers/tailwind.d.ts +19 -0
  27. package/dist/lib.cjs +1 -0
  28. package/dist/lib.d.ts +24 -0
  29. package/dist/lib.js +2155 -0
  30. package/dist/style.css +1 -0
  31. package/index.html +12 -0
  32. package/package.json +99 -0
  33. package/postcss.config.js +7 -0
  34. package/tailwind.config.cjs +14 -0
  35. package/tsconfig.json +31 -0
  36. package/tsconfig.node.json +10 -0
  37. package/utils/tailwind-configure.cjs +15 -0
  38. package/utils/tailwind-configure.d.ts +1 -0
  39. package/utils/tailwind-configure.js +13 -0
  40. package/vite.config.ts +48 -0
package/.eslintrc.cjs ADDED
@@ -0,0 +1,118 @@
1
+ const mainExtends = [
2
+ 'plugin:vue/vue3-recommended',
3
+ 'plugin:storybook/recommended',
4
+ 'prettier'
5
+ ]
6
+
7
+ /** @type {import('eslint').Linter.Config} */
8
+ const config = {
9
+ env: {
10
+ node: true
11
+ },
12
+
13
+ extends: [...mainExtends],
14
+ ignorePatterns: ['storybook-static', '!.storybook', 'tailwind-configure.d.ts'],
15
+ rules: {
16
+ 'no-alert': 'error',
17
+ eqeqeq: ['error', 'always', { null: 'always' }],
18
+ 'no-console': 'off',
19
+ 'no-var': 'error'
20
+ },
21
+ parserOptions: {
22
+ ecmaVersion: 2022,
23
+ sourceType: 'module'
24
+ },
25
+ overrides: [
26
+ {
27
+ files: '*.test.{ts,js}',
28
+ env: {
29
+ jest: true
30
+ }
31
+ },
32
+ {
33
+ files: './src/*.{js,ts,vue}',
34
+ env: {
35
+ node: false,
36
+ browser: true
37
+ }
38
+ },
39
+ {
40
+ files: '*.{ts,tsx,vue}',
41
+ extends: ['plugin:@typescript-eslint/recommended', ...mainExtends],
42
+ rules: {
43
+ '@typescript-eslint/no-explicit-any': ['error'],
44
+ '@typescript-eslint/no-unsafe-argument': ['error'],
45
+ '@typescript-eslint/no-unsafe-assignment': 'error',
46
+ '@typescript-eslint/no-unsafe-call': 'error',
47
+ '@typescript-eslint/no-unsafe-member-access': 'error',
48
+ '@typescript-eslint/no-unsafe-return': 'error',
49
+ '@typescript-eslint/no-for-in-array': ['error'],
50
+ '@typescript-eslint/restrict-template-expressions': ['error'],
51
+ '@typescript-eslint/restrict-plus-operands': ['error'],
52
+ '@typescript-eslint/await-thenable': ['warn'],
53
+ '@typescript-eslint/ban-types': ['warn'],
54
+ 'require-await': 'off',
55
+ '@typescript-eslint/require-await': 'error',
56
+ 'no-undef': 'off'
57
+ },
58
+ parserOptions: {
59
+ ecmaVersion: 2022,
60
+ sourceType: 'module',
61
+ parser: '@typescript-eslint/parser',
62
+ tsconfigRootDir: __dirname,
63
+ project: ['./tsconfig.json', './tsconfig.node.json'],
64
+ extraFileExtensions: ['.vue']
65
+ },
66
+ plugins: ['@typescript-eslint']
67
+ },
68
+ {
69
+ files: '*.vue',
70
+ plugins: ['vuejs-accessibility'],
71
+ extends: [
72
+ 'plugin:@typescript-eslint/recommended',
73
+ ...mainExtends,
74
+ 'plugin:vuejs-accessibility/recommended'
75
+ ],
76
+ rules: {
77
+ 'vue/component-tags-order': [
78
+ 'error',
79
+ { order: ['docs', 'template', 'script', 'style'] }
80
+ ],
81
+ 'vue/require-default-prop': 'off',
82
+ 'vue/multi-word-component-names': 'off',
83
+ 'vue/component-name-in-template-casing': [
84
+ 'error',
85
+ 'PascalCase',
86
+ { registeredComponentsOnly: false }
87
+ ],
88
+ 'vuejs-accessibility/label-has-for': [
89
+ 'error',
90
+ {
91
+ required: {
92
+ some: ['nesting', 'id']
93
+ }
94
+ }
95
+ ]
96
+ }
97
+ },
98
+ {
99
+ files: '*.d.ts',
100
+ rules: {
101
+ 'no-var': 'off',
102
+ '@typescript-eslint/no-explicit-any': 'off',
103
+ '@typescript-eslint/ban-types': 'off'
104
+ }
105
+ },
106
+ {
107
+ files: '*.stories.{js,ts}',
108
+ rules: {
109
+ // this one feels busted, tells me to await synchronous calls
110
+ 'storybook/await-interactions': 'off',
111
+ // storybook types suck and can't be augmented
112
+ '@typescript-eslint/no-unsafe-call': 'off'
113
+ }
114
+ }
115
+ ]
116
+ }
117
+
118
+ module.exports = config
package/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # ui-components
2
+
3
+ Speckle UI component library built with Vue 3 and relying on the Speckle Tailwind theme.
4
+
5
+ ## Setup
6
+
7
+ 1. Make sure you have `@speckle/tailwind-theme` installed and set up with Tailwind
8
+ 1. Install `@speckle/ui-components`
9
+ 1. In your tailwind config import `tailwindContentEntry` from `@speckle/ui-components/tailwind-configure` and invoke it in the `contents` field to ensure PurgeCSS is configured correctly. It requires the CJS `require` object as its only parameter. If it isn't available (in an ESM environment), you can use node's `createRequire()`.
10
+ 1. Import `@speckle/ui-components/style.css` in your app. If `exports` map isn't supported you can also import from `@speckle/ui-components/dist/style.css`
11
+
12
+ ### Usage in Nuxt v3
13
+
14
+ It's suggested that you also install the `@speckle/ui-components-nuxt` Nuxt module. It will ensure that all of the Vue components can be auto-imported like components in nuxt's `./components` directory. No need to import them manually anymore and you'll also get proper TS typing in your Vue templates out of the box!
15
+
16
+ Additionally you should add the following to your `build.transpile` array in your nuxt config:
17
+
18
+ ```js
19
+ // nuxt.config.js
20
+ export default {
21
+ build: {
22
+ transpile: [
23
+ '@headlessui/vue',
24
+ /^@heroicons\/vue/,
25
+ '@vueuse/core',
26
+ '@vueuse/shared',
27
+ '@speckle/ui-components'
28
+ ]
29
+ }
30
+ }
31
+ ```
32
+
33
+ This will ensure that some dependencies are transpiled properly so that they work correctly both during SSR & CSR.
34
+
35
+ ### Troubleshooting
36
+
37
+ #### Form validation doesn't work
38
+
39
+ It appears that in some scenarios Nuxt/Vite gets confused and bundles 'vee-validate' twice. To fix this add 'vee-validate' to `vite.resolve.dedupe` in your nuxt/vite config.
40
+
41
+ ## Build
42
+
43
+ Run `yarn build`
44
+
45
+ ## Development
46
+
47
+ Develop & test your components in Storybook - `yarn storybook`
48
+
49
+ Optionally you can also run `yarn dev` to run the Vite dev server which runs `App.vue` and in some special scenarios you might want to debug components there.
50
+
51
+ ### Troubleshooting
52
+
53
+ #### Styles don't work
54
+
55
+ Re-start storybook, it could be that you introduced a new tailwind class that was previously purged out
56
+
57
+ ## TODO
58
+
59
+ - Add export to Chromatic
60
+ - CI/CD?
@@ -0,0 +1,14 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ import { SourceAppDefinition } from '@speckle/shared';
3
+ declare const _sfc_main: import("vue").DefineComponent<{
4
+ sourceApp: {
5
+ type: __PropType<SourceAppDefinition>;
6
+ required: true;
7
+ };
8
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
9
+ sourceApp: {
10
+ type: __PropType<SourceAppDefinition>;
11
+ required: true;
12
+ };
13
+ }>>, {}>;
14
+ export default _sfc_main;
@@ -0,0 +1,65 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ import { ConcreteComponent } from 'vue';
3
+ type BadgeSize = 'base' | 'lg';
4
+ declare const _sfc_main: import("vue").DefineComponent<{
5
+ size: {
6
+ type: __PropType<BadgeSize | undefined>;
7
+ required: false;
8
+ };
9
+ colorClasses: {
10
+ type: __PropType<string | undefined>;
11
+ required: false;
12
+ };
13
+ dot: {
14
+ type: __PropType<boolean | undefined>;
15
+ required: false;
16
+ };
17
+ dotIconColorClasses: {
18
+ type: __PropType<string | undefined>;
19
+ required: false;
20
+ };
21
+ iconLeft: {
22
+ type: __PropType<ConcreteComponent | undefined>;
23
+ required: false;
24
+ };
25
+ rounded: {
26
+ type: __PropType<boolean | undefined>;
27
+ required: false;
28
+ };
29
+ clickableIcon: {
30
+ type: __PropType<boolean | undefined>;
31
+ required: false;
32
+ };
33
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click-icon"[], "click-icon", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
34
+ size: {
35
+ type: __PropType<BadgeSize | undefined>;
36
+ required: false;
37
+ };
38
+ colorClasses: {
39
+ type: __PropType<string | undefined>;
40
+ required: false;
41
+ };
42
+ dot: {
43
+ type: __PropType<boolean | undefined>;
44
+ required: false;
45
+ };
46
+ dotIconColorClasses: {
47
+ type: __PropType<string | undefined>;
48
+ required: false;
49
+ };
50
+ iconLeft: {
51
+ type: __PropType<ConcreteComponent | undefined>;
52
+ required: false;
53
+ };
54
+ rounded: {
55
+ type: __PropType<boolean | undefined>;
56
+ required: false;
57
+ };
58
+ clickableIcon: {
59
+ type: __PropType<boolean | undefined>;
60
+ required: false;
61
+ };
62
+ }>> & {
63
+ "onClick-icon"?: ((...args: any[]) => any) | undefined;
64
+ }, {}>;
65
+ export default _sfc_main;
@@ -0,0 +1,13 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ declare const _sfc_main: import("vue").DefineComponent<{
3
+ loading: {
4
+ type: __PropType<boolean>;
5
+ required: true;
6
+ };
7
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
8
+ loading: {
9
+ type: __PropType<boolean>;
10
+ required: true;
11
+ };
12
+ }>>, {}>;
13
+ export default _sfc_main;
@@ -0,0 +1,65 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ import { BulletStepType, HorizontalOrVertical } from '../../../helpers/common/components';
3
+ import { TailwindBreakpoints } from '../../../helpers/tailwind';
4
+ declare const _sfc_main: import("vue").DefineComponent<{
5
+ ariaLabel: {
6
+ type: __PropType<string | undefined>;
7
+ required: false;
8
+ };
9
+ basic: {
10
+ type: __PropType<boolean | undefined>;
11
+ required: false;
12
+ };
13
+ orientation: {
14
+ type: __PropType<HorizontalOrVertical | undefined>;
15
+ required: false;
16
+ };
17
+ steps: {
18
+ type: __PropType<BulletStepType[]>;
19
+ required: true;
20
+ };
21
+ modelValue: {
22
+ type: __PropType<number | undefined>;
23
+ required: false;
24
+ };
25
+ goVerticalBelow: {
26
+ type: __PropType<TailwindBreakpoints | undefined>;
27
+ required: false;
28
+ };
29
+ nonInteractive: {
30
+ type: __PropType<boolean | undefined>;
31
+ required: false;
32
+ };
33
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
34
+ ariaLabel: {
35
+ type: __PropType<string | undefined>;
36
+ required: false;
37
+ };
38
+ basic: {
39
+ type: __PropType<boolean | undefined>;
40
+ required: false;
41
+ };
42
+ orientation: {
43
+ type: __PropType<HorizontalOrVertical | undefined>;
44
+ required: false;
45
+ };
46
+ steps: {
47
+ type: __PropType<BulletStepType[]>;
48
+ required: true;
49
+ };
50
+ modelValue: {
51
+ type: __PropType<number | undefined>;
52
+ required: false;
53
+ };
54
+ goVerticalBelow: {
55
+ type: __PropType<TailwindBreakpoints | undefined>;
56
+ required: false;
57
+ };
58
+ nonInteractive: {
59
+ type: __PropType<boolean | undefined>;
60
+ required: false;
61
+ };
62
+ }>> & {
63
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
64
+ }, {}>;
65
+ export default _sfc_main;
@@ -0,0 +1,57 @@
1
+ import type { PropType as __PropType } from 'vue';
2
+ import { HorizontalOrVertical, NumberStepType } from '../../../helpers/common/components';
3
+ import { TailwindBreakpoints } from '../../../helpers/tailwind';
4
+ declare const _sfc_main: import("vue").DefineComponent<{
5
+ ariaLabel: {
6
+ type: __PropType<string | undefined>;
7
+ required: false;
8
+ };
9
+ orientation: {
10
+ type: __PropType<HorizontalOrVertical | undefined>;
11
+ required: false;
12
+ };
13
+ steps: {
14
+ type: __PropType<NumberStepType[]>;
15
+ required: true;
16
+ };
17
+ modelValue: {
18
+ type: __PropType<number | undefined>;
19
+ required: false;
20
+ };
21
+ goVerticalBelow: {
22
+ type: __PropType<TailwindBreakpoints | undefined>;
23
+ required: false;
24
+ };
25
+ nonInteractive: {
26
+ type: __PropType<boolean | undefined>;
27
+ required: false;
28
+ };
29
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
30
+ ariaLabel: {
31
+ type: __PropType<string | undefined>;
32
+ required: false;
33
+ };
34
+ orientation: {
35
+ type: __PropType<HorizontalOrVertical | undefined>;
36
+ required: false;
37
+ };
38
+ steps: {
39
+ type: __PropType<NumberStepType[]>;
40
+ required: true;
41
+ };
42
+ modelValue: {
43
+ type: __PropType<number | undefined>;
44
+ required: false;
45
+ };
46
+ goVerticalBelow: {
47
+ type: __PropType<TailwindBreakpoints | undefined>;
48
+ required: false;
49
+ };
50
+ nonInteractive: {
51
+ type: __PropType<boolean | undefined>;
52
+ required: false;
53
+ };
54
+ }>> & {
55
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
56
+ }, {}>;
57
+ export default _sfc_main;
@@ -0,0 +1,106 @@
1
+ import { ConcreteComponent, PropType } from 'vue';
2
+ import { Nullable, Optional } from '@speckle/shared';
3
+ type LinkSize = 'xs' | 'sm' | 'base' | 'lg' | 'xl';
4
+ declare const _sfc_main: import("vue").DefineComponent<{
5
+ to: {
6
+ type: PropType<Optional<string>>;
7
+ required: false;
8
+ default: undefined;
9
+ };
10
+ external: {
11
+ type: PropType<Optional<boolean>>;
12
+ required: false;
13
+ default: undefined;
14
+ };
15
+ disabled: {
16
+ type: PropType<Optional<boolean>>;
17
+ required: false;
18
+ default: undefined;
19
+ };
20
+ size: {
21
+ type: PropType<LinkSize>;
22
+ default: string;
23
+ };
24
+ foregroundLink: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ /**
29
+ * Add icon to the left from the text
30
+ */
31
+ iconLeft: {
32
+ type: PropType<Nullable<ConcreteComponent>>;
33
+ default: null;
34
+ };
35
+ /**
36
+ * Add icon to the right from the text
37
+ */
38
+ iconRight: {
39
+ type: PropType<Nullable<ConcreteComponent>>;
40
+ default: null;
41
+ };
42
+ /**
43
+ * Hide default slot (when you want to show icons only)
44
+ */
45
+ hideText: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "click"[], "click", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
50
+ to: {
51
+ type: PropType<Optional<string>>;
52
+ required: false;
53
+ default: undefined;
54
+ };
55
+ external: {
56
+ type: PropType<Optional<boolean>>;
57
+ required: false;
58
+ default: undefined;
59
+ };
60
+ disabled: {
61
+ type: PropType<Optional<boolean>>;
62
+ required: false;
63
+ default: undefined;
64
+ };
65
+ size: {
66
+ type: PropType<LinkSize>;
67
+ default: string;
68
+ };
69
+ foregroundLink: {
70
+ type: BooleanConstructor;
71
+ default: boolean;
72
+ };
73
+ /**
74
+ * Add icon to the left from the text
75
+ */
76
+ iconLeft: {
77
+ type: PropType<Nullable<ConcreteComponent>>;
78
+ default: null;
79
+ };
80
+ /**
81
+ * Add icon to the right from the text
82
+ */
83
+ iconRight: {
84
+ type: PropType<Nullable<ConcreteComponent>>;
85
+ default: null;
86
+ };
87
+ /**
88
+ * Hide default slot (when you want to show icons only)
89
+ */
90
+ hideText: {
91
+ type: BooleanConstructor;
92
+ default: boolean;
93
+ };
94
+ }>> & {
95
+ onClick?: ((...args: any[]) => any) | undefined;
96
+ }, {
97
+ to: Optional<string>;
98
+ size: LinkSize;
99
+ external: Optional<boolean>;
100
+ disabled: Optional<boolean>;
101
+ iconLeft: Nullable<ConcreteComponent>;
102
+ iconRight: Nullable<ConcreteComponent>;
103
+ hideText: boolean;
104
+ foregroundLink: boolean;
105
+ }>;
106
+ export default _sfc_main;