Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f8c05ad
setup localization
juliodialpad Apr 2, 2025
f30042c
update i18n version
juliodialpad Apr 3, 2025
87c99b9
translate to dialpadistan
juliodialpad Apr 3, 2025
65eed8e
test on attachment_carousel
juliodialpad Apr 3, 2025
c419f05
temporarily remove with type json
juliodialpad Apr 3, 2025
2a7b3c9
remove from attachment_carousel
juliodialpad Apr 7, 2025
81f283c
add more strings
juliodialpad Apr 7, 2025
8b301f6
translate to dialpadistan
juliodialpad Apr 7, 2025
33b1430
manually translate to spanish to test
juliodialpad Apr 7, 2025
fe0ccea
add spanish to allowed locales
juliodialpad Apr 7, 2025
e001527
test on popover
juliodialpad Apr 7, 2025
b222e3a
add with type json back
juliodialpad Apr 7, 2025
0ae6508
Merge branch 'staging' into dlt-2452-setup-i18n
juliodialpad Apr 7, 2025
e986b4b
remove unneeded changes
juliodialpad Apr 7, 2025
cc5a7c4
add github @dialpad:registry config
juliodialpad Apr 7, 2025
bbfcc5d
add packages read permission
juliodialpad Apr 7, 2025
b16a230
fix deploy-preview
juliodialpad Apr 7, 2025
249ac9a
try moving read packages to the right place
juliodialpad Apr 7, 2025
15fb32f
update package version
juliodialpad Apr 7, 2025
52d0404
update package versions
juliodialpad Apr 7, 2025
78a5798
remove unneeded ts configs
juliodialpad Apr 7, 2025
7a85e8f
remove packages read
juliodialpad Apr 7, 2025
d1e7d28
update actions
juliodialpad Apr 7, 2025
5b8ad0d
add closeButtonProps back
juliodialpad Apr 9, 2025
d3c0ee0
merge close button props and localized aria-label and title
juliodialpad Apr 9, 2025
edb86b5
Merge branch 'staging' into i18n/refactor-components
juliodialpad Apr 16, 2025
ade1ab3
update pnpm-lock
juliodialpad Apr 16, 2025
93f5113
Merge branch 'refs/heads/staging' into i18n/refactor-components
juliodialpad Apr 17, 2025
e3234f1
remove close button mixin and add localization mixin
juliodialpad Apr 17, 2025
ffa5908
migrate notice
juliodialpad Apr 17, 2025
891b0ed
migrate banner
juliodialpad Apr 17, 2025
1eb615c
migrate breadcrumbs.vue
juliodialpad Apr 17, 2025
d8ff42e
migrate button
juliodialpad Apr 17, 2025
6ae68cd
migrate chip
juliodialpad Apr 17, 2025
b297e32
migrate combobox
juliodialpad Apr 17, 2025
db0271d
update localization
juliodialpad Apr 17, 2025
0e30726
add localization to tests
juliodialpad Apr 17, 2025
020765f
update versions
juliodialpad Apr 17, 2025
c97d7d2
migrate datepicker
juliodialpad Apr 21, 2025
e6c2565
Merge branch 'i18n/base-branch' into i18n/refactor-components
juliodialpad Apr 21, 2025
61c5300
rollback undesired changes
juliodialpad Apr 21, 2025
2aa52b2
fix label sizes
juliodialpad Apr 21, 2025
ba32e5c
fix notice tests
juliodialpad Apr 21, 2025
66b8da3
fix notice_action tests
juliodialpad Apr 21, 2025
fc12c46
fix chip tests
juliodialpad Apr 21, 2025
4402639
Merge branch 'i18n/base-branch' into i18n/refactor-components
juliodialpad Apr 21, 2025
46f3362
fix checkbox tests
juliodialpad Apr 21, 2025
dd0f603
remove index
juliodialpad Apr 21, 2025
83abf43
fix tests
juliodialpad Apr 21, 2025
ada790b
fix tests
juliodialpad Apr 21, 2025
b389270
Merge branch 'i18n/base-branch' into i18n/refactor-components
juliodialpad Apr 23, 2025
a844646
prefix fluent strings
juliodialpad Apr 28, 2025
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
4 changes: 4 additions & 0 deletions packages/dialtone-vue2/common/mixins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ export {
export {
default as DtSrOnlyCloseButtonMixin,
} from './sr_only_close_button';

export {
default as DtLocalizationMixin,
} from './localization';
14 changes: 14 additions & 0 deletions packages/dialtone-vue2/common/mixins/localization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useI18N } from '@dialpad/i18n-vue2';
const { $t, $ta, currentLocale, setI18N } = useI18N();

export default {
methods: {
$t,
$ta,
setI18N,
},
//
computed: {
currentLocale: () => currentLocale,
},
};
95 changes: 87 additions & 8 deletions packages/dialtone-vue2/components/banner/banner.stories.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,66 @@
import { action } from '@storybook/addon-actions';
import DtBanner from './banner.vue';
import { createRenderConfig } from '@/common/storybook_utils';

