Skip to content

Commit

Permalink
feat: Create datetime component for forms (#243)
Browse files Browse the repository at this point in the history
* chore: Add dayjs as a peer dependency

* feat: Add `on-click-outside` modifier

* feat: Add initializer for Dayjs plugins

* feat: Copy datetime components from existing ember-nrg-ui

* feat: Use TypeScript for datetime components

* chore: Update next/previous icons

* refactor: Update classes and styling

* chore: Simplify template

* chore: Resolve template linting errors

* feat(datetime): Allow parsing of custom formats from input

* feat(bound-value): Declare `getDefaultValue` as instance member function

* chore: Allow '-**' directories to be imported

* chore: Add exports for `Datetime` component

* chore: Add tests for `Datetime` component

* chore: "Resolve" Glint template type error

* feat: Add `Datetime` component to form field

* style(calendar): Fix border rounding
  • Loading branch information
TSenter authored Nov 1, 2024
1 parent 6cbf98a commit 226a2f8
Show file tree
Hide file tree
Showing 22 changed files with 1,693 additions and 15 deletions.
13 changes: 13 additions & 0 deletions apps/docs-app/app/components/f/form/datetime.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import Datetime from '@nrg-ui/core/components/form/datetime';
import bind from '@nrg-ui/core/helpers/bind';

export default class extends Component {
@tracked
value;

<template>
<Datetime class="mt-3" @binding={{bind this "value"}} @type="datetime" />
</template>
}
1 change: 1 addition & 0 deletions apps/docs-app/app/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Router.map(function () {
this.route('form', function () {
this.route('checkbox');
this.route('checkbox-group');
this.route('datetime');
this.route('phone-input');
this.route('radio-group');
this.route('select');
Expand Down
1 change: 1 addition & 0 deletions apps/docs-app/app/templates/components.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<Sidebar.Group @header="Forms">
<:group as |Item|>
<Item @name="Form" @route="components.form.index" />
<Item @name="Datetime" @route="components.form.datetime" />
<Item @name="Checkbox" @route="components.form.checkbox" />
<Item @name="Checkbox Group" @route="components.form.checkbox-group" />
<Item @name="Phone Input" @route="components.form.phone-input" />
Expand Down
5 changes: 5 additions & 0 deletions apps/docs-app/app/templates/components/form/datetime.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{page-title "Datetime"}}

<div class="container mx-auto">
<F::Form::Datetime />
</div>
1 change: 1 addition & 0 deletions apps/test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"@typescript-eslint/parser": "^6.21.0",
"broccoli-asset-rev": "^3.0.0",
"concurrently": "^8.2.2",
"dayjs": "^1.11.13",
"ember-auto-import": "^2.7.3",
"ember-cli": "~5.9.0",
"ember-cli-app-version": "^6.0.1",
Expand Down
Loading

0 comments on commit 226a2f8

Please sign in to comment.