Skip to content

Commit

Permalink
Merge branch 'main' into asteele-passthrough-tokens-1967
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew565 authored Aug 25, 2023
2 parents dc82b0d + 1d52ecd commit 23b52fc
Show file tree
Hide file tree
Showing 21 changed files with 733 additions and 147 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@department-of-veterans-affairs/component-library",
"description": "VA.gov component library. Includes React and web components.",
"version": "19.0.1",
"version": "19.1.0",
"license": "MIT",
"scripts": {
"build": "webpack"
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/i18n/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ export default {
'gov-site-explanation': 'A .{{tld}} website belongs to an official government organization in the United States.',
'gov-site-https': 'Secure .{{tld}} websites use HTTPS',
'gov-site-lock': "A lock {{image}} or https:// means you've safely connected to the .{{tld}} website. Share sensitive information only on official, secure websites.",
'next': 'Next',
'previous': 'Previous'
};
2 changes: 2 additions & 0 deletions packages/core/src/i18n/translations/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ export default {
'gov-site-explanation': 'Un sitio web .{{tld}} pertenece a una organización oficial del Gobierno de Estados Unidos.',
'gov-site-https': 'Los sitios web seguros .{{tld}} usan HTTPS',
'gov-site-lock': "Un candado {{image}} o https:// significa que usted se conectó de forma segura a un sitio web .{{tld}}. Comparta información sensible sólo en sitios web oficiales y seguros.",
'next': 'Siguiente',
'previous': 'Anterior'
};
99 changes: 99 additions & 0 deletions packages/storybook/stories/va-pagination-uswds.stories.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import React, { useState, useEffect } from 'react';
import { getWebComponentDocs, propStructure, StoryDocs } from './wc-helpers';

const paginationDocs = getWebComponentDocs('va-pagination');

export default {
title: 'USWDS/Pagination USWDS',
id: 'uswds/va-pagination',
parameters: {
componentSubtitle: 'va-pagination web component',
docs: {
page: () => <StoryDocs data={paginationDocs} />,
}
}
}

const defaultArgs = {
page: 1,
pages: 24,
'max-page-list-length': 7,
unbounded: false
}

const Template = ({
page,
pages,
'max-page-list-length': maxPageListLength,
unbounded
}) => {
return (
<va-pagination
page={page}
pages={pages}
max-page-list-length={maxPageListLength}
uswds
unbounded={unbounded} />
);
}

export const Default = Template.bind(null);
Default.args = {
...defaultArgs,
};
Default.argTypes = propStructure(paginationDocs);

export const WithMiddle = Template.bind(null);
WithMiddle.args = {
...defaultArgs, page: 10
}

export const WithLast = Template.bind(null);
WithLast.args = {
...defaultArgs, page: 24
}

export const WithUnboundedFirst = Template.bind(null);
WithUnboundedFirst.args = {
...defaultArgs, unbounded: true
}

export const WithUnboundedMiddle = Template.bind(null);
WithUnboundedMiddle.args = {
...defaultArgs, unbounded: true, page: 10
}

export const WithSevenOrLess = Template.bind(null);
WithSevenOrLess.args = {
...defaultArgs, pages: 7
}

export const WithSevenOrLessMiddle = Template.bind(null);
WithSevenOrLessMiddle.args = {
...defaultArgs, pages: 7, page: 3
}

export const WithSevenOrLessLast = Template.bind(null);
WithSevenOrLessLast.args = {
...defaultArgs, pages: 7, page: 7
}

export const Internationalization = () => {
const [lang, setLang] = useState('en');

useEffect(() => {
document.querySelector('main').setAttribute('lang', lang);
}, [lang]);

return (
<div>
<button onClick={e => setLang('es')}>Español</button>
<button onClick={e => setLang('en')}>English</button>
<div style={{ marginTop: '20px' }}>
<h4>Default</h4>
<va-pagination page="10" pages="24" uswds />
<h4>Unbounded</h4>
<va-pagination page="10" pages="24" unbounded uswds />
</div>
</div>
)};
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const Template = ({
'heading-text': headingText,
labels,
centeredLabels,
counters
counters,
headerLevel,
progressTerm

}) => (
// Wrapper for spacing when viewing in storybook
// Component can be used without it
Expand All @@ -39,6 +42,8 @@ const Template = ({
labels={labels}
centered-labels={centeredLabels}
counters={counters}
header-level={headerLevel}
progress-term={progressTerm}
></va-segmented-progress-bar>
</div>
);
Expand Down Expand Up @@ -110,4 +115,25 @@ CenteredSmallCounters.args = {
labels: "Personal Information;Household Status;Supporting Documents;Signature;Review and Submit",
counters: 'small',
centeredLabels: true
};
};

export const CustomHeaderLevel = Template.bind(null);
CustomHeaderLevel.args = {
...defaultArgs,
label: 'Label is here',
labels: "Personal Information;Household Status;Supporting Documents;Signature;Review and Submit",
counters: 'small',
centeredLabels: true,
headerLevel: 2
};

export const CustomProgressTerm = Template.bind(null);
CustomProgressTerm.args = {
...defaultArgs,
label: 'Label is here',
labels: "Personal Information;Household Status;Supporting Documents;Signature;Review and Submit",
counters: 'small',
centeredLabels: true,
headerLevel: 2,
progressTerm: 'Chapter'
};
2 changes: 1 addition & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@department-of-veterans-affairs/web-components",
"version": "4.45.7",
"version": "4.45.9",
"description": "Stencil Component Starter",
"main": "dist/index.cjs.js",
"module": "dist/index.js",
Expand Down
32 changes: 32 additions & 0 deletions packages/web-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,14 @@ export namespace Components {
* Display last page number when the page count exceeds `maxPageListLength`
*/
"showLastPage"?: boolean;
/**
* Don't show last page when the page count exceeds `maxPageListLength` (but do show the ellipsis). Only relevant if uswds is true.
*/
"unbounded"?: boolean;
/**
* Whether or not the component will use USWDS v3 styling.
*/
"uswds"?: boolean;
}
interface VaPrivacyAgreement {
/**
Expand Down Expand Up @@ -956,6 +964,10 @@ export namespace Components {
* Whether or not an analytics event will be fired.
*/
"enableAnalytics"?: boolean;
/**
* Header level for button wrapper. Must be between 1 and 6 (v3 only)
*/
"headerLevel"?: number;
/**
* Text of current step (v3 only)
*/
Expand All @@ -968,6 +980,10 @@ export namespace Components {
* String containing a list of step labels delimited by a semi-colon (v3 only) Example: `"Step 1;Step 2;Step 3"`
*/
"labels"?: string;
/**
* The term used to indicate the current progress for the heading "[progressTerm] 2 of 5". (Screen reader only)
*/
"progressTerm"?: string;
/**
* The total number of segments in the progress bar
*/
Expand Down Expand Up @@ -2581,6 +2597,14 @@ declare namespace LocalJSX {
* Display last page number when the page count exceeds `maxPageListLength`
*/
"showLastPage"?: boolean;
/**
* Don't show last page when the page count exceeds `maxPageListLength` (but do show the ellipsis). Only relevant if uswds is true.
*/
"unbounded"?: boolean;
/**
* Whether or not the component will use USWDS v3 styling.
*/
"uswds"?: boolean;
}
interface VaPrivacyAgreement {
/**
Expand Down Expand Up @@ -2795,6 +2819,10 @@ declare namespace LocalJSX {
* Whether or not an analytics event will be fired.
*/
"enableAnalytics"?: boolean;
/**
* Header level for button wrapper. Must be between 1 and 6 (v3 only)
*/
"headerLevel"?: number;
/**
* Text of current step (v3 only)
*/
Expand All @@ -2811,6 +2839,10 @@ declare namespace LocalJSX {
* The event used to track usage of the component. This is emitted when the component renders and enableAnalytics is true.
*/
"onComponent-library-analytics"?: (event: VaSegmentedProgressBarCustomEvent<any>) => void;
/**
* The term used to indicate the current progress for the heading "[progressTerm] 2 of 5". (Screen reader only)
*/
"progressTerm"?: string;
/**
* The total number of segments in the progress bar
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ describe('va-memorable-date', () => {
<slot></slot>
<span id="error-message" role="alert"></span>
<div class='date-container'>
<va-text-input aria-describedby='dateHint' class='hydrated input-month'></va-text-input>
<va-text-input aria-describedby='dateHint' class='hydrated input-day'></va-text-input>
<va-text-input aria-describedby='dateHint' class='hydrated input-year' value=''></va-text-input>
<va-text-input aria-describedby='dateHint' class='hydrated input-month memorable-date-input'></va-text-input>
<va-text-input aria-describedby='dateHint' class='hydrated input-day memorable-date-input'></va-text-input>
<va-text-input aria-describedby='dateHint' class='hydrated input-year memorable-date-input' value=''></va-text-input>
</div>
</fieldset>
</mock:shadow-root>
Expand Down Expand Up @@ -59,9 +59,9 @@ describe('va-memorable-date', () => {
<slot></slot>
<span id="error-message" role="alert"></span>
<div class='date-container'>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-month'></va-text-input>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-day'></va-text-input>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-year' value=''></va-text-input>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-month memorable-date-input'></va-text-input>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-day memorable-date-input'></va-text-input>
<va-text-input aria-describedby='dateHint hint' class='hydrated input-year memorable-date-input' value=''></va-text-input>
</div>
</fieldset>
</mock:shadow-root>
Expand Down Expand Up @@ -642,13 +642,13 @@ describe('va-memorable-date', () => {
<span id="error-message" role="alert"></span>
<div class="usa-memorable-date">
<div class="usa-form-group usa-form-group--month">
<va-text-input aria-describedby="dateHint" class="hydrated usa-form-group--month-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint" class="hydrated memorable-date-input usa-form-group--month-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--day">
<va-text-input aria-describedby="dateHint" class="hydrated usa-form-group--day-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint" class="hydrated memorable-date-input usa-form-group--day-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--year">
<va-text-input aria-describedby="dateHint" class="hydrated usa-form-group--year-input" uswds="" value=""></va-text-input>
<va-text-input aria-describedby="dateHint" class="hydrated memorable-date-input usa-form-group--year-input" uswds="" value=""></va-text-input>
</div>
</div>
</fieldset>
Expand Down Expand Up @@ -693,13 +693,13 @@ describe('va-memorable-date', () => {
<span id="error-message" role="alert"></span>
<div class="usa-memorable-date">
<div class="usa-form-group usa-form-group--month">
<va-text-input aria-describedby="dateHint hint" class="hydrated usa-form-group--month-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint hint" class="hydrated memorable-date-input usa-form-group--month-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--day">
<va-text-input aria-describedby="dateHint hint" class="hydrated usa-form-group--day-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint hint" class="hydrated memorable-date-input usa-form-group--day-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--year">
<va-text-input aria-describedby="dateHint hint" class="hydrated usa-form-group--year-input" uswds="" value=""></va-text-input>
<va-text-input aria-describedby="dateHint hint" class="hydrated memorable-date-input usa-form-group--year-input" uswds="" value=""></va-text-input>
</div>
</div>
</fieldset>
Expand Down Expand Up @@ -1322,10 +1322,10 @@ describe('va-memorable-date', () => {
</va-select>
</div>
<div class="usa-form-group usa-form-group--day">
<va-text-input aria-describedby="dateHint" class="hydrated usa-form-group--day-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint" class="hydrated memorable-date-input usa-form-group--day-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--year">
<va-text-input aria-describedby="dateHint" class="hydrated usa-form-group--year-input" uswds="" value=""></va-text-input>
<va-text-input aria-describedby="dateHint" class="hydrated memorable-date-input usa-form-group--year-input" uswds="" value=""></va-text-input>
</div>
</div>
</fieldset>
Expand Down Expand Up @@ -1410,10 +1410,10 @@ describe('va-memorable-date', () => {
</va-select>
</div>
<div class="usa-form-group usa-form-group--day">
<va-text-input aria-describedby="dateHint hint" class="hydrated usa-form-group--day-input" uswds=""></va-text-input>
<va-text-input aria-describedby="dateHint hint" class="hydrated memorable-date-input usa-form-group--day-input" uswds=""></va-text-input>
</div>
<div class="usa-form-group usa-form-group--year">
<va-text-input aria-describedby="dateHint hint" class="hydrated usa-form-group--year-input" uswds="" value=""></va-text-input>
<va-text-input aria-describedby="dateHint hint" class="hydrated memorable-date-input usa-form-group--year-input" uswds="" value=""></va-text-input>
</div>
</div>
</fieldset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={month?.toString()}
onInput={handleDateChange}
class="usa-form-group--month-input"
class="usa-form-group--month-input memorable-date-input"
reflectInputError={error ? true : false}
inputmode="numeric"
type="text"
Expand Down Expand Up @@ -330,7 +330,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={day?.toString()}
onInput={handleDateChange}
class="usa-form-group--day-input"
class="usa-form-group--day-input memorable-date-input"
reflectInputError={error ? true : false}
inputmode="numeric"
type="text"
Expand All @@ -350,7 +350,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={year?.toString()}
onInput={handleDateChange}
class="usa-form-group--year-input"
class="usa-form-group--year-input memorable-date-input"
reflectInputError={error ? true : false}
inputmode="numeric"
type="text"
Expand Down Expand Up @@ -391,7 +391,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={month?.toString()}
onInput={handleDateChange}
class="input-month"
class="input-month memorable-date-input"
inputmode="numeric"
type="text"
ref={(field) => this.monthfield = field}
Expand All @@ -408,7 +408,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={day?.toString()}
onInput={handleDateChange}
class="input-day"
class="input-day memorable-date-input"
inputmode="numeric"
type="text"
ref={(field) => this.dayfield = field}
Expand All @@ -425,7 +425,7 @@ export class VaMemorableDate {
// if NaN provide empty string
value={year?.toString()}
onInput={handleDateChange}
class="input-year"
class="input-year memorable-date-input"
inputmode="numeric"
type="text"
ref={(field) => this.yearfield = field}
Expand Down
Loading

0 comments on commit 23b52fc

Please sign in to comment.