import { NOTICE_KINDS } from '@/components/notice/index.js';
import BannerDefault from './banner_default.story.vue';
import { argsData as noticeArgsData, argTypesData as noticeArgTypesData } from '../notice/notice.stories.js';

import backgroundImage from '@/common/assets/dialpad-gradient.png';
import { createRenderConfig, getIconNames } from '@/common/storybook_utils';

const iconsList = getIconNames();

export const argsData = {
...noticeArgsData,
onClose: action('close'),
onClick: action('click'),
show: undefined,
backgroundImage: null,
visuallyHiddenCloseLabel: 'Close Banner',
};

export const argTypesData = {
...noticeArgTypesData,
role: {
// Slots
titleOverride: {
table: {
type: { summary: 'VNode' },
},
control: {
type: 'text',
},
},
icon: {
options: iconsList,
table: {
type: { summary: 'component' },
},
control: {
type: 'select',
labels: {
undefined: '(empty)',
},
},
},
default: {
table: {
type: { summary: 'VNode' },
},
control: {
type: 'text',
},
},
action: {
table: {
type: { summary: 'VNode' },
},
control: {
type: 'text',
},
},

// Props
kind: {
options: NOTICE_KINDS,
control: {
type: 'select',
},
},
show: {
table: {
disable: true,
},
Expand All @@ -33,6 +79,11 @@ export const argTypesData = {
},
},
},
hideClose: {
control: {
type: 'boolean',
},
},
hideIcon: {
control: {
type: 'boolean',
Expand All @@ -43,6 +94,34 @@ export const argTypesData = {
type: 'boolean',
},
},
important: {
control: {
type: 'boolean',
},
},
pinned: {
control: {
type: 'boolean',
},
},

// Action Event Handlers
onClick: {
table: {
disable: true,
},
},
onClose: {
table: {
disable: true,
},
},
close: {
description: 'Close button click event',
table: {
type: { summary: 'event' },
},
},
};

export default {
Expand Down
9 changes: 0 additions & 9 deletions packages/dialtone-vue2/components/banner/banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<dt-notice-action
:hide-action="hideAction"
:hide-close="hideClose"
:close-button-props="closeButtonProps"
:visually-hidden-close="visuallyHiddenClose"
:visually-hidden-close-label="visuallyHiddenCloseLabel"
v-on="$listeners"
Expand Down Expand Up @@ -130,14 +129,6 @@ export default {
},
},

/**
* Props for the notice close button.
*/
closeButtonProps: {
type: Object,
default: () => ({}),
},

/**
* Hides the close button from the notice
* @values true, false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export default {
return {
...this.$attrs.closeButtonProps,
kind: this.buttonKind,
ariaLabel: 'Close',
};
},
},
Expand Down
7 changes: 5 additions & 2 deletions packages/dialtone-vue2/components/breadcrumbs/breadcrumbs.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<nav
:aria-label="ariaLabel"
:aria-label="ariaLabel || $t('DIALTONE_BREADCRUMBS_ARIA_LABEL')"
data-qa="dt-breadcrumbs"
:class="[
'd-breadcrumbs',
Expand All @@ -26,6 +26,7 @@
import { BREADCRUMBS_INVERTED_MODIFIER } from './breadcrumbs_constants';
import DtBreadcrumbItem from './breadcrumb_item.vue';
import utils from '@/common/utils';
import { DtLocalizationMixin } from '@/common/mixins';

/**
* Breadcrumbs are links used to provide context for the currently-viewed page
Expand All @@ -39,6 +40,8 @@ export default {
DtBreadcrumbItem,
},

mixins: [DtLocalizationMixin],

props: {
/**
* A provided list of breadcrumbs. Overridden by default slot
Expand Down Expand Up @@ -67,7 +70,7 @@ export default {
*/
ariaLabel: {
type: String,
default: 'breadcrumb',
default: '',
},
},

