@policystudio/policy-studio-ui-vue 1.1.90-beta.2 → 1.1.90-beta.4

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 (62) hide show
  1. package/.eslintrc.js +14 -3
  2. package/.storybook/PolicyStudio.ts +11 -0
  3. package/.storybook/manager.ts +7 -0
  4. package/package.json +21 -15
  5. package/src/App.vue +30 -0
  6. package/src/components/badges-and-tags/PsBadgeWithIcon.vue +2 -1
  7. package/src/components/badges-and-tags/PsProgressBar.vue +1 -1
  8. package/src/components/buttons/PsButton.vue +73 -95
  9. package/src/shims-vue.d.ts +11 -0
  10. package/src/stories/{Accordion.stories.js → Accordion.stories.ts} +2 -2
  11. package/src/stories/{BadgeWithIcon.stories.js → BadgeWithIcon.stories.ts} +1 -1
  12. package/src/stories/{BarChart.stories.js → BarChart.stories.ts} +1 -1
  13. package/src/stories/{Breadcrumb.stories.js → Breadcrumb.stories.ts} +1 -4
  14. package/src/stories/{CardInfos.stories.js → CardInfos.stories.ts} +1 -2
  15. package/src/stories/{ChartLegend.stories.js → ChartLegend.stories.ts} +1 -2
  16. package/src/stories/{Checkbox.stories.js → Checkbox.stories.ts} +1 -1
  17. package/src/stories/{CheckboxSimple.stories.js → CheckboxSimple.stories.ts} +1 -1
  18. package/src/stories/{Chips.stories.js → Chips.stories.ts} +24 -22
  19. package/src/stories/{ClimateZoneBadge.stories.js → ClimateZoneBadge.stories.ts} +1 -1
  20. package/src/stories/{CostEffectBar.stories.js → CostEffectBar.stories.ts} +1 -1
  21. package/src/stories/{Datatable.stories.js → Datatable.stories.ts} +2 -2
  22. package/src/stories/{DateCardInfo.stories.js → DateCardInfo.stories.ts} +1 -5
  23. package/src/stories/{InlineSelector.stories.js → InlineSelector.stories.ts} +1 -1
  24. package/src/stories/{InputTextArea.stories.js → InputTextArea.stories.ts} +1 -1
  25. package/src/stories/{RadioButtonSimple.stories.js → RadioButtonSimple.stories.ts} +1 -1
  26. package/src/stories/{Toggle.stories.js → Toggle.stories.ts} +1 -1
  27. package/src/stories/{Tooltip.stories.js → Tooltip.stories.ts} +3 -3
  28. package/src/util/{GeneralFunctions.js → GeneralFunctions.ts} +4 -4
  29. package/src/util/{imageLoader.js → imageLoader.ts} +7 -7
  30. package/tsconfig.json +42 -0
  31. package/webpack.config.js +1 -1
  32. package/.storybook/PolicyStudio.js +0 -10
  33. package/.storybook/manager.js +0 -6
  34. /package/.storybook/{eventBus.js → eventBus.ts} +0 -0
  35. /package/.storybook/{main.js → main.ts} +0 -0
  36. /package/.storybook/{preview.js → preview.ts} +0 -0
  37. /package/src/contents/{ComparisonData.js → ComparisonData.ts} +0 -0
  38. /package/src/contents/{FlexibleData.js → FlexibleData.ts} +0 -0
  39. /package/src/contents/{ResultsData.js → ResultsData.ts} +0 -0
  40. /package/src/{index.js → index.ts} +0 -0
  41. /package/src/stories/{Button.stories.js → Button.stories.ts} +0 -0
  42. /package/src/stories/{Dialog.stories.js → Dialog.stories.ts} +0 -0
  43. /package/src/stories/{Draggable.stories.js → Draggable.stories.ts} +0 -0
  44. /package/src/stories/{Dropdown.stories.js → Dropdown.stories.ts} +0 -0
  45. /package/src/stories/{DropdownList.stories.js → DropdownList.stories.ts} +0 -0
  46. /package/src/stories/{Header.stories.js → Header.stories.ts} +0 -0
  47. /package/src/stories/{HighlightRippleDot.stories.js → HighlightRippleDot.stories.ts} +0 -0
  48. /package/src/stories/{Icon.stories.js → Icon.stories.ts} +0 -0
  49. /package/src/stories/{Input.stories.js → Input.stories.ts} +0 -0
  50. /package/src/stories/{InputSelect.stories.js → InputSelect.stories.ts} +0 -0
  51. /package/src/stories/{MiniTag.stories.js → MiniTag.stories.ts} +0 -0
  52. /package/src/stories/{Playground.stories.js → Playground.stories.ts} +0 -0
  53. /package/src/stories/{ProgressBar.stories.js → ProgressBar.stories.ts} +0 -0
  54. /package/src/stories/{RadioButton.stories.js → RadioButton.stories.ts} +0 -0
  55. /package/src/stories/{SimpleAlert.stories.js → SimpleAlert.stories.ts} +0 -0
  56. /package/src/stories/{Slider.stories.js → Slider.stories.ts} +0 -0
  57. /package/src/stories/{Switch.stories.js → Switch.stories.ts} +0 -0
  58. /package/src/stories/{TabHeader.stories.js → TabHeader.stories.ts} +0 -0
  59. /package/src/stories/{TableResults.stories.js → TableResults.stories.ts} +0 -0
  60. /package/src/stories/{TagScope.stories.js → TagScope.stories.ts} +0 -0
  61. /package/src/stories/{TestimonialCard.stories.js → TestimonialCard.stories.ts} +0 -0
  62. /package/src/stories/{Toast.stories.js → Toast.stories.ts} +0 -0
