@flux-ui/components 3.1.3 → 3.1.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flux-ui/components",
3
3
  "description": "A set of opiniated UI components.",
4
- "version": "3.1.3",
4
+ "version": "3.1.4",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/basmilius",
@@ -57,8 +57,8 @@
57
57
  "dependencies": {
58
58
  "@basmilius/common": "^3.43.0",
59
59
  "@basmilius/utils": "^3.43.0",
60
- "@flux-ui/internals": "3.1.3",
61
- "@flux-ui/types": "3.1.3",
60
+ "@flux-ui/internals": "3.1.4",
61
+ "@flux-ui/types": "3.1.4",
62
62
  "@fortawesome/fontawesome-common-types": "^7.2.0",
63
63
  "clsx": "^2.1.1",
64
64
  "imask": "^7.6.1",
@@ -3,6 +3,7 @@
3
3
  :component-type="type"
4
4
  :class="clsx(
5
5
  cssClass,
6
+ isActive && cssClassActive,
6
7
  isFilled && $style.isFilled,
7
8
  size === 'small' && $style.isSmall,
8
9
  size === 'medium' && $style.isMedium,
@@ -11,6 +12,7 @@
11
12
  )"
12
13
  :type="isSubmit ? 'submit' : 'button'"
13
14
  :aria-disabled="disabled ? true : undefined"
15
+ :aria-pressed="isActive && type === 'button' ? true : undefined"
14
16
  :disabled="disabled ? true : undefined"
15
17
  :tabindex="disabled ? -1 : tabindex"
16
18
  :href="href"
@@ -82,6 +84,7 @@
82
84
  type = 'button'
83
85
  } = defineProps<FluxButtonProps & {
84
86
  readonly cssClass: string;
87
+ readonly cssClassActive?: string;
85
88
  readonly cssClassIcon: string;
86
89
  readonly cssClassLabel: string;
87
90
  }>();
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconLeading, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :css-class="$style.destructiveButton"
5
+ :css-class-active="$style.isActive"
5
6
  :css-class-icon="$style.destructiveButtonIcon"
6
7
  :css-class-label="$style.destructiveButtonLabel"
7
8
  @click="$emit('click', $event)"
@@ -16,8 +16,7 @@
16
16
  <dialog
17
17
  ref="dialog"
18
18
  :class="$style.flyoutDialog"
19
- @click="onDialogBackdropClick"
20
- @keydown.prevent.esc="close">
19
+ @click="onDialogBackdropClick">
21
20
  <FluxPane
22
21
  v-if="isOpen"
23
22
  ref="pane"
@@ -46,6 +45,12 @@
46
45
  import { FluxFlyoutInjectionKey } from '~flux/components/data';
47
46
  import FluxPane from './FluxPane.vue';
48
47
  import $style from '~flux/components/css/component/Flyout.module.scss';
48
+ import { useHotKey } from '@basmilius/common';
49
+
50
+ const emit = defineEmits<{
51
+ close: [];
52
+ open: [];
53
+ }>();
49
54
 
50
55
  const {
51
56
  direction = 'vertical',
@@ -93,6 +98,11 @@
93
98
  !isSSR && useEventListener(ref(window), 'resize', () => unref(isOpen) && reposition());
94
99
  useFocusTrap(paneRef);
95
100
 
101
+ useHotKey('esc', () => close(), {
102
+ enabled: isOpen,
103
+ target: dialogRef
104
+ });
105
+
96
106
  let closeAnimationEndListener: ((evt: AnimationEvent) => void) | null = null;
97
107
  let openAnimationEndListener: ((evt: AnimationEvent) => void) | null = null;
98
108
 
@@ -233,11 +243,13 @@
233
243
 
234
244
  if (isOpen && !dialog.open) {
235
245
  dialog.showModal();
246
+ emit('open');
236
247
 
237
248
  window.addEventListener('scroll', reposition, {passive: true});
238
249
  onCleanup(() => window.removeEventListener('scroll', reposition));
239
250
  } else if (!isOpen && dialog.open) {
240
251
  dialog.close();
252
+ emit('close');
241
253
  }
242
254
  });
243
255
 
@@ -250,6 +262,7 @@
250
262
  defineExpose({
251
263
  close,
252
264
  open,
253
- toggle
265
+ toggle,
266
+ isOpen
254
267
  });
255
268
  </script>
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconLeading, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :css-class="$style.primaryButton"
5
+ :css-class-active="$style.isActive"
5
6
  :css-class-icon="$style.primaryButtonIcon"
6
7
  :css-class-label="$style.primaryButtonLabel"
7
8
  @click="$emit('click', $event)"
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconLeading, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :css-class="$style.primaryLinkButton"
5
+ :css-class-active="$style.isActive"
5
6
  :css-class-icon="$style.primaryLinkButtonIcon"
6
7
  :css-class-label="$style.primaryLinkButtonLabel"
7
8
  @click="$emit('click', $event)"
@@ -1,12 +1,13 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :class="clsx(
5
5
  !isDone && !isLoading && $style.isIdle,
6
6
  isDone && $style.isDone,
7
7
  isLoading && $style.isLoading
8
8
  )"
9
9
  :css-class="$style.publishButton"
10
+ :css-class-active="$style.isActive"
10
11
  :css-class-icon="$style.publishButtonIcon"
11
12
  :css-class-label="$style.publishButtonLabel"
12
13
  @click="$emit('click', $event)"
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconLeading, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :css-class="$style.secondaryButton"
5
+ :css-class-active="$style.isActive"
5
6
  :css-class-icon="$style.secondaryButtonIcon"
6
7
  :css-class-label="$style.secondaryButtonLabel"
7
8
  @click="$emit('click', $event)"
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <FluxButton
3
- :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
3
+ :="{type, disabled, iconLeading, iconTrailing, isActive, isFilled, isLoading, isSubmit, label, size, tabindex, href, rel, target, to}"
4
4
  :css-class="$style.secondaryLinkButton"
5
+ :css-class-active="$style.isActive"
5
6
  :css-class-icon="$style.secondaryLinkButtonIcon"
6
7
  :css-class-label="$style.secondaryLinkButtonLabel"
7
8
  @click="$emit('click', $event)"
@@ -1,6 +1,8 @@
1
1
  @mixin button-active($background) {
2
- &:active {
2
+ &:active,
3
+ &.isActive {
3
4
  background: $background;
5
+ box-shadow: none;
4
6
  scale: .9875;
5
7
  }
6
8
  }