diff --git a/packages/-ember-caluma/package.json b/packages/-ember-caluma/package.json index bfba75da8..933a469ce 100644 --- a/packages/-ember-caluma/package.json +++ b/packages/-ember-caluma/package.json @@ -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", diff --git a/packages/distribution/package.json b/packages/distribution/package.json index 9c82f3b29..16a779578 100644 --- a/packages/distribution/package.json +++ b/packages/distribution/package.json @@ -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", diff --git a/packages/form-builder/package.json b/packages/form-builder/package.json index 45eca7064..0c75579c7 100644 --- a/packages/form-builder/package.json +++ b/packages/form-builder/package.json @@ -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", diff --git a/packages/form/addon/components/cf-field/input/date.hbs b/packages/form/addon/components/cf-field/input/date.hbs index 42f47b893..129ed9e46 100644 --- a/packages/form/addon/components/cf-field/input/date.hbs +++ b/packages/form/addon/components/cf-field/input/date.hbs @@ -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}} diff --git a/packages/form/addon/components/cf-field/input/date.js b/packages/form/addon/components/cf-field/input/date.js index eda90aa3c..70058c92a 100644 --- a/packages/form/addon/components/cf-field/input/date.js +++ b/packages/form/addon/components/cf-field/input/date.js @@ -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 { @@ -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"); } diff --git a/packages/form/app/styles/_flatpickr.scss b/packages/form/app/styles/_flatpickr.scss index 23ed92173..2956dbf89 100644 --- a/packages/form/app/styles/_flatpickr.scss +++ b/packages/form/app/styles/_flatpickr.scss @@ -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; diff --git a/packages/form/index.js b/packages/form/index.js index e219bc942..c5dd687c4 100644 --- a/packages/form/index.js +++ b/packages/form/index.js @@ -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); - }, }; diff --git a/packages/form/package.json b/packages/form/package.json index 66d526cb3..3c5ff8524 100644 --- a/packages/form/package.json +++ b/packages/form/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3bf9695f8..d3aaba5ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -281,6 +281,9 @@ importers: ember-validated-form: specifier: 7.0.0 version: 7.0.0(@babel/core@7.23.7)(ember-data@5.3.0)(ember-source@5.6.0)(webpack@5.89.0) + flatpickr: + specifier: 4.6.13 + version: 4.6.13 graphql: specifier: 15.8.0 version: 15.8.0 @@ -647,7 +650,7 @@ importers: version: file:packages/core(@ember/test-waiters@3.1.0)(@glimmer/component@1.1.2)(@glint/template@1.3.0)(ember-source@5.6.0)(webpack@5.89.0) '@projectcaluma/ember-form': specifier: workspace:^ - version: file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(flatpickr@4.6.13)(webpack@5.89.0) + version: file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(webpack@5.89.0) '@projectcaluma/ember-workflow': specifier: workspace:^ version: file:packages/workflow(@glimmer/tracking@1.1.2)(@glint/template@1.3.0)(ember-source@5.6.0)(webpack@5.89.0) @@ -693,6 +696,9 @@ importers: ember-uikit: specifier: ^9.0.0 version: 9.0.0(@glint/template@1.3.0)(ember-source@5.6.0)(webpack@5.89.0) + flatpickr: + specifier: ^4.6.13 + version: 4.6.13 graphql: specifier: ^15.8.0 version: 15.8.0 @@ -883,6 +889,9 @@ importers: ember-validators: specifier: ^4.1.2 version: 4.1.2(@glint/template@1.3.0) + flatpickr: + specifier: ^4.6.13 + version: 4.6.13 graphql: specifier: ^15.8.0 version: 15.8.0 @@ -1019,7 +1028,7 @@ importers: version: file:packages/core(@ember/test-waiters@3.1.0)(@glimmer/component@1.1.2)(@glint/template@1.3.0)(ember-source@5.6.0)(webpack@5.89.0) '@projectcaluma/ember-form': specifier: workspace:^ - version: file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(flatpickr@4.6.13)(webpack@5.89.0) + version: file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(webpack@5.89.0) codejar: specifier: ^4.2.0 version: 4.2.0 @@ -1077,6 +1086,9 @@ importers: ember-validated-form: specifier: ^7.0.0 version: 7.0.0(@babel/core@7.23.7)(@glint/template@1.3.0)(ember-data@5.3.0)(ember-source@5.6.0)(webpack@5.89.0) + flatpickr: + specifier: ^4.6.13 + version: 4.6.13 graphql: specifier: ^15.8.0 version: 15.8.0 @@ -19741,7 +19753,7 @@ packages: - typescript - webpack - file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(flatpickr@4.6.13)(webpack@5.89.0): + file:packages/form(@glint/template@1.3.0)(@projectcaluma/ember-workflow@12.8.0)(ember-source@5.6.0)(webpack@5.89.0): resolution: {directory: packages/form, type: directory} id: file:packages/form name: '@projectcaluma/ember-form' @@ -19780,6 +19792,7 @@ packages: ember-truth-helpers: 4.0.3(ember-source@5.6.0) ember-uikit: 9.0.0(@glint/template@1.3.0)(ember-source@5.6.0)(webpack@5.89.0) ember-validators: 4.1.2(@glint/template@1.3.0) + flatpickr: 4.6.13 graphql: 15.8.0 jexl: 2.3.0 lodash.isequal: 4.5.0 @@ -19790,7 +19803,6 @@ packages: - '@glint/environment-ember-loose' - '@glint/template' - encoding - - flatpickr - graphql-ws - react - react-dom