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

feat(date-picker): add pf-date-picker #2599

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
chore: split large demo files to individual files
  • Loading branch information
Arathy Kumar committed Mar 28, 2024
commit 19e0e1192dd1141ccf5665329ea197f854155aed
44 changes: 44 additions & 0 deletions elements/pf-date-picker/demo/date-format.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<div class="container">
<section>
<h2>Date Format</h2>
<pre><code>&lt;pf-date-picker dateFormatInput="YYYY-DD-MM"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker dateFormatInput="YYYY-DD-MM"></pf-date-picker>
<p>The date picker supports the following 12 date formats:</p>
<p><span>'DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'YYYY/DD/MM', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD',
'YYYY-DD-MM', 'DD.MM.YYYY', 'MM.DD.YYYY', 'YYYY.MM.DD', 'YYYY.DD.MM'</span></p>
<p>The date format is set globally, independent of the user's locale.
This means that all users will see the same date format, regardless of their language or region.</p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>

43 changes: 43 additions & 0 deletions elements/pf-date-picker/demo/date-input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<div class="container">
<section>
<h2>Set Input Date</h2>
<pre><code>&lt;pf-date-picker inputDate=${new Date(2023, 0, 1)}&gt;&lt;/pf-date-picker&gt;</code></pre>
<!-- ***** The value for inputDate must be passed as **DATE TYPE** from parent component (Here the value is passed as string type
for demo purpose, as there are some restrictions for adding Date type value in .html file). -->
<pf-date-picker inputDate="Sun Jan 01 2023 05:30:00 GMT+0530 (India Standard Time)"></pf-date-picker>
<p>The default date value can be passed to the date picker to set the initial date that is displayed.</p>
<p>In the above given example, the date set to be displayed initially is <span>January 1, 2023</span>.</p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>

40 changes: 40 additions & 0 deletions elements/pf-date-picker/demo/disabled.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="container">
<section>
<h2>Disabled</h2>
<pre><code>&lt;pf-date-picker isDisabled="true"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker isDisabled="true"></pf-date-picker>
<p>The <span>isDisabled</span> attribute can be used to disable the date picker.</p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>

43 changes: 43 additions & 0 deletions elements/pf-date-picker/demo/localization.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<div class="container">
<section>
<h2>Localization</h2>
<pre><code>&lt;pf-date-picker localizationLanguageCode="fi"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker localizationLanguageCode="fi"></pf-date-picker>
<p>The locale string can be passed to the date picker to set the date format.</p>
<p>In the above given example, the locale is set to <span>Finnish: fi</span></p>
<p>The date format is set globally, independent of the user's locale.
This means that all users will see the same date format, regardless of their language or region.</p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>

49 changes: 49 additions & 0 deletions elements/pf-date-picker/demo/min-and-max-date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<div class="container">
<section>
<h2>Set minimum and maximum date range</h2>
<pre><code>&lt;pf-date-picker minDate=${new Date(2023, 0, 2)} minDate=${new Date(2023, 0, 20)}
inputDate=${new Date(2023, 0, 3)}&gt;&lt;/pf-date-picker&gt;</code></pre>
<!-- ***** The values for minDate and maxDate must be passed as **DATE TYPE** from parent component (Here the values are passed as string type
for demo purpose, as there are some restrictions for adding Date type value in .html file). -->
<pf-date-picker
inputDate="Tue Jan 03 2023 05:30:00 GMT+0530 (India Standard Time)"
minDate="Mon Jan 02 2023 00:00:00 GMT+0530 (India Standard Time)"
maxDate="Fri Jan 20 2023 00:00:00 GMT+0530 (India Standard Time)">
</pf-date-picker>
<p>The minimum and maximum valid dates can be passed to the date picker to restrict the range of dates that can be selected</p>
<p>In the above given example, the minimum valid date
is <span>January 2, 2023</span>, and the maximum valid date is <span>January 20, 2023</span></p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>

62 changes: 0 additions & 62 deletions elements/pf-date-picker/demo/pf-date-picker.html
Original file line number Diff line number Diff line change
@@ -6,68 +6,6 @@ <h2>Basic</h2>
<p>The basic date picker will use the user's locale to determine the date format. The default minimum valid date
is <span>January 1, 1900</span>, and the default maximum valid date is <span>December 31, 9999</span>.</p>
</section>

