Commit graph

147 commits

Author SHA1 Message Date
Ian Lourenço
bb6954bfb6
Fix: visual glitch with autocomplete component (#20611)
* fix: add display:block style to span and correct minor typo

* refactor: change posisiton and max-heigh on scss

* refactor: adapt message with conditional

---------

Co-authored-by: Mac Siri <mac@forem.com>
2024-03-04 19:47:32 +00:00
Mac Siri
afa73e06e3
Replace Webpacker with Esbuild (#20470)
* Migrate to esbuild WIP

* Add exclude

* Remove redundant file

* Move file

* Move to javascript_include_tag

* Lint fix

* WIP

* WIP

* Add watch mode to esbuild WIP

* Get jest working

* Remove babel

* Revert "Remove babel"

This reverts commit 6da35260aa19d6f97f586deb66c0ecaf48433b73.

* More WIP

* Got image to load

* WIP

* Resolve audit

* Lint fix

* WIP

* Fix jest spec

* [CI] Remove asset-restore for test build stage

* Production compliant

* Temp disable sourcemap

* Update glob

* Add esbuild helper to stimulus

* Import fragment

* Temp disable coverage to see failing tests

* Fix broken spec

* Address lint

* Set proper es6 target

* Use esbuild for everything

* wait what

* Revert "Set proper es6 target"

This reverts commit 98f5278093421baa8ffe2ca580845b01c1a1eadf.

* Revert "Use esbuild for everything"

This reverts commit 0ac46738f07ffcb6af095ccb1ffa5e439b7fefa3.

* Replace uglifier with terser

* New compiled assets version

* Remvoe honeybadger-io/webpack

* Remove cypress coverage checks for now

* Update jsconfig.json

* Update docker-compose

* Remove public/packs-test from ci cache
2024-01-25 20:29:21 +00:00
Julia Undeutsch
9df24fc1f7
Add title="Check" to svg icon (#20285) 2023-10-30 17:04:54 -04:00
ktmouk
8963e185f8
Fix username combobox tries to load all users (#20227)
* Fix username combobox tries to load all users

* Add the limit param to the users_query

* Add a comment
2023-10-25 15:53:53 -04:00
ktmouk
3b37658df5
Fix lint:frontend warnings (#20256) 2023-10-19 12:59:54 -04:00
PJ
84a65f0a26
remove blocking attribute (#20116) 2023-09-15 10:35:35 -04:00
Joshua Wehner
6fe9d7d7a6
Allow org admins to add members as co-authors (#20008)
* Basics might be working?

* Stop propagating button clicks in autocomplete pills

* Better blank slate

* Better location to stop propagation

* Remove author_id from org co-authors

* Move UserStore and try testing it

* Remove extraneous comments

* OH... that's what that does!

* Very basic testing

* Re-organize javascripts

* Rename & re-org for testing

* Cleanup

* More tests

* Remove unnecessary nesting

* Coninuing to try to bump coverage

* Include /packs/ in code coverage metric

* Try tweaking jest coverage more?

We probably can't collect coverage from all of packs/* (because coverage is too low) but maybe we can try to opt-in for newer areas as we go?

* Relocate JS tests, for build & coverage

* User ID exception on search, not fetch

* Remove commented-out console.log

---------

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-09-15 08:12:41 -04:00
depfu[bot]
730f976c08
[js] Update preact 10.12.1 → 10.15.1 (minor) (#19716)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: PJ <pj@forem.com>
2023-07-12 16:24:19 -04:00
Rajat Talesra
47ec373f16
Updated story book annotations (#18562)
* Updated story book annotations

* Updated story book annotations

* Storybook code updated for css

* Nit fix
2022-10-11 19:43:40 +05:30
Rajat Talesra
895c40c2a7
Updated storybook (#18559) 2022-10-11 12:54:50 +05:30
depfu[bot]
34cd4e3675
[js] Update all Yarn dependencies (2022-08-17) (#18343)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-08-18 12:28:43 -04:00
Ridhwana
1c46207f91
Tests for the Multi Input Crayons Component (#18186)
* feat: add the labels

* feat: tests

* update specs following validation merge

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-27 12:25:13 -06:00
Suzanne Aitchison
caec27c300
Dynamically change number of formatter buttons in md toolbar overflow menu (#18224)
* dynamically change number of formatter buttons in the overflow menu

* add specs
2022-07-27 17:40:48 +01:00
Ridhwana
da72926428
Multi Input Crayons Component Documentation (Storybook) (#18188)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-26 17:07:34 -04:00
Ridhwana
ffa5e023bb
Implementing validation for the Multi Input Crayons Component (#18185)
* WIP: add the validation

* feat/WIP: set the color of the button to red

* feat: change color temporarily

* feat: add accessibility for validation

* feat: add the styling changes for the multi input

* feat: add focus visible styling as well

* fix: add comma to scss file to separate attributes

* chore: rename regex to inputRegex

* refactor: move out validation into a function

* chore: rename regex to inputRegex

* feat: add a validation Regex as a prop

* feat: update the text description

* chore: update spelling oops

* feat: remove comment

* remove comments

* rename error

* feat: add showLabel and labelText to the stories component

* cater for when we don't pass in a validationRegex

* some small tweaks

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-22 12:51:06 +01:00
Suzanne Aitchison
817db3e6f8
keyboard shortcuts in comment text area (#18117) 2022-07-18 12:01:48 -04:00
Suzanne Aitchison
76c7932b09
Member index: Filter by joining date (#17975)
* add the date picker into view

* allow date picker to overflow modal

* allow aria labels to be passed to inputs

* filter records

* add missing comment

* set earliest date

* specs and a small fix

* cypress spec

* fix typo

* tidying up

* fetch date_format

* commit code review suggestion to params

* Revert "commit code review suggestion to params"

This reverts commit 84fb0e0d3acc13257a362eb41c17b2bb8089606a.

* show added filter pill

* add cypress specs for applied filters

* woops! fix unintended change to filter code
2022-07-14 14:52:42 +01:00
Suzanne Aitchison
d9e79d6e70
try to make DRP spec more robust (#18115) 2022-07-14 07:05:25 -06:00
Suzanne Aitchison
02bba1c943
skip flaky date range picker spec (#18076) 2022-07-12 10:06:52 -06:00
Suzanne Aitchison
2f436731a7
Add markdown toolbar to comments (#18062)
* show the toolbar (WIP - includes some hacks and todos)

* allow calling component to pass additional toolbar elements

* add templates behaviour

* get templates working

* tweaks following mention autocomplete refactor

* remove image upload handler no longer needed

* rename method

* some small refactors

* only comment text area controls visibility of templates area

* fix error in role name

* fix mobile view

* update specs
2022-07-12 09:02:53 +01:00
Suzanne Aitchison
75d6e60a95
✂️ Remove reach combobox ✂️ (#17728)
* WIP: new autocomplete, search executed, dropdown positioned

* WIP: most features working in Editor

* handle textarea blur

* fix bug with id not attached to textarea

* updates to textAreaUtils tests

* aria live, fix border style

* replace comment text area

* fix some height and style issues

* update preact tests

* clean up styles, rename files, use portal for popover

* clean up styles, rename files, use portal for popover

* scroll popover items into view if necessary

* refactor cypress specs

* actually remove the package

* add some more specs

* remove storybook stories for now

* remove relative class causing issues

* small fixes for cypress specs

* make live region assertive to ensure change to combobox is known

* some comments

* add a storybook story

* replace % font size, add explainer to story
2022-07-11 12:50:52 +01:00
Suzanne Aitchison
d806393642
Validate date format and min/max in date range picker component (#18006)
* add validation behaviour

* add specs

* refactor into a hook
2022-06-30 10:08:06 +01:00
Arit Amana
750d379807
Allow ModRole & Admin to Suspend & Unsuspend User (#17946)
* gotta commit at some point

* out of gas

* IT'S WORKING NOW! 💥

* Cypress tests

* fix Travis failures

* incorporate PR review suggestions

* fix one failing Cypress test

* update API call

* add Unsuspend flow; fix Travis failures

* add tests for unsuspend flow

* remove unnecessary atrribute

* add article_policy spec

* fix failing Travis

* nudge Travis

* fix apparent typo  o o 🤷

* refactor a bunch of duplication

* nudge Travis

* fix Cypress failure related to authorizing moderator for user_status action

* rename modal partial

* remove unnecessary button-exists check

* address PR review suggestions

* hide suspend user btn after action

* toggle btn based on author suspension status

* add data-testids

* use data-testids

* controller refactor
2022-06-27 12:45:35 -04:00
Ridhwana
abeff25ec0
BETA version 2 of the Storybook Multi Input (Editing and Accessibility) (#17894)
* refactor: use the DefaultSelectionTemplate to list out the items

* refactor: rename function so that we map it to the deselect item event

* feat: first pass of adding edit functionality

* feat: update the name of the function from clearSelection to clearInput

* feat: setup the edit state by ensuring that we set the editValue and the inputPosition and then use useEffect to monitor changes

* chore: remove the old method in favour of a shared component

* feat: set the order of the items

* refactor: rename handleBlur function name to handleInputBlur

* feat: ensure that the edit field gets resized according to its current input

* feat: oops add inputSizerRef

* feat: when an item is being edited we need to ensure that it gets set back into the correct position and that we clear the previous state

* feat: handle the actual resizing fo the field on an input edit

* feat: use a shared DefaultSelectionTemplate for both the multiautocomplete and the multiinput component

* feat: make the defaultSelectionTemplate customizable based on the variant adn the classname

* feat: pressing backspace will start editing a previous selection if there is one

* feat: read out the selected items as its removed or edited

* feat: pass the regex through as a prop

* feat: move the functions around

* feat: add screen-reader only class

* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.stories.jsx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* feat: add the props to JSDoc

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-23 15:41:45 +02:00
Rajat Talesra
27c6f07686
Feature/add embed icon to editor toolbar (#17781)
* Finished task 1 and task 3

* Task 2:  If the user already has text selected inside syntax

* Added comments

* Tests added

* Nit fixes

* Code optimisation

* Nit fixes

* Fix typo

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Removed console log statements

* Minor fix

* Simplified code

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-06-10 17:33:23 +05:30
Suzanne Aitchison
6c9a09c344
Add quick select ranges to date range picker (#17850)
* Add utils for preset date ranges

* show the preset options in the calendar

* allow ranges to be selected in storybook

* add some more docs

* add missing prop type

* add tests

* move story out of beta

* fix last time periods

* small refactors
2022-06-08 15:48:06 +01:00
Ridhwana
fe447694ed
BETA version of the Storybook Multi Input (#17828)
* feat: create a crayons component called MultiInput that appears under App Components/MultiInput

* feat: add the doc describing the components to storybook

* feat: create the component ina  different file and reference its usage from the stories

* feat: add a random class to hook up a stylesheet to the component

* lets just copy soem HTML

* chore: remove arias that will not be used for the multiinput

* feat: update the classnames and remove unneeded html

* feat: multi input css updates

* feat: add the ability to set the list of emails using state

* feat: add the ability to clear the input selection

* feat: remove item

* feat: handle key events like space, comma and enter in the input

* refactor: clean up code a bit

* refactor: rename email to item

* fix: remove space keydown as its causing weird behaviour

* refactor: remove unused css now that we using pills

* feat: ensure that we do not add blank pills

* feat: add the component to BETA

* feat: rename addToList to addItemToList to be more verbose

* feat: add the first component prop i.e. placeholder

* feat: add a more descriptive text

* feat: add a padding to the field

* remove unused arial labels, and erword soem descriptions

* feat: add imports to scss

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/javascript/crayons/MultiInput/MultiInput.jsx

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Update app/javascript/crayons/MultiInput/__stories__/MultiInput.mdx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-06-07 12:22:33 +02:00
Suzanne Aitchison
c119b64b74
Reusable user admin modals (#17763)
* target modal content by a classname to avoid duplicate IDs

* woops - fix missed selector

* use showWindowModal in editUser

* move add org to a partial

* move add role into a partial

* move adjust credits to a partial

* move profile modals to be re-used

* generalise approach to add organisation modal

* generalise add role modal form

* generalise adjust credits modal

* rework unpublish modal

* refactor banish user modal

* refactors

* prevent issues with duplicate ids

* fix banish form action

* make sure role management specs covered in cypress

* let hidden modal content use IDs

* rename file for clarity

* add some JSDoc notes

* cleanup some redundant changes

* one more

* woops - fixed id that contained a classname
2022-06-02 09:52:26 -06:00
Suzanne Aitchison
02cdaed8e6
layout tweaks for mobile (#17771) 2022-05-31 10:55:19 +02:00
Suzanne Aitchison
f545b4b73f
localize display of US and non-US date format (#17758) 2022-05-25 17:08:00 +01:00
Suzanne Aitchison
c93794f987
Initial BETA storybook version of DateRangePicker (#17742)
* WIP initial component/story

* examples of customisation

* populate the month year pickers

* change the calendar view when the month or year is chosen

* fix which dates should be disabled

* style left right nav buttons

* add calendar icon, fix some date range styles

* extract some color variables

* some minor changes to styles and comments

* add phrases, allow all dates to be toggled in story

* consolidate styles

* conditional navigation given max and min dates

* labels on selects, tweaks to story

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* undo unrelated changes from merge

* retry adding dependencies, not feeling hopeful XD

* is this a preact issue?

* Revert "is this a preact issue?"

This reverts commit 5f3f720f8e739cc3dcca7fd54f8d97e08d8bb88c.

* without css import

* import styles via sass file, not component

* Apply suggestions from code review

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-05-24 17:43:58 +01:00
Suzanne Aitchison
c37bbd77e5
Member index phase 2 - mock filters modal (#17578)
* mock filters popover

* fix for safari

* add missing label
2022-05-17 15:25:21 +01:00
Suzanne Aitchison
26af4d951a
Update crayons Modal to add sheet variant (#17576)
* update Modal to add sheet variant

* dont use prompt title for modal sheet stories, to better reflect intended purpose

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-05-05 14:32:35 +01:00
Suzanne Aitchison
648c86c612
Add prop for user-defined selections in MultiSelectAutocomplete (#17402)
* add new prop and update specs

* update storybook
2022-04-29 09:39:25 +01:00
Suzanne Aitchison
e6c4e3ba2e
ignore fetched suggestions if input already cleared (#17419) 2022-04-25 16:03:36 +01:00
ludwiczakpawel
3a753cd7f6
one checkbox (#17212) 2022-04-14 10:51:40 +02:00
dependabot[bot]
3f3b13f382
Bump @testing-library/user-event from 13.5.0 to 14.1.0 (#17253)
* Bump @testing-library/user-event from 13.5.0 to 14.1.0

Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.5.0 to 14.1.0.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.5.0...v14.1)

---
updated-dependencies:
- dependency-name: "@testing-library/user-event"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* refactor to account for breaking changes

* remove redundant cleanup

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-13 10:41:08 -06:00
ludwiczakpawel
d6f204afc1
Toggle component (#17126)
* toggle

* box-sizing

* fixes

* whoopsy

* add specs for toggle component

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-04-11 09:44:43 +02:00
Suzanne Aitchison
be64f43c1a
Refactor runtime to webpacker JS (#17142)
* add runtime utilities in webpack land, refactor webpack JS using old class

* access Runtime in legacy JS code via window.Forem namespace

* refactor

* make sure data-runtime added only after page does initial load
2022-04-07 15:39:38 +01:00
Miguel Nieto A
148f242892
Replace listings tag component (#16855)
* wip

* feat:  Use MultiSelectAutocomplete for Tags

* feat:  Add additional tags for listings

* refactor: ♻️ Use preact/hooks and refactor propTypes

* fix: 🐛 Fix addiional tags support depending on the selected category

- Add slug to returned array in select_options_for_categories helper
- Differentiate the fields categoryId and categorySlug

* fix: 🐛 Adjust propTypes

* test: 🚨 Change test for select_options_for_categories helper

* refactor: ♻️ Apply requested changes

* refactor: ♻️ Remove border prop - default is true

* test: 🚨 Add test suite for ListingTagsField component

* refactor: ♻️ Apply requested changes

* refactor: ♻️ Remove unnecessary forEach + Improve code legibility

* docs: 📚 Remove topTags from hook documentation

* refactor: ♻️ Use the alias for crayons folder + Use loclaCompare in sort

* test: 🚨 Clean up mock response

* fix: 🐛 Reorder styles

* style: 🎨 Add comment to TagAutocompleteOption/Selection components
2022-03-30 16:51:40 +01:00
Fernando Valverde
445b5ba584
Re-enable imageUpload native integration (#15487)
* Re-enable imageUpload native integration

* remove temporary inline comments

* move addEventListener to useEffect hook

* console.log on native messages from image upload integration

* Debug suggestions

* store text area in ref rather than state

* call error callback from native message handler

* Remove debug logs

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-03-11 08:45:25 -06:00
Suzanne Aitchison
db288c0b4b
Use the Preact ColorPicker in creator onboarding (#16731)
* use Preact ColorPicker in creator onboarding

* update tests

* update comments

* Update app/javascript/packs/admin/creatorOnboarding.jsx

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-03-03 08:22:10 +00:00
Suzanne Aitchison
2fd5de8383
Use new ColorPicker in tag edit form (#16607)
* Use new ColorPicker in tag edit form

* use classnames, add comment
2022-02-17 14:59:09 +00:00
Suzanne Aitchison
8a14504a8e
Add accessible color picker component (#16385)
* add colorpicker component

* add tests

* separate out label, change swatch border
2022-02-07 14:30:02 +00:00
ludwiczakpawel
c9ef2ac15c
Modals fixes (#16310)
* .

* dark

* simplify and add stories

* update stories and docs

* fix
2022-01-27 16:24:23 +01:00
ludwiczakpawel
188877a865
Crayons: Pills component (#16271) 2022-01-27 15:34:03 +01:00
Nick Taylor
d227bbf770
Now <viewbox /> is preserved in SVGs when using the inline-react-svg plugin (#16287) 2022-01-24 16:25:14 -05:00
Nick Taylor
382b5528c7
Now the close X SVG icon is imported via the inline-react-svg plugin for the Modal component (#16288) 2022-01-24 16:01:21 -05:00
Suzanne Aitchison
222ce06f0f
Add new tag autocomplete to editor (#16025)
* add default placeholder, remove focus on first load

* fix some bugs re autofocus and mouse click to select

* allow custom selected styles to be passed in

* operate on objects with name property rather than plain strings

* WIP main functionality in place

* set default selections, allow a max to be placed on selections

* switch help context

* bug fixes to edit mode, static suggestions

* make sure suggestion resumes when edit begins

* cleanup and docs

* update existing form test

* add component tests

* add more component test cases

* refactor max selections flow, ensure default tag data only loads once

* stop removing combobox properties now the input stays visible

* add max selections test

* refactor

* make sure input refocus happens after blur event

* update cypress tests

* some small renames and doc changes

* only fetch exact matches from added tags

* fix test, update dark theme background

* set a max height on the popover, and ensure options can be scrolled into view

* woops - max height

* Update app/javascript/article-form/components/TagsField.jsx

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* refactors

* stop dropdown from flickering

* use ButtonNew

* remove redundant variant

* nudge PR checks

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-01-21 08:58:05 +00:00
ludwiczakpawel
87ff8f16a1
Color tokens (#16107) 2022-01-21 07:41:03 +01:00