Commit Graph

444 Commits

Author SHA1 Message Date
Albert Juhé Lluveras bd2b8cb279 Add Cart totals to Cart block (https://github.com/woocommerce/woocommerce-blocks/pull/1411)
* Add Cart totals to Cart block

* Accessibility improvements

* Load vendors styles separately

* Use same shipping placeholders for cart and checkout

* Refactor how we import @wordpress/components styles so only panel styles are imported

* Remove style-loader from vendors styles build process

* Add htmlFor attribute to TotalsCouponCodeInput

* Update totalItems shape to match API

* Fix wrong total items shape using numbers instead of strings

* Rename wc-blocks classes to wc-block

* Remove unnecessary parseInt()

* Add radix to parseInt()

* Rename totalRows to totalRowsConfig

* Move placeholder content out of the component

* Use Card component for cart's sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/1423)

* Use Card component for cart's sidebar

* Split RadioControl component

* No need to use Label in RadioControlOption

* Remove no longer valid @todo comment

* Use 'checked' prop instead of 'selected' in RadioControlOption

* Rename wc-blocks classes to wc-block

* Rename wc-blocks classes to wc-block (II)

* Make sure radio control ids are unique using withComponentId

* Load PanelBody and PanelRow from last version of @wordpress/components

* Create vendors-frontend.js file

* Load wordpress-component instead of @wordpress/components from <Button> component

* Only load 'withRestApiHydration' HOC

* Make vendors-frontend a dependency of cart-frontend script

* Revert "Only load 'withRestApiHydration' HOC"

This reverts commit 9f9b9759a98047b26e7d8f04189ffe78c1d5bb06.

* Fix fieldset background
2020-01-10 15:37:27 +01:00
Albert Juhé Lluveras f339e28310 Fix prices showing two currencies in some occasions (https://github.com/woocommerce/woocommerce-blocks/pull/1515) 2020-01-10 11:22:09 +01:00
Albert Juhé Lluveras 016b6b97ec Rename wc-blocks to wc-block classname prefix (https://github.com/woocommerce/woocommerce-blocks/pull/1541) 2020-01-10 10:42:53 +01:00
Albert Juhé Lluveras aa1d8e3e56 Fix Attribute Filter not reacting to query changes (https://github.com/woocommerce/woocommerce-blocks/pull/1540) 2020-01-10 10:42:37 +01:00
Rua Haszard 0763655d42 Cart block: line-items front end initial work (https://github.com/woocommerce/woocommerce-blocks/pull/1333)
* render block on front end, add `Shopping cart` heading (baby steps)

* fake data for editing full cart + show line count in header

* add note about core/html using `is-active` class for toggle state

* reinstate work-in-progress full cart component (lost in rebase)

* reinstate full cart from master

* component for full cart title & item count + margin tweaks:
- add margin between main cart & sidebar
- add margin after cart block

* add cart items sample data + factor sample product image to module

* use sample cart data for item count

* basic table of cart line items (no styling)

* prettification

* show images for cart line items + initial table styling

* cart quantity selector component (work in progress)

* use state for cart product quantity, allow incr/decr from UI (WIP)

* replace WIP custom quantity control with number edit (temporary)

* correctly format cart line item total price

* align cart item columns with headings + indent image on desktop

* tweak css for cart line item padding on mobile so it's more explicit

* show cart line item full price if discounted

* add placeholder for cart remove item link

* switch cart table to flex layout (was table)…
This will allow us to move things around for mobile/responsive layout.

* only show cart items table header on desktop

* more cart items styling - row borders, appropriate padding +
+ move image width to variable
+ fix class name plurality for row (item not items)

* use standard $gap instead of 1em for padding/margins

* responsive (mobile) layout for cart line items:
- shift line $ total to bottom right
- stack quantity selector in product info column

* remove extraneous cart table padding on mobile

* comment about unused styles for quantity selector component

* add follow up issue for todo

* remove inappropriate href

* render srcset & sizes for cart line item product image

* remove todo comment

* switch back to table markup for cart items (in progress):
- table is more semantic, associates headers with columns

* cart line items column widths - product column is larger (60%)

* reinstate table row borders

* bottom-align line item price on mobile

* cart contents heading should be H2 + prettify

* remove unused QuantitySelector code/styles, rename main class in line with BEM

* defaults for QuantitySelector props

* variable/property name tidies - match conventions/API

* fix bug: line total price is only bottom-align on small screen

* move QuantitySelector to root of components, intended to be generally useful

* use lineItem directly for cart, specify shape in PropTypes

* rename cart components to align with "line item" rather than "product"

* rejig class names to better align with new component names & BEM style

* show cart item image correct size:
- use single column for product image and info, with flex container
- specify image width (rem instead of px)

* fix safari issue - cart product images displaying vertically stretched

* shift product name left margin from image, to account for no-image case

* experiment: bump bundlewatch size limit for cart temporarily:
- our fake data inline image is heavy
- when we switch to real API we will no longer need it

* fix issue introduced when moving margin from image to details div:
- product details needs margin on left (not right)

* fix react props issues:
- explicitly destructure image props for srcSet (vs srcset)
- use API key field for line item key instead of id, fix duplicate test id
- CartLineItemsTable takes an array of lineItems (incorrect PropTypes)

* remove redundant divs + use conventional `null` (when no full price)

* override editor styles to ensure cart product image is correct size

* move cart items editor style override to editor.css

* add an explicit readable heading for cart heading to match visual layout
2020-01-10 11:50:14 +13:00
Albert Juhé Lluveras 24fba4880b Fix minor issues with TextInput component (https://github.com/woocommerce/woocommerce-blocks/pull/1523)
* Set default value to TextInput component

* Set TextInput label transition origin

* Set default onChange function prop to noop

* Fix wrong propType name

* Remove default onChange and set it required
2020-01-09 19:06:49 +01:00
Darren Ethier b68b66542b add padding zeros to displayed prices (https://github.com/woocommerce/woocommerce-blocks/pull/1520) 2020-01-08 15:10:29 -05:00
Albert Juhé Lluveras 4be59b5ad1 Add ESLint radix rule (https://github.com/woocommerce/woocommerce-blocks/pull/1512) 2020-01-08 10:48:43 +00:00
Albert Juhé Lluveras 41633e136c Fix withFeedbackPrompt JSDoc definition (https://github.com/woocommerce/woocommerce-blocks/pull/1513) 2020-01-08 10:48:35 +00:00
Darren Ethier 8627b81c16 Add payment method api and components to checkout steps (https://github.com/woocommerce/woocommerce-blocks/pull/1349)
This adds a payment methods api to the checkout block that allows for extension to register payment methods with the block.
2020-01-06 17:28:09 -05:00
Albert Juhé Lluveras 44f70d8438 Fix Cart buttons misalignment in Firefox (https://github.com/woocommerce/woocommerce-blocks/pull/1446) 2020-01-06 12:46:00 +01:00
Albert Juhé Lluveras e082a14e3b Rename checkout classes from 'wc-blocks-xyz' to 'wc-block-xyz' (https://github.com/woocommerce/woocommerce-blocks/pull/1449)
* Rename checkout classes from 'wc-blocks-checkout' to 'wc-block-checkout'

* Rename form components classes from 'wc-blocks-checkout' to 'wc-block-checkout'

* Rename 'wc-components' class names to 'wc-block'
2020-01-03 15:23:49 +01:00
Albert Juhé Lluveras 892a56364c Fix empty cart inner blocks disabled (https://github.com/woocommerce/woocommerce-blocks/pull/1447) 2020-01-03 15:22:50 +01:00
Albert Juhé Lluveras 0a78174d25 Checkout: Fix city input field showing country value (https://github.com/woocommerce/woocommerce-blocks/pull/1467) 2020-01-02 17:36:56 +01:00
Albert Juhé Lluveras 5701f7d6c9 Price filter: allow any numeric input (https://github.com/woocommerce/woocommerce-blocks/pull/1457)
* Price filter: allow any numeric input in inputs

* Price filter: allow negative numbers in input fields (https://github.com/woocommerce/woocommerce-blocks/pull/1458)

* Price filter: allow negative numbers in input fields

* Always update input fields based on minPrice and maxPrice

* Don't default values to 0
2020-01-02 14:07:59 +01:00
Albert Juhé Lluveras 03bfa7d5a5 Remove outdated comments from useStoreProducts (https://github.com/woocommerce/woocommerce-blocks/pull/1466) 2020-01-02 14:00:50 +01:00
Albert Juhé Lluveras a538771bc1 Make price slider accurately represent the selected price independently from step (https://github.com/woocommerce/woocommerce-blocks/pull/1453) 2020-01-02 12:10:41 +01:00
Garrett Hyder 21f1d03199 Fix double 'yet yet' (https://github.com/woocommerce/woocommerce-blocks/pull/1421)
Found during translation of WooCommerce 
Permalink - https://translate.wordpress.org/projects/wp-plugins/woocommerce/dev/en-ca/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=8771164&filters%5Btranslation_id%5D=68202906
2019-12-20 10:35:08 +01:00
Seghir Nadir aaddf13494 Add type to checkout input fields (https://github.com/woocommerce/woocommerce-blocks/pull/1401)
* add input type

* fix css issues with types and better change default position
2019-12-19 13:59:34 +01:00
Seghir Nadir cf495a775e Fix Price Filter constraints by rounding up and down (https://github.com/woocommerce/woocommerce-blocks/pull/1419)
* fix problem with price not rounding up right

* add test
2019-12-19 13:52:49 +01:00
Albert Juhé Lluveras 548b2b80a9 Update filter blocks descriptions to explain they only work with the All Products block (https://github.com/woocommerce/woocommerce-blocks/pull/1420) 2019-12-19 13:46:30 +01:00
Seghir Nadir ca506d0a48 fix translation quantities (https://github.com/woocommerce/woocommerce-blocks/pull/1415)
* fix translation quantities

* update i18n comments and add variable
2019-12-19 10:22:53 +01:00
Mike Jolley cfe55418b1 Translator string feedback (https://github.com/woocommerce/woocommerce-blocks/pull/1412)
* Translator comments need to immedietely precede strings

* Add some extra context to "chips"
2019-12-18 12:59:22 +00:00
Mike Jolley 6a47b2232a More API price formatting and currency handling (https://github.com/woocommerce/woocommerce-blocks/pull/1394)
* Consistent currency data and formatting for product prices

* Consistent get_store_currency_properties usage

* Update tests with schema changes

* min_price and max_price to subunit format

* Product query of min and max prices using subunit

* Cart item totals

* Collection data schema object and currency data inclusion

* Handle subunits and new API in product prices

* Update price slider to format numbers using library and new API responses for subunits

* Product query of min and max prices using subunit

* Fix indents in readme

* Add todo for currency formatting

* Handle step for subunits, fixes min/max constraints

* Handle subunit conversion on display, using consistent currency object and wrapped NumberFormat component.

* Prettier ran

* Update usePriceConstraints tests so rounding doesn't make all values be 0

* Rename to minorUnitValue

* Move currencyToNumberFormat to index file

* siteCurrencySettings to constant rather than function

* remove cents term

* cents->minor unit

* typo in todo note

* Switch to FormattedMonetaryAmount

* Formatting

* wrong case
2019-12-18 11:29:20 +00:00
Mike Jolley 9470caed80 Remove extra colon in active filter widget (https://github.com/woocommerce/woocommerce-blocks/pull/1399) 2019-12-17 18:32:32 +01:00
Darren Ethier b38c45787a fix incorrect property name for price format (https://github.com/woocommerce/woocommerce-blocks/pull/1397) 2019-12-17 10:25:37 +00:00
Albert Juhé Lluveras 506f964463 Update several blocks so they don't support HTML edition (https://github.com/woocommerce/woocommerce-blocks/pull/1395) 2019-12-17 09:38:31 +01:00
Seghir Nadir d58712ee2b Add Checkout Form components (https://github.com/woocommerce/woocommerce-blocks/pull/1351)
* initial commit at fields

* add radio control

* change input to be uncotrolled

* tweak styles

* populate block with boilerplate

* update aria in radio

* remove comment

* fix typo

* add missing colors

* put reminder to put Disabled back

* wrap text in i18n __

* reorder styles

* rename wc-components to wc-blocks

* use value instead of index for keys

* add no shipping placeholder

* change isEditor default to false

* fix problem with responsive
2019-12-16 23:13:41 +01:00
Albert Juhé Lluveras af5af78266 Price filter: preserve previous constraints while loading (https://github.com/woocommerce/woocommerce-blocks/pull/1386)
* Typo

* Save previous constraint while loading

* Add tests for formatPrice

* Small code refactor

* Refactor usePriceConstraints to DRY and add tests

* Add base-hooks to jest config
2019-12-16 17:48:02 +01:00
Albert Juhé Lluveras 77bb23bf32 Add Feedback Prompt in Cart & Checkout blocks sidebar (https://github.com/woocommerce/woocommerce-blocks/pull/1356)
* Add Feedback Prompt in Cart & Checkout blocks sidebar

* Add border

* Move getInspectorControls out of the component function

* Move feedback prompt to a HOC

* Add @todo comment to feedback link

* Use filter for withFeedbackPrompt

* Export withFeedbackPrompt from hocs index.js

* Typo

* Try moving the feedback texts to context

* Revert "Try moving the feedback texts to context"

This reverts commit 21f889b021ceea6fef722efab9663799829bc769.

* Revert "Use filter for withFeedbackPrompt"

This reverts commit 96bba029d61a383eafa2c0a1c08f7988e319b50d.

* Set feedback text in the HOC function

* Use arrow-function to simplify code

* Refactor
2019-12-16 15:59:16 +01:00
Albert Juhé Lluveras 6d383bee73 Fix Attribute Fiter count misalignment (https://github.com/woocommerce/woocommerce-blocks/pull/1391) 2019-12-16 14:58:29 +01:00
Albert Juhé Lluveras ec77f88a72 Reformat files (https://github.com/woocommerce/woocommerce-blocks/pull/1389) 2019-12-16 14:58:19 +01:00
Darren Ethier 25c32dff45 make sure we only allow one cart/checkout block per page/post (https://github.com/woocommerce/woocommerce-blocks/pull/1384) 2019-12-16 08:27:17 -05:00
Albert Juhé Lluveras a4be92ec15 Always filter attribute filters based on price filter (https://github.com/woocommerce/woocommerce-blocks/pull/1390) 2019-12-16 14:04:19 +01:00
Darren Ethier 80d76944cc account for default orderby changes in editor (https://github.com/woocommerce/woocommerce-blocks/pull/1385) 2019-12-16 07:35:13 -05:00
Darren Ethier 10c27e928d Only allow one instance of the All Products block per page/post. (https://github.com/woocommerce/woocommerce-blocks/pull/1383)
* only allow one instance of the all products block per page.

* limit filter blocks to one instance per page/post
2019-12-16 07:31:38 -05:00
Darren Ethier 762caa5aae Fix messaging when there are no attributes (https://github.com/woocommerce/woocommerce-blocks/pull/1382) 2019-12-16 07:28:03 -05:00
Darren Ethier 5ac157b14a Normalize set minPrice and maxPrice values by step (https://github.com/woocommerce/woocommerce-blocks/pull/1379)
* normalize set minPrice and maxPrice values by step

* follow standards for comment blocks
2019-12-13 16:54:35 -05:00
Albert Juhé Lluveras 5485e4c51c Use wc_review_ratings_enabled() API function to check if review ratings are enabled (https://github.com/woocommerce/woocommerce-blocks/pull/1374) 2019-12-13 18:13:11 +01:00
Albert Juhé Lluveras 810341d084 Add Cart block checkout button (https://github.com/woocommerce/woocommerce-blocks/pull/1366) 2019-12-12 20:46:56 +01:00
Albert Juhé Lluveras b5791d9c53 Rename SubmitButton to FilterSubmitButton (https://github.com/woocommerce/woocommerce-blocks/pull/1369) 2019-12-12 20:16:39 +01:00
Albert Juhé Lluveras bd4b57074e Load ErrorPlaceholder CSS only in the editor (https://github.com/woocommerce/woocommerce-blocks/pull/1368) 2019-12-12 20:16:11 +01:00
Darren Ethier cd25b1be07 Install bundlecop and configure in package.json size-check script (https://github.com/woocommerce/woocommerce-blocks/pull/1364)
* install bundlecop and configure in package.json size-check script

* update js doc to test bundlecop

* uninstall bundlesize package
2019-12-11 09:58:49 -05:00
Mike Jolley 5a1bbbefb9 Update NPM dependencies and script dependency handling (https://github.com/woocommerce/woocommerce-blocks/pull/1337)
* Update NPM packages

* Switch JSON dependencies to new PHP files

* include->require

* include->require

* Remove from package and run audit fix

* Update wp-prettier

* Use version from asset file

* Fix eslint issues and test failures

* Update OriginalComponent docblocks

* Props are objects, not arrays

* Array to Object

* fix tests throwing unhandled rejection errors in node.

These tests were all testing Promise.rejects but then not properly catching the reject in the assertions.

* exclude rule for no short array syntax allowed

This is a WordPress core standard that we choose to ignore because it’s silly in our context to follow that rule (and we’re being consistent with WooCommerce Admin).
2019-12-10 12:17:46 -05:00
Albert Juhé Lluveras bf260b0838 Add Empty Cart View with inner blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1350)
* Add Empty Cart View with inner blocks

* Add logic so empty cart is always saved and only displayed when cart is empty

* Make cart hidden until the correct display is loaded

* Add missing propTypes

* Remove is-loading class

* Import InnerBlocks from @wordpress/block-editor

* Add explanation for always rendering EmptyCart in the editor
2019-12-10 16:41:57 +01:00
Albert Juhé Lluveras 0fa4dd05a5 Add 'Go' button to Attribute Filter (https://github.com/woocommerce/woocommerce-blocks/pull/1332)
* Add 'Go' button to Attribute Filter

* Code cleanup

* Fixes

* Avoid onSubmit being called in the editor

* Update attributes help texts

* Fix wrong input check box width
2019-12-06 16:36:55 +01:00
Seghir Nadir 58d4d73b51 Introduce Checkout Form skeleton and Checkout Form Step Component (https://github.com/woocommerce/woocommerce-blocks/pull/1329)
* introduce form steps

* add last step

* add prop types

* fix css color variable naming

* add label for a11y

* use :last-child

* white space

* use direct args in classnames

* typo

* rename ids for steps

* fix line height to match title

Co-Authored-By: Albert Juhé Lluveras <aljullu@gmail.com>

* heading-content

* rename css var

* move vars to file

* move components within file

* move imports

* rename prop name to kebabCase

* update prop name

* make components responsive with storefront

* fix some compatiblity problems with 2020

* battle in the CSS ground

* move import to correct place

* turn stepHeadingContent to render prop

* styling
2019-12-06 14:18:55 +01:00
Rua Haszard 6afd947631 allow merchant to toggle cart empty/full modes in block editor (https://github.com/woocommerce/woocommerce-blocks/pull/1327)
* allow merchant to toggle cart empty/full modes in block editor

* use text `Button` for empty/full toolbar buttons

* fix highlighting of current cart state (empty/full) in editor:
- use new custom TextToolbarButton for empty/full mode buttons

* use color variables from css/abstracts/_colors

* Update assets/js/components/text-toolbar-button/index.js

Co-Authored-By: Seghir Nadir <nadir.seghir@gmail.com>

* fix className now props is separated out
2019-12-06 10:08:48 +13:00
Albert Juhé Lluveras 578ddbe94d Minor code style fixes in All Products blocks (https://github.com/woocommerce/woocommerce-blocks/pull/1330) 2019-12-05 17:03:31 +01:00
Albert Juhé Lluveras aa43840f13 Add 'AND' display format to Attribute filter dropdown (https://github.com/woocommerce/woocommerce-blocks/pull/1309)
* Add 'AND' display format to Attribute filter dropdown

* Add translators comments

* Remove 'assertive' from speak calls

* Wrap some functions in useCallback

* Only filter available filters if style=list and query=and

* Show placeholder in AND query type

* Add default cursor to list-item elements

* Fix issues with 20xx themes

* Fix issues with 20xx themes (II)
2019-12-05 14:58:44 +01:00