@nyaruka/temba-components 0.24.1 → 0.25.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/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [v0.25.0](https://github.com/nyaruka/temba-components/compare/v0.24.1...v0.25.0)
8
+
9
+ > 26 January 2022
10
+
11
+ - Add info text to select widget, animate open and close [`#148`](https://github.com/nyaruka/temba-components/pull/148)
12
+
7
13
  #### [v0.24.1](https://github.com/nyaruka/temba-components/compare/v0.24.0...v0.24.1)
8
14
 
9
15
  > 15 January 2022
package/demo/index.html CHANGED
@@ -1,117 +1,155 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html lang="en-GB">
3
- <head>
4
- <meta charset="utf-8">
5
- <link
6
- href="/sitestatic/css/temba-components.css"
7
- rel="stylesheet"
8
- type="text/css"
9
- />
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link
6
+ href="/sitestatic/css/temba-components.css"
7
+ rel="stylesheet"
8
+ type="text/css"
9
+ />
10
10
 
11
- <link
12
- href="https://fonts.googleapis.com/css?family=Roboto+Mono:300|Roboto:300,400,500"
13
- rel="stylesheet"
14
- />
11
+ <link
12
+ href="https://fonts.googleapis.com/css?family=Roboto+Mono:300|Roboto:300,400,500"
13
+ rel="stylesheet"
14
+ />
15
15
 
16
- <style>
17
- .example {
18
- border: 0px solid gray;
19
- padding: 10px;
20
- max-width: 500px;
21
- }
22
-
23
- </style>
24
- <script type="module">
25
- import '../out-tsc/temba-modules.js';
26
- </script>
27
-
28
- </head>
29
- <body>
30
- <temba-store
16
+ <style>
17
+ .example {
18
+ border: 0px solid gray;
19
+ padding: 10px;
20
+ max-width: 500px;
21
+ }
22
+ </style>
23
+ <script type="module">
24
+ import '../out-tsc/temba-modules.js';
25
+ </script>
26
+ <script>
27
+ function handleColorChange(event) {
28
+ var color = event.target.values[0].name;
29
+ if (color == 'Green') {
30
+ event.target.infoText = 'Green is super dangerous!';
31
+ } else {
32
+ event.target.infoText = null;
33
+ }
34
+ }
35
+ </script>
36
+ </head>
37
+ <body>
38
+ <temba-store
31
39
  completion="/static/api/completion.json"
32
40
  functions="/static/api/functions.json"
33
41
  fields="/static/api/fields.json"
34
42
  globals="/static/api/globals.json"
35
43
  groups="/static/api/groups.json"
36
- ></temba-store>
37
-
38
- <div class="example">
39
- <temba-omnibox
40
- placeholder='Contacts or Groups'
41
- label="Recipients"
42
- help_text="This is the helpful friendly book"
43
- endpoint="/contact/omnibox/?v=2"
44
- groups
45
- contacts
46
- ></temba-omnibox>
47
- </div>
48
- <div class="example">
49
- <temba-checkbox label="you betcha" checked></temba-checkbox>
50
- </div>
51
-
52
- <div class="example">
53
- <temba-textinput value="plain text"></temba-textinput>
54
- </div>
55
-
56
- <div class="example">
57
- <temba-completion value="you complete me @cont"></temba-completion>
58
- </div>
59
-
44
+ ></temba-store>
60
45
 
46
+ <div class="example">
47
+ <temba-omnibox
48
+ placeholder="Contacts or Groups"
49
+ label="Recipients"
50
+ help_text="This is the helpful friendly book"
51
+ endpoint="/contact/omnibox/?v=2"
52
+ groups
53
+ contacts
54
+ ></temba-omnibox>
55
+ </div>
56
+ <div class="example">
57
+ <temba-checkbox label="you betcha" checked></temba-checkbox>
58
+ </div>
61
59
 
62
- <div class="example">
63
- <temba-select placeholder='Select a color' clearable>
64
- <temba-option name="Red" value="0"></temba-option>
65
- <temba-option name="Green" value="1"></temba-option>
66
- <temba-option name="Blue" value="2"></temba-option>
67
- </temba-select>
68
- </div>
60
+ <div class="example">
61
+ <temba-textinput value="plain text"></temba-textinput>
62
+ </div>
69
63
 
70
- <div class="example">
71
- <temba-select placeholder='Select a color' expressions="message" values='[{"name":"Red","value":"0"}]' searchable multi disabled>
72
- <temba-option name="Red" value="0"></temba-option>
73
- <temba-option name="Green" value="1"></temba-option>
74
- <temba-option name="Blue" value="2"></temba-option>
75
- </temba-select>
76
- </div>
64
+ <div class="example">
65
+ <temba-completion value="you complete me @cont"></temba-completion>
66
+ </div>
77
67
 
68
+ <div class="example">
69
+ <temba-select
70
+ placeholder="Select a color"
71
+ info_text="Some colors are very dangerous, choose wisely"
72
+ onchange="handleColorChange(event)"
73
+ >
74
+ <temba-option name="Red" value="0"></temba-option>
75
+ <temba-option name="Green" value="1"></temba-option>
76
+ <temba-option name="Blue" value="2"></temba-option>
77
+ </temba-select>
78
+ </div>
78
79
 
79
- <div class="example">
80
- <temba-select name="Color" label="Color" help_text="I'm not really enabled at the moment" placeholder='Select a color' expressions="message" values='[{"name":"Red","value":"0"}]' searchable multi disabled>
81
- <temba-option name="Red" value="0"></temba-option>
82
- <temba-option name="Green" value="1"></temba-option>
83
- <temba-option name="Blue" value="2"></temba-option>
84
- </temba-select>
85
- </div>
80
+ <div class="example">
81
+ <temba-select placeholder="Select a color" clearable>
82
+ <temba-option name="Red" value="0"></temba-option>
83
+ <temba-option name="Green" value="1"></temba-option>
84
+ <temba-option name="Blue" value="2"></temba-option>
85
+ </temba-select>
86
+ </div>
86
87
 
87
- <div class="example">
88
- <script>
89
- function toggleSelect(evt) {
90
- document.getElementById("select-toggle").disabled = !evt.currentTarget.checked;
91
- }
92
- </script>
93
- <div style="display:flex;align-items: center;">
94
- <temba-checkbox onchange="toggleSelect(event)" checked></temba-checkbox>
95
- <temba-select style="margin-left:10px" id="select-toggle" placeholder='Select a color' expressions="message">
96
- <temba-option name="Red" value="0"></temba-option>
97
- <temba-option name="Green" value="1"></temba-option>
98
- <temba-option name="Blue" value="2"></temba-option>
99
- </temba-select>
88
+ <div class="example">
89
+ <temba-select
90
+ placeholder="Select a color"
91
+ expressions="message"
92
+ values='[{"name":"Red","value":"0"}]'
93
+ searchable
94
+ multi
95
+ disabled
96
+ >
97
+ <temba-option name="Red" value="0"></temba-option>
98
+ <temba-option name="Green" value="1"></temba-option>
99
+ <temba-option name="Blue" value="2"></temba-option>
100
+ </temba-select>
100
101
  </div>
101
- </div>
102
102
 
103
- <div class="example">
104
- <temba-textinput
105
- name="start"
106
- label="Start Time"
107
- help_text="This is something you should think long and hard about"
108
- placeholder="Put something down, for real"
109
- value="2020-11-28 15:03"
110
- clearable
111
- datetimepicker
112
- ></temba-textinput>
113
- </div>
103
+ <div class="example">
104
+ <temba-select
105
+ name="Color"
106
+ label="Color"
107
+ help_text="I'm not really enabled at the moment"
108
+ placeholder="Select a color"
109
+ expressions="message"
110
+ values='[{"name":"Red","value":"0"}]'
111
+ searchable
112
+ multi
113
+ disabled
114
+ >
115
+ <temba-option name="Red" value="0"></temba-option>
116
+ <temba-option name="Green" value="1"></temba-option>
117
+ <temba-option name="Blue" value="2"></temba-option>
118
+ </temba-select>
119
+ </div>
114
120
 
121
+ <div class="example">
122
+ <script>
123
+ function toggleSelect(evt) {
124
+ document.getElementById('select-toggle').disabled = !evt.currentTarget
125
+ .checked;
126
+ }
127
+ </script>
128
+ <div style="display: flex; align-items: center">
129
+ <temba-checkbox onchange="toggleSelect(event)" checked></temba-checkbox>
130
+ <temba-select
131
+ style="margin-left: 10px"
132
+ id="select-toggle"
133
+ placeholder="Select a color"
134
+ expressions="message"
135
+ >
136
+ <temba-option name="Red" value="0"></temba-option>
137
+ <temba-option name="Green" value="1"></temba-option>
138
+ <temba-option name="Blue" value="2"></temba-option>
139
+ </temba-select>
140
+ </div>
141
+ </div>
115
142
 
116
- </body>
143
+ <div class="example">
144
+ <temba-textinput
145
+ name="start"
146
+ label="Start Time"
147
+ help_text="This is something you should think long and hard about"
148
+ placeholder="Put something down, for real"
149
+ value="2020-11-28 15:03"
150
+ clearable
151
+ datetimepicker
152
+ ></temba-textinput>
153
+ </div>
154
+ </body>
117
155
  </html>