stimulus-flatpickr icon indicating copy to clipboard operation
stimulus-flatpickr copied to clipboard

Rails 7 new stimulus module

Open myanch200 opened this issue 2 years ago • 11 comments

I am using Rails 7 and now stimulus is imported a little bit differently instead of: import { Controller } from 'stimulus'; it should be import { Controller } from '@hotwired/stimulus';

Using the first one throws ✘ [ERROR] Could not resolve "stimulus"

myanch200 avatar Jun 04 '22 02:06 myanch200

I'm usin rails 7.0 and this work form me :

  • Install last version

    bin/importmap pin stimulus-flatpickr@beta

  • Add css <link rel="stylesheet" href="https://ga.jspm.io/npm:[email protected]/dist/flatpickr.min.css">

I don't know if the style can be added automatically

sergitejada avatar Jun 15 '22 21:06 sergitejada

Two months later and I have the same problem, because "stimulus" was renamed to "@hotwired/stimulus"

See: https://github.com/hotwired/stimulus/releases/tag/v3.0.0-beta.1

Stimulus is moving package location on npm from stimulus to @hotwired/stimulus. The new package is an all-in-one, so no more individual packages for core, multi map, mutation-observers, etc.

arusa avatar Jul 30 '22 22:07 arusa

ran into same issue, is this project still under maintaining? flatpickr is really a great project.

williamherry avatar Aug 01 '22 05:08 williamherry

It seems there is a published beta/3.0.0 version that fixes our problem: https://github.com/adrienpoly/stimulus-flatpickr/pull/89

arusa avatar Aug 15 '22 17:08 arusa

Following works when using yarn, as long as v3 is not yet published as a normal release.

yarn add stimulus-flatpickr@beta

phylor avatar Nov 05 '22 21:11 phylor

Could not find a declaration file for module 'stimulus-flatpickr'. error shows in vs code under "import Flatpickr from 'stimulus-flatpickr' "

1CISP avatar Nov 07 '22 06:11 1CISP

Can anyone get this to work under Rails 7?

philsmy avatar May 11 '23 00:05 philsmy

@philsmy this works

Following works when using yarn, as long as v3 is not yet published as a normal release.

yarn add stimulus-flatpickr@beta

williamherry avatar May 11 '23 04:05 williamherry

If I do that I get the same error as @1CISP above.

Could not find a declaration file for module 'stimulus-flatpickr'. '/Users/philsmy/development/zm/node_modules/stimulus-flatpickr/dist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/stimulus-flatpickr` if it exists or add a new declaration (.d.ts) file containing `declare module 'stimulus-flatpickr';`ts(7016)

When doing: import Flatpickr from 'stimulus-flatpickr'

philsmy avatar May 11 '23 06:05 philsmy

@philsmy check the version in package.json

"stimulus-flatpickr": "^3.0.0-0",

williamherry avatar May 12 '23 06:05 williamherry

I'm usin rails 7.0 and this work form me :

  • Install last version bin/importmap pin stimulus-flatpickr@beta
  • Add css <link rel="stylesheet" href="https://ga.jspm.io/npm:[email protected]/dist/flatpickr.min.css">

I don't know if the style can be added automatically

If you are using scss and esbuild you can include the styles in app/assets/stylesheets/application.xxxx.scss

@import "flatpickr/dist/flatpickr";

skiz avatar Mar 07 '24 01:03 skiz