Skip to content

Commit

Permalink
chore(flatpickr): fix usage of flatpickr
Browse files Browse the repository at this point in the history
  • Loading branch information
anehx committed Jan 23, 2024
1 parent 812894e commit a2657ba
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 17 deletions.
1 change: 1 addition & 0 deletions packages/-ember-caluma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"ember-truth-helpers": "4.0.3",
"ember-uikit": "9.0.0",
"ember-validated-form": "7.0.0",
"flatpickr": "4.6.13",
"graphql": "15.8.0",
"loader.js": "4.7.0",
"miragejs": "0.1.48",
Expand Down
1 change: 1 addition & 0 deletions packages/distribution/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"ember-svg-jar": "^2.4.7",
"ember-test-selectors": "^6.0.0",
"ember-uikit": "^9.0.0",
"flatpickr": "^4.6.13",
"graphql": "^15.8.0",
"graphql-tag": "^2.12.6",
"lodash.merge": "^4.6.2",
Expand Down
1 change: 1 addition & 0 deletions packages/form-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"ember-test-selectors": "^6.0.0",
"ember-uikit": "^9.0.0",
"ember-validated-form": "^7.0.0",
"flatpickr": "^4.6.13",
"graphql": "^15.8.0",
"graphql-tag": "^2.12.6",
"highlight.js": "^11.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/form/addon/components/cf-field/input/date.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class="uk-input {{if @disabled 'uk-disabled'}}"
readonly={{@disabled}}
@disabled={{@disabled}}
@locale={{this.locale}}
@locale={{this.localeObject}}
@date={{or @field.answer.value null}}
@altFormat={{this.dateFormat}}
@altInput={{true}}
Expand Down
5 changes: 5 additions & 0 deletions packages/form/addon/components/cf-field/input/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import lang from "flatpickr/dist/l10n";
import { DateTime } from "luxon";

export default class CfFieldInputDateComponent extends Component {
Expand All @@ -14,6 +15,10 @@ export default class CfFieldInputDateComponent extends Component {
return this.intl.primaryLocale.split("-")[0];
}

get localeObject() {
return lang[this.locale];
}

get config() {
return getOwner(this).resolveRegistration("config:environment");
}
Expand Down
2 changes: 2 additions & 0 deletions packages/form/app/styles/_flatpickr.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@use "sass:color";
@import "flatpickr/dist/flatpickr";
@import "flatpickr/dist/themes/airbnb";

$flatpickr-today-color: $global-warning-background;
$flatpickr-selected-color: $global-primary-background;
Expand Down
12 changes: 0 additions & 12 deletions packages/form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,4 @@

module.exports = {
name: require("./package").name,

included(...args) {
const app = this._findHost(this);

app.options.flatpickr = {
locales: ["de", "fr"],
theme: "airbnb",
...(app.options.flatpickr ?? {}),
};

this._super.included.apply(this, args);
},
};
1 change: 1 addition & 0 deletions packages/form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"ember-truth-helpers": "^4.0.3",
"ember-uikit": "^9.0.0",
"ember-validators": "^4.1.2",
"flatpickr": "^4.6.13",
"graphql": "^15.8.0",
"jexl": "^2.3.0",
"lodash.isequal": "^4.5.0",
Expand Down
20 changes: 16 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a2657ba

Please sign in to comment.