Expand Down
6 changes: 5 additions & 1 deletion packages/dialtone-vue2/components/button/button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:disabled="disabled"
:style="{ width: width }"
:aria-live="computedAriaLive"
:aria-label="loading ? 'loading' : $attrs['aria-label']"
:aria-label="loading ? $t('DIALTONE_BUTTON_LOADING') : $attrs['aria-label']"
v-on="buttonListeners"
>
<!-- NOTE(cormac): This span is needed since we can't apply styles to slots. -->
Expand Down Expand Up @@ -54,6 +54,8 @@ import {

import { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';

import { DtLocalizationMixin } from '@/common/mixins';

/**
* A button is a UI element which allows users to take an action throughout the app.
* It is important a button is identifiable, consistent, and communicates its actions clearly,
Expand All @@ -63,6 +65,8 @@ import { LINK_KIND_MODIFIERS, getLinkKindModifier } from '@/components/link';
export default {
name: 'DtButton',

mixins: [DtLocalizationMixin],

props: {
/**
* Whether the button is a circle or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ describe('DtCheckbox Tests', () => {

await input.trigger('click');

expect(wrapper.emitted()).toEqual({});
expect(wrapper.emitted('input')).toBeFalsy();
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ describe('Checkbox Group Tests', () => {

MOCK_SELECTED_CHECKBOX_FUNCTION(MOCK_SELECTED_VALUE);

expect(wrapper.emitted()).toEqual({});
expect(wrapper.emitted('input')).toBeFalsy();
});
});
});
Expand Down
1 change: 0 additions & 1 deletion packages/dialtone-vue2/components/chip/chip.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const argsData = {
onClose: action('close'),
onClick: action('click'),
size: 'md',
closeButtonProps: { ariaLabel: 'close' },
avatarSeed: '',
};

Expand Down
11 changes: 5 additions & 6 deletions packages/dialtone-vue2/components/chip/chip.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { createLocalVue, mount } from '@vue/test-utils';
import EmptyComponentFixture from '@/tests/fixtures/component.vue';
import { DtChip } from '@/components/chip';
import { useI18N } from '@dialpad/i18n-vue2';
const { $ta } = useI18N();

const MOCK_DEFAULT_TEXT = 'TEXT';
const MOCK_LOCALIZED_CLOSE_BUTTON_ATTRIBUTES = $ta('DIALTONE_CLOSE_BUTTON');

const baseProps = {
closeButtonProps: {
ariaLabel: 'close',
},
};
const baseProps = {};
const baseSlots = {};

let mockProps = {};
Expand Down Expand Up @@ -94,7 +93,7 @@ describe('DtChip Tests', () => {
});

it('button should have aria-label', () => {
expect(remove.attributes('aria-label')).toBe('close');
expect(remove.attributes('aria-label')).toBe(MOCK_LOCALIZED_CLOSE_BUTTON_ATTRIBUTES['aria-label']);
});
});

Expand Down
27 changes: 9 additions & 18 deletions packages/dialtone-vue2/components/chip/chip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
<component
:is="interactive ? 'button' : 'span'"
:id="id"
:type="interactive && 'button'"
:aria-label="ariaLabel"
:aria-labelledby="ariaLabel ? undefined : `${id}-content`"
:class="chipClasses()"
:type="interactive && 'button'"
data-qa="dt-chip"
:aria-labelledby="ariaLabel ? undefined : `${id}-content`"
:aria-label="ariaLabel"
v-on="chipListeners"
>
<span
v-if="$slots.icon"
data-qa="dt-chip-icon"
class="d-chip__icon"
data-qa="dt-chip-icon"
>
<!-- @slot slot for Chip icon -->
<slot name="icon" />
Expand All @@ -28,19 +28,18 @@
<span
v-if="$slots.default"
:id="`${id}-content`"
data-qa="dt-chip-label"
:class="['d-chip__text', contentClass]"
data-qa="dt-chip-label"
>
<!-- @slot slot for Content within chip -->
<slot />
</span>
</component>
<dt-button
v-if="!hideClose"
v-bind="closeButtonProps"
:class="chipCloseButtonClasses()"
data-qa="dt-chip-close"
:aria-label="closeButtonProps.ariaLabel"
v-bind="$ta('DIALTONE_CLOSE_BUTTON')"
@click="$emit('close')"
>
<template #icon>
Expand All @@ -61,6 +60,7 @@ import {
CHIP_ICON_SIZES,
} from './chip_constants';
import { getUniqueString } from '@/common/utils';
import { DtLocalizationMixin } from '@/common/mixins';

/**
* A chip is a compact UI element that provides brief, descriptive information about an element.
Expand All @@ -76,18 +76,9 @@ export default {
DtIconClose,
},

props: {
/**
* A set of props to be passed into the modal's close button. Requires an 'ariaLabel' property.
*/
closeButtonProps: {
type: Object,
default: function () { return { ariaLabel: 'close' }; },
validator: (props) => {
return !!props.ariaLabel;
},
},
mixins: [DtLocalizationMixin],

props: {
/**
* Hides the close button on the chip
* @values true, false
Expand Down
5 changes: 2 additions & 3 deletions packages/dialtone-vue2/components/chip/chip_default.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<dt-chip
:id="$attrs.id"
:hide-close="$attrs.hideClose"
:close-button-props="$attrs.closeButtonProps"
:interactive="$attrs.interactive"
:size="$attrs.size"
:aria-label="$attrs.ariaLabel"
Expand Down Expand Up @@ -38,9 +37,9 @@

<script>
import DtChip from './chip.vue';
import { CHIP_ICON_SIZES } from './chip_constants.js';
import { DtIcon } from '@/components/icon';
import { CHIP_ICON_SIZES } from '@/components/chip/chip_constants';
import DtAvatar from '@/components/avatar/avatar.vue';
import { DtAvatar } from '@/components/avatar';

export default {
name: 'DtChipDefault',
Expand Down
Loading
Loading