package/.eslintrc.js CHANGED
@@ -1,11 +1,14 @@
1
1
  module.exports = {
2
2
  root: true,
3
+
3
4
  env: {
4
5
  node: true
5
6
  },
7
+
6
8
  parser: 'vue-eslint-parser',
9
+
7
10
  parserOptions: {
8
- parser: '@babel/eslint-parser',
11
+ parser: '@typescript-eslint/parser',
9
12
  requireConfigFile: false,
10
13
  babelOptions: {
11
14
  babelrc: false,
@@ -13,7 +16,14 @@
13
16
  presets: ['@babel/preset-env'],
14
17
  },
15
18
  },
16
- extends: ['plugin:vue/vue3-essential', 'eslint:recommended','plugin:vue/vue3-strongly-recommended'],
19
+
20
+ extends: [
21
+ 'plugin:vue/vue3-essential',
22
+ 'eslint:recommended',
23
+ 'plugin:vue/vue3-strongly-recommended',
24
+ '@vue/typescript'
25
+ ],
26
+
17
27
  rules: {
18
28
  'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
19
29
  'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
@@ -57,6 +67,7 @@
57
67
  ]
58
68
  }]
59
69
  },
70
+
60
71
  overrides: [
61
72
  {
62
73
  files: [
@@ -67,5 +78,5 @@
67
78
  jest: true
68
79
  }
69
80
  }
70
- ]
81
+ ],
71
82
  }
@@ -0,0 +1,11 @@
1
+ import { create } from '@storybook/theming'
2
+ import PolicyStudioUiLogo from '../src/assets/images/policy-studio.svg'
3
+
4
+
5
+ export default create({
6
+ base: 'light',
7
+ brandTitle: 'Policy Studio UI Vue',
8
+ brandUrl: 'https://policystudio.co/',
9
+ brandImage: PolicyStudioUiLogo,
10
+ brandTarget: '_blank',
11
+ });
@@ -0,0 +1,7 @@
1
+ import { addons } from '@storybook/manager-api'
2
+
3
+ import PolicyStudio from './PolicyStudio'
4
+
5
+ addons.setConfig({
6
+ theme: PolicyStudio,
7
+ });
package/package.json CHANGED
@@ -1,28 +1,22 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.1.90-beta.2",
3
+ "version": "1.1.90-beta.4",
4
4
  "description": "Policy Studio UI",
5
- "main": "src/index.js",
6
5
  "author": "Policy Studio Team",
