@eightshift/frontend-libs-tailwind 1.4.6 → 1.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
6
6
 
7
7
  ---
8
8
 
9
+ ## [1.4.8]
10
+
11
+ ### Added
12
+
13
+ - `domain parameter` to setCookie function.
14
+
15
+ ## [1.4.7]
16
+
17
+ ### Changed
18
+ - Fixed Image component "image" part tailwind class output if not set.
19
+ - Fix Image component responsive output Co-authored-by: goran.alkovic@infinum.com
20
+ - Add "Auto" width to wrapperContent and set is as defaults
21
+ - Add a buttonType attribute to Button component
22
+ - Implement a11y for Icon component either by setting aria-hidden to true (default) or using the existing iconName label from manifest options key
23
+ - Updated dependencies.
24
+
9
25
  ## [1.4.6]
10
26
 
11
27
  ### Changed
@@ -159,6 +175,8 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a
159
175
  - Initial release.
160
176
 
161
177
  [Unreleased]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/master...HEAD
178
+ [1.4.8]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.7...1.4.8
179
+ [1.4.7]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.6...1.4.7
162
180
  [1.4.6]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.5...1.4.6
163
181
  [1.4.5]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.4...1.4.5
164
182
  [1.4.4]: https://github.com/infinum/eightshift-frontend-libs-tailwind/compare/1.4.3...1.4.4
