stalefish 8.0.3 → 8.0.4

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.
@@ -106,6 +106,15 @@ function detectTouchscreen () {
106
106
  }
107
107
 
108
108
  export default ({ wrapperStyle = null, holdingPen, label, placeholder, property, required, pattern, permanentTopPlaceholder = true, permanentTopLabel = false, flatpickrConfig = {}, timeOnly = false, disabled, disableClear = false, onchange, oninput }) => {
109
+ // Determine whether we should force Flatpickr on mobile/touch devices.
110
+ // By default we enable Flatpickr everywhere (disableMobile: true) so that
111
+ // environments that would otherwise show the native date/time inputs will
112
+ // still initialize the Flatpickr widget. Consumers can override by passing
113
+ // { disableMobile: false } inside flatpickrConfig.
114
+ const resolvedDisableMobile = flatpickrConfig && typeof flatpickrConfig.disableMobile !== 'undefined'
115
+ ? flatpickrConfig.disableMobile
116
+ : true
117
+
109
118
  let el = html`
110
119
  <div ${wrapperStyle ? { 'class': wrapperStyle } : ''} style="min-height: 55px; display: inline-block; width: calc(100% - 10px); margin: 40px 5px 5px 5px;">
111
120
  <div style="display: inline-block; width: 100%; text-align: left; position: relative; padding: 0;">
@@ -131,7 +140,7 @@ export default ({ wrapperStyle = null, holdingPen, label, placeholder, property,
131
140
  formField(holdingPen, property)(fauxE)
132
141
  onchange && onchange(fauxE)
133
142
  })
134
- }} onchange=${e => { change({ e, holdingPen, property, label: styles.label }); onchange && onchange(e) }} oninput=${e => { e.target.defaultValue = ''; oninput && oninput(e) }} placeholder="${placeholder || ''}${required ? ' *' : ''}" type="${detectTouchscreen() ? timeOnly ? 'time' : 'date' : 'text'}" ${pattern ? { pattern } : ''} value="${holdingPen[property] || ''}" data-input />
143
+ }} onchange=${e => { change({ e, holdingPen, property, label: styles.label }); onchange && onchange(e) }} oninput=${e => { e.target.defaultValue = ''; oninput && oninput(e) }} placeholder="${placeholder || ''}${required ? ' *' : ''}" type="${resolvedDisableMobile ? 'text' : (detectTouchscreen() ? (timeOnly ? 'time' : 'date') : 'text')}" ${pattern ? { pattern } : ''} value="${holdingPen[property] || ''}" data-input />
135
144
  </div>
136
145
  </div>
137
146
  `
@@ -140,7 +149,7 @@ export default ({ wrapperStyle = null, holdingPen, label, placeholder, property,
140
149
  // internal clear/close handlers can access it consistently via parent wrappers.
141
150
  // Using `this` or the fragment caused errors after migrating to halfcab/lit.
142
151
  const wrapper = el.firstElementChild || el
143
- attachFlatpickr(wrapper, flatpickr, Object.assign({}, flatpickrConfig, {
152
+ attachFlatpickr(wrapper, flatpickr, Object.assign({}, { disableMobile: resolvedDisableMobile }, flatpickrConfig, {
144
153
  wrap: true,
145
154
  onValueUpdate: (fpDate, dateString) => {
146
155
  let fauxE = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stalefish",
3
- "version": "8.0.3",
3
+ "version": "8.0.4",
4
4
  "description": "Simple function based component library for halfcab tagged template literals",
5
5
  "main": "index.mjs",
6
6
  "module": "index.mjs",