7
- "url": "https://github.com/Policy-Studio/policy-studio-ui-vue",
8
- "license": "MIT",
9
- "keywords": [
10
- "vue",
11
- "ui"
12
- ],
13
6
  "scripts": {
7
+ "serve": "concurrently --kill-others \"npm run watch-storybook\" \"npm run watch-tailwind\"",
14
8
  "lint": "vue-cli-service lint",
15
9
  "build-storybook": "storybook build",
16
10
  "build-tailwind": "postcss src/assets/scss/base.scss -o dist/css/psui_styles.css",
17
11
  "build-temp-tailwind": "postcss src/assets/scss/base.scss -o temp/css/psui_styles.css",
18
12
  "full-publish": "npm run lint && npm run build-tailwind && npm run build-storybook && npm publish --tag beta",
19
- "serve": "concurrently --kill-others \"npm run watch-storybook\" \"npm run watch-tailwind\"",
13
+ "kill-port": "sh ./scripts/kill-port.sh",
20
14
  "serve-prod": "concurrently --kill-others \"npm run watch-storybook\" \"npm run watch-prod-tailwind\"",
15
+ "storybook": "concurrently \"npm run kill-port\" \"npm run watch-prod-tailwind\" \"storybook dev -p 6006\"",
21
16
  "watch-prod-tailwind": "watch 'npm run build-tailwind' ./src/assets",
22
- "watch-tailwind": "watch 'npm run build-temp-tailwind' ./src/assets",
23
- "kill-port": "sh ./scripts/kill-port.sh",
24
- "storybook": "concurrently \"npm run kill-port\" \"npm run watch-prod-tailwind\" \"storybook dev -p 6006\""
17
+ "watch-tailwind": "watch 'npm run build-temp-tailwind' ./src/assets"
25
18
  },
19
+ "main": "src/index.js",
26
20
  "dependencies": {
27
21
  "@vue/compat": "^3.4.5",
28
22
  "core-js": "^3.6.5",
@@ -41,16 +35,20 @@
41
35
  "@storybook/test": "^7.6.7",
42
36
  "@storybook/vue3": "^7.6.7",
43
37
  "@storybook/vue3-webpack5": "^7.6.7",
38
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
39
+ "@typescript-eslint/parser": "^5.4.0",
44
40
  "@vue/cli-plugin-eslint": "^5.0.8",
41
+ "@vue/cli-plugin-typescript": "~5.0.0",
45
42
  "@vue/cli-service": "~5.0.8",
46
43
  "@vue/compiler-sfc": "^3.4.5",
47
44
  "@vue/eslint-config-prettier": "^9.0.0",
45
+ "@vue/eslint-config-typescript": "^9.1.0",
48
46
  "babel-eslint": "^10.1.0",
49
47
  "concurrently": "^7.0.0",
50
48
  "eslint": "^8.56.0",
51
49
  "eslint-plugin-prettier": "^5.1.2",
52
50
  "eslint-plugin-storybook": "^0.6.15",
53
- "eslint-plugin-vue": "^9.19.2",
51
+ "eslint-plugin-vue": "^8.7.1",
54
52
  "postcss": "^8.3.11",
55
53
  "postcss-cli": "^9.0.2",
56
54
  "postcss-import": "^14.0.2",
@@ -60,11 +58,19 @@
60
58
  "react-dom": "^18.2.0",
61
59
  "storybook": "^7.6.7",
62
60
  "tailwindcss": "^3.4.1",
61
+ "typescript": "~4.5.5",
63
62
  "vue-eslint-parser": "^9.3.2",
64
63
  "vue-loader": "^17.4.2",
65
- "watch": "^1.0.2"
64
+ "watch": "^1.0.2",
65
+ "webpack": "^5.89.0"
66
66
  },
67
67
  "engines": {
68
68
  "node": "18.19.0"
69
- }
69
+ },
70
+ "keywords": [
71
+ "vue",
72
+ "ui"
73
+ ],
74
+ "license": "MIT",
75
+ "url": "https://github.com/Policy-Studio/policy-studio-ui-vue"
70
76
  }
package/src/App.vue ADDED
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <img
3
+ alt="Vue logo"
4
+ src="./assets/logo.png"
5
+ >
6
+ <HelloWorld msg="Welcome to Your Vue.js + TypeScript App" />
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent } from 'vue'
11
+ import HelloWorld from './components/HelloWorld.vue'
12
+
13
+ export default defineComponent({
14
+ name: 'App',
15
+ components: {
16
+ HelloWorld
17
+ }
18
+ })
19
+ </script>
20
+
21
+ <style>
22
+ #app {
23
+ font-family: Avenir, Helvetica, Arial, sans-serif;
24
+ -webkit-font-smoothing: antialiased;
25
+ -moz-osx-font-smoothing: grayscale;
26
+ text-align: center;
27
+ color: #2c3e50;
28
+ margin-top: 60px;
29
+ }
30
+ </style>
@@ -24,7 +24,8 @@
24
24
  * It set any further css style that might be needed.
