Skip to content

Commit 7b94ddf

Browse files
authored
Merge pull request #25 from IPLSplatoon/ux-tweaks
UX Tweaks
2 parents 9267692 + 69c5782 commit 7b94ddf

File tree

92 files changed

+3283
-2536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+3283
-2536
lines changed

.eslintrc.json

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
"import/resolver": {
1414
"typescript": {
1515
"project": "tsconfig.json"
16-
},
17-
"webpack": {
18-
"config": "webpack.config.js",
19-
"config-index": 0
2016
}
2117
},
2218
"import/extensions": [".js", ".ts"]
@@ -87,7 +83,9 @@
8783
"files": ["*.test.ts"],
8884
"rules": {
8985
"@typescript-eslint/no-var-requires": 0,
90-
"@typescript-eslint/no-this-alias": 0
86+
"@typescript-eslint/no-this-alias": 0,
87+
"@typescript-eslint/no-non-null-assertion": 0,
88+
"vue/one-component-per-file": 0
9189
}
9290
},
9391
{

CHANGELOG.md

+140
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,143 @@
1+
# 3.0.0
2+
3+
## Breaking
4+
5+
- Library stylesheets must be manually imported
6+
- ipl-radio requires a `name` prop
7+
- Some style changes may require dependent styles to use `!important` when it wasn't before. Some examples:
8+
- `text-align` or `display` on ipl-button when the `clickable` prop is set
9+
- Input validation logic has been overhauled - the value to validate is no longer required when declaring field validators.
10+
- <details>
11+
<summary>Old implementation</summary>
12+
13+
```vue
14+
<template>
15+
<ipl-input
16+
v-model="firstValue"
17+
name="firstValue"
18+
label="First Value"
19+
/>
20+
<ipl-input
21+
v-model="secondValue"
22+
name="secondValue"
23+
label="Second Value"
24+
/>
25+
</template>
26+
27+
<script lang="ts">
28+
import { computed, defineComponent, ref } from 'vue';
29+
import {
30+
allValid,
31+
IplInput,
32+
notBlank,
33+
provideValidators,
34+
validator
35+
} from '@iplsplatoon/vue-components';
36+
37+
export default defineComponent({
38+
components: { IplInput },
39+
40+
setup() {
41+
const firstValue = ref('');
42+
const secondValue = ref('');
43+
44+
const firstValueValidator = validator(firstValue, false, notBlank);
45+
const validators = {
46+
firstValue: firstValueValidator,
47+
secondValue: validator(secondValue, false, notBlank)
48+
};
49+
provideValidators(validators);
50+
51+
return {
52+
allValid: computed(() => allValid(validators)),
53+
firstValueValid: computed(() => firstValueValidator.isValid),
54+
firstValue,
55+
secondValue
56+
};
57+
}
58+
});
59+
</script>
60+
```
61+
</details>
62+
- <details>
63+
<summary>New implementation</summary>
64+
65+
```vue
66+
<template>
67+
<ipl-input
68+
v-model="firstValue"
69+
name="firstValue"
70+
label="First Value"
71+
/>
72+
<ipl-input
73+
v-model="secondValue"
74+
name="secondValue"
75+
label="Second Value"
76+
/>
77+
</template>
78+
79+
<script lang="ts">
80+
import { computed, defineComponent, ref } from 'vue';
81+
import {
82+
// allValid is no longer an export - use the return value of provideValidators.
83+
IplInput,
84+
notBlank,
85+
provideValidators,
86+
validator
87+
} from '@iplsplatoon/vue-components';
88+
89+
export default defineComponent({
90+
components: { IplInput },
91+
92+
setup() {
93+
const firstValue = ref('');
94+
const secondValue = ref('');
95+
96+
const { allValid, fieldIsValid } = provideValidators({
97+
// The first parameter is no longer present.
98+
firstValue: validator(false, notBlank),
99+
secondValue: validator(false, notBlank)
100+
});
101+
102+
return {
103+
allValid,
104+
firstValueValid: computed(() => fieldIsValid('firstValue')),
105+
firstValue,
106+
secondValue
107+
};
108+
}
109+
});
110+
</script>
111+
```
112+
113+
</details>
114+
115+
## Other Changes
116+
117+
- Most components can be controlled by keyboard input when expected
118+
- Some components have been refactored:
119+
- Clickable ipl-space components use the `<button>` element
120+
- Buttons use `<button>` instead of `<a>` unless they are links
121+
- ipl-sidebar uses the built-in `<dialog>` element
122+
- ipl-small-toggle uses the `<input>` element instead of a bunch of divs
123+
- Buttons acting as links act as expected when they are disabled or require confirmation (#23)
124+
125+
## Additions
126+
127+
- Added ipl-textarea
128+
- Added ipl-pagination
129+
- ipl-input supports adding a placeholder
130+
- Added a larger theme for ipl-input
131+
- SSR support
132+
- Provide separate ESM and UMD builds
133+
- `color` and `without-content-background` props to ipl-expanding-space
134+
- Added `copiable` to ipl-data-row
135+
- ipl-data-row can contain any element as the value through the default slot
136+
- Updated ipl-button:
137+
- Allow removing the background color
138+
- Added `inline` prop
139+
- Button size can be adjusted by changing `font-size` in CSS
140+
1141
# 2.10.1
2142
3143
- Move docs to a vitepress-powered concoction, combining the previously separate plain-text docs and locally built examples into a single site

docs/.vitepress/components/Demo.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import(`../../examples/${props.sourceFile}.vue`).then(result => {
1919

2020
<style lang="scss">
2121
@use 'src/styles/colors';
22+
@use 'src/styles/constants';
2223
2324
html.dark .demo-preview > *:first-child {
2425
--line-color: #37445C;
@@ -46,7 +47,7 @@ html.dark .demo-preview > *:first-child {
4647
linear-gradient(to right, var(--line-color) $grid-width, transparent $grid-width),
4748
linear-gradient(to bottom, var(--line-color) $grid-width, transparent $grid-width);
4849
49-
font-family: 'Roboto', sans-serif;
50+
font-family: constants.$body-font;
5051
font-weight: 400;
5152
padding: 24px;
5253
@@ -72,7 +73,7 @@ html.dark .demo-preview > *:first-child {
7273
margin: 0 auto;
7374
}
7475
75-
.demo-preview > *:not(:first-child, .ipl-expansion-panel__content) {
76+
.demo-preview > *:not(:first-child, .ipl-expanding-space) {
7677
background-color: var(--vp-c-bg);
7778
border-radius: 8px;
7879
padding: 8px;

docs/.vitepress/config.mts

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ export default defineConfig({
2626
{ text: 'Expanding Space Group', link: '/ipl-expanding-space-group' },
2727
{ text: 'Message', link: '/ipl-message' },
2828
{ text: 'Input', link: '/ipl-input' },
29+
{ text: 'Textarea', link: '/ipl-textarea' },
2930
{ text: 'Radio', link: '/ipl-radio' },
3031
{ text: 'Select', link: '/ipl-select' },
3132
{ text: 'Multi-Select', link: '/ipl-multi-select' },
3233
{ text: 'File Upload', link: '/ipl-upload' },
3334
{ text: 'Progress Bar', link: '/ipl-progress-bar' },
3435
{ text: 'Toggles', link: '/toggles' },
3536
{ text: 'Loading Spinner', link: '/ipl-spinner' },
36-
{ text: 'Sidebar', link: '/ipl-sidebar' }
37+
{ text: 'Sidebar', link: '/ipl-sidebar' },
38+
{ text: 'Pagination', link: '/ipl-pagination' }
3739
]
3840
}
3941
],

docs/.vitepress/theme/Layout.vue

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<DefaultLayout />
3+
</template>
4+
5+
<script setup lang="ts">
6+
import DefaultLayout from 'vitepress/dist/client/theme-default/Layout.vue';
7+
import { useData } from 'vitepress';
8+
import { onMounted, watch } from 'vue';
9+
10+
const { isDark } = useData();
11+
12+
onMounted(() => {
13+
watch(isDark, newValue => {
14+
if (newValue) {
15+
document.documentElement.classList.remove('light');
16+
} else {
17+
document.documentElement.classList.add('light');
18+
}
19+
}, { immediate: true });
20+
});
21+
</script>

docs/.vitepress/theme/index.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import type { Theme } from 'vitepress';
3-
import DefaultTheme from 'vitepress/theme-without-fonts';
2+
import { Theme } from 'vitepress';
43
import Demo from '../components/Demo.vue';
54
import EventLog from '../components/EventLog.vue';
65
import { IplExpandingSpace } from '../../../src';
6+
import Layout from './Layout.vue';
77

8+
// Vitepress broke some of my styles, so I just resolved to... taking the bits that I didn't want out and importing
9+
// everything piecemeal. It works for now.
10+
import 'vitepress/dist/client/theme-default/styles/vars.css';
11+
import 'vitepress/dist/client/theme-default/styles/base.css';
12+
import 'vitepress/dist/client/theme-default/styles/utils.css';
13+
import 'vitepress/dist/client/theme-default/styles/components/custom-block.css';
14+
import 'vitepress/dist/client/theme-default/styles/components/vp-code.css';
15+
import 'vitepress/dist/client/theme-default/styles/components/vp-code-group.css';
16+
import './vp-doc.css';
17+
import 'vitepress/dist/client/theme-default/styles/components/vp-sponsor.css';
818
import './style.scss';
919

1020
export default {
11-
extends: DefaultTheme,
12-
enhanceApp({ app, router, siteData }) {
21+
Layout: Layout,
22+
enhanceApp({ app }) {
1323
app.component('Demo', Demo);
1424
app.component('EventLog', EventLog);
1525
app.component('IplExpandingSpace', IplExpandingSpace);

docs/.vitepress/theme/style.scss

+14-25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use '../../../src/styles/colors';
2+
@use '../../../src/styles/constants';
23

3-
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
4+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');
45
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');
56

67
/**
@@ -33,25 +34,26 @@
3334
--vp-c-danger-2: #{colors.$error-color};
3435
--vp-c-danger-3: #{colors.$error-color};
3536
--vp-c-danger-soft: #{colors.$error-background-color};
37+
38+
--vp-c-bg: var(--ipl-bg-primary);
39+
--vp-c-bg-alt: var(--ipl-bg-secondary);
40+
--vp-c-bg-soft: var(--ipl-bg-secondary);
41+
--vp-c-bg-elv: var(--ipl-bg-secondary);
3642
}
3743

3844
.dark {
39-
--vp-c-bg: #{colors.$background-primary};
40-
--vp-c-bg-alt: #{colors.$background-secondary};
41-
--vp-c-bg-soft: #{colors.$background-secondary};
42-
--vp-c-bg-elv: #{colors.$background-secondary};
4345
--vp-c-divider: #606770;
4446
}
4547

4648
:root {
47-
--vp-font-family-base: 'Roboto', sans-serif;
49+
--vp-font-family-base: #{constants.$body-font};
4850
--vp-font-family-mono: 'Roboto Mono', monospace;
4951
--vp-code-color: var(--vp-c-text-1);
5052
}
5153

5254
.source-example {
5355
margin-top: 8px;
54-
font-family: 'Roboto', sans-serif;
56+
font-family: constants.$body-font;
5557
font-synthesis: none;
5658

5759
[class*='language-'] {
@@ -80,32 +82,19 @@
8082
flex-wrap: wrap;
8183
justify-content: center;
8284

83-
> * {
84-
width: auto !important;
85+
&.no-wrap {
86+
flex-wrap: nowrap;
87+
}
8588

86-
&:not(:last-child) {
87-
margin-right: 12px;
88-
}
89+
> *:not(:last-child) {
90+
margin-right: 12px;
8991
}
9092
}
9193

9294
.vertical-layout > *:not(:last-child) {
9395
margin-bottom: 8px;
9496
}
9597

96-
// TODO: actually integrate these into the library
97-
.ipl-expansion-panel__content {
98-
background-color: var(--vp-c-bg) !important;
99-
}
100-
101-
html:not(.dark) .ipl-expansion-panel__header-background:hover {
102-
background-color: #FBFBFB !important;
103-
}
104-
105-
html:not(.dark) .ipl-expansion-panel__header-background:active {
106-
background-color: #F8F8F8 !important;
107-
}
108-
10998
html {
11099
line-height: normal;
111100
}

0 commit comments

Comments
 (0)