@orangesk/orange-design-system 1.1.0 → 1.2.0

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.
Files changed (47) hide show
  1. package/build/app.css +1 -1
  2. package/build/app.css.map +1 -1
  3. package/build/app.js +1 -1
  4. package/build/app.js.map +1 -1
  5. package/build/asset-manifest.json +1 -1
  6. package/build/components/ContentBlock/style.css +1 -1
  7. package/build/components/ContentBlock/style.css.map +1 -1
  8. package/build/components/Forms/Autocomplete/style.css.map +1 -1
  9. package/build/components/Forms/Field/style.css +1 -1
  10. package/build/components/Forms/Field/style.css.map +1 -1
  11. package/build/components/Forms/Group/style.css +1 -1
  12. package/build/components/Forms/Group/style.css.map +1 -1
  13. package/build/components/Forms/Label/style.css +1 -1
  14. package/build/components/Forms/Label/style.css.map +1 -1
  15. package/build/components/Forms/TextInput/style.css +1 -1
  16. package/build/components/Forms/TextInput/style.css.map +1 -1
  17. package/build/components/Forms/style.css +1 -1
  18. package/build/components/Forms/style.css.map +1 -1
  19. package/build/components/Grid/style.css +1 -1
  20. package/build/components/Grid/style.css.map +1 -1
  21. package/build/components/Hero/style.css +1 -1
  22. package/build/components/Hero/style.css.map +1 -1
  23. package/build/components/PageTitle/style.css +1 -1
  24. package/build/components/PageTitle/style.css.map +1 -1
  25. package/build/components/style.css +1 -1
  26. package/build/components/style.css.map +1 -1
  27. package/build/index.css +1 -1
  28. package/build/index.css.map +1 -1
  29. package/build/index.js +1 -1
  30. package/build/index.js.map +1 -1
  31. package/build/lib/components.css +1 -1
  32. package/build/lib/components.css.map +1 -1
  33. package/build/lib/scripts.js +1 -1
  34. package/build/lib/style.css +1 -1
  35. package/build/lib/style.css.map +1 -1
  36. package/build/{precache-manifest.b04d89f2500e7f8bcf46fb7b5ee718ed.js → precache-manifest.9da449d7e8658fcb34a0ba7b00d37a59.js} +22 -22
  37. package/build/{precache-manifest.30f104c4417ea61c3e07049c304fda84.js → precache-manifest.ebba1f9177bac34813e80e2289131e04.js} +12 -12
  38. package/build/service-worker.js +1 -1
  39. package/build/static.js +1 -1
  40. package/package.json +1 -1
  41. package/src/components/Forms/Autocomplete/Autocomplete.mdx +7 -3
  42. package/src/components/Forms/Group/Group.mdx +57 -1
  43. package/src/components/Forms/Label/styles/style.scss +4 -0
  44. package/src/components/Forms/TextInput/styles/config.scss +2 -0
  45. package/src/components/Forms/TextInput/styles/mixins.scss +18 -3
  46. package/src/components/Forms/TextInput/styles/style.scss +4 -0
  47. package/src/components/Grid/styles/mixins.scss +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangesk/orange-design-system",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "engines": {
6
6
  "node": "18.x"
@@ -117,6 +117,10 @@ When rendering a select element is not feasible, for example due to fetching sea
117
117
  />
118
118
  </Preview>
119
119
 
120
+ ## With search icon
121
+
122
+ More about usage with search icon can be found in [Addons documentation](/components/forms/addons).
123
+
120
124
  ## JS module reference
121
125
 