25
25
  */
26
26
  iconClass: {
27
- type: String
27
+ type: String,
28
+ default:''
28
29
  },
29
30
  message: {
30
31
  type: String,
@@ -38,7 +38,7 @@ export default {
38
38
  default: 1
39
39
  },
40
40
  forceBreakEven: {
41
- Boolean,
41
+ type: Boolean,
42
42
  default: false
43
43
  },
44
44
  value: {
@@ -6,127 +6,105 @@
6
6
  class="psui-el-button"
7
7
  :class="[getComponentClass, {'hover': isHover}, {'disabled': disabled || loading }]"
8
8
  >
9
- <svg
9
+ <svg
10
10
  v-if="loading"
11
11
  class="psui-animate-spin psui-mr-3 psui-h-5 psui-w-5 psui-text-black"
12
12
  :class="`${iconPosition == 'left' ? 'psui-mr-3' : 'psui-ml-3 psui--mr-1'}`"
13
- xmlns="http://www.w3.org/2000/svg"
14
- fill="none"
15
- viewBox="0 0 24 24"
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ fill="none"
15
+ viewBox="0 0 24 24"
16
16
  >
17
- <circle
18
- class="psui-opacity-25"
19
- cx="12"
20
- cy="12"
21
- r="10"
22
- stroke="currentColor"
23
- stroke-width="4"
17
+ <circle
18
+ class="psui-opacity-25"
19
+ cx="12"
20
+ cy="12"
21
+ r="10"
22
+ stroke="currentColor"
23
+ stroke-width="4"
24
24
  />
25
- <path
26
- class="psui-opacity-75"
27
- fill="currentColor"
28
- d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
25
+ <path
26
+ class="psui-opacity-75"
27
+ fill="currentColor"
28
+ d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
29
29
  />
30
30
  </svg>
31
- <i
32
- v-else-if="icon"
33
- :class="iconClass"
34
- class="material-icons-round"
31
+ <i
32
+ v-else-if="icon"
33
+ :class="iconClass"
34
+ class="material-icons-round"
35
35
  >{{ icon }}</i>
36
36
  <span v-if="label">{{ label }}</span>
37
37
  </button>
38
38
  </template>
39
39
 
40
- <script>
41
- export default {
42
- props: {
43
- /**
44
- * It set de label of the button when component is rendered.
45
- */
40
+ <script setup lang="ts">
41
+ import { computed, ref } from 'vue'
42
+
43
+ const isHover = ref(false)
44
+
45
+ const emit = defineEmits(['click'])
46
+
47
+ const props = defineProps({
46
48
  label: {
47
49
  type: String,
50
+ default: ''
48
51
  },
49
- /**
50
- * It set the layout of the button. eg: solid, outline, ghost, onlytext and caution.
51
- */
52
- layout: {
52
+ layout:{
53
53
  type: String,
54
54
  default: 'solid',
55
- validator: (value) => ['solid','outline','ghost','onlytext','caution'].includes(value)
55
+ validator: (value:string) => ['solid','outline','ghost','onlytext','caution'].includes(value)
56
56
  },
57
- /**
58
- * It sets the text key which will retrieve a icon from Google Fonts. Make sure to get the correct description of your icon on https://fonts.google.com/.
59
- */
60
57
  icon: {
61
58
  type: String,
59
+ default: ''
62
60
  },
63
- /**
64
- * It sets the position of the icon. eg: left or right.
65
- */
66
- iconPosition:{
61
+ iconPosition: {
67
62
  type: String,
68
63
  default: 'left',
69
- validator: (value) => ['left','right'].includes(value)
64
+ validator: (value:string) => ['left','right'].includes(value)
70
65
  },
71
- /**
72
- * It sets the size of the icon. eg: small, medium and big.
73
- */
74
66
  size: {
75
- type: String,
76
- default: 'big',
77
- validator: (value) => ['small','medium','big'].includes(value)
78
- },
79
- /**
80
- * It disable the button. All mouse event are disabled.
81
- */
82
- disabled: {
83
- type: Boolean,
84
- default: false
85
- },
86
- /**
87
- * It disable and add a spin icon to the button. All mouse event are disabled.
88
- */
89
- loading: {
90
- type: Boolean,
91
- default: false
92
- },
93
- /**
94
- * It set any further css style that might be needed.
95
- */
96
- iconClass:{
97
- type: String
98
- }
99
- },
100
- data(){
101
- return {
102
- isHover: false,
103
- }
104
- },
105
- computed: {
106
- getComponentClass(){
107
- if(this.icon){
108
- return `layout-${this.layout} size-${this.size} icon-${this.iconPosition}`
109
- } else {
110
- return `layout-${this.layout} size-${this.size}`
111
- }
112
- },
113
- },
114
- methods: {
115
- onClick() {
116
- if (this.disabled) return
117
- this.$emit('click')
118
- },
119
- onMouseEnter(){
120
- if(!this.disabled){
121
- this.isHover = true
122
- }
123
- },
124
- onMouseLeave(){
125
- if(!this.disabled){
126
- this.isHover = false
127
- }
67
+ type: String,
68
+ default: 'big',
69
+ validator: (value:string) => ['small','medium','big'].includes(value)
70
+ },
71
+ disabled: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ loading: {
76
+ type: Boolean,
77
+ default: false
78
+ },
79
+ iconClass:{
80
+ type: String,
81
+ default: ''
82
+ }
83
+ })
84
+
85
+ const getComponentClass = computed(()=>{
86
+ if(props.icon){
87
+ return `layout-${props.layout} size-${props.size} icon-${props.iconPosition}`
88
+ } else {
89
+ return `layout-${props.layout} size-${props.size}`
90
+ }
91
+ })
92
+
93
+ const onClick = () => {
94
+ if (props.disabled) return
95
+ emit('click')
96
+ }
97
+ const onMouseEnter = () => {
98
+ if(!props.disabled){
99
+ isHover.value = true
100
+ }
101
+ }
102
+
103
+ const onMouseLeave = () => {
104
+ if(!props.disabled){
105
+ isHover.value = false
128
106
  }
129
107
  }
130
- }
108
+
131
109
  </script>
132
110
 
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ declare module '*.vue' {
3
+ import type { DefineComponent } from 'vue'
4
+ const component: DefineComponent<{}, {}, any>
5
+ export default component
6
+ }
7
+
8
+ declare module '*.svg' {
9
+ const content: string;
10
+ export default content;
11
+ }
@@ -8,8 +8,8 @@ export default {
8
8
  }
9
9
 
10
10
 
11
- export const Index = (args, { argTypes }) => ({
12
- props: Object.keys(argTypes, args),
11
+ export const Index = (args:any, { argTypes }: { argTypes:any }) => ({
12
+ props: Object.keys({argTypes, args}),
13
13
  components: { PsAccordion, PsAccordionItem },
14
14
  template:
15
15
  `
@@ -7,7 +7,7 @@ export default {
7
7
  },
8
8
  }
9
9
 
10
- const TemplateDefault = (args, {argTypes})=>({
10
+ const TemplateDefault = (args:any, {argTypes}:{argTypes:any})=>({
11
11
  props: Object.keys(argTypes),
12
12
  components:{PsBadgeWithIcon},
13
13
  template: `
@@ -4,7 +4,7 @@ export default {
4
4
  component: PsBarChart,
5
5
  }
6
6
 
7
- const defaultTemplate = (args, {argTypes}) => ({
7
+ const defaultTemplate = (args:any, {argTypes}:{argTypes:any}) => ({
8
8
  props: Object.keys(argTypes),
9
9
  components: { PsBarChart },
10
10
  template: `
@@ -11,7 +11,7 @@ const items = [
11
11
  { title: '4th level', route: '' },
12
12
  ]
13
13
 
14
- const Template = (args, { argTypes }) => ({
14
+ const Template = (args:any, { argTypes }:{argTypes:any}) => ({
15
15
  props: Object.keys(argTypes),
16
16
  components: { PsBreadcrumb },
17
17
  template: `
@@ -20,6 +20,3 @@ const Template = (args, { argTypes }) => ({
20
20
  })
21
21
 
22
22
  export const Default = Template.bind({})
23
- Default.args = {
24
- items: items,
25
- }
@@ -6,11 +6,10 @@ export default {
6
6
  argTypes: {},
7
7
  }
8
8
 
9
- const Template = (args, { argTypes }) => ({
9
+ const Template = (args:any, { argTypes }:{ argTypes:any }) => ({
10
10
  props: Object.keys(argTypes),
11
11
  components: { PsCardInfos },
12
12
  template: '<PsCardInfos v-bind="$props" />',
13
13
  })
14
14
 
15
15
  export const CardInfos = Template.bind({})
16
- CardInfos.args = {}
@@ -6,11 +6,10 @@ export default {
6
6
  argTypes: {},
7
7
  }
8
8
 
9
- const Template = (args, { argTypes }) => ({
9
+ const Template = (args:any, { argTypes } : { argTypes:any }) => ({
10
10
  props: Object.keys(argTypes),
11
11
  components: { PsChartLegend },
12
12
  template: '<PsChartLegend v-bind="$props" />',
13
13
  })
14
14
 
15
15
  export const ChartLegend = Template.bind({})
16
- ChartLegend.args = {}
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsCheckbox,
6
6
  }
7
7
 
8
- const defaultTemplate = (args, {argTypes}) => ({
8
+ const defaultTemplate = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: { PsCheckbox},
11
11
  template: `
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsCheckboxSimple,
6
6
  }
7
7
 
8
- const defaultTemplate = (args, {argTypes}) => ({
8
+ const defaultTemplate = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: { PsCheckboxSimple },
11
11
  data: () => ({
@@ -1,31 +1,33 @@
1
1
  import PsChips from '../components/chips/PsChips.vue'
2
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
3
 
3
- export default {
4
- title: 'Components/Chips',
5
- component: PsChips,
4
+ import * as HeaderStories from '../stories/Header.stories'
5
+
6
+ const meta: Meta<typeof PsChips> = {
7
+ component: PsChips
6
8
  }
7
9
 
8
- const Template = (args, { argTypes }) => ({
9
- props: Object.keys(argTypes),
10
- components: { PsChips },
11
- data: ()=>{
12
- return{
13
- isChecked: true,
14
- isCheckedTwo: null,
15
- }
16
- },
17
- template: `<div style="display:flex; gap: 10px;">
18
- <PsChips v-bind='$props' type="button" @update:checked='isChecked = $event' :checked='isChecked'/>
10
+ export default meta
11
+
12
+ type Story = StoryObj<typeof PsChips>
13
+
14
+ export const Primary: Story = {
15
+ render: (args) => ({
16
+ components: { PsChips },
17
+ setup(){
18
+ return { args }
19
+ },
20
+ template: `<div style="display:flex; gap: 10px;">
19
21
  <PsChips v-bind='$props' label="Simple chips with icons" type="button" layout="with-icon" icon="home" @update:checked='isChecked = $event' :checked='isChecked'/>
20
22
  <PsChips v-bind='$props' label="Radio chips" type="radio" @update:checked='isChecked = $event' :checked='isChecked'/>
21
23
  <PsChips v-bind='$props' label="Checkbox chips" type="checkbox" @update:checked='isCheckedTwo = $event' :checked='isCheckedTwo'/>
22
24
  <PsChips v-bind='$props' label="Rich chips" type="button" layout="rich" icon="text_snippet" @update:checked='isChecked = $event' :checked='isChecked'/>
23
25
  </div>
24
- `
25
- })
26
-
27
- export const Default = Template.bind({})
28
- Default.args = {
29
- label: 'Simple Chip',
30
- icon:'',
31
- }
26
+ `,
27
+ args:{
28
+ label: 'Simple Chip',
29
+ icon:'',
30
+ ...HeaderStories.LoggedIn.args
31
+ }
32
+ })
33
+ }
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsClimateZoneBadge,
6
6
  }
7
7
 
8
- const Template = (args, { argTypes }) => ({
8
+ const Template = (args:any, { argTypes }:{ argTypes:any }) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: { PsClimateZoneBadge },
11
11
  template: '<PsClimateZoneBadge v-bind="$props" />',
@@ -13,7 +13,7 @@ export default {
13
13
  },
14
14
  }
15
15
 
16
- const Template = (args, { argTypes }) => ({
16
+ const Template = (args:any, { argTypes }:{ argTypes:any }) => ({
17
17
  props: Object.keys(argTypes),
18
18
  components: { PsCostEffectBar },
19
19
  template: '<PsCostEffectBar v-bind="$props" />',
@@ -10,7 +10,7 @@ export default {
10
10
  }
11
11
  }
12
12
 
13
- const Template = (args, { argTypes }) => ({
13
+ const Template = (args:any, { argTypes }:{ argTypes:any }) => ({
14
14
  props: Object.keys(argTypes),
15
15
  components: {PsDataTable},
16
16
  template: `
@@ -20,7 +20,7 @@ const Template = (args, { argTypes }) => ({
20
20
  `
21
21
  })
22
22
 
23
- const RichTemplate = (args, { argTypes } ) => ({
23
+ const RichTemplate = (args:any, { argTypes }:{ argTypes:any } ) => ({
24
24
  props: Object.keys(argTypes),
25
25
  components: {PsDataTable, PsDataTableItem},
26
26
  template: `
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsDateCardInfo,
6
6
  }
7
7
 
8
- const Template = (args,{argTypes}) => ({
8
+ const Template = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components:{PsDateCardInfo},
11
11
  template: `
@@ -18,7 +18,3 @@ export default {
18
18
  })
19
19
 
20
20
  export const Default = Template.bind({})
21
-
22
- Default.args = {
23
- date: '2021/02/23'
24
- }
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsInlineSelector,
6
6
  }
7
7
 
8
- const TemplateDefault = (args, {argTypes}) => ({
8
+ const TemplateDefault = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: {PsInlineSelector},
11
11
  template: `
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsInputTextArea,
6
6
  }
7
7
 
8
- const Template = (args, {argTypes}) => ({
8
+ const Template = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: {PsInputTextArea},
11
11
  template: `
@@ -5,7 +5,7 @@ export default {
5
5
  component: PsRadioButtonSimple,
6
6
  }
7
7
 
8
- const defaultTemplate = (args, {argTypes}) => ({
8
+ const defaultTemplate = (args:any, {argTypes}:{argTypes:any}) => ({
9
9
  props: Object.keys(argTypes),
10
10
  components: { PsRadioButtonSimple },
11
11
  data: () => ({
@@ -34,7 +34,7 @@ window.addEventListener('click', (ev) => {
34
34
  })
35
35
 
36
36
  function copyText(textToCopy) {
37
- var myTemporaryInputElement = document.createElement('input')
37
+ const myTemporaryInputElement = document.createElement('input')
38
38
  myTemporaryInputElement.type = 'text'
39
39
  myTemporaryInputElement.value = textToCopy
40
40
  document.body.appendChild(myTemporaryInputElement)
@@ -8,7 +8,7 @@ export default {
8
8
  subcomponents: {PsRichTooltip, PsDialogTooltip}
9
9
  }
10
10
 
11
- const TemplateDialog = (args, {argTypes}) => ({
11
+ const TemplateDialog = (args:any, {argTypes}:{argTypes:any}) => ({
12
12
  props: Object.keys(argTypes),
13
13
  components: {PsDialogTooltip},
14
14
  template: `
@@ -41,7 +41,7 @@ const TemplateDialog = (args, {argTypes}) => ({
41
41
  `,
42
42
  })
43
43
 
44
- const TemplateRich = (args,{argTypes})=>({
44
+ const TemplateRich = (args:any, {argTypes}:{argTypes:any})=>({
45
45
  props: Object.keys(argTypes),
46
46
  components: {PsRichTooltip},
47
47
  template: `
@@ -74,7 +74,7 @@ const TemplateRich = (args,{argTypes})=>({
74
74
  `
75
75
  })
76
76
 
77
- const TemplateDefault = (args, {argTypes}) => ({
77
+ const TemplateDefault = (args:any, {argTypes}:{argTypes:any}) => ({
78
78
  props: Object.keys(argTypes),
79
79
  components: {PsTooltip},
80
80
  template: `
@@ -1,9 +1,9 @@
1
1
  export const randomString = (length) => {
2
- var result = ''
3
- var characters =
2
+ let result = ''
3
+ const characters =
4
4
  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
5
- var charactersLength = characters.length
6
- for (var i = 0; i < length; i++) {
5
+ const charactersLength = characters.length
6
+ for (let i = 0; i < length; i++) {
7
7
  result += characters.charAt(Math.floor(Math.random() * charactersLength))
8
8
  }
9
9
  return result
@@ -1,14 +1,14 @@
1
1
  export default ({ imageUrl, onProgress = null, returnsBase64 = true }) => {
2
2
  return new Promise((resolve, reject) => {
3
- var xhr = new XMLHttpRequest()
4
- var notifiedNotComputable = false
3
+ const xhr = new XMLHttpRequest()
4
+ let notifiedNotComputable = false
5
5
 
6
6
  xhr.open('GET', imageUrl, true)
7
7
  xhr.responseType = 'arraybuffer'
8
8
 
9
9
  xhr.onprogress = (ev) => {
10
10
  if (ev.lengthComputable) {
11
- let progress = parseInt((ev.loaded / ev.total) * 100)
11
+ const progress = parseInt((ev.loaded / ev.total) * 100)
12
12
  if(onProgress) onProgress(progress)
13
13
  } else {
14
14
  if (!notifiedNotComputable) {
@@ -30,11 +30,11 @@ export default ({ imageUrl, onProgress = null, returnsBase64 = true }) => {
30
30
  if(!returnsBase64) {
31
31
  resolve()
32
32
  } else {
33
- var options = {}
34
- var headers = xhr.getAllResponseHeaders()
35
- var mime = headers.match(/^Content-Type\\:\s*(.*?)$/mi)
33
+ const options = {}
34
+ const headers = xhr.getAllResponseHeaders()
35
+ const mime = headers.match(/^Content-Type\\:\s*(.*?)$/mi)
36
36
  if (mime && mime[1]) options.type = mime[1]
37
- var blob = new Blob([xhr.response], options)
37
+ const blob = new Blob([xhr.response], options)
38
38
  resolve(window.URL.createObjectURL(blob))
39
39
  }
40
40
  }
package/tsconfig.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "esnext",
4
+ "module": "esnext",
5
+ "strict": true,
6
+ "jsx": "preserve",
7
+ "moduleResolution": "node",
8
+ "allowJs": true,
9
+ "skipLibCheck": true,
10
+ "esModuleInterop": true,
11
+ "allowSyntheticDefaultImports": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "useDefineForClassFields": true,
14
+ "sourceMap": true,
15
+ "baseUrl": ".",
16
+ "types": [
17
+ "webpack-env"
18
+ ],
19
+ "paths": {
20
+ "@/*": [
21
+ "src/*"
22
+ ]
23
+ },
24
+ "lib": [
25
+ "esnext",
26
+ "dom",
27
+ "dom.iterable",
28
+ "scripthost"
29
+ ]
30
+ },
31
+ "include": [
32
+ "src/**/*.ts",
33
+ "src/**/*.tsx",
34
+ "src/**/*.vue",
35
+ "tests/**/*.ts",
36
+ "tests/**/*.tsx",
37
+ ".storybook/*.ts"
38
+ ],
39
+ "exclude": [
40
+ "node_modules"
41
+ ]
42
+ }
package/webpack.config.js CHANGED
@@ -16,7 +16,7 @@ module.exports = {
16
16
  }
17
17
  }
18
18
  }
19
- }
19
+ },
20
20
  ]
21
21
  }
22
22
  }
@@ -1,10 +0,0 @@
1
- import { create } from '@storybook/theming';
2
- import logo from '../src/assets/images/policy-studio.svg';
3
-
4
- export default create({
5
- base: 'light',
6
- brandTitle: 'Policy Studio UI Vue',
7
- brandUrl: 'https://policystudio.co/',
8
- brandImage: logo,
9
- brandTarget: '_blank',
10
- });
@@ -1,6 +0,0 @@
1
- import { addons } from '@storybook/addons';
2
- import PolicyStudio from './PolicyStudio';
3
-
4
- addons.setConfig({
5
- theme: PolicyStudio,
6
- });
File without changes
File without changes
File without changes
File without changes
File without changes