@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.
- package/build/app.css +1 -1
- package/build/app.css.map +1 -1
- package/build/app.js +1 -1
- package/build/app.js.map +1 -1
- package/build/asset-manifest.json +1 -1
- package/build/components/ContentBlock/style.css +1 -1
- package/build/components/ContentBlock/style.css.map +1 -1
- package/build/components/Forms/Autocomplete/style.css.map +1 -1
- package/build/components/Forms/Field/style.css +1 -1
- package/build/components/Forms/Field/style.css.map +1 -1
- package/build/components/Forms/Group/style.css +1 -1
- package/build/components/Forms/Group/style.css.map +1 -1
- package/build/components/Forms/Label/style.css +1 -1
- package/build/components/Forms/Label/style.css.map +1 -1
- package/build/components/Forms/TextInput/style.css +1 -1
- package/build/components/Forms/TextInput/style.css.map +1 -1
- package/build/components/Forms/style.css +1 -1
- package/build/components/Forms/style.css.map +1 -1
- package/build/components/Grid/style.css +1 -1
- package/build/components/Grid/style.css.map +1 -1
- package/build/components/Hero/style.css +1 -1
- package/build/components/Hero/style.css.map +1 -1
- package/build/components/PageTitle/style.css +1 -1
- package/build/components/PageTitle/style.css.map +1 -1
- package/build/components/style.css +1 -1
- package/build/components/style.css.map +1 -1
- package/build/index.css +1 -1
- package/build/index.css.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/scripts.js +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/{precache-manifest.b04d89f2500e7f8bcf46fb7b5ee718ed.js → precache-manifest.9da449d7e8658fcb34a0ba7b00d37a59.js} +22 -22
- package/build/{precache-manifest.30f104c4417ea61c3e07049c304fda84.js → precache-manifest.ebba1f9177bac34813e80e2289131e04.js} +12 -12
- package/build/service-worker.js +1 -1
- package/build/static.js +1 -1
- package/package.json +1 -1
- package/src/components/Forms/Autocomplete/Autocomplete.mdx +7 -3
- package/src/components/Forms/Group/Group.mdx +57 -1
- package/src/components/Forms/Label/styles/style.scss +4 -0
- package/src/components/Forms/TextInput/styles/config.scss +2 -0
- package/src/components/Forms/TextInput/styles/mixins.scss +18 -3
- package/src/components/Forms/TextInput/styles/style.scss +4 -0
- package/src/components/Grid/styles/mixins.scss +8 -0
package/package.json
CHANGED
|
@@ -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.
|
|
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.
|
|
@@ -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:
|
|
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:
|
|
78
|
+
background-image: config.$background-image-search-icon;
|
|
64
79
|
}
|
|
65
80
|
}
|