@dialpad/dialtone-vue 1.0.0-beta.1

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.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # Handset 📞
2
+
3
+ Handset is a library of Vue components for [Dialtone][dt]. The goal is to simplify and standardize the use of common UI patterns and behaviour across all Dialpad projects.
4
+
5
+ **[Component Documentation Site ↗️][handbook]**
6
+
7
+ [dt]: https://dialpad.design
8
+
9
+ ### Project Status
10
+
11
+ Handset is a new project, and as such it is under constant development as we add new components and refine existing ones. Please refer to the [project board][project] to see the status of Handset components and request new components that should be in the Handset library.
12
+
13
+ [project]: https://github.com/orgs/dialpad/projects/1
14
+
15
+ ### Timeline
16
+
17
+ Our goal is to have a stable 1.0 release in early 2021. At this point, we will split Handset into a separate repository and follow semantic versioning.
18
+
19
+ ## Usage
20
+
21
+ Handset components can be imported directly from the package. Some components also export named constants, which can be imported as well:
22
+
23
+ ```js
24
+ import { HsInput, VALIDATION_MESSAGE_TYPES } from '@dialpad/handset';
25
+ ```
26
+
27
+ ## Storybook Component Documentation
28
+
29
+ Handset uses [Storybook][storybook] for documentation of components, as well as an environment for local development. Please see the [Storybook Documentation Site][handbook] for specific usage information and interactive documentation for each Handset component.
30
+
31
+ All components in Handset should have stories written for them in Storybook. For more information on how to write stories, see the [documentation][stories].
32
+
33
+ [storybook]: https://storybook.js.org
34
+ [handbook]: https://static.dialpadcdn.com/storybook/index.html
35
+ [stories]: https://static.dialpadcdn.com/storybook/index.html?path=/story/docs-storybook-getting-started--page
36
+
37
+ ### Running Storybook Locally
38
+
39
+ Storybook provides a sandbox to develop and experiment with components locally, in isolation from the rest of the app. With Storybook you get live reloading of component templates and styles, just like you would in the app. You can also test different props and slots and see the effects in real time, test accessibility issues, and more.
40
+
41
+ To run Storybook locally, first install the dependencies:
42
+
43
+ ```
44
+ npm run install:storybook
45
+ ```
46
+
47
+ Then you can run the dev server:
48
+
49
+ ```
50
+ npm run storybook
51
+ ```
52
+
53
+ ## Developing Handset Components
54
+
55
+ Building components for Handset is similar to components for Dialpad or UberConference, but there are some differences. Remember that Handset is a shared library so more care has to be taken to avoid breaking changes.
56
+
57
+ Remember that Handset is a separate project, so be sure to run the lint and unit tests for Handset separately whenever making changes to the library.
58
+
59
+ See [CONTRIBUTING](./CONTRIBUTING.md).
60
+
61
+ ### CSS & Dialtone
62
+
63
+ Dialtone components should utilize the global immutable CSS classes provided by Dialtone whenever possible. It is a requirement of any project using Handset to include these classes.
64
+
65
+ If needed, you can also write custom CSS using the Dialtone LESS variables or mixins by importing `../css/dialtone.less`.
66
+
67
+ Please **do not** use any scoped CSS in Handset components.
68
+
69
+ ### Unit Tests
70
+
71
+ Each component should have a corresponding unit test in the `tests/specs` directory. There is no special test setup as Handset components do not have access to the Vuex store or custom methods/directives.
72
+
73
+ ### Exports
74
+
75
+ When adding a new component, please add its exports to `index.js`, including any named exports, so they're available for import to users of Handset:
76
+
77
+ ```js
78
+ export {
79
+ default as HsInput,
80
+ INPUT_SIZE_TYPES,
81
+ } from './components/input.vue';
82
+ ```
83
+
84
+ ### External Dependencies
85
+
86
+ Handset components are designed to be used in a variety of different projects. As such, Handset components should be pure Vue components with no dependencies on global Vue plugins or stores, except when noted below. This in particular means:
87
+
88
+ - **No access to the Vuex store.** Different projects will have different store structures, and so Handset components cannot access the Vuex store. Handset components should take data as props only.
89
+ - **No I18n.** Each project will have its own i18n implementation. Any text needed in a Handset component should be passed as props or slots.
90
+ - **No custom directives.** Directives in Vue are installed globally and vary from project to project. Custom directives (such as `v-tooltip`) cannot be used in Handset components.
91
+ - **No other custom global methods.** Some projects may implement custom global methods on the Vue object. Handset components are limited to the built-in Vue methods.
92
+ - **No imports outside of the handset directory.**
93
+ - **Vue 2 compatibility.** Handset components should ideally support Vue 2 and 3, but a minimum of Vue 2 support is currently required.
94
+
95
+ ## Using Handset in your Project
96
+
97
+ Project using Handset should be aware of the requirements:
98
+
99
+ - Dialtone classes must be made available globally (to avoid duplication, Handset does not do this for you).
100
+ - A tool like Webpack must be used to package the SFC components from Handset.
101
+ - LESS preprocessor support for Vue SFC `<style>` blocks.
102
+ - Handset components are built for Vue 2, with Vue 3 support coming soon.
103
+
104
+ These requirements are enforced via peerdependencies of Handset when possible.