mado-ui 0.4.0 → 0.5.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/css/index.css +563 -0
- package/dist/components/drop-down.d.ts +5 -4
- package/dist/components/iframe.d.ts +5 -5
- package/dist/components/index.d.ts +2 -0
- package/dist/components/video.d.ts +30 -0
- package/dist/components.esm.js +426 -8
- package/dist/components.esm.js.map +1 -1
- package/dist/components.js +427 -7
- package/dist/components.js.map +1 -1
- package/dist/hooks/create-fast-context.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks.esm.js.map +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/icons/10-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/10-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/15-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/15-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/3-people.d.ts +1 -1
- package/dist/icons/3-rectangles-desktop-fill.d.ts +1 -1
- package/dist/icons/3-rectangles-desktop.d.ts +1 -1
- package/dist/icons/30-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/30-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/45-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/45-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/5-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/5-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/60-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/60-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/75-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/75-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/90-arrow-trianglehead-clockwise.d.ts +2 -0
- package/dist/icons/90-arrow-trianglehead-counterclockwise.d.ts +2 -0
- package/dist/icons/airplane.d.ts +1 -1
- package/dist/icons/arrow-down-backward-and-arrow-up-forward-rectangle.d.ts +2 -0
- package/dist/icons/arrow-triangle-2-circlepath-circle-fill.d.ts +1 -1
- package/dist/icons/arrow-triangle-2-circlepath-circle.d.ts +1 -1
- package/dist/icons/arrow-up-forward-and-arrow-down-backward-rectangle.d.ts +2 -0
- package/dist/icons/bag-fill.d.ts +1 -1
- package/dist/icons/banknote.d.ts +1 -1
- package/dist/icons/bell-fill.d.ts +1 -1
- package/dist/icons/bolt-car.d.ts +1 -1
- package/dist/icons/bolt-fill.d.ts +1 -1
- package/dist/icons/bolt-ring-closed.d.ts +1 -1
- package/dist/icons/bolt-trianglebadge-exclamationmark.d.ts +1 -1
- package/dist/icons/book-fill.d.ts +1 -1
- package/dist/icons/bookmark-fill.d.ts +1 -1
- package/dist/icons/briefcase-fill.d.ts +1 -1
- package/dist/icons/bubble-left-fill.d.ts +1 -1
- package/dist/icons/building-2-fill.d.ts +1 -1
- package/dist/icons/calendar.d.ts +1 -1
- package/dist/icons/camera-fill.d.ts +1 -1
- package/dist/icons/car-fill.d.ts +1 -1
- package/dist/icons/cart-fill.d.ts +1 -1
- package/dist/icons/chart-bar-doc-horizontal.d.ts +1 -1
- package/dist/icons/checkmark-seal.d.ts +1 -1
- package/dist/icons/checkmark.d.ts +1 -1
- package/dist/icons/chevron-compact-down.d.ts +1 -1
- package/dist/icons/chevron-down.d.ts +1 -1
- package/dist/icons/chevron-left-forwardslash-chevron-right.d.ts +1 -1
- package/dist/icons/chevron-left.d.ts +1 -1
- package/dist/icons/chevron-right.d.ts +1 -1
- package/dist/icons/chevron-up-chevron-down.d.ts +1 -1
- package/dist/icons/circle-fill.d.ts +1 -1
- package/dist/icons/clock-badge-checkmark.d.ts +1 -1
- package/dist/icons/clock-fill.d.ts +1 -1
- package/dist/icons/cloud-fill.d.ts +1 -1
- package/dist/icons/cube-fill.d.ts +1 -1
- package/dist/icons/curve-point-left.d.ts +1 -1
- package/dist/icons/dial-high.d.ts +1 -1
- package/dist/icons/doc-fill.d.ts +1 -1
- package/dist/icons/doc-on-clipboard.d.ts +1 -1
- package/dist/icons/doc-on-doc-fill.d.ts +1 -1
- package/dist/icons/doc-on-doc.d.ts +1 -1
- package/dist/icons/doc-text-magnifyingglass.d.ts +1 -1
- package/dist/icons/dollar-sign.d.ts +1 -1
- package/dist/icons/ellipsis-circle-fill.d.ts +1 -1
- package/dist/icons/ellipsis-circle.d.ts +1 -1
- package/dist/icons/envelope-fill.d.ts +1 -1
- package/dist/icons/envelope.d.ts +1 -1
- package/dist/icons/exclamationmark-octagon.d.ts +1 -1
- package/dist/icons/eye.d.ts +1 -1
- package/dist/icons/figure-water-fitness.d.ts +1 -1
- package/dist/icons/flag-fill.d.ts +1 -1
- package/dist/icons/flame-fill.d.ts +1 -1
- package/dist/icons/folder-fill.d.ts +1 -1
- package/dist/icons/folder.d.ts +1 -1
- package/dist/icons/gearshape-fill.d.ts +1 -1
- package/dist/icons/gearshape.d.ts +1 -1
- package/dist/icons/gift-fill.d.ts +1 -1
- package/dist/icons/globe-americas-fill.d.ts +1 -1
- package/dist/icons/hare-fill.d.ts +1 -1
- package/dist/icons/house-deskclock.d.ts +1 -1
- package/dist/icons/house-fill.d.ts +1 -1
- package/dist/icons/house.d.ts +1 -1
- package/dist/icons/index.d.ts +143 -104
- package/dist/icons/iphone-house.d.ts +1 -1
- package/dist/icons/light-ribbon.d.ts +1 -1
- package/dist/icons/lightbulb-fill.d.ts +1 -1
- package/dist/icons/lightbulb-led.d.ts +1 -1
- package/dist/icons/list-bullet-clipboard-fill.d.ts +1 -1
- package/dist/icons/magnifyingglass.d.ts +1 -1
- package/dist/icons/map-pin-ellipse.d.ts +1 -1
- package/dist/icons/minus-plus-batterblock.d.ts +1 -1
- package/dist/icons/network-shield.d.ts +1 -1
- package/dist/icons/network.d.ts +1 -1
- package/dist/icons/newspaper-fill.d.ts +1 -1
- package/dist/icons/number.d.ts +1 -1
- package/dist/icons/paperplane-fill.d.ts +1 -1
- package/dist/icons/pause-fill.d.ts +2 -0
- package/dist/icons/person-crop-square.d.ts +1 -1
- package/dist/icons/person-fill-questionmark.d.ts +1 -1
- package/dist/icons/person-fill.d.ts +1 -1
- package/dist/icons/person.d.ts +1 -1
- package/dist/icons/phone-arrow-up-right.d.ts +1 -1
- package/dist/icons/phone-fill.d.ts +1 -1
- package/dist/icons/phone.d.ts +1 -1
- package/dist/icons/photo-badge-arrow-down-fill.d.ts +2 -0
- package/dist/icons/photo-badge-arrow-down.d.ts +2 -0
- package/dist/icons/play-fill.d.ts +2 -0
- package/dist/icons/play-rectangle-fill.d.ts +1 -1
- package/dist/icons/plus.d.ts +1 -1
- package/dist/icons/qrcode.d.ts +1 -1
- package/dist/icons/rectangle-fill-on-arrow-down-forward-topleading-rectangle.d.ts +2 -0
- package/dist/icons/rectangle-fill.d.ts +2 -0
- package/dist/icons/rectangle-portrait-and-arrow-left-fill.d.ts +1 -1
- package/dist/icons/rectangle-portrait-and-arrow-left.d.ts +1 -1
- package/dist/icons/rectangle-triangle-up.d.ts +2 -0
- package/dist/icons/rectangle.d.ts +2 -0
- package/dist/icons/sensor.d.ts +1 -1
- package/dist/icons/signature.d.ts +1 -1
- package/dist/icons/solar-panel.d.ts +1 -1
- package/dist/icons/speaker-fill.d.ts +2 -0
- package/dist/icons/speaker-minus-fill.d.ts +2 -0
- package/dist/icons/speaker-minus.d.ts +2 -0
- package/dist/icons/speaker-plus-fill.d.ts +2 -0
- package/dist/icons/speaker-plus.d.ts +2 -0
- package/dist/icons/speaker-slash-fill.d.ts +2 -0
- package/dist/icons/speaker-slash.d.ts +2 -0
- package/dist/icons/speaker-wave-1-fill.d.ts +2 -0
- package/dist/icons/speaker-wave-1.d.ts +2 -0
- package/dist/icons/speaker-wave-2-fill.d.ts +2 -0
- package/dist/icons/speaker-wave-2.d.ts +2 -0
- package/dist/icons/speaker-wave-3-fill.d.ts +2 -0
- package/dist/icons/speaker-wave-3.d.ts +2 -0
- package/dist/icons/speaker.d.ts +2 -0
- package/dist/icons/square-and-arrow-down-fill.d.ts +1 -1
- package/dist/icons/square-and-arrow-down.d.ts +1 -1
- package/dist/icons/square-and-arrow-up-fill.d.ts +1 -1
- package/dist/icons/square-and-arrow-up.d.ts +1 -1
- package/dist/icons/square-and-pencil-fill.d.ts +1 -1
- package/dist/icons/square-and-pencil.d.ts +1 -1
- package/dist/icons/text-bubble.d.ts +1 -1
- package/dist/icons/trash-fill.d.ts +1 -1
- package/dist/icons/trash.d.ts +1 -1
- package/dist/icons/tree.d.ts +1 -1
- package/dist/icons/umbrella-fill.d.ts +1 -1
- package/dist/icons/xmark.d.ts +1 -1
- package/dist/icons.esm.js +162 -2
- package/dist/icons.esm.js.map +1 -1
- package/dist/icons.js +203 -3
- package/dist/icons.js.map +1 -1
- package/dist/index.esm.js +426 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +427 -7
- package/dist/index.js.map +1 -1
- package/package.json +95 -94
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function createFastContext<Store>(defaultInitialState: Store): {
|
|
3
3
|
Provider: ({ initialValue, ...props }: Pick<HTMLAttributes<HTMLElement>, "children"> & {
|
|
4
4
|
initialValue?: Store;
|
|
5
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.esm.js","sources":["../src/hooks/create-fast-context.tsx","../src/hooks/use-form-context.tsx","../src/hooks/use-fieldset-context.tsx","../src/hooks/use-form-status.tsx"],"sourcesContent":["// * React\nimport { HTMLAttributes, useRef, createContext, useContext, useSyncExternalStore } from 'react'\n\nexport default function createFastContext<Store>(defaultInitialState: Store) {\n\tfunction useStoreData(initialState: Store = defaultInitialState): {\n\t\tget: () => Store\n\t\tset: (value: Store | ((prevState: Store) => Store)) => void\n\t\tsubscribe: (callback: () => void) => () => void\n\t} {\n\t\tconst store = useRef(initialState),\n\t\t\tget = () => store.current,\n\t\t\tsubscribers = useRef(new Set<() => void>())\n\n\t\tconst set = (value: Store | ((prevState: Store) => Store)) => {\n\t\t\tif (typeof value === 'function') {\n\t\t\t\tstore.current = (value as (prevState: Store) => Store)(store.current)\n\t\t\t} else {\n\t\t\t\tstore.current = value\n\t\t\t}\n\t\t\tsubscribers.current.forEach(callback => callback())\n\t\t}\n\n\t\tconst subscribe = (callback: () => void) => {\n\t\t\tsubscribers.current.add(callback)\n\t\t\treturn () => subscribers.current.delete(callback)\n\t\t}\n\n\t\treturn {\n\t\t\tget,\n\t\t\tset,\n\t\t\tsubscribe,\n\t\t}\n\t}\n\n\ttype UseStoreDataReturnType = ReturnType<typeof useStoreData>\n\n\tconst StoreContext = createContext<UseStoreDataReturnType | null>(null)\n\n\tfunction Provider({\n\t\tinitialValue = defaultInitialState,\n\t\t...props\n\t}: Pick<HTMLAttributes<HTMLElement>, 'children'> & { initialValue?: Store }) {\n\t\treturn <StoreContext.Provider value={useStoreData(initialValue)} {...props} />\n\t}\n\n\tfunction useStore<SelectorOutput>(\n\t\tselector: (store: Store) => SelectorOutput,\n\t\tinitialValue?: Store,\n\t): [SelectorOutput | undefined, ((value: Store | ((prevState: Store) => Store)) => void) | undefined] {\n\t\tconst store = useContext(StoreContext)\n\n\t\tif (!store) {\n\t\t\tconst localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState\n\n\t\t\tconst selectedValue = selector(localStoreValue)\n\t\t\tconst noOpSet = () => console.warn('Attempting to set store value outside of Provider')\n\n\t\t\treturn [selectedValue, noOpSet]\n\t\t}\n\n\t\tconst state = useSyncExternalStore(\n\t\t\tstore.subscribe,\n\t\t\t() => selector(store.get()),\n\t\t\t() => selector(initialValue !== undefined ? initialValue : defaultInitialState),\n\t\t)\n\n\t\treturn [state, store.set]\n\t}\n\n\treturn {\n\t\tProvider,\n\t\tuseStore,\n\t}\n}\n","// * Types\nexport type FieldType = 'array' | 'email' | 'file' | 'number' | 'object' | 'string' | 'tel' | 'textarea' | 'url'\n\nexport type StringField = {\n\ttype: 'email' | 'file' | 'number' | 'string' | 'tel' | 'textarea' | 'url'\n\tvalue: string\n\trequired?: boolean\n\tinvalid?: boolean\n}\n\nexport type ObjectField = { type: 'object'; fields: Field[] }\n\nexport type ArrayField = { type: 'array'; of: ArrayObjectOrNormalField }\n\ntype ArrayObjectOrNormalField = StringField | ArrayField | ObjectField\n\nexport type Field = ArrayObjectOrNormalField & {\n\tid: string\n\tname: string\n}\n\nexport type FormContext = Field[]\n\n// * React\nimport { ReactNode, useCallback } from 'react'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\n/**\n * # Define Field\n *\n * This is a helper function to define a field in a form context with type safety.\n */\nexport function defineField(fieldDefinition: Field) {\n\treturn fieldDefinition\n}\n\nexport function isStringField(field: Field) {\n\treturn Boolean(field.type !== 'object' && field.type !== 'array')\n}\n\nconst { Provider, useStore } = createFastContext<FormContext>([])\n\nexport function FormContextProvider({ children }: { children?: ReactNode }) {\n\treturn <Provider>{children}</Provider>\n}\n\nexport function useFormContext() {\n\tconst [formContext, setFormContext] = useStore(store => store)\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst otherFields = (prevContext || []).filter(otherField => otherField.id !== field.id)\n\n\t\t\treturn [...otherFields, field]\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFormContext?.(prevContext => (prevContext || []).filter(field => field.id !== fieldID))\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst field = prevContext.find(({ id }) => id === fieldID)\n\n\t\t\tif (!field) throw new Error(`Field with id \"${fieldID}\" not found in form context.`)\n\n\t\t\tconst otherFields = prevContext.filter(({ id }) => id !== fieldID)\n\n\t\t\tconst updatedField = { ...field, ...updates } as Field\n\n\t\t\treturn [...otherFields, updatedField]\n\t\t})\n\t}, [])\n\n\treturn [formContext, { registerField, removeField, updateField }] as const\n}\n","// * Types\nimport { defineField, Field, isStringField, StringField, useFormContext } from './use-form-context'\n\nexport type FieldsetContextValue = {\n\tfieldList: Field[]\n\tdecorative: boolean\n\tid: string\n\tjoin?: string\n\tname: string\n}\n\nexport type FieldsetContext = [\n\tFieldsetContextValue | undefined,\n\t{\n\t\tregisterField: (field: Field) => void\n\t\tremoveField: (fieldID: string) => void\n\t\tupdateField: (fieldID: string, updates: Partial<Field>) => void\n\t},\n]\n\n// * React\nimport { ReactNode, useCallback, useEffect } from 'react'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\nconst { Provider, useStore } = createFastContext<FieldsetContextValue | undefined>(undefined)\n\nexport function FieldsetContextProvider({\n\tchildren,\n\tinitialValue,\n}: {\n\tchildren?: ReactNode\n\tinitialValue?: FieldsetContextValue\n}) {\n\treturn <Provider initialValue={initialValue}>{children}</Provider>\n}\n\nexport function useFieldsetContext(): FieldsetContext {\n\tconst [fieldsetContext, setFieldsetContext] = useStore(store => store),\n\t\t[, formContextFunctions] = useFormContext()\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\tconst existingFieldIndex = prev.fieldList.findIndex(existingField => existingField.id === field.id)\n\n\t\t\tconst newFieldList =\n\t\t\t\texistingFieldIndex >= 0\n\t\t\t\t\t? prev.fieldList.map((existingField, index) => (index === existingFieldIndex ? field : existingField))\n\t\t\t\t\t: [...prev.fieldList, field]\n\n\t\t\treturn { ...prev, fieldList: newFieldList }\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.filter(field => field.id !== fieldID),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.map(field => (field.id === fieldID ? ({ ...field, ...updates } as Field) : field)),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst createFormContextEntry = useCallback((fieldsetEntry: FieldsetContextValue): Field => {\n\t\tif (fieldsetEntry.join) {\n\t\t\tconst joinedValue = fieldsetEntry.fieldList\n\t\t\t\t.filter(field => isStringField(field) && (field as StringField).value !== '')\n\t\t\t\t.map(field => (field as StringField).value)\n\t\t\t\t.join(fieldsetEntry.join)\n\n\t\t\treturn defineField({\n\t\t\t\ttype: 'string',\n\t\t\t\tid: fieldsetEntry.id,\n\t\t\t\tname: fieldsetEntry.name,\n\t\t\t\tvalue: joinedValue,\n\t\t\t\trequired: fieldsetEntry.fieldList.some(field => (field as StringField).required),\n\t\t\t\tinvalid: fieldsetEntry.fieldList.some(field => (field as StringField).invalid),\n\t\t\t})\n\t\t}\n\n\t\treturn defineField({\n\t\t\ttype: 'object',\n\t\t\tid: fieldsetEntry.id,\n\t\t\tname: fieldsetEntry.name,\n\t\t\tfields: fieldsetEntry.fieldList,\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!fieldsetContext || fieldsetContext.decorative) return\n\n\t\tconst formContextEntry = createFormContextEntry(fieldsetContext)\n\n\t\tformContextFunctions.registerField(formContextEntry)\n\n\t\treturn () => {\n\t\t\tformContextFunctions.removeField(fieldsetContext.id)\n\t\t}\n\t}, [fieldsetContext, formContextFunctions.registerField, formContextFunctions.removeField, createFormContextEntry])\n\n\treturn [fieldsetContext, { registerField, removeField, updateField }]\n}\n","// * Types\nimport { ReactNode, Suspense } from 'react'\n\nexport type FormStatus = 'error' | 'incomplete' | 'loading' | 'ready' | 'success' | 'readonly'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\nconst DEFAULT_STATUS: FormStatus = 'incomplete'\n\nconst { Provider, useStore } = createFastContext<FormStatus>(DEFAULT_STATUS)\n\nexport function FormStatusProvider({\n\tchildren,\n\tinitialStatus = DEFAULT_STATUS,\n}: {\n\tchildren?: ReactNode\n\tinitialStatus?: FormStatus\n}) {\n\treturn (\n\t\t<Suspense>\n\t\t\t<Provider initialValue={initialStatus}>{children}</Provider>\n\t\t</Suspense>\n\t)\n}\n\nexport function useFormStatus() {\n\treturn useStore(store => store)\n}\n"],"names":["_jsx","Provider","useStore"],"mappings":";;;AAGc,SAAU,iBAAiB,CAAQ,mBAA0B,EAAA;IAC1E,SAAS,YAAY,CAAC,YAAA,GAAsB,mBAAmB,EAAA;QAK9D,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,EACjC,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,EACzB,WAAW,GAAG,MAAM,CAAC,IAAI,GAAG,EAAc,CAAC;AAE5C,QAAA,MAAM,GAAG,GAAG,CAAC,KAA4C,KAAI;AAC5D,YAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;gBAChC,KAAK,CAAC,OAAO,GAAI,KAAqC,CAAC,KAAK,CAAC,OAAO,CAAC;YACtE;iBAAO;AACN,gBAAA,KAAK,CAAC,OAAO,GAAG,KAAK;YACtB;AACA,YAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC;AACpD,QAAA,CAAC;AAED,QAAA,MAAM,SAAS,GAAG,CAAC,QAAoB,KAAI;AAC1C,YAAA,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;YACjC,OAAO,MAAM,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;AAClD,QAAA,CAAC;QAED,OAAO;YACN,GAAG;YACH,GAAG;YACH,SAAS;SACT;IACF;AAIA,IAAA,MAAM,YAAY,GAAG,aAAa,CAAgC,IAAI,CAAC;IAEvE,SAAS,QA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9B,EAAA;AACA,IAAA,QACCF,GAAA,CAAC,QAAQ,EAAA,EAAA,QAAA,EACRA,IAAC,QAAQ,EAAA,EAAC,YAAY,EAAE,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAY,EAAA,CAClD;AAEb;SAEgB,aAAa,GAAA;IAC5B,OAAO,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC;AAChC;;;;"}
|
|
1
|
+
{"version":3,"file":"hooks.esm.js","sources":["../src/hooks/create-fast-context.tsx","../src/hooks/use-form-context.tsx","../src/hooks/use-fieldset-context.tsx","../src/hooks/use-form-status.tsx"],"sourcesContent":["// * React\nimport { HTMLAttributes, useRef, createContext, useContext, useSyncExternalStore } from 'react'\n\nexport function createFastContext<Store>(defaultInitialState: Store) {\n\tfunction useStoreData(initialState: Store = defaultInitialState): {\n\t\tget: () => Store\n\t\tset: (value: Store | ((prevState: Store) => Store)) => void\n\t\tsubscribe: (callback: () => void) => () => void\n\t} {\n\t\tconst store = useRef(initialState),\n\t\t\tget = () => store.current,\n\t\t\tsubscribers = useRef(new Set<() => void>())\n\n\t\tconst set = (value: Store | ((prevState: Store) => Store)) => {\n\t\t\tif (typeof value === 'function') {\n\t\t\t\tstore.current = (value as (prevState: Store) => Store)(store.current)\n\t\t\t} else {\n\t\t\t\tstore.current = value\n\t\t\t}\n\t\t\tsubscribers.current.forEach(callback => callback())\n\t\t}\n\n\t\tconst subscribe = (callback: () => void) => {\n\t\t\tsubscribers.current.add(callback)\n\t\t\treturn () => subscribers.current.delete(callback)\n\t\t}\n\n\t\treturn {\n\t\t\tget,\n\t\t\tset,\n\t\t\tsubscribe,\n\t\t}\n\t}\n\n\ttype UseStoreDataReturnType = ReturnType<typeof useStoreData>\n\n\tconst StoreContext = createContext<UseStoreDataReturnType | null>(null)\n\n\tfunction Provider({\n\t\tinitialValue = defaultInitialState,\n\t\t...props\n\t}: Pick<HTMLAttributes<HTMLElement>, 'children'> & { initialValue?: Store }) {\n\t\treturn <StoreContext.Provider value={useStoreData(initialValue)} {...props} />\n\t}\n\n\tfunction useStore<SelectorOutput>(\n\t\tselector: (store: Store) => SelectorOutput,\n\t\tinitialValue?: Store,\n\t): [SelectorOutput | undefined, ((value: Store | ((prevState: Store) => Store)) => void) | undefined] {\n\t\tconst store = useContext(StoreContext)\n\n\t\tif (!store) {\n\t\t\tconst localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState\n\n\t\t\tconst selectedValue = selector(localStoreValue)\n\t\t\tconst noOpSet = () => console.warn('Attempting to set store value outside of Provider')\n\n\t\t\treturn [selectedValue, noOpSet]\n\t\t}\n\n\t\tconst state = useSyncExternalStore(\n\t\t\tstore.subscribe,\n\t\t\t() => selector(store.get()),\n\t\t\t() => selector(initialValue !== undefined ? initialValue : defaultInitialState),\n\t\t)\n\n\t\treturn [state, store.set]\n\t}\n\n\treturn {\n\t\tProvider,\n\t\tuseStore,\n\t}\n}\n","// * Types\nexport type FieldType = 'array' | 'email' | 'file' | 'number' | 'object' | 'string' | 'tel' | 'textarea' | 'url'\n\nexport type StringField = {\n\ttype: 'email' | 'file' | 'number' | 'string' | 'tel' | 'textarea' | 'url'\n\tvalue: string\n\trequired?: boolean\n\tinvalid?: boolean\n}\n\nexport type ObjectField = { type: 'object'; fields: Field[] }\n\nexport type ArrayField = { type: 'array'; of: ArrayObjectOrNormalField }\n\ntype ArrayObjectOrNormalField = StringField | ArrayField | ObjectField\n\nexport type Field = ArrayObjectOrNormalField & {\n\tid: string\n\tname: string\n}\n\nexport type FormContext = Field[]\n\n// * React\nimport { ReactNode, useCallback } from 'react'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\n/**\n * # Define Field\n *\n * This is a helper function to define a field in a form context with type safety.\n */\nexport function defineField(fieldDefinition: Field) {\n\treturn fieldDefinition\n}\n\nexport function isStringField(field: Field) {\n\treturn Boolean(field.type !== 'object' && field.type !== 'array')\n}\n\nconst { Provider, useStore } = createFastContext<FormContext>([])\n\nexport function FormContextProvider({ children }: { children?: ReactNode }) {\n\treturn <Provider>{children}</Provider>\n}\n\nexport function useFormContext() {\n\tconst [formContext, setFormContext] = useStore(store => store)\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst otherFields = (prevContext || []).filter(otherField => otherField.id !== field.id)\n\n\t\t\treturn [...otherFields, field]\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFormContext?.(prevContext => (prevContext || []).filter(field => field.id !== fieldID))\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst field = prevContext.find(({ id }) => id === fieldID)\n\n\t\t\tif (!field) throw new Error(`Field with id \"${fieldID}\" not found in form context.`)\n\n\t\t\tconst otherFields = prevContext.filter(({ id }) => id !== fieldID)\n\n\t\t\tconst updatedField = { ...field, ...updates } as Field\n\n\t\t\treturn [...otherFields, updatedField]\n\t\t})\n\t}, [])\n\n\treturn [formContext, { registerField, removeField, updateField }] as const\n}\n","// * Types\nimport { defineField, Field, isStringField, StringField, useFormContext } from './use-form-context'\n\nexport type FieldsetContextValue = {\n\tfieldList: Field[]\n\tdecorative: boolean\n\tid: string\n\tjoin?: string\n\tname: string\n}\n\nexport type FieldsetContext = [\n\tFieldsetContextValue | undefined,\n\t{\n\t\tregisterField: (field: Field) => void\n\t\tremoveField: (fieldID: string) => void\n\t\tupdateField: (fieldID: string, updates: Partial<Field>) => void\n\t},\n]\n\n// * React\nimport { ReactNode, useCallback, useEffect } from 'react'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\nconst { Provider, useStore } = createFastContext<FieldsetContextValue | undefined>(undefined)\n\nexport function FieldsetContextProvider({\n\tchildren,\n\tinitialValue,\n}: {\n\tchildren?: ReactNode\n\tinitialValue?: FieldsetContextValue\n}) {\n\treturn <Provider initialValue={initialValue}>{children}</Provider>\n}\n\nexport function useFieldsetContext(): FieldsetContext {\n\tconst [fieldsetContext, setFieldsetContext] = useStore(store => store),\n\t\t[, formContextFunctions] = useFormContext()\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\tconst existingFieldIndex = prev.fieldList.findIndex(existingField => existingField.id === field.id)\n\n\t\t\tconst newFieldList =\n\t\t\t\texistingFieldIndex >= 0\n\t\t\t\t\t? prev.fieldList.map((existingField, index) => (index === existingFieldIndex ? field : existingField))\n\t\t\t\t\t: [...prev.fieldList, field]\n\n\t\t\treturn { ...prev, fieldList: newFieldList }\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.filter(field => field.id !== fieldID),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.map(field => (field.id === fieldID ? ({ ...field, ...updates } as Field) : field)),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst createFormContextEntry = useCallback((fieldsetEntry: FieldsetContextValue): Field => {\n\t\tif (fieldsetEntry.join) {\n\t\t\tconst joinedValue = fieldsetEntry.fieldList\n\t\t\t\t.filter(field => isStringField(field) && (field as StringField).value !== '')\n\t\t\t\t.map(field => (field as StringField).value)\n\t\t\t\t.join(fieldsetEntry.join)\n\n\t\t\treturn defineField({\n\t\t\t\ttype: 'string',\n\t\t\t\tid: fieldsetEntry.id,\n\t\t\t\tname: fieldsetEntry.name,\n\t\t\t\tvalue: joinedValue,\n\t\t\t\trequired: fieldsetEntry.fieldList.some(field => (field as StringField).required),\n\t\t\t\tinvalid: fieldsetEntry.fieldList.some(field => (field as StringField).invalid),\n\t\t\t})\n\t\t}\n\n\t\treturn defineField({\n\t\t\ttype: 'object',\n\t\t\tid: fieldsetEntry.id,\n\t\t\tname: fieldsetEntry.name,\n\t\t\tfields: fieldsetEntry.fieldList,\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!fieldsetContext || fieldsetContext.decorative) return\n\n\t\tconst formContextEntry = createFormContextEntry(fieldsetContext)\n\n\t\tformContextFunctions.registerField(formContextEntry)\n\n\t\treturn () => {\n\t\t\tformContextFunctions.removeField(fieldsetContext.id)\n\t\t}\n\t}, [fieldsetContext, formContextFunctions.registerField, formContextFunctions.removeField, createFormContextEntry])\n\n\treturn [fieldsetContext, { registerField, removeField, updateField }]\n}\n","// * Types\nimport { ReactNode, Suspense } from 'react'\n\nexport type FormStatus = 'error' | 'incomplete' | 'loading' | 'ready' | 'success' | 'readonly'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\nconst DEFAULT_STATUS: FormStatus = 'incomplete'\n\nconst { Provider, useStore } = createFastContext<FormStatus>(DEFAULT_STATUS)\n\nexport function FormStatusProvider({\n\tchildren,\n\tinitialStatus = DEFAULT_STATUS,\n}: {\n\tchildren?: ReactNode\n\tinitialStatus?: FormStatus\n}) {\n\treturn (\n\t\t<Suspense>\n\t\t\t<Provider initialValue={initialStatus}>{children}</Provider>\n\t\t</Suspense>\n\t)\n}\n\nexport function useFormStatus() {\n\treturn useStore(store => store)\n}\n"],"names":["_jsx","Provider","useStore"],"mappings":";;;AAGM,SAAU,iBAAiB,CAAQ,mBAA0B,EAAA;IAClE,SAAS,YAAY,CAAC,YAAA,GAAsB,mBAAmB,EAAA;QAK9D,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,EACjC,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,EACzB,WAAW,GAAG,MAAM,CAAC,IAAI,GAAG,EAAc,CAAC;AAE5C,QAAA,MAAM,GAAG,GAAG,CAAC,KAA4C,KAAI;AAC5D,YAAA,IAAI,OAAO,KAAK,K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,sBAAsB,CAAC,eAAe,CAAC;AAEhE,QAAA,oBAAoB,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAEpD,QAAA,OAAO,MAAK;AACX,YAAA,oBAAoB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;AACrD,QAAA,CAAC;AACF,IAAA,CAAC,EAAE,CAAC,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,oBAAoB,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;IAEnH,OAAO,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACtE;;AC7GA,MAAM,cAAc,GAAe,YAAY;AAE/C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAa,cAAc,CAAC;AAEtE,SAAU,kBAAkB,CAAC,EAClC,QAAQ,EACR,aAAa,GAAG,cAAc,GAI9B,EAAA;AACA,IAAA,QACCF,GAAA,CAAC,QAAQ,EAAA,EAAA,QAAA,EACRA,IAAC,QAAQ,EAAA,EAAC,YAAY,EAAE,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAY,EAAA,CAClD;AAEb;SAEgB,aAAa,GAAA;IAC5B,OAAO,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC;AAChC;;;;"}
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../src/hooks/create-fast-context.tsx","../src/hooks/use-form-context.tsx","../src/hooks/use-fieldset-context.tsx","../src/hooks/use-form-status.tsx"],"sourcesContent":["// * React\nimport { HTMLAttributes, useRef, createContext, useContext, useSyncExternalStore } from 'react'\n\nexport default function createFastContext<Store>(defaultInitialState: Store) {\n\tfunction useStoreData(initialState: Store = defaultInitialState): {\n\t\tget: () => Store\n\t\tset: (value: Store | ((prevState: Store) => Store)) => void\n\t\tsubscribe: (callback: () => void) => () => void\n\t} {\n\t\tconst store = useRef(initialState),\n\t\t\tget = () => store.current,\n\t\t\tsubscribers = useRef(new Set<() => void>())\n\n\t\tconst set = (value: Store | ((prevState: Store) => Store)) => {\n\t\t\tif (typeof value === 'function') {\n\t\t\t\tstore.current = (value as (prevState: Store) => Store)(store.current)\n\t\t\t} else {\n\t\t\t\tstore.current = value\n\t\t\t}\n\t\t\tsubscribers.current.forEach(callback => callback())\n\t\t}\n\n\t\tconst subscribe = (callback: () => void) => {\n\t\t\tsubscribers.current.add(callback)\n\t\t\treturn () => subscribers.current.delete(callback)\n\t\t}\n\n\t\treturn {\n\t\t\tget,\n\t\t\tset,\n\t\t\tsubscribe,\n\t\t}\n\t}\n\n\ttype UseStoreDataReturnType = ReturnType<typeof useStoreData>\n\n\tconst StoreContext = createContext<UseStoreDataReturnType | null>(null)\n\n\tfunction Provider({\n\t\tinitialValue = defaultInitialState,\n\t\t...props\n\t}: Pick<HTMLAttributes<HTMLElement>, 'children'> & { initialValue?: Store }) {\n\t\treturn <StoreContext.Provider value={useStoreData(initialValue)} {...props} />\n\t}\n\n\tfunction useStore<SelectorOutput>(\n\t\tselector: (store: Store) => SelectorOutput,\n\t\tinitialValue?: Store,\n\t): [SelectorOutput | undefined, ((value: Store | ((prevState: Store) => Store)) => void) | undefined] {\n\t\tconst store = useContext(StoreContext)\n\n\t\tif (!store) {\n\t\t\tconst localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState\n\n\t\t\tconst selectedValue = selector(localStoreValue)\n\t\t\tconst noOpSet = () => console.warn('Attempting to set store value outside of Provider')\n\n\t\t\treturn [selectedValue, noOpSet]\n\t\t}\n\n\t\tconst state = useSyncExternalStore(\n\t\t\tstore.subscribe,\n\t\t\t() => selector(store.get()),\n\t\t\t() => selector(initialValue !== undefined ? initialValue : defaultInitialState),\n\t\t)\n\n\t\treturn [state, store.set]\n\t}\n\n\treturn {\n\t\tProvider,\n\t\tuseStore,\n\t}\n}\n","// * Types\nexport type FieldType = 'array' | 'email' | 'file' | 'number' | 'object' | 'string' | 'tel' | 'textarea' | 'url'\n\nexport type StringField = {\n\ttype: 'email' | 'file' | 'number' | 'string' | 'tel' | 'textarea' | 'url'\n\tvalue: string\n\trequired?: boolean\n\tinvalid?: boolean\n}\n\nexport type ObjectField = { type: 'object'; fields: Field[] }\n\nexport type ArrayField = { type: 'array'; of: ArrayObjectOrNormalField }\n\ntype ArrayObjectOrNormalField = StringField | ArrayField | ObjectField\n\nexport type Field = ArrayObjectOrNormalField & {\n\tid: string\n\tname: string\n}\n\nexport type FormContext = Field[]\n\n// * React\nimport { ReactNode, useCallback } from 'react'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\n/**\n * # Define Field\n *\n * This is a helper function to define a field in a form context with type safety.\n */\nexport function defineField(fieldDefinition: Field) {\n\treturn fieldDefinition\n}\n\nexport function isStringField(field: Field) {\n\treturn Boolean(field.type !== 'object' && field.type !== 'array')\n}\n\nconst { Provider, useStore } = createFastContext<FormContext>([])\n\nexport function FormContextProvider({ children }: { children?: ReactNode }) {\n\treturn <Provider>{children}</Provider>\n}\n\nexport function useFormContext() {\n\tconst [formContext, setFormContext] = useStore(store => store)\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst otherFields = (prevContext || []).filter(otherField => otherField.id !== field.id)\n\n\t\t\treturn [...otherFields, field]\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFormContext?.(prevContext => (prevContext || []).filter(field => field.id !== fieldID))\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst field = prevContext.find(({ id }) => id === fieldID)\n\n\t\t\tif (!field) throw new Error(`Field with id \"${fieldID}\" not found in form context.`)\n\n\t\t\tconst otherFields = prevContext.filter(({ id }) => id !== fieldID)\n\n\t\t\tconst updatedField = { ...field, ...updates } as Field\n\n\t\t\treturn [...otherFields, updatedField]\n\t\t})\n\t}, [])\n\n\treturn [formContext, { registerField, removeField, updateField }] as const\n}\n","// * Types\nimport { defineField, Field, isStringField, StringField, useFormContext } from './use-form-context'\n\nexport type FieldsetContextValue = {\n\tfieldList: Field[]\n\tdecorative: boolean\n\tid: string\n\tjoin?: string\n\tname: string\n}\n\nexport type FieldsetContext = [\n\tFieldsetContextValue | undefined,\n\t{\n\t\tregisterField: (field: Field) => void\n\t\tremoveField: (fieldID: string) => void\n\t\tupdateField: (fieldID: string, updates: Partial<Field>) => void\n\t},\n]\n\n// * React\nimport { ReactNode, useCallback, useEffect } from 'react'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\nconst { Provider, useStore } = createFastContext<FieldsetContextValue | undefined>(undefined)\n\nexport function FieldsetContextProvider({\n\tchildren,\n\tinitialValue,\n}: {\n\tchildren?: ReactNode\n\tinitialValue?: FieldsetContextValue\n}) {\n\treturn <Provider initialValue={initialValue}>{children}</Provider>\n}\n\nexport function useFieldsetContext(): FieldsetContext {\n\tconst [fieldsetContext, setFieldsetContext] = useStore(store => store),\n\t\t[, formContextFunctions] = useFormContext()\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\tconst existingFieldIndex = prev.fieldList.findIndex(existingField => existingField.id === field.id)\n\n\t\t\tconst newFieldList =\n\t\t\t\texistingFieldIndex >= 0\n\t\t\t\t\t? prev.fieldList.map((existingField, index) => (index === existingFieldIndex ? field : existingField))\n\t\t\t\t\t: [...prev.fieldList, field]\n\n\t\t\treturn { ...prev, fieldList: newFieldList }\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.filter(field => field.id !== fieldID),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.map(field => (field.id === fieldID ? ({ ...field, ...updates } as Field) : field)),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst createFormContextEntry = useCallback((fieldsetEntry: FieldsetContextValue): Field => {\n\t\tif (fieldsetEntry.join) {\n\t\t\tconst joinedValue = fieldsetEntry.fieldList\n\t\t\t\t.filter(field => isStringField(field) && (field as StringField).value !== '')\n\t\t\t\t.map(field => (field as StringField).value)\n\t\t\t\t.join(fieldsetEntry.join)\n\n\t\t\treturn defineField({\n\t\t\t\ttype: 'string',\n\t\t\t\tid: fieldsetEntry.id,\n\t\t\t\tname: fieldsetEntry.name,\n\t\t\t\tvalue: joinedValue,\n\t\t\t\trequired: fieldsetEntry.fieldList.some(field => (field as StringField).required),\n\t\t\t\tinvalid: fieldsetEntry.fieldList.some(field => (field as StringField).invalid),\n\t\t\t})\n\t\t}\n\n\t\treturn defineField({\n\t\t\ttype: 'object',\n\t\t\tid: fieldsetEntry.id,\n\t\t\tname: fieldsetEntry.name,\n\t\t\tfields: fieldsetEntry.fieldList,\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!fieldsetContext || fieldsetContext.decorative) return\n\n\t\tconst formContextEntry = createFormContextEntry(fieldsetContext)\n\n\t\tformContextFunctions.registerField(formContextEntry)\n\n\t\treturn () => {\n\t\t\tformContextFunctions.removeField(fieldsetContext.id)\n\t\t}\n\t}, [fieldsetContext, formContextFunctions.registerField, formContextFunctions.removeField, createFormContextEntry])\n\n\treturn [fieldsetContext, { registerField, removeField, updateField }]\n}\n","// * Types\nimport { ReactNode, Suspense } from 'react'\n\nexport type FormStatus = 'error' | 'incomplete' | 'loading' | 'ready' | 'success' | 'readonly'\n\n// * Hooks\nimport createFastContext from './create-fast-context'\n\nconst DEFAULT_STATUS: FormStatus = 'incomplete'\n\nconst { Provider, useStore } = createFastContext<FormStatus>(DEFAULT_STATUS)\n\nexport function FormStatusProvider({\n\tchildren,\n\tinitialStatus = DEFAULT_STATUS,\n}: {\n\tchildren?: ReactNode\n\tinitialStatus?: FormStatus\n}) {\n\treturn (\n\t\t<Suspense>\n\t\t\t<Provider initialValue={initialStatus}>{children}</Provider>\n\t\t</Suspense>\n\t)\n}\n\nexport function useFormStatus() {\n\treturn useStore(store => store)\n}\n"],"names":["useRef","createContext","_jsx","useContext","useSyncExternalStore","Provider","useStore","useCallback","useEffect","Suspense"],"mappings":";;;;;AAGc,SAAU,iBAAiB,CAAQ,mBAA0B,EAAA;IAC1E,SAAS,YAAY,CAAC,YAAA,GAAsB,mBAAmB,EAAA;QAK9D,MAAM,KAAK,GAAGA,YAAM,CAAC,YAAY,CAAC,EACjC,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,EACzB,WAAW,GAAGA,YAAM,CAAC,IAAI,GAAG,EAAc,CAAC;AAE5C,QAAA,MAAM,GAAG,GAAG,CAAC,KAA4C,KAAI;AAC5D,YAAA,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;gBAChC,KAAK,CAAC,OAAO,GAAI,KAAqC,CAAC,KAAK,CAAC,OAAO,CAAC;YACtE;iBAAO;AACN,gBAAA,KAAK,CAAC,OAAO,GAAG,KAAK;YACtB;AACA,YAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC;AACpD,QAAA,CAAC;AAED,QAAA,MAAM,SAAS,GAAG,CAAC,QAAoB,KAAI;AAC1C,YAAA,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;YACjC,OAAO,MAAM,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;AAClD,QAAA,CAAC;QAED,OAAO;YACN,GAAG;YACH,GAAG;YACH,SAAS;SACT;IACF;AAIA,IAAA,MAAM,YAAY,GAAGC,mBAAa,CAAgC,IAAI,CAAC;IAEvE,SAAS,QAAQ,CAAC,EACjB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AAc,GAI9B,EAAA;AACA,IAAA,QACCN,cAAA,CAACO,cAAQ,EAAA,EAAA,QAAA,EACRP,eAAC,QAAQ,EAAA,EAAC,YAAY,EAAE,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAY,EAAA,CAClD;AAEb;SAEgB,aAAa,GAAA;IAC5B,OAAO,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC;AAChC;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"hooks.js","sources":["../src/hooks/create-fast-context.tsx","../src/hooks/use-form-context.tsx","../src/hooks/use-fieldset-context.tsx","../src/hooks/use-form-status.tsx"],"sourcesContent":["// * React\nimport { HTMLAttributes, useRef, createContext, useContext, useSyncExternalStore } from 'react'\n\nexport function createFastContext<Store>(defaultInitialState: Store) {\n\tfunction useStoreData(initialState: Store = defaultInitialState): {\n\t\tget: () => Store\n\t\tset: (value: Store | ((prevState: Store) => Store)) => void\n\t\tsubscribe: (callback: () => void) => () => void\n\t} {\n\t\tconst store = useRef(initialState),\n\t\t\tget = () => store.current,\n\t\t\tsubscribers = useRef(new Set<() => void>())\n\n\t\tconst set = (value: Store | ((prevState: Store) => Store)) => {\n\t\t\tif (typeof value === 'function') {\n\t\t\t\tstore.current = (value as (prevState: Store) => Store)(store.current)\n\t\t\t} else {\n\t\t\t\tstore.current = value\n\t\t\t}\n\t\t\tsubscribers.current.forEach(callback => callback())\n\t\t}\n\n\t\tconst subscribe = (callback: () => void) => {\n\t\t\tsubscribers.current.add(callback)\n\t\t\treturn () => subscribers.current.delete(callback)\n\t\t}\n\n\t\treturn {\n\t\t\tget,\n\t\t\tset,\n\t\t\tsubscribe,\n\t\t}\n\t}\n\n\ttype UseStoreDataReturnType = ReturnType<typeof useStoreData>\n\n\tconst StoreContext = createContext<UseStoreDataReturnType | null>(null)\n\n\tfunction Provider({\n\t\tinitialValue = defaultInitialState,\n\t\t...props\n\t}: Pick<HTMLAttributes<HTMLElement>, 'children'> & { initialValue?: Store }) {\n\t\treturn <StoreContext.Provider value={useStoreData(initialValue)} {...props} />\n\t}\n\n\tfunction useStore<SelectorOutput>(\n\t\tselector: (store: Store) => SelectorOutput,\n\t\tinitialValue?: Store,\n\t): [SelectorOutput | undefined, ((value: Store | ((prevState: Store) => Store)) => void) | undefined] {\n\t\tconst store = useContext(StoreContext)\n\n\t\tif (!store) {\n\t\t\tconst localStoreValue = initialValue !== undefined ? initialValue : defaultInitialState\n\n\t\t\tconst selectedValue = selector(localStoreValue)\n\t\t\tconst noOpSet = () => console.warn('Attempting to set store value outside of Provider')\n\n\t\t\treturn [selectedValue, noOpSet]\n\t\t}\n\n\t\tconst state = useSyncExternalStore(\n\t\t\tstore.subscribe,\n\t\t\t() => selector(store.get()),\n\t\t\t() => selector(initialValue !== undefined ? initialValue : defaultInitialState),\n\t\t)\n\n\t\treturn [state, store.set]\n\t}\n\n\treturn {\n\t\tProvider,\n\t\tuseStore,\n\t}\n}\n","// * Types\nexport type FieldType = 'array' | 'email' | 'file' | 'number' | 'object' | 'string' | 'tel' | 'textarea' | 'url'\n\nexport type StringField = {\n\ttype: 'email' | 'file' | 'number' | 'string' | 'tel' | 'textarea' | 'url'\n\tvalue: string\n\trequired?: boolean\n\tinvalid?: boolean\n}\n\nexport type ObjectField = { type: 'object'; fields: Field[] }\n\nexport type ArrayField = { type: 'array'; of: ArrayObjectOrNormalField }\n\ntype ArrayObjectOrNormalField = StringField | ArrayField | ObjectField\n\nexport type Field = ArrayObjectOrNormalField & {\n\tid: string\n\tname: string\n}\n\nexport type FormContext = Field[]\n\n// * React\nimport { ReactNode, useCallback } from 'react'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\n/**\n * # Define Field\n *\n * This is a helper function to define a field in a form context with type safety.\n */\nexport function defineField(fieldDefinition: Field) {\n\treturn fieldDefinition\n}\n\nexport function isStringField(field: Field) {\n\treturn Boolean(field.type !== 'object' && field.type !== 'array')\n}\n\nconst { Provider, useStore } = createFastContext<FormContext>([])\n\nexport function FormContextProvider({ children }: { children?: ReactNode }) {\n\treturn <Provider>{children}</Provider>\n}\n\nexport function useFormContext() {\n\tconst [formContext, setFormContext] = useStore(store => store)\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst otherFields = (prevContext || []).filter(otherField => otherField.id !== field.id)\n\n\t\t\treturn [...otherFields, field]\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFormContext?.(prevContext => (prevContext || []).filter(field => field.id !== fieldID))\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFormContext?.(prevContext => {\n\t\t\tconst field = prevContext.find(({ id }) => id === fieldID)\n\n\t\t\tif (!field) throw new Error(`Field with id \"${fieldID}\" not found in form context.`)\n\n\t\t\tconst otherFields = prevContext.filter(({ id }) => id !== fieldID)\n\n\t\t\tconst updatedField = { ...field, ...updates } as Field\n\n\t\t\treturn [...otherFields, updatedField]\n\t\t})\n\t}, [])\n\n\treturn [formContext, { registerField, removeField, updateField }] as const\n}\n","// * Types\nimport { defineField, Field, isStringField, StringField, useFormContext } from './use-form-context'\n\nexport type FieldsetContextValue = {\n\tfieldList: Field[]\n\tdecorative: boolean\n\tid: string\n\tjoin?: string\n\tname: string\n}\n\nexport type FieldsetContext = [\n\tFieldsetContextValue | undefined,\n\t{\n\t\tregisterField: (field: Field) => void\n\t\tremoveField: (fieldID: string) => void\n\t\tupdateField: (fieldID: string, updates: Partial<Field>) => void\n\t},\n]\n\n// * React\nimport { ReactNode, useCallback, useEffect } from 'react'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\nconst { Provider, useStore } = createFastContext<FieldsetContextValue | undefined>(undefined)\n\nexport function FieldsetContextProvider({\n\tchildren,\n\tinitialValue,\n}: {\n\tchildren?: ReactNode\n\tinitialValue?: FieldsetContextValue\n}) {\n\treturn <Provider initialValue={initialValue}>{children}</Provider>\n}\n\nexport function useFieldsetContext(): FieldsetContext {\n\tconst [fieldsetContext, setFieldsetContext] = useStore(store => store),\n\t\t[, formContextFunctions] = useFormContext()\n\n\tconst registerField = useCallback((field: Field) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\tconst existingFieldIndex = prev.fieldList.findIndex(existingField => existingField.id === field.id)\n\n\t\t\tconst newFieldList =\n\t\t\t\texistingFieldIndex >= 0\n\t\t\t\t\t? prev.fieldList.map((existingField, index) => (index === existingFieldIndex ? field : existingField))\n\t\t\t\t\t: [...prev.fieldList, field]\n\n\t\t\treturn { ...prev, fieldList: newFieldList }\n\t\t})\n\t}, [])\n\n\tconst removeField = useCallback((fieldID: string) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.filter(field => field.id !== fieldID),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst updateField = useCallback((fieldID: string, updates: Partial<Field>) => {\n\t\tsetFieldsetContext?.(prev => {\n\t\t\tif (!prev) return prev\n\n\t\t\treturn {\n\t\t\t\t...prev,\n\t\t\t\tfieldList: prev.fieldList.map(field => (field.id === fieldID ? ({ ...field, ...updates } as Field) : field)),\n\t\t\t}\n\t\t})\n\t}, [])\n\n\tconst createFormContextEntry = useCallback((fieldsetEntry: FieldsetContextValue): Field => {\n\t\tif (fieldsetEntry.join) {\n\t\t\tconst joinedValue = fieldsetEntry.fieldList\n\t\t\t\t.filter(field => isStringField(field) && (field as StringField).value !== '')\n\t\t\t\t.map(field => (field as StringField).value)\n\t\t\t\t.join(fieldsetEntry.join)\n\n\t\t\treturn defineField({\n\t\t\t\ttype: 'string',\n\t\t\t\tid: fieldsetEntry.id,\n\t\t\t\tname: fieldsetEntry.name,\n\t\t\t\tvalue: joinedValue,\n\t\t\t\trequired: fieldsetEntry.fieldList.some(field => (field as StringField).required),\n\t\t\t\tinvalid: fieldsetEntry.fieldList.some(field => (field as StringField).invalid),\n\t\t\t})\n\t\t}\n\n\t\treturn defineField({\n\t\t\ttype: 'object',\n\t\t\tid: fieldsetEntry.id,\n\t\t\tname: fieldsetEntry.name,\n\t\t\tfields: fieldsetEntry.fieldList,\n\t\t})\n\t}, [])\n\n\tuseEffect(() => {\n\t\tif (!fieldsetContext || fieldsetContext.decorative) return\n\n\t\tconst formContextEntry = createFormContextEntry(fieldsetContext)\n\n\t\tformContextFunctions.registerField(formContextEntry)\n\n\t\treturn () => {\n\t\t\tformContextFunctions.removeField(fieldsetContext.id)\n\t\t}\n\t}, [fieldsetContext, formContextFunctions.registerField, formContextFunctions.removeField, createFormContextEntry])\n\n\treturn [fieldsetContext, { registerField, removeField, updateField }]\n}\n","// * Types\nimport { ReactNode, Suspense } from 'react'\n\nexport type FormStatus = 'error' | 'incomplete' | 'loading' | 'ready' | 'success' | 'readonly'\n\n// * Hooks\nimport { createFastContext } from './create-fast-context'\n\nconst DEFAULT_STATUS: FormStatus = 'incomplete'\n\nconst { Provider, useStore } = createFastContext<FormStatus>(DEFAULT_STATUS)\n\nexport function FormStatusProvider({\n\tchildren,\n\tinitialStatus = DEFAULT_STATUS,\n}: {\n\tchildren?: ReactNode\n\tinitialStatus?: FormStatus\n}) {\n\treturn (\n\t\t<Suspense>\n\t\t\t<Provider initialValue={initialStatus}>{children}</Provider>\n\t\t</Suspense>\n\t)\n}\n\nexport function useFormStatus() {\n\treturn useStore(store => store)\n}\n"],"names":["useRef","createContext","_jsx","useContext","useSyncExternalStore","Provider","useStore","useCallback","useEffect","Suspense"],"mappings":";;;;;AAGM,SAAU,iBAAiB,CAAQ,mBAA0B,EAAA;IAClE,SAAS,YAAY,CAAC,YAAA,GAAsB,mBAAmB,EAAA;QAK9D,MAAM,KAAK,GAAGA,YAAM,CAAC,YAAY,CAAC,EACjC,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,EACzB,WAAW,GAAGA,YAAM,CAAC,IAAI,GAAG,EAAc,CAAC;AAE5C,QAAA,MAAM,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ACd,QAAA,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,UAAU;YAAE;AAEpD,QAAA,MAAM,gBAAgB,GAAG,sBAAsB,CAAC,eAAe,CAAC;AAEhE,QAAA,oBAAoB,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAEpD,QAAA,OAAO,MAAK;AACX,YAAA,oBAAoB,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;AACrD,QAAA,CAAC;AACF,IAAA,CAAC,EAAE,CAAC,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,oBAAoB,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;IAEnH,OAAO,CAAC,eAAe,EAAE,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACtE;;AC7GA,MAAM,cAAc,GAAe,YAAY;AAE/C,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAAa,cAAc,CAAC;AAEtE,SAAU,kBAAkB,CAAC,EAClC,QAAQ,EACR,aAAa,GAAG,cAAc,GAI9B,EAAA;AACA,IAAA,QACCN,cAAA,CAACO,cAAQ,EAAA,EAAA,QAAA,EACRP,eAAC,QAAQ,EAAA,EAAC,YAAY,EAAE,aAAa,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAY,EAAA,CAClD;AAEb;SAEgB,aAAa,GAAA;IAC5B,OAAO,QAAQ,CAAC,KAAK,IAAI,KAAK,CAAC;AAChC;;;;;;;;;;;;"}
|
package/dist/icons/3-people.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ThreePeople(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ThreeRectanglesDesktopFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ThreeRectanglesDesktop(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/airplane.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Airplane(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ArrowTriangle2CirclepathCircleFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ArrowTriangle2CirclepathCircle(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/bag-fill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BagFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/banknote.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Banknote(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BellFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/bolt-car.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BoltCar(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BoltFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BoltRingClosed(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BoltTrianglebadgeExclamationmark(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BookFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BookmarkFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BriefcaseFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function BubbleLeftFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Building2Fill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/calendar.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Calendar(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CameraFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/car-fill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CarFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CartFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChartBarDocHorizontal(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CheckmarkSeal(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Checkmark(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SVGAttributes } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronCompactDown(props: Omit<SVGAttributes<SVGSVGElement>, 'viewBox' | 'children'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronDown(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronLeftForwardslashChevronRight(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronLeft(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronRight(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ChevronUpChevronDown(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CircleFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ClockBadgeCheckmark(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ClockFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CloudFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CubeFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function CurvePointLeft(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DialHigh(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/doc-fill.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DocFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DocOnClipboard(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DocOnDocFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DocOnDoc(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DocOnMagnifyingglass(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function DollarSign(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function EllipsisCircleFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function EllipsisCircle(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function EnvelopeFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/envelope.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Envelope(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function ExclamationmarkOctagon(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/eye.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Eye(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function FigureWaterFitness(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function FlagFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function FlameFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function FolderFill(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|
package/dist/icons/folder.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentPropsWithRef } from 'react';
|
|
2
|
-
export
|
|
2
|
+
export declare function Folder(props: Omit<ComponentPropsWithRef<'svg'>, 'viewBox'>): import("react/jsx-runtime").JSX.Element;
|