@neovici/cosmoz-input 6.0.0-beta.1 → 6.0.0-beta.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.
@@ -7,11 +7,12 @@ import { attributes, render } from './render';
7
7
  import { styles } from './styles';
8
8
  import { useAllowedPattern } from './use-allowed-pattern';
9
9
  import { useInput } from './use-input';
10
- import { getPlaceholder } from './util';
10
+ import { defaultMax, getPlaceholder } from './util';
11
11
  const observedAttributes = [
12
12
  'type',
13
13
  'variant',
14
14
  'hint',
15
+ 'error-message',
15
16
  'compact',
16
17
  'required',
17
18
  'pattern',
@@ -50,7 +51,7 @@ export const Input = (host) => {
50
51
  @focus=${onFocus}
51
52
  @blur=${onFocus}
52
53
  min=${ifDefined(min)}
53
- max=${ifDefined(max)}
54
+ max=${ifDefined(defaultMax(type, max))}
54
55
  step=${ifDefined(step)}
55
56
  />
56
57
  `, host);
@@ -7,7 +7,15 @@ import { attributes, render } from './render';
7
7
  import { styles } from './styles';
8
8
  import { useAutoHeight } from './use-auto-height';
9
9
  import { useInput } from './use-input';
10
- const observedAttributes = ['rows', 'placeholder', ...attributes];
10
+ const observedAttributes = [
11
+ 'rows',
12
+ 'placeholder',
13
+ 'label',
14
+ 'hint',
15
+ 'error-message',
16
+ 'required',
17
+ ...attributes,
18
+ ];
11
19
  export const Textarea = (host) => {
12
20
  const { autocomplete, value, placeholder, readonly, disabled, rows, cols, maxlength, } = host, { onChange, onFocus, onInput, onRef } = useInput(host);
13
21
  useAutoHeight(host);
@@ -88,5 +88,5 @@ const style = css `
88
88
  `;
89
89
  customElements.define('cosmoz-toggle', component(CosmozToggle, {
90
90
  styleSheets: [style, toggleStyles],
91
- observedAttributes: ['disabled'],
91
+ observedAttributes: ['label', 'disabled', 'error'],
92
92
  }));
package/dist/render.js CHANGED
@@ -15,9 +15,9 @@ export const render = (control, { hint, label, invalid, errorMessage, compact, r
15
15
  ${control}
16
16
  </div>
17
17
  <!-- compact: tooltip always visible, red icon when invalid -->
18
- ${when(invalid, () => html `<cosmoz-tooltip
18
+ ${when(compact && invalid && errorMessage, () => html `<cosmoz-tooltip
19
19
  placement="top"
20
- description=${invalid ? errorMessage : label}
20
+ description=${errorMessage}
21
21
  delay="300"
22
22
  >
23
23
  ${infoCircleIcon({ width: '16px', height: '16px' })}
package/dist/styles.js CHANGED
@@ -48,7 +48,7 @@ export const styles = css `
48
48
  }
49
49
 
50
50
  .wrap:has(#input:focus) {
51
- box-shadow: 0 0 0 2px var(--cz-color-border-brand);
51
+ box-shadow: var(--cz-focus-ring);
52
52
  }
53
53
 
54
54
  :host([invalid]) .wrap {
@@ -56,7 +56,7 @@ export const styles = css `
56
56
  }
57
57
 
58
58
  :host([invalid]) .wrap:has(#input:focus) {
59
- box-shadow: 0 0 0 2px var(--cz-color-border-error);
59
+ box-shadow: var(--cz-focus-ring-error);
60
60
  }
61
61
 
62
62
  .control {
package/dist/util.d.ts CHANGED
@@ -2,4 +2,5 @@ interface Props {
2
2
  placeholder?: string;
3
3
  }
4
4
  export declare const getPlaceholder: ({ placeholder }: Props) => string;
5
+ export declare const defaultMax: (type: string, max?: string) => string | undefined;
5
6
  export {};
package/dist/util.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export const getPlaceholder = ({ placeholder }) => {
2
2
  return placeholder || ' ';
3
3
  };
4
+ export const defaultMax = (type, max) => max ?? (type === 'date' ? '9999-12-31' : undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-input",
3
- "version": "6.0.0-beta.1",
3
+ "version": "6.0.0-beta.3",
4
4
  "description": "A input web component",
5
5
  "keywords": [
6
6
  "lit-html",
@@ -76,7 +76,7 @@
76
76
  "lit-html": "^2.0.0 || ^3.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@commitlint/cli": "^20.0.0",
79
+ "@commitlint/cli": "^21.0.0",
80
80
  "@commitlint/config-conventional": "^20.0.0",
81
81
  "@neovici/cfg": "^2.8.0",
82
82
  "@neovici/testing": "^2.3.0",
@@ -96,7 +96,7 @@
96
96
  "lint-staged": "^16.2.7",
97
97
  "semantic-release": "^25.0.2",
98
98
  "shadow-dom-testing-library": "^1.13.1",
99
- "sinon": "^21.0.0",
99
+ "sinon": "^22.0.0",
100
100
  "storybook": "^10.1.9",
101
101
  "vitest": "^4.0.18",
102
102
  "@types/mocha": "^10.0.3",