stalefish 7.4.1 → 7.4.3

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.
@@ -5,41 +5,39 @@ import clone from 'fast-clone'
5
5
  let cache = new LRU(300)
6
6
 
7
7
  let styles = css`
8
- .checkbox {
9
- margin: 0 10px 0 20px !important;
10
- position: absolute;
11
- right: 4px;
12
- top: 16.5px;
13
- }
14
-
15
- .label {
16
- position: relative;
17
- display: inline-flex;
18
- align-items: center;
19
- border-radius: 0;
20
- font-size: 18px;
21
- font-weight: normal;
22
- color: #999;
23
- margin: 5px 5px 5px 5px;
24
- padding: 10px;
25
- background-color: rgba(255,255,255,0.8);
26
- border: solid 5px #c9c9c9;
27
- user-select: none;
28
- padding: 12px;
29
- box-sizing: border-box;
30
- width: calc(100% - 10px);
31
- }
32
-
33
- .checkbox.touched:invalid:not(:focus) {
34
- outline: red solid 2px;
35
- }
8
+ .checkbox {
9
+ margin: 0 10px 0 20px !important;
10
+ position: absolute;
11
+ right: 4px;
12
+ top: 16.5px;
13
+ }
14
+
15
+ .label {
16
+ position: relative;
17
+ display: inline-flex;
18
+ align-items: center;
19
+ border-radius: 0;
20
+ font-size: 18px;
21
+ font-weight: normal;
22
+ color: #999;
23
+ margin: 5px 5px 5px 5px;
24
+ border: solid 5px #c9c9c9;
25
+ user-select: none;
26
+ padding: 12px;
27
+ box-sizing: border-box;
28
+ width: calc(100% - 10px);
29
+ }
30
+
31
+ .checkbox.touched:invalid:not(:focus) {
32
+ outline: red solid 2px;
33
+ }
36
34
  `
37
35
 
38
36
  class Checkbox extends Component {
39
37
  createElement (args) {
40
38
  this.args = clone(args)
41
39
  this.onchange = args.onchange
42
- let { wrapperStyle, holdingPen, label, property, required, indeterminate, disabled } = args
40
+ let { wrapperStyle, holdingPen, label, property, required, indeterminate, disabled, darkBackground } = args
43
41
 
44
42
  let checkboxEl = html`<input data-gramm="false" ${disabled ? { disabled } : ''} style="${disabled ? 'cursor: not-allowed;' : ''}" class="${styles.checkbox} ${fieldIsTouched(holdingPen, property) === true ? styles.touched : ''}" value="${holdingPen[property] === true ? 'true' : null}" ${holdingPen[property] === true ? { checked: 'checked' } : ''} onchange=${e => {
45
43
  formField(holdingPen, property)(e)
@@ -49,9 +47,9 @@ class Checkbox extends Component {
49
47
  checkboxEl.indeterminate = indeterminate || false
50
48
 
51
49
  return html`
52
- <label style="${disabled ? 'cursor: not-allowed; opacity: 0.3;' : ''}text-align: left; width: 100%; display: inline-block; vertical-align: bottom;" ${wrapperStyle ? { 'class': wrapperStyle } : ''}>
53
- <span class="${styles.label}">${label}${required ? ' *' : ''}${checkboxEl}</span>
54
- </label>
50
+ <label style="${disabled ? 'cursor: not-allowed; opacity: 0.3;' : ''}text-align: left; width: 100%; display: inline-block; vertical-align: bottom;" ${wrapperStyle ? { 'class': wrapperStyle } : ''}>
51
+ <span class="${styles.label}" style="background-color: rgba(255,255,255,${darkBackground ? 1 : 0.8});">${label}${required ? ' *' : ''}${checkboxEl}</span>
52
+ </label>
55
53
  `
56
54
  }
57
55
 
@@ -107,7 +107,7 @@ class Textfield extends Component {
107
107
 
108
108
  let { highlightBorder = false, wrapperStyle = null, holdingPen, label, placeholder, property, required, pattern, type, autofocus, valueContext, permanentTopPlaceholder = false, permanentTopLabel = false, disabled, maxCharacters, maxNumber, minNumber, darkBackground } = args
109
109
 
110
- let input = html`<input data-gramm="false" ${disabled ? { disabled } : ''} ${maxNumber ? { max: maxNumber } : ''} ${minNumber ? { min: minNumber } : ''} ${maxCharacters ? { maxlength: maxCharacters } : ''} style="${disabled ? 'cursor: not-allowed; opacity: 0.3;' : ''}" class="${styles.textfield} ${fieldIsTouched(holdingPen, property) === true ? styles.touched : ''} ${highlightBorder ? styles.highlight : ''}" value="${holdingPen[property] !== undefined && holdingPen[property] !== null ? holdingPen[property] : ''}" onkeyup=${e => this.onkeyup && this.onkeyup(e)} ${required ? { required: 'required' } : ''} onchange=${e => { change({ e, holdingPen, property, label: styles.label }); this.onchange && this.onchange(e) }} oninput=${e => { change({ e, holdingPen, property, label: styles.label }); this.oninput && this.oninput(e) }} onblur=${formField(holdingPen, property)} placeholder="${placeholder || ''}${required ? ' *' : ''}" type="${determineType(type)}" ${pattern ? { pattern } : ''} ${type.toLowerCase() === 'number' ? { step: determineStep(type) } : ''} />`
110
+ let input = html`<input data-gramm="false" ${disabled ? { disabled } : ''} ${maxNumber ? { max: maxNumber } : ''} ${minNumber ? { min: minNumber } : ''} ${maxCharacters ? { maxlength: maxCharacters } : ''} style="${type === 'color' ? 'height: 50px; padding: 2px 3px;' : ''}${disabled ? 'cursor: not-allowed; opacity: 0.3;' : ''}" class="${styles.textfield} ${fieldIsTouched(holdingPen, property) === true ? styles.touched : ''} ${highlightBorder ? styles.highlight : ''}" value="${holdingPen[property] !== undefined && holdingPen[property] !== null ? holdingPen[property] : ''}" onkeyup=${e => this.onkeyup && this.onkeyup(e)} ${required ? { required: 'required' } : ''} onchange=${e => { change({ e, holdingPen, property, label: styles.label }); this.onchange && this.onchange(e) }} oninput=${e => { change({ e, holdingPen, property, label: styles.label }); this.oninput && this.oninput(e) }} onblur=${formField(holdingPen, property)} placeholder="${placeholder || ''}${required ? ' *' : ''}" type="${determineType(type)}" ${pattern ? { pattern } : ''} ${type.toLowerCase() === 'number' ? { step: determineStep(type) } : ''} />`
111
111
 
112
112
  if (autofocus) {
113
113
  input.autofocus = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stalefish",
3
- "version": "7.4.1",
3
+ "version": "7.4.3",
4
4
  "description": "Simple function based component library for halfcab tagged template literals",
5
5
  "main": "index.mjs",
6
6
  "module": "index.mjs",