tide-design-system 2.0.22 → 2.0.23
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/.eslintrc.cjs +90 -0
- package/.storybook/main.ts +60 -0
- package/.storybook/preview.ts +252 -0
- package/dist/css/grid-layout.css +7 -3
- package/dist/tide-design-system.js +45 -39
- package/index.ts +122 -0
- package/package.json +8 -12
- package/src/assets/css/animation.css +14 -0
- package/src/assets/css/dynamic-buttons.css +79 -0
- package/src/assets/css/dynamic-utilities.css +39 -0
- package/src/assets/css/grid-layout.css +71 -0
- package/src/assets/css/main.css +5 -0
- package/src/assets/css/realm/aero.css +42 -0
- package/src/assets/css/realm/atv.css +43 -0
- package/src/assets/css/realm/boatmart.css +42 -0
- package/src/assets/css/realm/cycle.css +42 -0
- package/src/assets/css/realm/equip.css +42 -0
- package/src/assets/css/realm/pwc.css +42 -0
- package/src/assets/css/realm/rv.css +50 -0
- package/src/assets/css/realm/snow.css +42 -0
- package/src/assets/css/realm/truck.css +42 -0
- package/src/assets/css/reset.css +79 -0
- package/src/assets/css/storybook.css +9 -0
- package/src/assets/css/utilities.css +1602 -0
- package/src/assets/css/variables.css +118 -0
- package/src/assets/svg/icons/IconAccountBalance.svg +5 -0
- package/src/assets/svg/icons/IconAdd.svg +3 -0
- package/src/assets/svg/icons/IconAiDescription.svg +7 -0
- package/src/assets/svg/icons/IconAlignSpace.svg +3 -0
- package/src/assets/svg/icons/IconApplePay.svg +5 -0
- package/src/assets/svg/icons/IconArrowBack.svg +3 -0
- package/src/assets/svg/icons/IconArrowForward.svg +3 -0
- package/src/assets/svg/icons/IconArrowRight.svg +3 -0
- package/src/assets/svg/icons/IconAssignment.svg +5 -0
- package/src/assets/svg/icons/IconAwardStar.svg +5 -0
- package/src/assets/svg/icons/IconBookmark.svg +5 -0
- package/src/assets/svg/icons/IconCalendarMonth.svg +5 -0
- package/src/assets/svg/icons/IconCall.svg +5 -0
- package/src/assets/svg/icons/IconCheck.svg +3 -0
- package/src/assets/svg/icons/IconChevronLeft.svg +3 -0
- package/src/assets/svg/icons/IconChevronRight.svg +3 -0
- package/src/assets/svg/icons/IconClear.svg +5 -0
- package/src/assets/svg/icons/IconClose.svg +3 -0
- package/src/assets/svg/icons/IconCycle.svg +5 -0
- package/src/assets/svg/icons/IconDelete.svg +5 -0
- package/src/assets/svg/icons/IconDiamond.svg +5 -0
- package/src/assets/svg/icons/IconDraft.svg +3 -0
- package/src/assets/svg/icons/IconEdit.svg +5 -0
- package/src/assets/svg/icons/IconError.svg +5 -0
- package/src/assets/svg/icons/IconExpandContent.svg +3 -0
- package/src/assets/svg/icons/IconExpandLess.svg +3 -0
- package/src/assets/svg/icons/IconExpandMore.svg +3 -0
- package/src/assets/svg/icons/IconFacebook.svg +5 -0
- package/src/assets/svg/icons/IconFavorite.svg +5 -0
- package/src/assets/svg/icons/IconFavoriteFilled.svg +5 -0
- package/src/assets/svg/icons/IconFormatBold.svg +5 -0
- package/src/assets/svg/icons/IconFormatItalic.svg +3 -0
- package/src/assets/svg/icons/IconFormatListBulleted.svg +5 -0
- package/src/assets/svg/icons/IconForum.svg +5 -0
- package/src/assets/svg/icons/IconGavel.svg +5 -0
- package/src/assets/svg/icons/IconGoogle.svg +18 -0
- package/src/assets/svg/icons/IconGooglePay.svg +5 -0
- package/src/assets/svg/icons/IconGrid.svg +3 -0
- package/src/assets/svg/icons/IconHeight.svg +3 -0
- package/src/assets/svg/icons/IconHelp.svg +5 -0
- package/src/assets/svg/icons/IconInfo.svg +5 -0
- package/src/assets/svg/icons/IconInsertText.svg +5 -0
- package/src/assets/svg/icons/IconInstagram.svg +5 -0
- package/src/assets/svg/icons/IconIosShare.svg +5 -0
- package/src/assets/svg/icons/IconLayout.svg +5 -0
- package/src/assets/svg/icons/IconLinkedIn.svg +5 -0
- package/src/assets/svg/icons/IconLocalShipping.svg +5 -0
- package/src/assets/svg/icons/IconLock.svg +5 -0
- package/src/assets/svg/icons/IconMail.svg +5 -0
- package/src/assets/svg/icons/IconMenu.svg +3 -0
- package/src/assets/svg/icons/IconMoreHoriz.svg +5 -0
- package/src/assets/svg/icons/IconNotifications.svg +5 -0
- package/src/assets/svg/icons/IconOpenInNew.svg +5 -0
- package/src/assets/svg/icons/IconPalette.svg +5 -0
- package/src/assets/svg/icons/IconPaypal.svg +5 -0
- package/src/assets/svg/icons/IconPerson.svg +5 -0
- package/src/assets/svg/icons/IconPhotoCamera.svg +5 -0
- package/src/assets/svg/icons/IconPinterest.svg +5 -0
- package/src/assets/svg/icons/IconPlayArrow.svg +3 -0
- package/src/assets/svg/icons/IconRemove.svg +3 -0
- package/src/assets/svg/icons/IconRoundedCorners.svg +5 -0
- package/src/assets/svg/icons/IconRuler.svg +3 -0
- package/src/assets/svg/icons/IconSearch.svg +5 -0
- package/src/assets/svg/icons/IconSeating.svg +3 -0
- package/src/assets/svg/icons/IconSell.svg +5 -0
- package/src/assets/svg/icons/IconShare.svg +5 -0
- package/src/assets/svg/icons/IconShoppingCart.svg +5 -0
- package/src/assets/svg/icons/IconSms.svg +5 -0
- package/src/assets/svg/icons/IconStar.svg +5 -0
- package/src/assets/svg/icons/IconSwapVert.svg +5 -0
- package/src/assets/svg/icons/IconThreeDRotation.svg +18 -0
- package/src/assets/svg/icons/IconTrophy.svg +5 -0
- package/src/assets/svg/icons/IconTune.svg +5 -0
- package/src/assets/svg/icons/IconTwitter.svg +5 -0
- package/src/assets/svg/icons/IconVideocam.svg +5 -0
- package/src/assets/svg/icons/IconViewInAr.svg +5 -0
- package/src/assets/svg/icons/IconVisibility.svg +5 -0
- package/src/assets/svg/icons/IconVolumeOff.svg +5 -0
- package/src/assets/svg/icons/IconVolumeOn.svg +5 -0
- package/src/assets/svg/icons/IconWarning.svg +5 -0
- package/src/assets/svg/icons/IconWeight.svg +3 -0
- package/src/assets/svg/icons/IconWidth.svg +3 -0
- package/src/assets/svg/icons/IconYoutube.svg +5 -0
- package/src/components/TideAccordionItem.vue +105 -0
- package/src/components/TideAlert.vue +124 -0
- package/src/components/TideBackgroundImage.vue +44 -0
- package/src/components/TideBadge.vue +30 -0
- package/src/components/TideBadgePremium.vue +31 -0
- package/src/components/TideBadgeTrustedPartner.vue +38 -0
- package/src/components/TideBreadCrumbs.vue +53 -0
- package/src/components/TideButton.vue +67 -0
- package/src/components/TideButtonIcon.vue +52 -0
- package/src/components/TideButtonPagination.vue +71 -0
- package/src/components/TideCard.vue +19 -0
- package/src/components/TideCarousel.vue +188 -0
- package/src/components/TideChipAction.vue +48 -0
- package/src/components/TideChipFilter.vue +55 -0
- package/src/components/TideChipInput.vue +44 -0
- package/src/components/TideColumns.vue +53 -0
- package/src/components/TideDivider.vue +24 -0
- package/src/components/TideIcon.vue +58 -0
- package/src/components/TideImage.vue +44 -0
- package/src/components/TideIndicator.vue +57 -0
- package/src/components/TideInputCheckbox.vue +145 -0
- package/src/components/TideInputRadio.vue +87 -0
- package/src/components/TideInputSelect.vue +204 -0
- package/src/components/TideInputText.vue +292 -0
- package/src/components/TideInputTextarea.vue +196 -0
- package/src/components/TideLink.vue +66 -0
- package/src/components/TideModal.vue +187 -0
- package/src/components/TidePagination.vue +67 -0
- package/src/components/TideSeoLinks.vue +58 -0
- package/src/components/TideTabs.vue +89 -0
- package/src/components/TideToggle.vue +95 -0
- package/src/docs/development.md +51 -0
- package/src/docs/integration.md +79 -0
- package/src/docs/storybook.md +39 -0
- package/src/stories/DemoCssUtilities.stories.ts +154 -0
- package/src/stories/DemoCssUtilitiesByTextInput.stories.ts +61 -0
- package/src/stories/FoundationsBorder.stories.ts +230 -0
- package/src/stories/FoundationsGap.stories.ts +180 -0
- package/src/stories/FoundationsMargin.stories.ts +155 -0
- package/src/stories/FoundationsPadding.stories.ts +108 -0
- package/src/stories/FoundationsShadow.stories.ts +84 -0
- package/src/stories/FoundationsTypography.stories.ts +172 -0
- package/src/stories/Template.stories.ts +71 -0
- package/src/stories/TideAccordionItem.stories.ts +68 -0
- package/src/stories/TideAlert.stories.ts +58 -0
- package/src/stories/TideBackgroundImage.stories.ts +53 -0
- package/src/stories/TideBadge.stories.ts +31 -0
- package/src/stories/TideBadgePremium.stories.ts +31 -0
- package/src/stories/TideBadgeTrustedPartner.stories.ts +33 -0
- package/src/stories/TideBreadCrumbs.stories.ts +43 -0
- package/src/stories/TideButton.stories.ts +118 -0
- package/src/stories/TideButtonIcon.stories.ts +103 -0
- package/src/stories/TideButtonPagination.stories.ts +99 -0
- package/src/stories/TideCard.stories.ts +38 -0
- package/src/stories/TideCarousel.stories.ts +130 -0
- package/src/stories/TideChipAction.stories.ts +46 -0
- package/src/stories/TideChipFilter.stories.ts +59 -0
- package/src/stories/TideChipInput.stories.ts +42 -0
- package/src/stories/TideColumns.stories.ts +90 -0
- package/src/stories/TideDivider.stories.ts +46 -0
- package/src/stories/TideIcon.stories.ts +29 -0
- package/src/stories/TideIndicator.stories.ts +31 -0
- package/src/stories/TideInputCheckbox.stories.ts +86 -0
- package/src/stories/TideInputRadio.stories.ts +71 -0
- package/src/stories/TideInputSelect.stories.ts +145 -0
- package/src/stories/TideInputText.stories.ts +181 -0
- package/src/stories/TideInputTextarea.stories.ts +116 -0
- package/src/stories/TideLink.stories.ts +137 -0
- package/src/stories/TideModal.stories.ts +122 -0
- package/src/stories/TidePagination.stories.ts +83 -0
- package/src/stories/TideSeoLinks.stories.ts +67 -0
- package/src/stories/TideTabs.stories.ts +100 -0
- package/src/stories/TideToggle.stories.ts +69 -0
- package/src/stories/Welcome.mdx +17 -0
- package/src/types/Alert.ts +8 -0
- package/src/types/Badge.ts +21 -0
- package/src/types/BreadCrumb.ts +5 -0
- package/src/types/Detail.ts +4 -0
- package/src/types/Element.ts +13 -0
- package/src/types/FacetRange.ts +84 -0
- package/src/types/Field.ts +54 -0
- package/src/types/Form.ts +58 -0
- package/src/types/Formatted.ts +22 -0
- package/src/types/Icon.ts +87 -0
- package/src/types/Link.ts +5 -0
- package/src/types/ListingMedia.ts +43 -0
- package/src/types/Orientation.ts +6 -0
- package/src/types/Priority.ts +11 -0
- package/src/types/Raw.ts +5 -0
- package/src/types/Realm.ts +13 -0
- package/src/types/RealmConfig.ts +14 -0
- package/src/types/Select.ts +10 -0
- package/src/types/Size.ts +6 -0
- package/src/types/Storybook.ts +219 -0
- package/src/types/Styles.ts +590 -0
- package/src/types/Tab.ts +5 -0
- package/src/types/Target.ts +6 -0
- package/src/types/TextInput.ts +16 -0
- package/src/types/Validation.ts +24 -0
- package/src/utilities/format.ts +184 -0
- package/src/utilities/storybook.ts +295 -0
- package/src/utilities/validation.ts +197 -0
- package/tests/utilities-format.spec.ts +430 -0
- package/tsconfig.app.json +14 -0
- package/tsconfig.config.json +12 -0
- package/tsconfig.json +22 -0
- package/tsconfig.vitest.json +10 -0
- package/vite.config.ts +43 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Element } from '@/types/Element';
|
|
3
|
+
import type { Icon } from '@/types/Icon';
|
|
4
|
+
import type { Priority } from '@/types/Priority';
|
|
5
|
+
|
|
6
|
+
import TideIcon from '@/components/TideIcon.vue';
|
|
7
|
+
import { CSS } from '@/types/Styles';
|
|
8
|
+
import { ELEMENT } from '@/types/Element';
|
|
9
|
+
import { PRIORITY } from '@/types/Priority';
|
|
10
|
+
import { SIZE } from '@/types/Size';
|
|
11
|
+
import { TARGET } from '@/types/Target';
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
element?: Element;
|
|
16
|
+
href?: string;
|
|
17
|
+
icon: Icon;
|
|
18
|
+
isNewTab?: boolean;
|
|
19
|
+
priority?: Priority;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
23
|
+
disabled: false,
|
|
24
|
+
element: ELEMENT.BUTTON,
|
|
25
|
+
href: undefined,
|
|
26
|
+
icon: undefined,
|
|
27
|
+
isNewTab: false,
|
|
28
|
+
priority: PRIORITY.PRIMARY,
|
|
29
|
+
});
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<component
|
|
34
|
+
:aria-label="props.icon"
|
|
35
|
+
:class="[
|
|
36
|
+
props.element === ELEMENT.LINK ? 'tide-link-as-button-icon' : 'tide-button-icon',
|
|
37
|
+
props.priority && `tide-button-${props.priority}`,
|
|
38
|
+
[CSS.DISPLAY.FLEX, CSS.AXIS1.CENTER, CSS.AXIS2.CENTER, CSS.BORDER.RADIUS.FULL, CSS.PADDING.FULL.HALF],
|
|
39
|
+
props.element === ELEMENT.LINK ? [CSS.UNDERLINE.OFF] : '',
|
|
40
|
+
]"
|
|
41
|
+
:disabled="props.element === ELEMENT.BUTTON && props.disabled"
|
|
42
|
+
:href="props.element === ELEMENT.LINK && props.href ? props.href : undefined"
|
|
43
|
+
:target="props.element === ELEMENT.LINK && props.isNewTab ? TARGET.BLANK : TARGET.SELF"
|
|
44
|
+
:is="props.element === ELEMENT.LINK ? 'a' : 'button'"
|
|
45
|
+
>
|
|
46
|
+
<TideIcon
|
|
47
|
+
:icon="props.icon"
|
|
48
|
+
:size="SIZE.LARGE"
|
|
49
|
+
v-if="props.icon"
|
|
50
|
+
/>
|
|
51
|
+
</component>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { ElementTextAsIcon } from '@/types/Element';
|
|
3
|
+
|
|
4
|
+
import { CSS } from '@/types/Styles';
|
|
5
|
+
import { ELEMENT_TEXT_AS_ICON } from '@/types/Element';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
element?: ElementTextAsIcon;
|
|
10
|
+
href?: string;
|
|
11
|
+
label: string | number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
disabled: false,
|
|
16
|
+
element: ELEMENT_TEXT_AS_ICON.BUTTON,
|
|
17
|
+
href: undefined,
|
|
18
|
+
label: undefined,
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<template>
|
|
23
|
+
<component
|
|
24
|
+
:class="[
|
|
25
|
+
props.element === ELEMENT_TEXT_AS_ICON.LINK ? 'tide-link-as-button-icon' : 'tide-button-icon',
|
|
26
|
+
[CSS.DISPLAY.INLINE_BLOCK, CSS.BORDER.RADIUS.FULL, CSS.PADDING.FULL.HALF],
|
|
27
|
+
props.element === ELEMENT_TEXT_AS_ICON.LINK ? [CSS.UNDERLINE.OFF] : '',
|
|
28
|
+
props.element === ELEMENT_TEXT_AS_ICON.DIV ? [CSS.CURSOR.POINTER] : '',
|
|
29
|
+
[CSS.FONT.WEIGHT.SEVEN_HUNDRED],
|
|
30
|
+
]"
|
|
31
|
+
:disabled="props.element === ELEMENT_TEXT_AS_ICON.BUTTON && props.disabled"
|
|
32
|
+
:href="props.element === ELEMENT_TEXT_AS_ICON.LINK && props.href ? props.href : undefined"
|
|
33
|
+
:is="
|
|
34
|
+
props.element === ELEMENT_TEXT_AS_ICON.LINK
|
|
35
|
+
? 'a'
|
|
36
|
+
: props.element === ELEMENT_TEXT_AS_ICON.BUTTON
|
|
37
|
+
? 'button'
|
|
38
|
+
: 'div'
|
|
39
|
+
"
|
|
40
|
+
>
|
|
41
|
+
<span :class="['label', CSS.DISPLAY.FLEX, CSS.AXIS1.CENTER, CSS.AXIS2.CENTER]">
|
|
42
|
+
{{ props.label }}
|
|
43
|
+
</span>
|
|
44
|
+
</component>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
.tide-button-icon,
|
|
49
|
+
.tide-link-as-button-icon {
|
|
50
|
+
border: 1px solid var(--tide-white);
|
|
51
|
+
background: var(--tide-white);
|
|
52
|
+
color: var(--tide-secondary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.tide-button-icon:not(:disabled):hover,
|
|
56
|
+
.tide-link-as-button-icon:not(:disabled):hover {
|
|
57
|
+
border: 1px solid var(--tide-surface-variant);
|
|
58
|
+
background: var(--tide-surface-variant);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.tide-button-icon:disabled,
|
|
62
|
+
.tide-link-as-button-icon:disabled {
|
|
63
|
+
border: 1px solid var(--tide-border-high);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.tide-button-icon .label,
|
|
67
|
+
.tide-link-as-button-icon .label {
|
|
68
|
+
width: 1.5rem;
|
|
69
|
+
height: 1.5rem;
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { CSS } from '@/types/Styles';
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<div
|
|
7
|
+
:class="[
|
|
8
|
+
'tide-card',
|
|
9
|
+
CSS.HEIGHT.FULL,
|
|
10
|
+
CSS.BORDER.RADIUS.HALF,
|
|
11
|
+
CSS.BG.SURFACE.DEFAULT,
|
|
12
|
+
CSS.SHADOW.BOTTOM,
|
|
13
|
+
CSS.FONT.COLOR.SURFACE.DEFAULT,
|
|
14
|
+
CSS.SNAP_ALIGN.START,
|
|
15
|
+
]"
|
|
16
|
+
>
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { onMounted, onUnmounted, onUpdated, ref, watch } from 'vue';
|
|
3
|
+
|
|
4
|
+
import TideButtonIcon from '@/components/TideButtonIcon.vue';
|
|
5
|
+
import { CSS } from '@/types/Styles';
|
|
6
|
+
import { ICON } from '@/types/Icon';
|
|
7
|
+
import { PRIORITY } from '@/types/Priority';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
isTouchscreen?: boolean;
|
|
11
|
+
offsetX?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
offsetX: 0,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits(['change']);
|
|
19
|
+
|
|
20
|
+
let contentWidth = ref();
|
|
21
|
+
let frameWidth = ref();
|
|
22
|
+
let hasOverflow = ref();
|
|
23
|
+
let lastPosition = ref();
|
|
24
|
+
|
|
25
|
+
const contentRef = ref();
|
|
26
|
+
const frameRef = ref();
|
|
27
|
+
const showButtons = ref();
|
|
28
|
+
const currentSlide = ref(0);
|
|
29
|
+
|
|
30
|
+
const gap = 16;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Measure the current slide based on the scroll
|
|
34
|
+
* position of the frame. The current slide is
|
|
35
|
+
* the slide that is closest to the left edge of
|
|
36
|
+
* the frame.
|
|
37
|
+
*/
|
|
38
|
+
const measureCurrentSlide = () => {
|
|
39
|
+
// get left offsets of each slide
|
|
40
|
+
const slideOffsets = Array.from(contentRef.value.children).map((slide: any) => slide.offsetLeft);
|
|
41
|
+
|
|
42
|
+
if (slideOffsets.length === 0) return;
|
|
43
|
+
|
|
44
|
+
// get value closest to current scroll position
|
|
45
|
+
const closestSlideOffset = slideOffsets.reduce((prev, curr) => {
|
|
46
|
+
return Math.abs(curr - frameRef.value.scrollLeft) < Math.abs(prev - frameRef.value.scrollLeft) ? curr : prev;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// set current slide to index of closest slide
|
|
50
|
+
currentSlide.value = slideOffsets.indexOf(closestSlideOffset);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const measureDom = () => {
|
|
54
|
+
contentWidth.value = contentRef.value.scrollWidth;
|
|
55
|
+
frameWidth.value = frameRef.value.clientWidth;
|
|
56
|
+
hasOverflow.value = contentWidth.value > frameWidth.value;
|
|
57
|
+
lastPosition.value = frameRef.value.scrollWidth - frameRef.value.clientWidth;
|
|
58
|
+
showButtons.value = hasOverflow.value && !props.isTouchscreen;
|
|
59
|
+
|
|
60
|
+
measureCurrentSlide();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// TODO: debounce this
|
|
64
|
+
const handleScroll = () => {
|
|
65
|
+
measureDom();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Scrolls to the slide at the given index, or
|
|
70
|
+
* to the first or last slide if the given index
|
|
71
|
+
* is out of bounds.
|
|
72
|
+
* @param slideIndex The index of the slide to scroll to
|
|
73
|
+
*/
|
|
74
|
+
const scrollToSlide = (slideIndex: number) => {
|
|
75
|
+
frameRef.value.scrollTo({
|
|
76
|
+
behavior: 'smooth',
|
|
77
|
+
left: contentRef.value.children[slideIndex].offsetLeft,
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const showNextSlide = () => {
|
|
82
|
+
const contentWidth = contentRef.value.scrollWidth;
|
|
83
|
+
const contentRightEdge = frameRef.value.scrollLeft + frameRef.value.clientWidth;
|
|
84
|
+
|
|
85
|
+
if (contentRightEdge > contentWidth) {
|
|
86
|
+
frameRef.value.scrollTo({
|
|
87
|
+
behavior: 'smooth',
|
|
88
|
+
left: contentWidth,
|
|
89
|
+
});
|
|
90
|
+
} else {
|
|
91
|
+
const isFirstSlideWithOffset = props.offsetX && currentSlide.value === 0;
|
|
92
|
+
const isLastSlide = contentRightEdge === contentWidth;
|
|
93
|
+
const nextSlide = isLastSlide ? 0 : isFirstSlideWithOffset ? 2 : currentSlide.value + 1;
|
|
94
|
+
|
|
95
|
+
scrollToSlide(nextSlide);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const showPreviousSlide = () => {
|
|
100
|
+
const firstSlide = props.offsetX ? 1 : 0;
|
|
101
|
+
const isFirstSlide = currentSlide.value - 1 === firstSlide;
|
|
102
|
+
const isSecondSlide = currentSlide.value <= firstSlide;
|
|
103
|
+
const previousSlide = isSecondSlide
|
|
104
|
+
? contentRef.value.children.length - 1
|
|
105
|
+
: isFirstSlide
|
|
106
|
+
? 0
|
|
107
|
+
: currentSlide.value - 1;
|
|
108
|
+
|
|
109
|
+
scrollToSlide(previousSlide);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
window.addEventListener('resize', measureDom);
|
|
113
|
+
|
|
114
|
+
onMounted(() => {
|
|
115
|
+
measureDom();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
onUnmounted(() => {
|
|
119
|
+
window.removeEventListener('resize', measureDom);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
onUpdated(() => {
|
|
123
|
+
measureDom();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
watch(currentSlide, () => {
|
|
127
|
+
emit('change', currentSlide.value);
|
|
128
|
+
});
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<template>
|
|
132
|
+
<section
|
|
133
|
+
:class="['tide-carousel', CSS.POSITION.RELATIVE, CSS.DISPLAY.FLEX, CSS.AXIS2.CENTER, CSS.WIDTH.FULL]"
|
|
134
|
+
ref="carouselRef"
|
|
135
|
+
>
|
|
136
|
+
<div
|
|
137
|
+
:class="[CSS.SCROLLBAR.OFF, CSS.SNAP.ON, CSS.OVERFLOW.X.SCROLL]"
|
|
138
|
+
ref="frameRef"
|
|
139
|
+
@scroll="handleScroll"
|
|
140
|
+
>
|
|
141
|
+
<ul
|
|
142
|
+
:class="[props.isTouchscreen ? [CSS.OVERFLOW.X.AUTO] : '', CSS.DISPLAY.FLEX, CSS.GAP.ONE, CSS.LIST_BULLETS.OFF]"
|
|
143
|
+
ref="contentRef"
|
|
144
|
+
>
|
|
145
|
+
<li
|
|
146
|
+
:class="[CSS.FLEX.SHRINK.OFF, CSS.SNAP_ALIGN.START]"
|
|
147
|
+
:style="{ width: `${props.offsetX - gap}px` }"
|
|
148
|
+
v-if="props.offsetX"
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<slot />
|
|
152
|
+
|
|
153
|
+
<li
|
|
154
|
+
:class="[CSS.FLEX.SHRINK.OFF, CSS.SNAP_ALIGN.START]"
|
|
155
|
+
:style="{ width: `${props.offsetX - gap}px` }"
|
|
156
|
+
v-if="props.offsetX"
|
|
157
|
+
/>
|
|
158
|
+
</ul>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div
|
|
162
|
+
:class="[
|
|
163
|
+
CSS.POSITION.ABSOLUTE,
|
|
164
|
+
CSS.DISPLAY.FLEX,
|
|
165
|
+
CSS.AXIS1.BETWEEN,
|
|
166
|
+
CSS.AXIS2.CENTER,
|
|
167
|
+
CSS.WIDTH.FULL,
|
|
168
|
+
CSS.HEIGHT.FULL,
|
|
169
|
+
CSS.POINTER_EVENTS.OFF,
|
|
170
|
+
]"
|
|
171
|
+
v-if="showButtons"
|
|
172
|
+
>
|
|
173
|
+
<TideButtonIcon
|
|
174
|
+
:class="[CSS.MARGIN.LEFT.ONE, CSS.POINTER_EVENTS.ON]"
|
|
175
|
+
:icon="ICON.CHEVRON_LEFT"
|
|
176
|
+
:priority="PRIORITY.QUATERNARY"
|
|
177
|
+
@click="showPreviousSlide"
|
|
178
|
+
/>
|
|
179
|
+
|
|
180
|
+
<TideButtonIcon
|
|
181
|
+
:class="[CSS.MARGIN.RIGHT.ONE, CSS.POINTER_EVENTS.ON]"
|
|
182
|
+
:icon="ICON.CHEVRON_RIGHT"
|
|
183
|
+
:priority="PRIORITY.QUATERNARY"
|
|
184
|
+
@click="showNextSlide"
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
</section>
|
|
188
|
+
</template>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import TideIcon from '@/components/TideIcon.vue';
|
|
3
|
+
import { CSS } from '@/types/Styles';
|
|
4
|
+
import { ICON } from '@/types/Icon';
|
|
5
|
+
import { TARGET } from '@/types/Target';
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
href: string;
|
|
9
|
+
isNewTab?: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
14
|
+
isNewTab: false,
|
|
15
|
+
});
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<a
|
|
20
|
+
:class="[
|
|
21
|
+
'tide-chip-action',
|
|
22
|
+
CSS.AXIS2.CENTER,
|
|
23
|
+
CSS.GAP.HALF,
|
|
24
|
+
CSS.BORDER.FULL.ONE,
|
|
25
|
+
CSS.BORDER.RADIUS.FULL,
|
|
26
|
+
CSS.PADDING.X.ONE,
|
|
27
|
+
CSS.PADDING.Y.HALF,
|
|
28
|
+
CSS.BG.SURFACE.DEFAULT,
|
|
29
|
+
CSS.FONT.SIZE.FOURTEEN,
|
|
30
|
+
CSS.FONT.WEIGHT.FIVE_HUNDRED,
|
|
31
|
+
CSS.FONT.COLOR.SURFACE.DEFAULT,
|
|
32
|
+
CSS.UNDERLINE.OFF,
|
|
33
|
+
]"
|
|
34
|
+
:href="props.href"
|
|
35
|
+
:target="props.isNewTab ? TARGET.BLANK : TARGET.SELF"
|
|
36
|
+
>
|
|
37
|
+
<TideIcon :icon="ICON.SEARCH" />
|
|
38
|
+
|
|
39
|
+
<span>{{ props.label }}</span>
|
|
40
|
+
</a>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<style scoped>
|
|
44
|
+
.tide-chip-action:hover {
|
|
45
|
+
background-color: var(--tide-surface-variant);
|
|
46
|
+
border-color: var(--tide-border-high);
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { CSS } from '@/types/Styles';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
label: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<button
|
|
14
|
+
:class="[
|
|
15
|
+
'tide-chip-filter',
|
|
16
|
+
props.isActive
|
|
17
|
+
? [CSS.BG.SECONDARY, CSS.FONT.COLOR.SECONDARY]
|
|
18
|
+
: [CSS.BG.SURFACE.VARIANT, CSS.FONT.COLOR.SURFACE.DEFAULT],
|
|
19
|
+
CSS.DISPLAY.FLEX,
|
|
20
|
+
CSS.AXIS2.CENTER,
|
|
21
|
+
CSS.GAP.HALF,
|
|
22
|
+
CSS.BORDER.FULL.ONE,
|
|
23
|
+
CSS.BORDER.RADIUS.FULL,
|
|
24
|
+
CSS.PADDING.X.ONE,
|
|
25
|
+
CSS.PADDING.Y.HALF,
|
|
26
|
+
CSS.FONT.SIZE.FOURTEEN,
|
|
27
|
+
CSS.FONT.WEIGHT.FIVE_HUNDRED,
|
|
28
|
+
props.isActive ? 'active' : '',
|
|
29
|
+
]"
|
|
30
|
+
>
|
|
31
|
+
<slot />
|
|
32
|
+
<div :class="[CSS.DISPLAY.FLEX, CSS.AXIS1.CENTER, CSS.AXIS2.CENTER, CSS.GAP.HALF]">
|
|
33
|
+
<span :class="[props.isActive ? '' : 'icon-spacing', CSS.FONT.WEIGHT.FIVE_HUNDRED, CSS.WHITESPACE_WRAP.OFF]">
|
|
34
|
+
{{ props.label }}
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
</button>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<style scoped>
|
|
41
|
+
/* Border must always exist to prevent resize on hover state, but match background color on rest state to blend in. */
|
|
42
|
+
.tide-chip-filter {
|
|
43
|
+
border-color: var(--tide-surface-variant);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.tide-chip-filter.active {
|
|
47
|
+
border-color: var(--tide-secondary);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.tide-chip-filter:hover {
|
|
51
|
+
background-color: var(--tide-surface-variant);
|
|
52
|
+
border-color: var(--tide-border);
|
|
53
|
+
color: var(--tide-on-surface);
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import TideIcon from '@/components/TideIcon.vue';
|
|
3
|
+
import { CSS } from '@/types/Styles';
|
|
4
|
+
import { ICON } from '@/types/Icon';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const props = defineProps<Props>();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<button
|
|
15
|
+
:class="[
|
|
16
|
+
'tide-chip-input',
|
|
17
|
+
CSS.BG.SURFACE.VARIANT,
|
|
18
|
+
CSS.FONT.COLOR.SURFACE,
|
|
19
|
+
CSS.DISPLAY.FLEX,
|
|
20
|
+
CSS.AXIS2.CENTER,
|
|
21
|
+
CSS.GAP.HALF,
|
|
22
|
+
CSS.BORDER.FULL.ONE,
|
|
23
|
+
CSS.BORDER.RADIUS.FULL,
|
|
24
|
+
CSS.PADDING.X.ONE,
|
|
25
|
+
CSS.PADDING.Y.HALF,
|
|
26
|
+
CSS.FONT.SIZE.FOURTEEN,
|
|
27
|
+
CSS.FONT.WEIGHT.FIVE_HUNDRED,
|
|
28
|
+
]"
|
|
29
|
+
>
|
|
30
|
+
<span>{{ props.label }}</span>
|
|
31
|
+
|
|
32
|
+
<TideIcon :icon="ICON.CLOSE" />
|
|
33
|
+
</button>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<style scoped>
|
|
37
|
+
.tide-chip-input {
|
|
38
|
+
border-color: var(--tide-border);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.tide-chip-input:hover {
|
|
42
|
+
border-color: var(--tide-border-high);
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { CSS } from '@/types/Styles';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
heading?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
9
|
+
heading: '',
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<section class="tide-columns">
|
|
15
|
+
<h2 :class="[CSS.MARGIN.BOTTOM.HALF, CSS.FONT.SIZE.SIXTEEN]">{{ props.heading }}</h2>
|
|
16
|
+
|
|
17
|
+
<ul :class="[CSS.DISPLAY.FLEX, CSS.FLEX.WRAP, CSS.GAP.TWO, CSS.LIST_BULLETS.OFF]">
|
|
18
|
+
<li class="tide-columns-column">
|
|
19
|
+
<slot name="section1" />
|
|
20
|
+
</li>
|
|
21
|
+
|
|
22
|
+
<li class="tide-columns-column">
|
|
23
|
+
<slot name="section2" />
|
|
24
|
+
</li>
|
|
25
|
+
|
|
26
|
+
<li class="tide-columns-column">
|
|
27
|
+
<slot name="section3" />
|
|
28
|
+
</li>
|
|
29
|
+
|
|
30
|
+
<li class="tide-columns-column">
|
|
31
|
+
<slot name="section4" />
|
|
32
|
+
</li>
|
|
33
|
+
</ul>
|
|
34
|
+
</section>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<style scoped>
|
|
38
|
+
.tide-columns-column {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (min-width: 992px) {
|
|
43
|
+
.tide-columns-column {
|
|
44
|
+
width: calc((100% - 2rem) / 2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (min-width: 1232px) {
|
|
49
|
+
.tide-columns-column {
|
|
50
|
+
width: calc((100% - 6rem) / 4);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { Orientation } from '@/types/Orientation';
|
|
3
|
+
import { CSS } from '@/types/Styles';
|
|
4
|
+
import { ORIENTATION } from '@/types/Orientation';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
orientation?: Orientation;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
11
|
+
orientation: ORIENTATION.HORIZONTAL,
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div
|
|
17
|
+
:class="[
|
|
18
|
+
CSS.BORDER.COLOR.LOW,
|
|
19
|
+
props.orientation === ORIENTATION.HORIZONTAL
|
|
20
|
+
? [CSS.MARGIN.Y.HALF, CSS.BORDER.BOTTOM.ONE]
|
|
21
|
+
: [CSS.MARGIN.X.HALF, CSS.BORDER.RIGHT.ONE],
|
|
22
|
+
]"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { defineAsyncComponent, markRaw, ref, watch } from 'vue';
|
|
3
|
+
|
|
4
|
+
import type { Component } from 'vue';
|
|
5
|
+
import type { Icon } from '@/types/Icon';
|
|
6
|
+
import type { Size } from '@/types/Size';
|
|
7
|
+
|
|
8
|
+
import { CSS } from '@/types/Styles';
|
|
9
|
+
import { SIZE } from '@/types/Size';
|
|
10
|
+
import { formatPascalCase } from '@/utilities/format';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
icon: Icon;
|
|
14
|
+
size?: Size;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
18
|
+
size: SIZE.SMALL,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const innerSVG = ref<Component>();
|
|
22
|
+
|
|
23
|
+
watch(
|
|
24
|
+
() => props.icon,
|
|
25
|
+
() => {
|
|
26
|
+
const id = props.icon as unknown as string;
|
|
27
|
+
const name = formatPascalCase(id);
|
|
28
|
+
const component = defineAsyncComponent(() => import(`../assets/svg/icons/Icon${name}.svg`));
|
|
29
|
+
|
|
30
|
+
innerSVG.value = markRaw(component);
|
|
31
|
+
},
|
|
32
|
+
{ immediate: true }
|
|
33
|
+
);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<div :class="['tide-icon', props.size]">
|
|
38
|
+
<Component
|
|
39
|
+
:class="[CSS.DISPLAY.BLOCK]"
|
|
40
|
+
:data-icon="icon"
|
|
41
|
+
fill="currentColor"
|
|
42
|
+
:is="innerSVG"
|
|
43
|
+
v-if="innerSVG"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.tide-icon svg {
|
|
50
|
+
width: 1.5rem;
|
|
51
|
+
height: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tide-icon.small svg {
|
|
55
|
+
width: 1.25rem;
|
|
56
|
+
height: 1.25rem;
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
import { CSS } from '@/types/Styles';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
alt?: string;
|
|
8
|
+
cdn?: string;
|
|
9
|
+
isLazy?: boolean;
|
|
10
|
+
offset?: number;
|
|
11
|
+
src?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
15
|
+
alt: '',
|
|
16
|
+
cdn: undefined,
|
|
17
|
+
isLazy: true,
|
|
18
|
+
offset: 0,
|
|
19
|
+
src: undefined,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const tideImage = ref();
|
|
23
|
+
|
|
24
|
+
const imageDefault = `${props.cdn}/image-coming-soon-512.png`;
|
|
25
|
+
|
|
26
|
+
const setImageFromDefault = () => {
|
|
27
|
+
tideImage.value.src = imageDefault;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
defineExpose(tideImage.value);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<img
|
|
35
|
+
:alt="alt"
|
|
36
|
+
:class="['tide-image', CSS.OBJECT.CENTER, CSS.OBJECT.COVER]"
|
|
37
|
+
:loading="isLazy ? 'lazy' : 'eager'"
|
|
38
|
+
ref="tideImage"
|
|
39
|
+
:src="src ?? imageDefault"
|
|
40
|
+
@error="setImageFromDefault"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<style scoped></style>
|