@@ -10,23 +10,30 @@ export type { ClassNames, ClassHash, ClassNamesProperty, ClassNamed } from "./de
1010export default classNaming
1111export { classNamesCheck } from "./check"
1212
13- /**
14- * Makes `className` string from imported CSS
15- * @example
16- * <div className={`${classNamingBasic({ClassName})}` } />
17- * <div {...classNamingBasic({ClassName}) } />
18- * const cn = classNamingBasic({C1})({C2}); <div {...cn({C3})({C4}) } />
19- */
2013interface ClassNamingCall <
2114 //TODO #8 `extends ReactRelated`
2215 Source extends CssModule
2316> {
2417/**
25- * @example
26- * classes(true) === props.className
27- * classes({class1: true, class2: false}) === "class1"
28- * classes(true, {class1: true, class2: false})
29- */
18+ * Makes `className` string
19+ * @example
20+ * // Using in Components
21+ * <div {...classNaming(...)} data-block={`${classNaming(...)}` } />
22+ * <Component {...{
23+ * ...classNaming(...)},
24+ * ...classnames
25+ * }/>
26+ *
27+ * // With destructed `classnames`
28+ * classNaming(className?, {App__Container, App__Item})} />
29+ *
30+ * // Toggler
31+ * classNaming(true?, {Btn_Float: true, Btn___disabled: false})
32+
33+ * // Pipe-able
34+ * const Cell = classNaming(className), Col1 = Cell({Column_1})
35+ * <div {...Col1({Row_1})} />
36+ */
3037 (
3138 arg0 ?: ClassNamingContext < Source > | true | string | ActionsMap < Source > ,
3239 arg1 ?: [ Extract < typeof arg0 , true | string > ] extends [ never ]
@@ -51,13 +58,28 @@ type ActionsMap<K extends CssModule> = {[k in keyof K]?: ClassHash|boolean}
5158// type ToggleMap<K extends ClassNamesMap> = {[k in keyof K]?: boolean}
5259
5360/**
54- *
61+ * Makes `className` string or settle context
5562 * @example
56- * const classes = classNaming(this.props)
57- * const classes = classNaming({classnames, className})
58- * const classes = classNaming({classnames})
59- */
63+ * // To set context
64+ * const classes = classNaming({classnames, className})
65+ *
66+ * // Using in Components
67+ * <div {...classNaming(...)} data-block={`${classNaming(...)}` } />
68+ * <Component {...{
69+ * ...classNaming(...)},
70+ * ...classnames
71+ * }/>
72+ *
73+ * // With destructed `classnames`
74+ * classNaming(className?, {App__Container, App__Item}) } />
75+ *
76+ * // Toggler
77+ * classNaming(true?, {Btn_Float: true, Btn___disabled: false})
6078
79+ * // Pipe-able
80+ * const Cell = classNaming(className), Col1 = Cell({Column_1})
81+ * <div {...Col1({Row_1}) } />
82+ */
6183function classNaming <
6284 //TODO #8 `extends ReactRelated`
6385 Source extends CssModule
0 commit comments