@pantograph/pattern-vue 0.0.1 → 0.0.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.
@@ -1,16 +1,12 @@
1
1
  import { InputExtendsEmits, InputExtendsProps, InputNotExtendsEmits, InputNotExtendsProps, InputSlots } from '@pantograph/vue';
2
2
  /**
3
- * Props for the InputPassword component
4
- *
5
- * Important:
6
- * - When a component wants to reuse and extend another component's prop type in
7
- * Vue macros (`defineProps<T>()`), do NOT import a single "final" props type.
8
- * - Instead, import the split pair (`InputExtendsProps` + `InputNotExtendsProps`)
9
- * and compose them with intersections (`&`).
10
- *
11
- * Extends all `Input` props and adds `visible` for password visibility control.
3
+ * Props inherited from Input component
4
+ */
5
+ export type InputPasswordExtendsProps = InputExtendsProps & InputNotExtendsProps;
6
+ /**
7
+ * Props specific to InputPassword component
12
8
  */
13
- export type InputPasswordProps = InputExtendsProps & InputNotExtendsProps & {
9
+ export type InputPasswordNotExtendsProps = {
14
10
  /**
15
11
  * Whether the password is visible (v-model)
16
12
  */
@@ -26,6 +22,12 @@ export type InputPasswordProps = InputExtendsProps & InputNotExtendsProps & {
26
22
  */
27
23
  invisibleIcon?: string;
28
24
  };
25
+ /**
26
+ * Props for the InputPassword component
27
+ *
28
+ * Extends all `Input` props and adds `visible` for password visibility control.
29
+ */
30
+ export type InputPasswordProps = InputPasswordExtendsProps & InputPasswordNotExtendsProps;
29
31
  /**
30
32
  * Slots for the InputPassword component
31
33
  *
@@ -34,24 +36,29 @@ export type InputPasswordProps = InputExtendsProps & InputNotExtendsProps & {
34
36
  */
35
37
  export type InputPasswordSlots = InputSlots;
36
38
  /**
37
- * Emits for the InputPassword component
38
- *
39
- * Important:
40
- * - Same rule as props: use split emit types (`InputExtendsEmits` + `InputNotExtendsEmits`)
41
- * when composing emits for `defineEmits<T>()`.
42
- *
43
- * Extends all `Input` emits and adds visible state update.
39
+ * Emits inherited from Input component
40
+ */
41
+ export type InputPasswordExtendsEmits = InputExtendsEmits & InputNotExtendsEmits;
42
+ /**
43
+ * Emits specific to InputPassword component
44
44
  */
45
- export type InputPasswordEmits = InputExtendsEmits & InputNotExtendsEmits & {
45
+ export type InputPasswordNotExtendsEmits = {
46
46
  /**
47
47
  * Emitted when the visible state is updated
48
48
  */
49
49
  'update:visible': [value: boolean];
50
50
  };
51
+ /**
52
+ * Emits for the InputPassword component
53
+ *
54
+ * Extends all `Input` emits and adds visible state update.
55
+ */
56
+ export type InputPasswordEmits = InputPasswordExtendsEmits & InputPasswordNotExtendsEmits;
51
57
  /**
52
58
  * Default props for the InputPassword component
53
59
  */
54
60
  export declare const INPUT_PASSWORD_DEFAULT_PROPS: {
61
+ readonly visible: undefined;
55
62
  readonly visibleIcon: "tabler:eye-off";
56
63
  readonly invisibleIcon: "tabler:eye";
57
64
  readonly readonly: undefined;
@@ -80,6 +87,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<In
80
87
  disabled: boolean;
81
88
  clearIcon: string;
82
89
  bordered: boolean;
90
+ visible: boolean;
83
91
  visibleIcon: string;
84
92
  invisibleIcon: string;
85
93
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, Readonly<import('@pantograph/vue').InputExtendsSlots> & import('@pantograph/vue').InputExtendsSlots>;
@@ -1,6 +1,6 @@
1
1
  import { DefineComponent } from '@pantograph/utils-vue';
2
- import { default as InputPassword, InputPasswordSlots, InputPasswordEmits, InputPasswordProps, INPUT_PASSWORD_DEFAULT_PROPS } from './InputPassword';
3
- export { InputPassword, type InputPasswordProps, type InputPasswordSlots, type InputPasswordEmits, INPUT_PASSWORD_DEFAULT_PROPS, };
2
+ import { default as InputPassword, InputPasswordSlots, InputPasswordEmits, InputPasswordExtendsEmits, InputPasswordExtendsProps, InputPasswordNotExtendsEmits, InputPasswordNotExtendsProps, InputPasswordProps, INPUT_PASSWORD_DEFAULT_PROPS } from './InputPassword';
3
+ export { InputPassword, type InputPasswordProps, type InputPasswordExtendsProps, type InputPasswordNotExtendsProps, type InputPasswordSlots, type InputPasswordEmits, type InputPasswordExtendsEmits, type InputPasswordNotExtendsEmits, INPUT_PASSWORD_DEFAULT_PROPS, };
4
4
  declare module 'vue' {
5
5
  interface GlobalComponents {
6
6
  InputPassword: DefineComponent<InputPasswordProps, InputPasswordSlots, InputPasswordEmits>;
package/dist/use/index.js CHANGED
@@ -52,6 +52,7 @@ function W(s, e) {
52
52
  }
53
53
  const P = {
54
54
  ...D,
55
+ visible: void 0,
55
56
  visibleIcon: "tabler:eye-off",
56
57
  invisibleIcon: "tabler:eye"
57
58
  }, u = /* @__PURE__ */ A({
@@ -98,10 +99,10 @@ const P = {
98
99
  defaultValue: !1,
99
100
  passive: t.visible === void 0
100
101
  }
101
- ), i = a(() => n.value ? "text" : "password"), I = () => {
102
+ ), i = a(() => n.value ? "text" : "password"), v = () => {
102
103
  n.value = !n.value;
103
- }, v = W(t, r), _ = N(), p = a(
104
- () => H({ ..._, ...v.value }, [
104
+ }, I = W(t, r), _ = N(), p = a(
105
+ () => H({ ..._, ...I.value }, [
105
106
  "visible",
106
107
  "onUpdate:visible",
107
108
  "invisibleIcon",
@@ -109,14 +110,14 @@ const P = {
109
110
  ])
110
111
  ), B = () => {
111
112
  const d = (c) => {
112
- var b;
113
- const f = (b = o.trailing) == null ? void 0 : b.call(o, c);
114
- return S(f) ? y(z, {
113
+ var f;
114
+ const b = (f = o.trailing) == null ? void 0 : f.call(o, c);
115
+ return S(b) ? y(z, {
115
116
  size: c.iconSize,
116
117
  icon: n.value ? t.visibleIcon : t.invisibleIcon,
117
- onClick: I,
118
+ onClick: v,
118
119
  "aria-label": n.value ? "Hide password" : "Show password"
119
- }) : f;
120
+ }) : b;
120
121
  };
121
122
  return y(
122
123
  x,
@@ -138,7 +139,7 @@ const P = {
138
139
  }
139
140
  });
140
141
  Object.assign(u, w(u, "InputPassword"));
141
- const $ = "0.0.0", q = function(s, e = {}) {
142
+ const $ = "0.0.2", q = function(s, e = {}) {
142
143
  const { cssInJs: t } = e;
143
144
  return s.config.globalProperties.$pantographCssInJs = t, import("@pantograph/tokens/style/index.css"), t || import("@pantograph/styles/index.css"), Object.values(L).forEach((o) => {
144
145
  o.install && s.use(o);
@@ -1 +1 @@
1
- "use strict";var C=Object.create;var _=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var T=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of h(e))!E.call(o,s)&&s!==t&&_(o,s,{get:()=>e[s],enumerable:!(n=A(e,s))||n.enumerable});return o};var v=(o,e,t)=>(t=o!=null?C(j(o)):{},T(e||!o||!o.__esModule?_(t,"default",{value:o,enumerable:!0}):t,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@pantograph/utils-vue"),r=require("vue"),d=require("@pantograph/utils"),u=require("@pantograph/vue"),N=Object.freeze(Object.defineProperty({__proto__:null,get INPUT_PASSWORD_DEFAULT_PROPS(){return y},get InputPassword(){return c},get default(){return I}},Symbol.toStringTag,{value:"Module"}));function F(o,e){const t={...o};for(let n=0;n<e.length;n++){const s=e[n];delete t[s]}return t}function U(o){const e=r.getCurrentInstance(),t=e==null?void 0:e.type.emits,n={};return t!=null&&t.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),t==null||t.forEach(s=>{n[r.toHandlerKey(r.camelize(s))]=(...i)=>o(s,...i)}),n}function V(o){const e=r.getCurrentInstance(),t=Object.keys((e==null?void 0:e.type.props)??{}).reduce((s,i)=>{const l=(e==null?void 0:e.type.props[i]).default;return l!==void 0&&(s[i]=l),s},{}),n=r.toRef(o);return r.computed(()=>{const s={},i=(e==null?void 0:e.vnode.props)??{};return Object.keys(i).forEach(l=>{s[r.camelize(l)]=i[l]}),Object.keys({...t,...s}).reduce((l,a)=>(n.value[a]!==void 0&&(l[a]=n.value[a]),l),{})})}function D(o,e){const t=V(o),n=e?U(e):{};return r.computed(()=>({...t.value,...n}))}const y={...u.INPUT_DEFAULT_PROPS,visibleIcon:"tabler:eye-off",invisibleIcon:"tabler:eye"},c=r.defineComponent({...d.getComponentOptions("InputPassword"),__name:"InputPassword",props:r.mergeDefaults({readonly:{type:Boolean},disabled:{type:Boolean},autoFocus:{type:Boolean},leading:{},trailing:{},clearIcon:{},trailingCls:{type:[Array,Object,String,Number,null,Boolean]},clearIconCls:{type:[Array,Object,String,Number,null,Boolean]},dividerCls:{type:[Array,Object,String,Number,null,Boolean]},leadingCls:{type:[Array,Object,String,Number,null,Boolean]},class:{type:[Array,Object,String,Number,null,Boolean]},allowClear:{type:Boolean},bordered:{type:Boolean},simple:{type:Boolean},size:{},status:{},steps:{type:Boolean},contentFit:{type:Boolean},outsideFgColor:{type:Boolean},id:{},maxlength:{},type:{},placeholder:{},required:{type:Boolean},modelValue:{},defaultValue:{},visible:{type:Boolean},visibleIcon:{},invisibleIcon:{}},y),emits:["blur","focus","clear","pointerdown","update:modelValue","change","update:visible"],setup(o,{emit:e}){const t=o,n=r.useSlots(),s=e,i=d.getBemElement(u.inputPrefix,"password_type"),l=b.useVModel(t,"visible",s,{defaultValue:!1,passive:t.visible===void 0}),a=r.computed(()=>l.value?"text":"password"),S=()=>{l.value=!l.value},O=D(t,s),B=r.useAttrs(),f=r.computed(()=>F({...B,...O.value},["visible","onUpdate:visible","invisibleIcon","visibleIcon"])),w=()=>{const g=p=>{var P;const m=(P=n.trailing)==null?void 0:P.call(n,p);return b.isEmptyElement(m)?r.h(u.Icon,{size:p.iconSize,icon:l.value?t.visibleIcon:t.invisibleIcon,onClick:S,"aria-label":l.value?"Hide password":"Show password"}):m};return r.h(u.Input,{...f.value,type:a.value,trailingCls:d.normCls(i,f.value.trailingCls)},{...n,trailing:g})};return(g,p)=>(r.openBlock(),r.createBlock(w))}});Object.assign(c,b.installComponent(c,"InputPassword"));const R="0.0.0",k=function(o,e={}){const{cssInJs:t}=e;return o.config.globalProperties.$pantographCssInJs=t,import("@pantograph/tokens/style/index.css"),t||import("@pantograph/styles/index.css"),Object.values(N).forEach(n=>{n.install&&o.use(n)}),o},I={version:R,install:k};exports.INPUT_PASSWORD_DEFAULT_PROPS=y;exports._sfc_main=c;exports.default=I;
1
+ "use strict";var C=Object.create;var v=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var T=(o,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of h(e))!E.call(o,s)&&s!==t&&v(o,s,{get:()=>e[s],enumerable:!(n=A(e,s))||n.enumerable});return o};var _=(o,e,t)=>(t=o!=null?C(j(o)):{},T(e||!o||!o.__esModule?v(t,"default",{value:o,enumerable:!0}):t,o));Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("@pantograph/utils-vue"),l=require("vue"),d=require("@pantograph/utils"),u=require("@pantograph/vue"),N=Object.freeze(Object.defineProperty({__proto__:null,get INPUT_PASSWORD_DEFAULT_PROPS(){return y},get InputPassword(){return c},get default(){return I}},Symbol.toStringTag,{value:"Module"}));function F(o,e){const t={...o};for(let n=0;n<e.length;n++){const s=e[n];delete t[s]}return t}function U(o){const e=l.getCurrentInstance(),t=e==null?void 0:e.type.emits,n={};return t!=null&&t.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),t==null||t.forEach(s=>{n[l.toHandlerKey(l.camelize(s))]=(...i)=>o(s,...i)}),n}function V(o){const e=l.getCurrentInstance(),t=Object.keys((e==null?void 0:e.type.props)??{}).reduce((s,i)=>{const r=(e==null?void 0:e.type.props[i]).default;return r!==void 0&&(s[i]=r),s},{}),n=l.toRef(o);return l.computed(()=>{const s={},i=(e==null?void 0:e.vnode.props)??{};return Object.keys(i).forEach(r=>{s[l.camelize(r)]=i[r]}),Object.keys({...t,...s}).reduce((r,a)=>(n.value[a]!==void 0&&(r[a]=n.value[a]),r),{})})}function D(o,e){const t=V(o),n=e?U(e):{};return l.computed(()=>({...t.value,...n}))}const y={...u.INPUT_DEFAULT_PROPS,visible:void 0,visibleIcon:"tabler:eye-off",invisibleIcon:"tabler:eye"},c=l.defineComponent({...d.getComponentOptions("InputPassword"),__name:"InputPassword",props:l.mergeDefaults({readonly:{type:Boolean},disabled:{type:Boolean},autoFocus:{type:Boolean},leading:{},trailing:{},clearIcon:{},trailingCls:{type:[Array,Object,String,Number,null,Boolean]},clearIconCls:{type:[Array,Object,String,Number,null,Boolean]},dividerCls:{type:[Array,Object,String,Number,null,Boolean]},leadingCls:{type:[Array,Object,String,Number,null,Boolean]},class:{type:[Array,Object,String,Number,null,Boolean]},allowClear:{type:Boolean},bordered:{type:Boolean},simple:{type:Boolean},size:{},status:{},steps:{type:Boolean},contentFit:{type:Boolean},outsideFgColor:{type:Boolean},id:{},maxlength:{},type:{},placeholder:{},required:{type:Boolean},modelValue:{},defaultValue:{},visible:{type:Boolean},visibleIcon:{},invisibleIcon:{}},y),emits:["blur","focus","clear","pointerdown","update:modelValue","change","update:visible"],setup(o,{emit:e}){const t=o,n=l.useSlots(),s=e,i=d.getBemElement(u.inputPrefix,"password_type"),r=b.useVModel(t,"visible",s,{defaultValue:!1,passive:t.visible===void 0}),a=l.computed(()=>r.value?"text":"password"),S=()=>{r.value=!r.value},O=D(t,s),B=l.useAttrs(),f=l.computed(()=>F({...B,...O.value},["visible","onUpdate:visible","invisibleIcon","visibleIcon"])),w=()=>{const g=p=>{var P;const m=(P=n.trailing)==null?void 0:P.call(n,p);return b.isEmptyElement(m)?l.h(u.Icon,{size:p.iconSize,icon:r.value?t.visibleIcon:t.invisibleIcon,onClick:S,"aria-label":r.value?"Hide password":"Show password"}):m};return l.h(u.Input,{...f.value,type:a.value,trailingCls:d.normCls(i,f.value.trailingCls)},{...n,trailing:g})};return(g,p)=>(l.openBlock(),l.createBlock(w))}});Object.assign(c,b.installComponent(c,"InputPassword"));const R="0.0.2",k=function(o,e={}){const{cssInJs:t}=e;return o.config.globalProperties.$pantographCssInJs=t,import("@pantograph/tokens/style/index.css"),t||import("@pantograph/styles/index.css"),Object.values(N).forEach(n=>{n.install&&o.use(n)}),o},I={version:R,install:k};exports.INPUT_PASSWORD_DEFAULT_PROPS=y;exports._sfc_main=c;exports.default=I;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pantograph/pattern-vue",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "id": "pattern-vue",
5
5
  "private": false,
6
6
  "license": "MIT",