pat-shopping-cart
Add a value to a "shopping cart" and process this "shopping cart".
This can be used to implement a bulk download feature e.g.
<a class="pat-shopping-cart" data-pat-shopping-cart="id: 0d599f0ec05c3bda8c3b8a68c32a1b47">
Add this item for download
</a>
When an item is added to the cart, the element is given the .in-cart css class.
A .pat-shopping-cart element is also used for processing the cart.
A list of the id values is submitted to the action URL using the POST method as a comma separated string.
<a class="pat-shopping-cart" data-pat-shopping-cart="action: /download-as-zip">
Download the items
</a>
The shopping cart action element gets the .has-items css class when there are items in the cart, and .is-empty otherwise.
To add a button to empty the cart use "action: empty":
<a class="pat-shopping-cart" data-pat-shopping-cart="action: empty">
Empty your shopping cart
</a>
To use an action without clearing the cart use "contents: keep":
<a class="pat-shopping-cart" data-pat-shopping-cart="action: delete-confirmation; contents: keep">
Delete the selected items
</a>
You can pass on other patterns to the action "patterns: pat-modal":
<a class="pat-shopping-cart" data-pat-shopping-cart="action: delete-confirmation; patterns: pat-modal">
Delete the selected items
</a>
You can configure patterns passed on to the action by prepending data-pat-shopping-cart to the pattern:
<a class="pat-shopping-cart" data-pat-shopping-cart="action: delete-confirmation; patterns: pat-inject" data-pat-shopping-cart-inject="source: #main-content; target: #footer">
Delete the selected items
</a>
3.0.0-alpha.0 (2022-06-15)
Features
- Build: Build module federation enabled bundles. (fdf16a4)
Breaking Changes
-
Depend on @patternslib/dev and extend config from there. (adc614a)
-
Extend babel config from @patternslib/dev. (f33e6fd)
-
Extend commitlint config from @patternslib/dev. (46650d2)
-
Extend eslint config from @patternslib/dev. (3c4cb9a)
-
Extend jest config from @patternslib/dev. (fcdf079)
-
Extend Makefile from @patternslib/dev. (3847470)
-
Extend prettier config from @patternslib/dev. (4e6c3bb)
-
Extend release-it config from @patternslib/dev. (ffe1ada)
-
Extend webpack config from @patternslib/dev. (dd4a0a2)
Maintenance
-
build: Add build:dev script to package.json to create a unminified development build. (deaae50)
-
Build: @patternslib/patternslib as peerDependency. (ee61fff)Move @patternslib/patternslib dependency to peerDependencies and set to any version to avoid version conflicts when this package is a dependency of another Patternslib based package.
-
Build: Add @patternslib/patternslib also to devDependencies so that we get it installed. (9d25a41)
-
Build: Add keyword "patternslib" to package.json. (c1abab6)
-
Build: Explicitly add jquery as a dependency. (2271120)
-
Build: Extend jest.config.js from Patternslib and reuse their setupTests file too. (4df0b70)
-
Build: Keep yarn.lock in repository. (3435232)
-
Build: Makefile - Allow OTP when publishing to npm, build bundles and publish them on GitHub, add pre-release targets. (9a8e530)
-
Build: Remove dependency regenerator-runtime except from test setup. The async/await runtime handling is already built-in in current Babel. (b774693)
-
Build: Update GitHub actions setup. (3cad038)
-
Build: Upgrade and cleanup dependencies. (d4b68f1)
-
webpack: Configure devServer static directory. (eebb62a)