122
126
  Autocomplete is backed with [accessible-autocomplete | see docs](https://alphagov.github.io/accessible-autocomplete)
@@ -136,7 +140,7 @@ const myAutocomplete = new window.myApp.Autocomplete(
136
140
  // fuction that populates search results
137
141
  source: (query, populateResults) => {
138
142
  // you can filter filter items based on your preference, for example you
139
- // can use indexOf() or startsWith() function inside filter, or any different way to filter items
143
+ // can use indexOf() or startsWith() function inside filter, or any different way to filter items
140
144
  const filteredResults = cities.filter(
141
145
  city => city.toLowerCase().indexOf(query.toLowerCase()) !== -1
142
146
  );
@@ -153,11 +157,11 @@ const myAutocomplete = new window.myApp.Autocomplete(
153
157
  },
154
158
  defaultValue: '',
155
159
  templates: {
156
- // inputValue is a function that receives one argument, the currently selected suggestion.
160
+ // inputValue is a function that receives one argument, the currently selected suggestion.
157
161
  // It returns the string value to be inserted into the input.
158
162
  // example
159
163
  inputValue: result => result && result.name ,
160
- // suggestion is a function that receives one argument, a suggestion to be displayed.
164
+ // suggestion is a function that receives one argument, a suggestion to be displayed.
161
165
  // It is used when rendering suggestions, and should return a string, which can contain HTML.
162
166
  // example
163
167
  suggestion: result => result && \`<strong>\${result.name}</strong>\`,
@@ -8,7 +8,8 @@ import Group from './';
8
8
 
9
9
  # Seach Icon
10
10
 
11
- Add search icon to element using `.input--search-icon`. Icon is visible when element is not focused and doesn't have value. It's required to set empty placeholder. Does not apply for radios and checkboxes.
11
+ Add search icon to element using `.input--search-icon`. Icon is visible when element is not focused and doesn't have value.
12
+ It's required to set empty placeholder. Usage with placeholder is described in [the example below](#search-icon-with-placeholder). Does not apply for radios and checkboxes.
12
13
 
13
14
  <Preview>
14
15
  <Autocomplete
@@ -49,6 +50,61 @@ Add search icon to element using `.input--search-icon`. Icon is visible when ele
49
50
  />
50
51
  </Preview>
51
52
 
53
+ ## Search icon with placeholder
54
+
55
+ When using displaying search icon on input with placeholder, it's required to set the `.input--search-icon-with-placeholder` class on the input element.
56
+ Does not apply for radios and checkboxes.
57
+
58
+ ### Usage with Autocomplete
59
+
60
+ <Preview>
61
+ <Autocomplete
62
+ id="search-autocomplete"
63
+ options={[
64
+ '',
65
+ 'apple',
66
+ 'apricot',
67
+ 'banana',
68
+ 'blueberry',
69
+ 'fig',
70
+ 'lime',
71
+ 'lemon',
72
+ 'mango',
73
+ 'orange',
74
+ 'raspberry',
75
+ 'watermelon',
76
+ ]}
77
+ data-autocomplete-config={JSON.stringify({
78
+ customInputClassName: 'input--search-icon-with-placeholder',
79
+ placeholder: "Select fruit"
80
+ })}
81
+ placeholder=""
82
+ />
83
+ </Preview>
84
+
85
+ ### Usage with TextInput
86
+
87
+ Regular input
88
+
89
+ <Preview>
90
+ <TextInput
91
+ id="search-1"
92
+ htmlType="text"
93
+ className="input--search-icon-with-placeholder"
94
+ placeholder="Search"
95
+ />
96
+ </Preview>
97
+
98
+ Large input
99
+ <Preview>
100
+ <TextInput
101
+ id="search-1"
102
+ htmlType="text"
103
+ className="input--search-icon-with-placeholder text-input--large"
104
+ placeholder="Search"
105
+ />
106
+ </Preview>
107
+
52
108
  # Control Group
53
109
 
54
110
  Add prefixes and suffixes to control elements. Does not apply for radios and checkboxes.
@@ -2,4 +2,8 @@
2
2
 
3
3
  .label {
4
4
  @include mixins.base();
5
+
6
+ &[for] {
7
+ cursor: pointer;
8
+ }
5
9
  }
@@ -56,3 +56,5 @@ $widths: (
56
56
  max-width: 100%,
57
57
  ),
58
58
  );
59
+
60
+ $background-image-search-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none"><path fill="%23999999" fill-rule="evenodd" d="m19.82 18-5.64-5.65a7.81 7.81 0 1 0-1.83 1.82L18 19.82a.63.63 0 0 0 .88 0l.94-.94a.63.63 0 0 0 0-.88Zm-12-4.88a5.32 5.32 0 1 1 0-10.63 5.32 5.32 0 0 1 0 10.63Z" clip-rule="evenodd"/></svg>');
@@ -49,17 +49,32 @@
49
49
  @include generate.css-map($config, $width);
50
50
  }
51
51
 
52
- @mixin search-icon {
53
- background-image: url('data:image/svg+xml,<svg width="20" height="21" viewBox="0 0 20 21" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(%23clip0_7771_16629)"><path fill-rule="evenodd" clip-rule="evenodd" d="M19.415 18.1651L13.999 12.7501C15.0907 11.2188 15.5669 9.33307 15.3331 7.46704C15.0993 5.601 14.1727 3.89101 12.737 2.6763C11.3013 1.46159 9.46147 0.830902 7.58249 0.909364C5.70351 0.987826 3.92267 1.7697 2.59325 3.09988C1.26383 4.43006 0.482974 6.21135 0.405586 8.09037C0.328198 9.9694 0.959933 11.8089 2.17547 13.2439C3.391 14.6789 5.10152 15.6045 6.96769 15.8372C8.83385 16.0699 10.7193 15.5927 12.25 14.5001L17.666 19.9151C17.7787 20.0272 17.9311 20.0901 18.09 20.0901C18.2489 20.0901 18.4014 20.0272 18.514 19.9151L19.416 19.0131C19.5278 18.9004 19.5905 18.7481 19.5905 18.5891C19.5905 18.4304 19.5268 18.2779 19.415 18.1651ZM7.89602 13.4941C6.54408 13.4941 5.24751 12.9571 4.29155 12.0011C3.33558 11.0451 2.79852 9.74858 2.79852 8.39664C2.79852 7.0447 3.33558 5.74813 4.29155 4.79216C5.24751 3.83619 6.54408 3.29914 7.89602 3.29914C9.24796 3.29914 10.5445 3.83619 11.5005 4.79216C12.4565 5.74813 12.9935 7.0447 12.9935 8.39664C12.9935 9.74858 12.4565 11.0451 11.5005 12.0011C10.5445 12.9571 9.24796 13.4941 7.89602 13.4941Z" fill="%23999999"/></g><defs><clipPath id="clip0_7771_16629"><rect width="20" height="20" fill="white" transform="translate(0 0.5)"/></clipPath></defs></svg>');
52
+ @mixin search-icon-base {
53
+ background-image: config.$background-image-search-icon;
54
54
  background-repeat: no-repeat;
55
55
  @include generate.css-map(config.$background-search, 'default');
56
56
 
57
57
  &.text-input--large {
58
58
  @include generate.css-map(config.$background-search, 'large');
59
59
  }
60
+ }
61
+
62
+ @mixin search-icon {
63
+ @include search-icon-base;
64
+
65
+ &:not(:placeholder-shown),
66
+ &:focus {
67
+ background-image: none;
68
+ }
69
+ }
70
+
71
+ @mixin search-icon-with-placeholder {
72
+ @include search-icon-base;
73
+
74
+ padding-left: convert.to-rem(40px);
60
75
 
61
76
  &:not(:placeholder-shown),
62
77
  &:focus {
63
- background-image: none;
78
+ background-image: config.$background-image-search-icon;
64
79
  }
65
80
  }
@@ -22,3 +22,7 @@
22
22
  .input--search-icon {
23
23
  @include mixins.search-icon();
24
24
  }
25
+
26
+ .input--search-icon-with-placeholder {
27
+ @include mixins.search-icon-with-placeholder();
28
+ }
@@ -40,6 +40,14 @@
40
40
  flex-shrink: 1;
41
41
  flex-grow: 1;
42
42
  }
43
+
44
+ > [data-same-height-child] {
45
+ flex-grow: 0 !important;
46
+ }
47
+
48
+ > :not([data-same-height-child]) {
49
+ flex-grow: 1 !important;
50
+ }
43
51
  }
44
52
  }
45
53