Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UX Tweaks #25

Merged
merged 61 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
d3018ce
Don't fail with an error when buttons are missing click handlers
inkfarer Dec 20, 2023
309d227
Buttons only show a pointer cursor if they will direct the user to an…
inkfarer Dec 20, 2023
d7c0ce9
checkbox: Refactoring, display active state
inkfarer Dec 20, 2023
8d736c4
Initial support for a light theme
inkfarer Dec 21, 2023
0ebdabd
Remove unneeded import
inkfarer Dec 21, 2023
8151042
Only display focus rings for checkboxes when necessary
inkfarer Dec 21, 2023
46150ff
Allow ipl-small-toggle to be controlled by a keyboard
inkfarer Dec 21, 2023
9a52a8b
Refactor small toggle styles
inkfarer Dec 22, 2023
b9e31f6
Allow ipl-toggle to be controlled by a keyboard
inkfarer Dec 22, 2023
3290e9b
Put back a prop validator that was incidentally removed
inkfarer Dec 22, 2023
0aaa2a5
Fix broken tests
inkfarer Dec 22, 2023
d979d56
Create a common variable for the document body text
inkfarer Dec 22, 2023
6434d03
Fix small icon buttons not being square anymore
inkfarer Dec 22, 2023
1b8fc2e
Fix some vitepress default styles overriding component ones
inkfarer Dec 22, 2023
8693942
Render buttons as <button> elements by default for semantics, fix som…
inkfarer Dec 22, 2023
829c578
Add missing expanding space example
inkfarer Dec 22, 2023
9e39e8e
Restore Roboto font import in docs
inkfarer Dec 22, 2023
c4fe9ad
Allow expanding spaces to be expanded by keyboard input
inkfarer Dec 23, 2023
6af3d86
Render space components as buttons when marked clickable to make them…
inkfarer Dec 23, 2023
245bd3f
Move ipl-sidebar to using the built-in dialog component
inkfarer Dec 24, 2023
d65bb47
Allow ipl-radio to accept keyboard input
inkfarer Dec 26, 2023
ec8524f
Fix some elements partially not changing color on theme change
inkfarer Dec 27, 2023
fbe8a17
Fix a recursion error in ipl-multi-select
inkfarer Dec 27, 2023
67709b6
When removing an item from ipl-multi-select with a keyboard, automati…
inkfarer Dec 27, 2023
eea5b44
Fix some options in ipl-multi-select not being selectable
inkfarer Dec 27, 2023
3090e40
Allow ipl-upload to be used with a keyboard
inkfarer Dec 27, 2023
fa817f0
Allow ipl-dialog-title and ipl-message to be used with a keyboard
inkfarer Dec 27, 2023
78659e2
Undo example changes made for testing
inkfarer Dec 27, 2023
46d7305
Override some UA styles in ipl-select
inkfarer Dec 27, 2023
9a22272
Tweak color input styles to better indicate interactivity
inkfarer Dec 28, 2023
00e1419
Bump version number
inkfarer Dec 28, 2023
4387b86
Rework input validation logic
inkfarer Jan 3, 2024
85f288d
Add ipl-textarea
inkfarer Jan 4, 2024
d1294cf
Allow defining placeholder text on ipl-input
inkfarer Jan 4, 2024
13a416b
Fix some nearly invisible colors on light mode
inkfarer Jan 4, 2024
d1eb366
Give inputs a larger variant
inkfarer Jan 5, 2024
25049d2
Tweak variable naming
inkfarer Jan 5, 2024
78aeb68
Switch to vite to provide an ESM build, improving Nuxt support and sh…
inkfarer Jan 5, 2024
f28dc89
Refactor ipl-space background styles to be reusable; Support "primary…
inkfarer Jan 9, 2024
43d2f31
Change ipl-progress-bar default background color from legacy option
inkfarer Jan 9, 2024
b118278
Allow expanded content background to be removed and add color prop to…
inkfarer Jan 9, 2024
e465e85
Add function to ipl-input to unfocus the input
inkfarer Jan 9, 2024
82a727d
Adjust padding for expanding spaces without a content background
inkfarer Jan 12, 2024
5906227
Fix broken styles in demo event log
inkfarer Jan 12, 2024
fc946c0
Add an optional button to copy the value of ipl-data-row
inkfarer Jan 12, 2024
a370907
Add a slot to ipl-data-row to change the value to an arbitrary element
inkfarer Jan 12, 2024
ba736c5
Turn the keyboard focus outline width into a css variable
inkfarer Jan 13, 2024
fcc0aca
Fix the keyboard focus outline unintentionally animating on ipl-expan…
inkfarer Jan 13, 2024
64fbfaa
Allow ipl-data-row to accept numbers as values
inkfarer Jan 13, 2024
bac1981
Allow removing the background color on buttons
inkfarer Jan 13, 2024
243568a
ipl-button size can be adjusted by changing its font size; Add inline…
inkfarer Jan 13, 2024
4967fac
Replace <button> with ipl-button to reduce repeating styles
inkfarer Jan 13, 2024
cb7d413
Adjust text button colors to help differentiate them from disabled bu…
inkfarer Jan 15, 2024
df2eaa6
Fix selects not opening when clicking on their arrow icon
inkfarer Jan 15, 2024
6c5a618
Add ipl-pagination
inkfarer Jan 15, 2024
3785b59
Fix layout bug on copiable ipl-data-row
inkfarer Jan 15, 2024
0ad0416
Externalize font-awesome dependencies to dramatically reduce bundle size
inkfarer Jan 15, 2024
6af413a
Prevent Firefox from caching button disabled state
inkfarer Jan 15, 2024
b5d4ae9
Fix tests
inkfarer Jan 15, 2024
f91c51e
Allow ipl-pagination to show a loading spinner
inkfarer Jan 15, 2024
69c5782
Clickable spaces no longer show a pointer cursor
inkfarer Jan 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
"import/resolver": {
"typescript": {
"project": "tsconfig.json"
},
"webpack": {
"config": "webpack.config.js",
"config-index": 0
}
},
"import/extensions": [".js", ".ts"]
Expand Down Expand Up @@ -87,7 +83,9 @@
"files": ["*.test.ts"],
"rules": {
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/no-this-alias": 0
"@typescript-eslint/no-this-alias": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"vue/one-component-per-file": 0
}
},
{
Expand Down
140 changes: 140 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,143 @@
# 3.0.0

## Breaking

- Library stylesheets must be manually imported
- ipl-radio requires a `name` prop
- Some style changes may require dependent styles to use `!important` when it wasn't before. Some examples:
- `text-align` or `display` on ipl-button when the `clickable` prop is set
- Input validation logic has been overhauled - the value to validate is no longer required when declaring field validators.
- <details>
<summary>Old implementation</summary>

```vue
<template>
<ipl-input
v-model="firstValue"
name="firstValue"
label="First Value"
/>
<ipl-input
v-model="secondValue"
name="secondValue"
label="Second Value"
/>
</template>

<script lang="ts">
import { computed, defineComponent, ref } from 'vue';
import {
allValid,
IplInput,
notBlank,
provideValidators,
validator
} from '@iplsplatoon/vue-components';

export default defineComponent({
components: { IplInput },

setup() {
const firstValue = ref('');
const secondValue = ref('');

const firstValueValidator = validator(firstValue, false, notBlank);
const validators = {
firstValue: firstValueValidator,
secondValue: validator(secondValue, false, notBlank)
};
provideValidators(validators);

return {
allValid: computed(() => allValid(validators)),
firstValueValid: computed(() => firstValueValidator.isValid),
firstValue,
secondValue
};
}
});
</script>
```
</details>
- <details>
<summary>New implementation</summary>

```vue
<template>
<ipl-input
v-model="firstValue"
name="firstValue"
label="First Value"
/>
<ipl-input
v-model="secondValue"
name="secondValue"
label="Second Value"
/>
</template>

<script lang="ts">
import { computed, defineComponent, ref } from 'vue';
import {
// allValid is no longer an export - use the return value of provideValidators.
IplInput,
notBlank,
provideValidators,
validator
} from '@iplsplatoon/vue-components';

export default defineComponent({
components: { IplInput },

setup() {
const firstValue = ref('');
const secondValue = ref('');

const { allValid, fieldIsValid } = provideValidators({
// The first parameter is no longer present.
firstValue: validator(false, notBlank),
secondValue: validator(false, notBlank)
});

return {
allValid,
firstValueValid: computed(() => fieldIsValid('firstValue')),
firstValue,
secondValue
};
}
});
</script>
```

</details>

## Other Changes

- Most components can be controlled by keyboard input when expected
- Some components have been refactored:
- Clickable ipl-space components use the `<button>` element
- Buttons use `<button>` instead of `<a>` unless they are links
- ipl-sidebar uses the built-in `<dialog>` element
- ipl-small-toggle uses the `<input>` element instead of a bunch of divs
- Buttons acting as links act as expected when they are disabled or require confirmation (#23)

## Additions

- Added ipl-textarea
- Added ipl-pagination
- ipl-input supports adding a placeholder
- Added a larger theme for ipl-input
- SSR support
- Provide separate ESM and UMD builds
- `color` and `without-content-background` props to ipl-expanding-space
- Added `copiable` to ipl-data-row
- ipl-data-row can contain any element as the value through the default slot
- Updated ipl-button:
- Allow removing the background color
- Added `inline` prop
- Button size can be adjusted by changing `font-size` in CSS

# 2.10.1

- Move docs to a vitepress-powered concoction, combining the previously separate plain-text docs and locally built examples into a single site
Expand Down
5 changes: 3 additions & 2 deletions docs/.vitepress/components/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import(`../../examples/${props.sourceFile}.vue`).then(result => {

<style lang="scss">
@use 'src/styles/colors';
@use 'src/styles/constants';

html.dark .demo-preview > *:first-child {
--line-color: #37445C;
Expand Down Expand Up @@ -46,7 +47,7 @@ html.dark .demo-preview > *:first-child {
linear-gradient(to right, var(--line-color) $grid-width, transparent $grid-width),
linear-gradient(to bottom, var(--line-color) $grid-width, transparent $grid-width);

font-family: 'Roboto', sans-serif;
font-family: constants.$body-font;
font-weight: 400;
padding: 24px;

Expand All @@ -72,7 +73,7 @@ html.dark .demo-preview > *:first-child {
margin: 0 auto;
}

.demo-preview > *:not(:first-child, .ipl-expansion-panel__content) {
.demo-preview > *:not(:first-child, .ipl-expanding-space) {
background-color: var(--vp-c-bg);
border-radius: 8px;
padding: 8px;
Expand Down
4 changes: 3 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ export default defineConfig({
{ text: 'Expanding Space Group', link: '/ipl-expanding-space-group' },
{ text: 'Message', link: '/ipl-message' },
{ text: 'Input', link: '/ipl-input' },
{ text: 'Textarea', link: '/ipl-textarea' },
{ text: 'Radio', link: '/ipl-radio' },
{ text: 'Select', link: '/ipl-select' },
{ text: 'Multi-Select', link: '/ipl-multi-select' },
{ text: 'File Upload', link: '/ipl-upload' },
{ text: 'Progress Bar', link: '/ipl-progress-bar' },
{ text: 'Toggles', link: '/toggles' },
{ text: 'Loading Spinner', link: '/ipl-spinner' },
{ text: 'Sidebar', link: '/ipl-sidebar' }
{ text: 'Sidebar', link: '/ipl-sidebar' },
{ text: 'Pagination', link: '/ipl-pagination' }
]
}
],
Expand Down
21 changes: 21 additions & 0 deletions docs/.vitepress/theme/Layout.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<DefaultLayout />
</template>

<script setup lang="ts">
import DefaultLayout from 'vitepress/dist/client/theme-default/Layout.vue';
import { useData } from 'vitepress';
import { onMounted, watch } from 'vue';

const { isDark } = useData();

onMounted(() => {
watch(isDark, newValue => {
if (newValue) {
document.documentElement.classList.remove('light');
} else {
document.documentElement.classList.add('light');
}
}, { immediate: true });
});
</script>
18 changes: 14 additions & 4 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
// https://vitepress.dev/guide/custom-theme
import type { Theme } from 'vitepress';
import DefaultTheme from 'vitepress/theme-without-fonts';
import { Theme } from 'vitepress';
import Demo from '../components/Demo.vue';
import EventLog from '../components/EventLog.vue';
import { IplExpandingSpace } from '../../../src';
import Layout from './Layout.vue';

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

export default {
extends: DefaultTheme,
enhanceApp({ app, router, siteData }) {
Layout: Layout,
enhanceApp({ app }) {
app.component('Demo', Demo);
app.component('EventLog', EventLog);
app.component('IplExpandingSpace', IplExpandingSpace);
Expand Down
39 changes: 14 additions & 25 deletions docs/.vitepress/theme/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use '../../../src/styles/colors';
@use '../../../src/styles/constants';

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

/**
Expand Down Expand Up @@ -33,25 +34,26 @@
--vp-c-danger-2: #{colors.$error-color};
--vp-c-danger-3: #{colors.$error-color};
--vp-c-danger-soft: #{colors.$error-background-color};

--vp-c-bg: var(--ipl-bg-primary);
--vp-c-bg-alt: var(--ipl-bg-secondary);
--vp-c-bg-soft: var(--ipl-bg-secondary);
--vp-c-bg-elv: var(--ipl-bg-secondary);
}

.dark {
--vp-c-bg: #{colors.$background-primary};
--vp-c-bg-alt: #{colors.$background-secondary};
--vp-c-bg-soft: #{colors.$background-secondary};
--vp-c-bg-elv: #{colors.$background-secondary};
--vp-c-divider: #606770;
}

:root {
--vp-font-family-base: 'Roboto', sans-serif;
--vp-font-family-base: #{constants.$body-font};
--vp-font-family-mono: 'Roboto Mono', monospace;
--vp-code-color: var(--vp-c-text-1);
}

.source-example {
margin-top: 8px;
font-family: 'Roboto', sans-serif;
font-family: constants.$body-font;
font-synthesis: none;

[class*='language-'] {
Expand Down Expand Up @@ -80,32 +82,19 @@
flex-wrap: wrap;
justify-content: center;

> * {
width: auto !important;
&.no-wrap {
flex-wrap: nowrap;
}

&:not(:last-child) {
margin-right: 12px;
}
> *:not(:last-child) {
margin-right: 12px;
}
}

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

// TODO: actually integrate these into the library
.ipl-expansion-panel__content {
background-color: var(--vp-c-bg) !important;
}

html:not(.dark) .ipl-expansion-panel__header-background:hover {
background-color: #FBFBFB !important;
}

html:not(.dark) .ipl-expansion-panel__header-background:active {
background-color: #F8F8F8 !important;
}

html {
line-height: normal;
}
Expand Down
Loading