@@ -19,6 +19,7 @@ if (!$buttonUse) {
19
19
  $additionalClass = $attributes['additionalClass'] ?? '';
20
20
  $additionalAttributes = $attributes['additionalAttributes'] ?? [];
21
21
  $buttonId = Helpers::checkAttr('buttonId', $attributes, $manifest);
22
+ $buttonType = Helpers::checkAttr('buttonType', $attributes, $manifest);
22
23
 
23
24
  $buttonUrl = Helpers::checkAttr('buttonUrl', $attributes, $manifest);
24
25
  $buttonIsNewTab = Helpers::checkAttr('buttonIsNewTab', $attributes, $manifest);
@@ -59,6 +60,10 @@ if (!empty($buttonAriaLabel)) {
59
60
  $buttonAttrs['class'] = Helpers::tailwindClasses('base', $attributes, $manifest, 'button', $additionalClass);
60
61
 
61
62
  $buttonTag = !empty($buttonUrl) ? 'a' : 'button';
63
+
64
+ if (empty($buttonUrl) && !empty($buttonType)) {
65
+ $buttonAttrs['type'] = $buttonType;
66
+ }
62
67
  ?>
63
68
 
64
69
  <<?php echo $buttonTag; // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped ?>
@@ -20,6 +20,9 @@
20
20
  "buttonId": {
21
21
  "type": "string"
22
22
  },
23
+ "buttonType": {
24
+ "type": "string"
25
+ },
23
26
  "buttonColor": {
24
27
  "type": "string",
25
28
  "default": "navy-500"
@@ -19,6 +19,7 @@ if (!$iconUse) {
19
19
  $additionalClass = $attributes['additionalClass'] ?? '';
20
20
 
21
21
  $iconName = Helpers::checkAttr('iconName', $attributes, $manifest);
22
+ $iconAriaHidden = Helpers::checkAttr('iconAriaHidden', $attributes, $manifest);
22
23
 
23
24
  if (!isset($manifest['icons'][$iconName])) {
24
25
  return;
@@ -29,7 +30,23 @@ $icon = $manifest['icons'][$iconName];
29
30
  $className = Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass);
30
31
 
31
32
  if (!empty($className)) {
32
- $icon = str_replace('<svg ', '<svg class="' . htmlspecialchars($className) . '" ', $icon);
33
+ $icon = str_replace('<svg ', '<svg class="' . esc_attr($className) . '" ', $icon);
34
+ }
35
+
36
+ if ($iconAriaHidden) {
37
+ $icon = str_replace('<svg ', '<svg aria-hidden="true" ', $icon);
38
+ } else {
39
+ $iconTitle = '';
40
+ $iconOption = array_filter($manifest['options']['iconName'], fn($option) => $option['value'] === $iconName);
41
+
42
+ if (!empty($iconOption)) {
43
+ $iconTitle = reset($iconOption)['label'];
44
+ }
45
+
46
+ if (!empty($iconTitle)) {
47
+ $titleTag = '<title>' . esc_html($iconTitle) . '</title>';
48
+ $icon = str_replace('</svg>', $titleTag . '</svg>', $icon);
49
+ }
33
50
  }
34
51
 
35
52
  // phpcs:ignore Eightshift.Security.HelpersEscape.OutputNotEscaped
@@ -21,6 +21,10 @@
21
21
  "iconUse": {
22
22
  "type": "boolean",
23
23
  "default": true
24
+ },
25
+ "iconAriaHidden": {
26
+ "type": "boolean",
27
+ "default": true
24
28
  }
25
29
  },
26
30
  "options": {
@@ -25,7 +25,11 @@ $imageAlt = get_post_meta($imageData['_default']['id'], '_wp_attachment_image_al
25
25
  $isDesktopFirst = $imageData['_desktopFirst'] ?? false;
26
26
 
27
27
  $breakpointData = Helpers::getSettingsGlobalVariablesBreakpoints();
28
- $breakpoints = Helpers::getTwBreakpoints();
28
+ $breakpoints = Helpers::getTwBreakpoints($isDesktopFirst);
29
+
30
+ if (!$isDesktopFirst) {
31
+ $breakpoints = array_reverse($breakpoints);
32
+ }
29
33
  ?>
30
34
 
31
35
  <picture
@@ -33,7 +37,8 @@ $breakpoints = Helpers::getTwBreakpoints();
33
37
  class="<?php echo esc_attr($additionalClass['picture']); ?>"
34
38
  <?php } ?>
35
39
  >
36
- <?php foreach ($breakpoints as $breakpoint) { ?>
40
+ <?php
41
+ foreach ($breakpoints as $breakpoint) { ?>
37
42
  <?php
38
43
  if (!isset($imageData[$breakpoint])) {
39
44
  continue;
@@ -45,7 +50,7 @@ $breakpoints = Helpers::getTwBreakpoints();
45
50
  continue;
46
51
  }
47
52
 
48
- $breakpointWidth = $breakpointData[$breakpoint];
53
+ $breakpointWidth = $breakpointData[str_replace('max-', '', $breakpoint)];
49
54
 
50
55
  $widthMode = $isDesktopFirst ? 'max-width' : 'min-width';
51
56
 
@@ -57,7 +62,7 @@ $breakpoints = Helpers::getTwBreakpoints();
57
62
  <img
58
63
  src="<?php echo esc_url($imageData['_default']['url'] ?? ''); ?>"
59
64
  alt="<?php echo esc_attr($imageAlt); ?>"
60
- class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? $additionalClass)); ?>"
65
+ class="<?php echo esc_attr(Helpers::tailwindClasses('base', $attributes, $manifest, $additionalClass['image'] ?? '')); ?>"
61
66
  />
62
67
  </picture>
63
68
 
@@ -90,7 +90,7 @@
90
90
  "wrapperContentWidth": {
91
91
  "type": "object",
92
92
  "default": {
93
- "_default": "full",
93
+ "_default": "auto",
94
94
  "_desktopFirst": true
95
95
  }
96
96
  },
@@ -289,6 +289,11 @@
289
289
  }
290
290
  ],
291
291
  "wrapperContentWidth": [
292
+ {
293
+ "label": "Auto",
294
+ "value": "auto",
295
+ "separator": "below"
296
+ },
292
297
  {
293
298
  "label": "Full",
294
299
  "value": "full",
@@ -439,6 +444,7 @@
439
444
  "wrapperContentWidth": {
440
445
  "responsive": true,
441
446
  "twClasses": {
447
+ "auto": "w-auto",
442
448
  "full": "w-full",
443
449
  "half": "w-1/2",
444
450
  "one-third": "w-1/3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eightshift/frontend-libs-tailwind",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "A framework for creating modern Gutenberg themes with styling provided by Tailwind CSS.",
5
5
  "author": {
6
6
  "name": "Eightshift team",
@@ -34,35 +34,35 @@
34
34
  "homepage": "https://github.com/infinum/eightshift-frontend-libs-tailwind#readme",
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@eightshift/ui-components": "^1.8.0",
38
- "@stylistic/eslint-plugin-js": "^2.11.0",
37
+ "@eightshift/ui-components": "^1.9.1",
38
+ "@stylistic/eslint-plugin-js": "^2.12.1",
39
39
  "@stylistic/stylelint-plugin": "^3.1.1",
40
- "@swc/core": "^1.9.3",
41
- "@wordpress/api-fetch": "^7.13.0",
42
- "@wordpress/block-editor": "^14.8.0",
40
+ "@swc/core": "^1.10.1",
41
+ "@wordpress/api-fetch": "^7.14.0",
42
+ "@wordpress/block-editor": "^14.9.0",
43
43
  "@wordpress/dependency-extraction-webpack-plugin": "^5.9.0",
44
- "@wordpress/dom-ready": "^4.13.0",
45
- "@wordpress/server-side-render": "^5.13.0",
46
- "browserslist": "^4.24.2",
44
+ "@wordpress/dom-ready": "^4.14.0",
45
+ "@wordpress/server-side-render": "^5.14.0",
46
+ "browserslist": "^4.24.3",
47
47
  "css-loader": "^7.1.2",
48
48
  "css-minimizer-webpack-plugin": "^7.0.0",
49
- "eslint": "^9.15.0",
49
+ "eslint": "^9.17.0",
50
50
  "eslint-config-prettier": "^9.1.0",
51
51
  "eslint-plugin-prettier": "^5.2.1",
52
- "globals": "^15.12.0",
52
+ "globals": "^15.13.0",
53
53
  "husky": "^9.1.7",
54
54
  "lightningcss": "^1.28.2",
55
55
  "mini-css-extract-plugin": "^2.9.2",
56
56
  "postcss": "^8.4.49",
57
57
  "postcss-loader": "^8.1.1",
58
- "prettier": "^3.4.1",
58
+ "prettier": "^3.4.2",
59
59
  "prettier-plugin-tailwindcss": "^0.6.9",
60
- "sonner": "^1.7.0",
61
- "stylelint": "^16.11.0",
60
+ "sonner": "^1.7.1",
61
+ "stylelint": "^16.12.0",
62
62
  "stylelint-config-standard": "^36.0.1",
63
63
  "swc-loader": "^0.2.6",
64
- "terser-webpack-plugin": "^5.3.10",
65
- "webpack": "^5.96.1",
64
+ "terser-webpack-plugin": "^5.3.11",
65
+ "webpack": "^5.97.1",
66
66
  "webpack-cli": "^5.1.4",
67
67
  "webpack-manifest-plugin": "^5.0.0",
68
68
  "webpack-merge": "^6.0.1"
@@ -70,11 +70,11 @@
70
70
  "devDependencies": {
71
71
  "embla-carousel": "^8.5.1",
72
72
  "fluid-tailwind": "^1.0.4",
73
- "lint-staged": "^15.2.10",
73
+ "lint-staged": "^15.2.11",
74
74
  "micromodal": "^0.4.10",
75
- "ol": "^10.2.1",
76
- "ol-mapbox-style": "^12.3.5",
77
- "tailwindcss": "^3.4.15",
75
+ "ol": "^10.3.1",
76
+ "ol-mapbox-style": "^12.4.0",
77
+ "tailwindcss": "^3.4.17",
78
78
  "tailwindcss-animate": "^1.0.7"
79
79
  },
80
80
  "sideEffects": false,
@@ -2,6 +2,7 @@
2
2
  * Helper to set and unset cookies.
3
3
  */
4
4
  export const cookies = {
5
+
5
6
  /**
6
7
  * Set a cookie value
7
8
  *
@@ -9,7 +10,7 @@ export const cookies = {
9
10
  * @param {string} value - Cookie value.
10
11
  * @param {number} time - Number denoting the expiration of the cookie.
11
12
  * @param {string} path - URL path that must exist in the requested URL in order to send the Cookie header.
12
- *
13
+ * @param {string?} domain - Cookie domain. Optional.
13
14
  * @access public
14
15
  *
15
16
  * @returns {void}
@@ -19,16 +20,22 @@ export const cookies = {
19
20
  * cookies.setCookie('gdpr', '2', cookies.setOneDay(), '/');
20
21
  * ```
21
22
  */
22
- setCookie(key, value, time, path) {
23
+ setCookie(key, value, time, path, domain) {
23
24
  const expires = new Date();
24
- expires.setTime(expires.getTime() + time);
25
+ expires.setTime(expires.getTime() + (time));
26
+
25
27
  let pathValue = '';
28
+ let domainValue = '';
26
29
 
27
30
  if (typeof path !== 'undefined') {
28
- pathValue = `path=${path};`;
31
+ pathValue = `;path=${path}`;
32
+ }
33
+
34
+ if (typeof domain !== 'undefined') {
35
+ domainValue = `;domain=${domain}`;
29
36
  }
30
37
 
31
- document.cookie = `${key}=${value};${pathValue}expires=${expires.toUTCString()}`;
38
+ document.cookie = `${key}=${value}${pathValue}${domainValue};expires=${expires.toUTCString()}`;
32
39
  },
33
40
 
34
41
  /**
package/bun.lockb DELETED
Binary file