<section>
<h2>Date Format</h2>
<pre><code>&lt;pf-date-picker dateFormatInput="YYYY-DD-MM"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker dateFormatInput="YYYY-DD-MM"></pf-date-picker>
<p>The date picker supports the following 12 date formats:</p>
<p><span>'DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'YYYY/DD/MM', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD',
'YYYY-DD-MM', 'DD.MM.YYYY', 'MM.DD.YYYY', 'YYYY.MM.DD', 'YYYY.DD.MM'</span></p>
<p>The date format is set globally, independent of the user's locale.
This means that all users will see the same date format, regardless of their language or region.</p>
</section>

<section>
<h2>Localization</h2>
<pre><code>&lt;pf-date-picker localizationLanguageCode="fi"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker localizationLanguageCode="fi"></pf-date-picker>
<p>The locale string can be passed to the date picker to set the date format.</p>
<p>In the above given example, the locale is set to <span>Finnish: fi</span></p>
<p>The date format is set globally, independent of the user's locale.
This means that all users will see the same date format, regardless of their language or region.</p>
</section>

<section>
<h2>Translation</h2>
<pre><code>&lt;pf-date-picker translationLanguageCode="fr"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker translationLanguageCode="fr"></pf-date-picker>
<p>The translation language string can be passed to the date picker to localize the month names.</p>
<p>In the above given example, the language is set to <span>French: fr</span></p>
</section>

<section>
<h2>Set Date</h2>
<pre><code>&lt;pf-date-picker inputDate=${new Date(2023, 0, 1)}&gt;&lt;/pf-date-picker&gt;</code></pre>
<!-- ***** The value for inputDate must be passed as **DATE TYPE** from parent component (Here the value is passed as string type
for demo purpose, as there are some restrictions for adding Date type value in .html file). -->
<pf-date-picker inputDate="Sun Jan 01 2023 05:30:00 GMT+0530 (India Standard Time)"></pf-date-picker>
<p>The default date value can be passed to the date picker to set the initial date that is displayed.</p>
<p>In the above given example, the date set to be displayed initially is <span>January 1, 2023</span>.</p>
</section>

<section>
<h2>Set Min and Max Date</h2>
<pre><code>&lt;pf-date-picker minDate=${new Date(2023, 0, 2)} minDate=${new Date(2023, 0, 20)}
inputDate=${new Date(2023, 0, 3)}&gt;&lt;/pf-date-picker&gt;</code></pre>
<!-- ***** The values for minDate and maxDate must be passed as **DATE TYPE** from parent component (Here the values are passed as string type
for demo purpose, as there are some restrictions for adding Date type value in .html file). -->
<pf-date-picker
inputDate="Tue Jan 03 2023 05:30:00 GMT+0530 (India Standard Time)"
minDate="Mon Jan 02 2023 00:00:00 GMT+0530 (India Standard Time)"
maxDate="Fri Jan 20 2023 00:00:00 GMT+0530 (India Standard Time)">
</pf-date-picker>
<p>The minimum and maximum valid dates can be passed to the date picker to restrict the range of dates that can be selected</p>
<p>In the above given example, the minimum valid date
is <span>January 2, 2023</span>, and the maximum valid date is <span>January 20, 2023</span></p>
</section>

<section>
<h2>Disabled</h2>
<pre><code>&lt;pf-date-picker isDisabled="true"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker isDisabled="true"></pf-date-picker>
<p>The <span>isDisabled</span> attribute can be used to disable the date picker.</p>
</section>
</div>


41 changes: 41 additions & 0 deletions elements/pf-date-picker/demo/translation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<div class="container">
<section>
<h2>Translation</h2>
<pre><code>&lt;pf-date-picker translationLanguageCode="fr"&gt;&lt;/pf-date-picker&gt;</code></pre>
<pf-date-picker translationLanguageCode="fr"></pf-date-picker>
<p>The translation language string can be passed to the date picker to localize the month names.</p>
<p>In the above given example, the language is set to <span>French: fr</span></p>
</section>
</div>


<script type="module">
import '@patternfly/elements/pf-date-picker/pf-date-picker.js';
</script>

<style>
.container {
min-height: 25vh;
height: auto;
width: 100%;
display: flex;
align-items: flex-start;
justify-content: flex-start;
padding: 40px;
flex-direction: column;
}

.container section {
margin-bottom: var(--rh-space-lg, 16px)
}

.container section p span {
color: var(--rh-color-text-secondary-on-light, #4d4d4d);
font-family: var(--rh-font-family-code, RedHatMono, "Red Hat Mono", "Courier New", Courier, monospace);
}

.container section pre {
padding-bottom: var(--rh-space-md, 8px)
}
</style>