@newtonedev/components 0.1.3 → 0.1.5
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/dist/composites/actions/Button/Button.d.ts +37 -0
- package/dist/composites/actions/Button/Button.d.ts.map +1 -0
- package/dist/composites/actions/Button/Button.styles.d.ts +63 -0
- package/dist/composites/actions/Button/Button.styles.d.ts.map +1 -0
- package/dist/{Button → composites/actions/Button}/Button.types.d.ts +12 -3
- package/dist/composites/actions/Button/Button.types.d.ts.map +1 -0
- package/dist/composites/actions/Button/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.d.ts.map +1 -0
- package/dist/{Select → composites/form-controls/Select}/Select.styles.d.ts +1 -1
- package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/Select.types.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/SelectOption.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Select/useSelect.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/TextInput.d.ts.map +1 -0
- package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.styles.d.ts +1 -1
- package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/TextInput.types.d.ts.map +1 -0
- package/dist/composites/form-controls/TextInput/index.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/Toggle.d.ts.map +1 -0
- package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.styles.d.ts +1 -1
- package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/Toggle.types.d.ts.map +1 -0
- package/dist/composites/form-controls/Toggle/index.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/AppShell.d.ts.map +1 -0
- package/dist/{AppShell → composites/layout/AppShell}/AppShell.styles.d.ts +1 -1
- package/dist/composites/layout/AppShell/AppShell.styles.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/AppShell.types.d.ts.map +1 -0
- package/dist/composites/layout/AppShell/index.d.ts.map +1 -0
- package/dist/composites/layout/Card/Card.d.ts.map +1 -0
- package/dist/{Card → composites/layout/Card}/Card.styles.d.ts +1 -1
- package/dist/composites/layout/Card/Card.styles.d.ts.map +1 -0
- package/dist/{Card → composites/layout/Card}/Card.types.d.ts +1 -1
- package/dist/composites/layout/Card/Card.types.d.ts.map +1 -0
- package/dist/composites/layout/Card/index.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.d.ts.map +1 -0
- package/dist/{Navbar → composites/layout/Navbar}/Navbar.styles.d.ts +1 -1
- package/dist/composites/layout/Navbar/Navbar.styles.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/Navbar.types.d.ts.map +1 -0
- package/dist/composites/layout/Navbar/index.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.d.ts +1 -1
- package/dist/composites/layout/Sidebar/Sidebar.styles.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/Sidebar.types.d.ts.map +1 -0
- package/dist/composites/layout/Sidebar/index.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/Popover.d.ts.map +1 -0
- package/dist/{Popover → composites/overlays/Popover}/Popover.styles.d.ts +1 -1
- package/dist/composites/overlays/Popover/Popover.styles.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/Popover.types.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/index.d.ts.map +1 -0
- package/dist/composites/overlays/Popover/usePopover.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.d.ts.map +1 -0
- package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/ColorScaleSlider/index.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/HueSlider.d.ts.map +1 -0
- package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/HueSlider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/HueSlider/index.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/Slider.d.ts.map +1 -0
- package/dist/{Slider → composites/range-inputs/Slider}/Slider.styles.d.ts +1 -1
- package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/Slider.types.d.ts.map +1 -0
- package/dist/composites/range-inputs/Slider/index.d.ts.map +1 -0
- package/dist/index.cjs +999 -620
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +26 -26
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +955 -576
- package/dist/index.js.map +1 -1
- package/dist/primitives/Icon/Icon.d.ts.map +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts +1 -1
- package/dist/primitives/Wrapper/Wrapper.types.d.ts.map +1 -1
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/tokens/computeTokens.d.ts.map +1 -1
- package/dist/tokens/types.d.ts +10 -0
- package/dist/tokens/types.d.ts.map +1 -1
- package/dist/tokens/useTokens.d.ts +20 -2
- package/dist/tokens/useTokens.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/composites/actions/Button/Button.styles.ts +365 -0
- package/src/composites/actions/Button/Button.tsx +115 -0
- package/src/{Button → composites/actions/Button}/Button.types.ts +14 -3
- package/src/{Select → composites/form-controls/Select}/Select.styles.ts +1 -1
- package/src/{Select → composites/form-controls/Select}/Select.tsx +4 -4
- package/src/{Select → composites/form-controls/Select}/SelectOption.tsx +2 -2
- package/src/{TextInput → composites/form-controls/TextInput}/TextInput.styles.ts +1 -1
- package/src/{TextInput → composites/form-controls/TextInput}/TextInput.tsx +1 -1
- package/src/{Toggle → composites/form-controls/Toggle}/Toggle.styles.ts +1 -1
- package/src/{Toggle → composites/form-controls/Toggle}/Toggle.tsx +1 -1
- package/src/{AppShell → composites/layout/AppShell}/AppShell.styles.ts +1 -1
- package/src/{AppShell → composites/layout/AppShell}/AppShell.tsx +1 -1
- package/src/{Card → composites/layout/Card}/Card.styles.ts +1 -1
- package/src/{Card → composites/layout/Card}/Card.tsx +1 -1
- package/src/{Card → composites/layout/Card}/Card.types.ts +1 -1
- package/src/{Navbar → composites/layout/Navbar}/Navbar.styles.ts +1 -1
- package/src/{Navbar → composites/layout/Navbar}/Navbar.tsx +1 -1
- package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.styles.ts +1 -1
- package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.tsx +1 -1
- package/src/{Popover → composites/overlays/Popover}/Popover.styles.ts +1 -1
- package/src/{Popover → composites/overlays/Popover}/Popover.tsx +1 -1
- package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.styles.ts +1 -1
- package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.tsx +1 -1
- package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.styles.ts +1 -1
- package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.tsx +1 -1
- package/src/{Slider → composites/range-inputs/Slider}/Slider.styles.ts +1 -1
- package/src/{Slider → composites/range-inputs/Slider}/Slider.tsx +1 -1
- package/src/index.ts +27 -27
- package/src/primitives/Icon/Icon.tsx +16 -1
- package/src/primitives/Wrapper/Wrapper.types.ts +1 -1
- package/src/registry/registry.ts +213 -1
- package/src/tokens/computeTokens.ts +16 -0
- package/src/tokens/types.ts +10 -0
- package/src/tokens/useTokens.ts +25 -3
- package/dist/AppShell/AppShell.d.ts.map +0 -1
- package/dist/AppShell/AppShell.styles.d.ts.map +0 -1
- package/dist/AppShell/AppShell.types.d.ts.map +0 -1
- package/dist/AppShell/index.d.ts.map +0 -1
- package/dist/Button/Button.d.ts +0 -28
- package/dist/Button/Button.d.ts.map +0 -1
- package/dist/Button/Button.styles.d.ts +0 -46
- package/dist/Button/Button.styles.d.ts.map +0 -1
- package/dist/Button/Button.types.d.ts.map +0 -1
- package/dist/Button/index.d.ts.map +0 -1
- package/dist/Card/Card.d.ts.map +0 -1
- package/dist/Card/Card.styles.d.ts.map +0 -1
- package/dist/Card/Card.types.d.ts.map +0 -1
- package/dist/Card/index.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +0 -1
- package/dist/ColorScaleSlider/ColorScaleSlider.types.d.ts.map +0 -1
- package/dist/ColorScaleSlider/index.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.styles.d.ts.map +0 -1
- package/dist/HueSlider/HueSlider.types.d.ts.map +0 -1
- package/dist/HueSlider/index.d.ts.map +0 -1
- package/dist/Navbar/Navbar.d.ts.map +0 -1
- package/dist/Navbar/Navbar.styles.d.ts.map +0 -1
- package/dist/Navbar/Navbar.types.d.ts.map +0 -1
- package/dist/Navbar/index.d.ts.map +0 -1
- package/dist/Popover/Popover.d.ts.map +0 -1
- package/dist/Popover/Popover.styles.d.ts.map +0 -1
- package/dist/Popover/Popover.types.d.ts.map +0 -1
- package/dist/Popover/index.d.ts.map +0 -1
- package/dist/Popover/usePopover.d.ts.map +0 -1
- package/dist/Select/Select.d.ts.map +0 -1
- package/dist/Select/Select.styles.d.ts.map +0 -1
- package/dist/Select/Select.types.d.ts.map +0 -1
- package/dist/Select/SelectOption.d.ts.map +0 -1
- package/dist/Select/index.d.ts.map +0 -1
- package/dist/Select/useSelect.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.styles.d.ts.map +0 -1
- package/dist/Sidebar/Sidebar.types.d.ts.map +0 -1
- package/dist/Sidebar/index.d.ts.map +0 -1
- package/dist/Slider/Slider.d.ts.map +0 -1
- package/dist/Slider/Slider.styles.d.ts.map +0 -1
- package/dist/Slider/Slider.types.d.ts.map +0 -1
- package/dist/Slider/index.d.ts.map +0 -1
- package/dist/TextInput/TextInput.d.ts.map +0 -1
- package/dist/TextInput/TextInput.styles.d.ts.map +0 -1
- package/dist/TextInput/TextInput.types.d.ts.map +0 -1
- package/dist/TextInput/index.d.ts.map +0 -1
- package/dist/Toggle/Toggle.d.ts.map +0 -1
- package/dist/Toggle/Toggle.styles.d.ts.map +0 -1
- package/dist/Toggle/Toggle.types.d.ts.map +0 -1
- package/dist/Toggle/index.d.ts.map +0 -1
- package/src/Button/Button.styles.ts +0 -133
- package/src/Button/Button.tsx +0 -86
- /package/dist/{Button → composites/actions/Button}/index.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/Select.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/Select.types.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/SelectOption.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/index.d.ts +0 -0
- /package/dist/{Select → composites/form-controls/Select}/useSelect.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/TextInput.types.d.ts +0 -0
- /package/dist/{TextInput → composites/form-controls/TextInput}/index.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/Toggle.types.d.ts +0 -0
- /package/dist/{Toggle → composites/form-controls/Toggle}/index.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/AppShell.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/AppShell.types.d.ts +0 -0
- /package/dist/{AppShell → composites/layout/AppShell}/index.d.ts +0 -0
- /package/dist/{Card → composites/layout/Card}/Card.d.ts +0 -0
- /package/dist/{Card → composites/layout/Card}/index.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/Navbar.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/Navbar.types.d.ts +0 -0
- /package/dist/{Navbar → composites/layout/Navbar}/index.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/Sidebar.types.d.ts +0 -0
- /package/dist/{Sidebar → composites/layout/Sidebar}/index.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/Popover.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/Popover.types.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/index.d.ts +0 -0
- /package/dist/{Popover → composites/overlays/Popover}/usePopover.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.d.ts +0 -0
- /package/dist/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.d.ts +0 -0
- /package/dist/{HueSlider → composites/range-inputs/HueSlider}/index.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/Slider.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/Slider.types.d.ts +0 -0
- /package/dist/{Slider → composites/range-inputs/Slider}/index.d.ts +0 -0
- /package/src/{Button → composites/actions/Button}/index.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/Select.types.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/index.ts +0 -0
- /package/src/{Select → composites/form-controls/Select}/useSelect.ts +0 -0
- /package/src/{TextInput → composites/form-controls/TextInput}/TextInput.types.ts +0 -0
- /package/src/{TextInput → composites/form-controls/TextInput}/index.ts +0 -0
- /package/src/{Toggle → composites/form-controls/Toggle}/Toggle.types.ts +0 -0
- /package/src/{Toggle → composites/form-controls/Toggle}/index.ts +0 -0
- /package/src/{AppShell → composites/layout/AppShell}/AppShell.types.ts +0 -0
- /package/src/{AppShell → composites/layout/AppShell}/index.ts +0 -0
- /package/src/{Card → composites/layout/Card}/index.ts +0 -0
- /package/src/{Navbar → composites/layout/Navbar}/Navbar.types.ts +0 -0
- /package/src/{Navbar → composites/layout/Navbar}/index.ts +0 -0
- /package/src/{Sidebar → composites/layout/Sidebar}/Sidebar.types.ts +0 -0
- /package/src/{Sidebar → composites/layout/Sidebar}/index.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/Popover.types.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/index.ts +0 -0
- /package/src/{Popover → composites/overlays/Popover}/usePopover.ts +0 -0
- /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/ColorScaleSlider.types.ts +0 -0
- /package/src/{ColorScaleSlider → composites/range-inputs/ColorScaleSlider}/index.ts +0 -0
- /package/src/{HueSlider → composites/range-inputs/HueSlider}/HueSlider.types.ts +0 -0
- /package/src/{HueSlider → composites/range-inputs/HueSlider}/index.ts +0 -0
- /package/src/{Slider → composites/range-inputs/Slider}/Slider.types.ts +0 -0
- /package/src/{Slider → composites/range-inputs/Slider}/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,IAAQ,EACR,KAAK,EACL,SAAa,EACb,KAAK,EACL,OAAO,EAEP,kBAAkB,EAElB,MAAM,EACN,QAAQ,EACR,GAAG,GACJ,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/primitives/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,IAAQ,EACR,KAAK,EACL,SAAa,EACb,KAAK,EACL,OAAO,EAEP,kBAAkB,EAElB,MAAM,EACN,QAAQ,EACR,GAAG,GACJ,EAAE,SAAS,qBAqEX"}
|
|
@@ -41,7 +41,7 @@ export interface WrapperProps {
|
|
|
41
41
|
* Child elements. Must be React Native elements (View, Text, etc.).
|
|
42
42
|
* Unlike Frame, raw strings are NOT auto-wrapped in `<Text>`.
|
|
43
43
|
*/
|
|
44
|
-
readonly children
|
|
44
|
+
readonly children?: React.ReactNode;
|
|
45
45
|
/** Flex direction. @default 'vertical' */
|
|
46
46
|
readonly direction?: Direction;
|
|
47
47
|
/** Enable flex wrap. @default false */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wrapper.types.d.ts","sourceRoot":"","sources":["../../../src/primitives/Wrapper/Wrapper.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,aAAa,EACb,WAAW,EACX,OAAO,EACP,UAAU,EACX,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,WAAW,YAAY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,MAAM,CAAC;IAE3B,gCAAgC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B,gCAAgC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAI5B,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B,0CAA0C;IAC1C,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAI/B,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,SAAS,YAAY,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/registry/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,SAAS,YAAY,EAO7C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,SAAS,aAAa,EA8kB9C,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAElE;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEhE;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,aAAa,EAAE,CAEpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeTokens.d.ts","sourceRoot":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,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,GACA,cAAc,CA+NhB"}
|
package/dist/tokens/types.d.ts
CHANGED
|
@@ -9,6 +9,16 @@ export interface ResolvedTokens {
|
|
|
9
9
|
readonly backgroundElevated: ColorResult;
|
|
10
10
|
/** Background color for sunken surfaces (input fields, wells) */
|
|
11
11
|
readonly backgroundSunken: ColorResult;
|
|
12
|
+
/**
|
|
13
|
+
* Background color for interactive components with neutral backgrounds.
|
|
14
|
+
* Uses a fixed -0.035 NV (luminosity) offset from current background to ensure
|
|
15
|
+
* consistent visual contrast across all elevations (-2 to 2).
|
|
16
|
+
*
|
|
17
|
+
* Use for: Button (neutral primary), and future components with neutral filled backgrounds.
|
|
18
|
+
* Don't use for: Semantic variants (accent/success/error/warning), transparent backgrounds,
|
|
19
|
+
* or primitives (Frame/Wrapper/Text/Icon already handle elevation correctly).
|
|
20
|
+
*/
|
|
21
|
+
readonly backgroundInteractive: ColorResult;
|
|
12
22
|
/** Primary text color (high contrast for body text) */
|
|
13
23
|
readonly textPrimary: ColorResult;
|
|
14
24
|
/** Secondary text color (lower contrast for captions, labels) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tokens/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAC;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC;IACzC,iEAAiE;IACjE,QAAQ,CAAC,gBAAgB,EAAE,WAAW,CAAC;IACvC,uDAAuD;IACvD,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC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AAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;SACtB,CAAC;QACF,QAAQ,CAAC,UAAU,EAAE;YACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;SAC1B,CAAC;QACF,QAAQ,CAAC,MAAM,EAAE;YACf,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;YACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;YACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;YAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;SACvB,CAAC;KACH,CAAC;IACF,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;QACnD,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;QACzD,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;KAC/B,CAAC;CACH"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { ElevationLevel } from '../theme/types';
|
|
2
2
|
import type { ResolvedTokens } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Extended tokens result that includes the resolved elevation level.
|
|
5
|
+
* This allows components to make elevation-aware styling decisions.
|
|
6
|
+
*/
|
|
7
|
+
export interface UseTokensResult extends ResolvedTokens {
|
|
8
|
+
elevation: ElevationLevel;
|
|
9
|
+
}
|
|
3
10
|
/**
|
|
4
11
|
* Hook to compute design tokens for the current theme/mode/elevation.
|
|
5
12
|
*
|
|
@@ -12,7 +19,7 @@ import type { ResolvedTokens } from './types';
|
|
|
12
19
|
*
|
|
13
20
|
* @param elevation - Elevation level (0=sunken, 1=default, 2=elevated).
|
|
14
21
|
* When omitted, reads from FrameContext or defaults to 1.
|
|
15
|
-
* @returns Resolved design tokens with all necessary colors
|
|
22
|
+
* @returns Resolved design tokens with all necessary colors + resolved elevation
|
|
16
23
|
*
|
|
17
24
|
* @example
|
|
18
25
|
* ```tsx
|
|
@@ -24,6 +31,17 @@ import type { ResolvedTokens } from './types';
|
|
|
24
31
|
* );
|
|
25
32
|
* }
|
|
26
33
|
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* // Elevation-aware component:
|
|
38
|
+
* function ElevationAwareButton() {
|
|
39
|
+
* const tokens = useTokens();
|
|
40
|
+
* // Use tokens.elevation to make color decisions
|
|
41
|
+
* const bg = tokens.elevation === 2 ? tokens.background : tokens.backgroundSunken;
|
|
42
|
+
* return <View style={{ backgroundColor: srgbToHex(bg.srgb) }} />;
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
27
45
|
*/
|
|
28
|
-
export declare function useTokens(elevation?: ElevationLevel):
|
|
46
|
+
export declare function useTokens(elevation?: ElevationLevel): UseTokensResult;
|
|
29
47
|
//# sourceMappingURL=useTokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTokens.d.ts","sourceRoot":"","sources":["../../src/tokens/useTokens.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"useTokens.d.ts","sourceRoot":"","sources":["../../src/tokens/useTokens.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,SAAS,CAAC,SAAS,CAAC,EAAE,cAAc,GAAG,eAAe,CA2BrE"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { srgbToHex } from 'newtone';
|
|
2
|
+
import type { UseTokensResult } from '../../../tokens/useTokens';
|
|
3
|
+
import type { ButtonVariant, ButtonSemantic, ButtonSize } from './Button.types';
|
|
4
|
+
import type { TextSize } from '../../../primitives/Text/Text.types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration returned by getButtonConfig
|
|
8
|
+
*/
|
|
9
|
+
export interface ButtonConfig {
|
|
10
|
+
variantColors: {
|
|
11
|
+
bg: string;
|
|
12
|
+
pressedBg: string;
|
|
13
|
+
textColor: string;
|
|
14
|
+
iconColor: string;
|
|
15
|
+
borderWidth: number;
|
|
16
|
+
borderColor?: string;
|
|
17
|
+
};
|
|
18
|
+
sizeTokens: {
|
|
19
|
+
padding: number;
|
|
20
|
+
gap: number;
|
|
21
|
+
borderRadius: number;
|
|
22
|
+
textSize: TextSize;
|
|
23
|
+
iconSize: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Padding object for asymmetric horizontal padding
|
|
29
|
+
*/
|
|
30
|
+
export interface ButtonPadding {
|
|
31
|
+
paddingLeft: number;
|
|
32
|
+
paddingRight: number;
|
|
33
|
+
paddingTop: number;
|
|
34
|
+
paddingBottom: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Add opacity to a hex color string.
|
|
39
|
+
* @param hexColor - Hex color string (e.g., "#ff0000")
|
|
40
|
+
* @param opacity - Opacity value from 0 to 1
|
|
41
|
+
* @returns Hex color with alpha channel
|
|
42
|
+
*/
|
|
43
|
+
function withOpacity(hexColor: string, opacity: number): string {
|
|
44
|
+
const alpha = Math.round(opacity * 255).toString(16).padStart(2, '0');
|
|
45
|
+
return `${hexColor}${alpha}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Compute asymmetric button padding based on icon/text presence.
|
|
50
|
+
*
|
|
51
|
+
* Text appears visually closer to borders than icons, so we add 8px extra
|
|
52
|
+
* horizontal padding on the text side for optical balance.
|
|
53
|
+
*
|
|
54
|
+
* @param size - Button size (determines base padding)
|
|
55
|
+
* @param hasIcon - Whether button has an icon
|
|
56
|
+
* @param hasText - Whether button has text
|
|
57
|
+
* @param iconPosition - Icon position relative to text
|
|
58
|
+
* @returns Padding object with all four sides
|
|
59
|
+
*/
|
|
60
|
+
export function computeButtonPadding(
|
|
61
|
+
size: ButtonSize,
|
|
62
|
+
hasIcon: boolean,
|
|
63
|
+
hasText: boolean,
|
|
64
|
+
iconPosition: 'left' | 'right'
|
|
65
|
+
): ButtonPadding {
|
|
66
|
+
// Size-specific base padding
|
|
67
|
+
const basePadding: Record<ButtonSize, number> = {
|
|
68
|
+
sm: 8,
|
|
69
|
+
md: 12,
|
|
70
|
+
lg: 16,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const base = basePadding[size];
|
|
74
|
+
const textExtra = 8; // Optical correction for text vs icon
|
|
75
|
+
|
|
76
|
+
// Icon-only: square button
|
|
77
|
+
if (!hasText && hasIcon) {
|
|
78
|
+
return {
|
|
79
|
+
paddingLeft: base,
|
|
80
|
+
paddingRight: base,
|
|
81
|
+
paddingTop: base,
|
|
82
|
+
paddingBottom: base,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Text-only: extra padding on both sides
|
|
87
|
+
if (hasText && !hasIcon) {
|
|
88
|
+
return {
|
|
89
|
+
paddingLeft: base + textExtra,
|
|
90
|
+
paddingRight: base + textExtra,
|
|
91
|
+
paddingTop: base,
|
|
92
|
+
paddingBottom: base,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Icon + text: extra padding on text side only
|
|
97
|
+
if (hasText && hasIcon) {
|
|
98
|
+
if (iconPosition === 'left') {
|
|
99
|
+
return {
|
|
100
|
+
paddingLeft: base,
|
|
101
|
+
paddingRight: base + textExtra,
|
|
102
|
+
paddingTop: base,
|
|
103
|
+
paddingBottom: base,
|
|
104
|
+
};
|
|
105
|
+
} else {
|
|
106
|
+
return {
|
|
107
|
+
paddingLeft: base + textExtra,
|
|
108
|
+
paddingRight: base,
|
|
109
|
+
paddingTop: base,
|
|
110
|
+
paddingBottom: base,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Fallback: symmetric base padding
|
|
116
|
+
return {
|
|
117
|
+
paddingLeft: base,
|
|
118
|
+
paddingRight: base,
|
|
119
|
+
paddingTop: base,
|
|
120
|
+
paddingBottom: base,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Get elevation-aware background color for neutral primary button.
|
|
126
|
+
* Uses backgroundInteractive token for consistent contrast across all elevations.
|
|
127
|
+
*
|
|
128
|
+
* @param tokens - Resolved tokens for current elevation
|
|
129
|
+
* @returns Background color hex string
|
|
130
|
+
*/
|
|
131
|
+
function getNeutralPrimaryBg(tokens: UseTokensResult): string {
|
|
132
|
+
// Use the new backgroundInteractive token which maintains consistent
|
|
133
|
+
// contrast (-0.035 NV offset) across all elevations
|
|
134
|
+
return srgbToHex(tokens.backgroundInteractive.srgb);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Compute button configuration based on variant, semantic, size, and state.
|
|
139
|
+
*
|
|
140
|
+
* This function ONLY computes variant colors + size tokens.
|
|
141
|
+
* Layout concerns (flexbox, spacing, alignment) are handled by Wrapper primitive.
|
|
142
|
+
* Typography concerns (font, size, weight) are handled by Text primitive.
|
|
143
|
+
*
|
|
144
|
+
* Now elevation-aware: neutral primary uses backgroundInteractive for consistent contrast.
|
|
145
|
+
*
|
|
146
|
+
* @param variant - Button type (primary, secondary, tertiary)
|
|
147
|
+
* @param semantic - Button semantic meaning (neutral, accent, success, error, warning)
|
|
148
|
+
* @param size - Button size (sm, md, lg)
|
|
149
|
+
* @param disabled - Whether button is disabled
|
|
150
|
+
* @param tokens - Resolved tokens for current elevation
|
|
151
|
+
* @returns ButtonConfig with variantColors and sizeTokens
|
|
152
|
+
*/
|
|
153
|
+
export function getButtonConfig(
|
|
154
|
+
variant: ButtonVariant,
|
|
155
|
+
semantic: ButtonSemantic,
|
|
156
|
+
size: ButtonSize,
|
|
157
|
+
disabled: boolean,
|
|
158
|
+
tokens: UseTokensResult
|
|
159
|
+
): ButtonConfig {
|
|
160
|
+
// Get size configuration
|
|
161
|
+
const sizeConfig = getSizeConfig(size, tokens);
|
|
162
|
+
|
|
163
|
+
// Get variant-specific colors
|
|
164
|
+
const variantColors = getVariantColors(variant, semantic, disabled, tokens);
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
variantColors,
|
|
168
|
+
sizeTokens: {
|
|
169
|
+
padding: sizeConfig.padding,
|
|
170
|
+
gap: sizeConfig.gap,
|
|
171
|
+
borderRadius: sizeConfig.borderRadius,
|
|
172
|
+
textSize: sizeConfig.textSize,
|
|
173
|
+
iconSize: sizeConfig.iconSize,
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get size configuration with unified icon/text sizes across all sizes.
|
|
180
|
+
* Only padding and radius scale with size.
|
|
181
|
+
*/
|
|
182
|
+
function getSizeConfig(size: ButtonSize, tokens: UseTokensResult) {
|
|
183
|
+
const configs: Record<ButtonSize, {
|
|
184
|
+
padding: number;
|
|
185
|
+
gap: number;
|
|
186
|
+
borderRadius: number;
|
|
187
|
+
textSize: TextSize;
|
|
188
|
+
iconSize: number;
|
|
189
|
+
}> = {
|
|
190
|
+
sm: {
|
|
191
|
+
padding: 8,
|
|
192
|
+
gap: tokens.spacing['08'],
|
|
193
|
+
borderRadius: 8,
|
|
194
|
+
textSize: 'base', // 16px
|
|
195
|
+
iconSize: 24,
|
|
196
|
+
},
|
|
197
|
+
md: {
|
|
198
|
+
padding: 12,
|
|
199
|
+
gap: tokens.spacing['08'],
|
|
200
|
+
borderRadius: 12,
|
|
201
|
+
textSize: 'base', // 16px
|
|
202
|
+
iconSize: 24,
|
|
203
|
+
},
|
|
204
|
+
lg: {
|
|
205
|
+
padding: 16,
|
|
206
|
+
gap: tokens.spacing['08'],
|
|
207
|
+
borderRadius: 16,
|
|
208
|
+
textSize: 'base', // 16px
|
|
209
|
+
iconSize: 24,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
return configs[size];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Get variant-specific colors from theme tokens.
|
|
218
|
+
* Handles disabled state override for all variants.
|
|
219
|
+
*/
|
|
220
|
+
function getVariantColors(
|
|
221
|
+
variant: ButtonVariant,
|
|
222
|
+
semantic: ButtonSemantic,
|
|
223
|
+
disabled: boolean,
|
|
224
|
+
tokens: UseTokensResult
|
|
225
|
+
) {
|
|
226
|
+
// Disabled state overrides for all variants
|
|
227
|
+
if (disabled) {
|
|
228
|
+
const baseColors = getVariantColorsForState(variant, semantic, tokens);
|
|
229
|
+
return {
|
|
230
|
+
...baseColors,
|
|
231
|
+
bg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
232
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
233
|
+
textColor: srgbToHex(tokens.textSecondary.srgb),
|
|
234
|
+
iconColor: srgbToHex(tokens.textSecondary.srgb),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return getVariantColorsForState(variant, semantic, tokens);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Get variant colors for non-disabled state.
|
|
243
|
+
* Implements 3 types × 5 semantics = 15 combinations.
|
|
244
|
+
*/
|
|
245
|
+
function getVariantColorsForState(
|
|
246
|
+
variant: ButtonVariant,
|
|
247
|
+
semantic: ButtonSemantic,
|
|
248
|
+
tokens: UseTokensResult
|
|
249
|
+
) {
|
|
250
|
+
// Get semantic color
|
|
251
|
+
const getSemanticColor = (): string => {
|
|
252
|
+
switch (semantic) {
|
|
253
|
+
case 'accent':
|
|
254
|
+
return srgbToHex(tokens.interactive.srgb);
|
|
255
|
+
case 'success':
|
|
256
|
+
return srgbToHex(tokens.success.srgb);
|
|
257
|
+
case 'error':
|
|
258
|
+
return srgbToHex(tokens.error.srgb);
|
|
259
|
+
case 'warning':
|
|
260
|
+
return srgbToHex(tokens.warning.srgb);
|
|
261
|
+
default:
|
|
262
|
+
return srgbToHex(tokens.textPrimary.srgb);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// PRIMARY VARIANT: Filled background
|
|
267
|
+
if (variant === 'primary') {
|
|
268
|
+
if (semantic === 'neutral') {
|
|
269
|
+
// Neutral primary - uses backgroundInteractive for consistent contrast across elevations
|
|
270
|
+
const bg = getNeutralPrimaryBg(tokens);
|
|
271
|
+
return {
|
|
272
|
+
bg,
|
|
273
|
+
pressedBg: withOpacity(bg, 0.8), // Slightly darker on press
|
|
274
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
275
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
276
|
+
borderWidth: 1,
|
|
277
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (semantic === 'accent') {
|
|
282
|
+
// Accent primary = old primary (interactive bg, contrast text)
|
|
283
|
+
return {
|
|
284
|
+
bg: srgbToHex(tokens.interactive.srgb),
|
|
285
|
+
pressedBg: srgbToHex(tokens.interactiveActive.srgb),
|
|
286
|
+
textColor: srgbToHex(tokens.background.srgb), // Contrast inversion
|
|
287
|
+
iconColor: srgbToHex(tokens.background.srgb),
|
|
288
|
+
borderWidth: 1,
|
|
289
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Semantic primary (success, error, warning)
|
|
294
|
+
const semanticColor = getSemanticColor();
|
|
295
|
+
return {
|
|
296
|
+
bg: semanticColor,
|
|
297
|
+
pressedBg: withOpacity(semanticColor, 0.8), // Darken on press
|
|
298
|
+
textColor: srgbToHex(tokens.background.srgb), // Contrast text
|
|
299
|
+
iconColor: srgbToHex(tokens.background.srgb),
|
|
300
|
+
borderWidth: 1,
|
|
301
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// SECONDARY VARIANT: Outlined (border + subtle background for non-neutral)
|
|
306
|
+
if (variant === 'secondary') {
|
|
307
|
+
if (semantic === 'neutral') {
|
|
308
|
+
// Neutral secondary = old outline (transparent bg)
|
|
309
|
+
return {
|
|
310
|
+
bg: 'transparent',
|
|
311
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
312
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
313
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
314
|
+
borderWidth: 1,
|
|
315
|
+
borderColor: srgbToHex(tokens.border.srgb),
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Semantic secondary (accent, success, error, warning) - light bg, NO visible border
|
|
320
|
+
const semanticColor = getSemanticColor();
|
|
321
|
+
return {
|
|
322
|
+
bg: withOpacity(semanticColor, 0.1), // Light background tint
|
|
323
|
+
pressedBg: withOpacity(semanticColor, 0.15), // Slightly darker on press
|
|
324
|
+
textColor: semanticColor,
|
|
325
|
+
iconColor: semanticColor,
|
|
326
|
+
borderWidth: 1,
|
|
327
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// TERTIARY VARIANT: Ghost (text-only, no visible border)
|
|
332
|
+
if (variant === 'tertiary') {
|
|
333
|
+
if (semantic === 'neutral') {
|
|
334
|
+
// Neutral tertiary = old ghost
|
|
335
|
+
return {
|
|
336
|
+
bg: 'transparent',
|
|
337
|
+
pressedBg: srgbToHex(tokens.backgroundSunken.srgb),
|
|
338
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
339
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
340
|
+
borderWidth: 1,
|
|
341
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Semantic tertiary (accent, success, error, warning)
|
|
346
|
+
const semanticColor = getSemanticColor();
|
|
347
|
+
return {
|
|
348
|
+
bg: 'transparent',
|
|
349
|
+
pressedBg: withOpacity(semanticColor, 0.1), // Subtle background tint
|
|
350
|
+
textColor: semanticColor,
|
|
351
|
+
iconColor: semanticColor,
|
|
352
|
+
borderWidth: 1,
|
|
353
|
+
borderColor: 'transparent', // Invisible border for consistent sizing
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Fallback (should never reach here with proper types)
|
|
358
|
+
return {
|
|
359
|
+
bg: 'transparent',
|
|
360
|
+
pressedBg: 'transparent',
|
|
361
|
+
textColor: srgbToHex(tokens.textPrimary.srgb),
|
|
362
|
+
iconColor: srgbToHex(tokens.textPrimary.srgb),
|
|
363
|
+
borderWidth: 0,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable } from 'react-native';
|
|
3
|
+
import type { ButtonProps } from './Button.types';
|
|
4
|
+
import { getButtonConfig, computeButtonPadding } from './Button.styles';
|
|
5
|
+
import { useTokens } from '../../../tokens/useTokens';
|
|
6
|
+
import { Icon } from '../../../primitives/Icon/Icon';
|
|
7
|
+
import { Text } from '../../../primitives/Text/Text';
|
|
8
|
+
import { Wrapper } from '../../../primitives/Wrapper/Wrapper';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Button — A composite component demonstrating the primitive composition pattern.
|
|
12
|
+
*
|
|
13
|
+
* **Composition Architecture:**
|
|
14
|
+
* - Pressable (RN primitive) — handles interaction
|
|
15
|
+
* - Wrapper (primitive) — handles layout (direction, gap, padding, alignment)
|
|
16
|
+
* - Icon (primitive) — handles icon rendering with theme tokens
|
|
17
|
+
* - Text (primitive) — handles typography with theme tokens
|
|
18
|
+
*
|
|
19
|
+
* This component does NOT manually compute flexbox, spacing, or typography styles.
|
|
20
|
+
* Instead, it delegates to primitives which already handle these concerns.
|
|
21
|
+
*
|
|
22
|
+
* Automatically adapts to the current theme and mode from NewtoneProvider.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <Button variant="primary" semantic="accent" size="md" onPress={() => console.log('Pressed')}>
|
|
27
|
+
* Click me
|
|
28
|
+
* </Button>
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <Button icon="add" variant="primary" semantic="accent" onPress={handleAdd}>
|
|
34
|
+
* New Item
|
|
35
|
+
* </Button>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Button icon="delete" variant="tertiary" semantic="neutral" size="sm" onPress={handleDelete} />
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function Button({
|
|
44
|
+
children,
|
|
45
|
+
icon,
|
|
46
|
+
iconPosition = 'left',
|
|
47
|
+
variant = 'primary',
|
|
48
|
+
semantic = 'neutral',
|
|
49
|
+
size = 'md',
|
|
50
|
+
disabled = false,
|
|
51
|
+
style,
|
|
52
|
+
textStyle,
|
|
53
|
+
...pressableProps
|
|
54
|
+
}: ButtonProps) {
|
|
55
|
+
// Read tokens from current elevation context
|
|
56
|
+
// backgroundInteractive provides consistent contrast across all elevations
|
|
57
|
+
const tokens = useTokens();
|
|
58
|
+
|
|
59
|
+
// Get color tokens + size config (now using backgroundInteractive for consistent contrast)
|
|
60
|
+
const { variantColors, sizeTokens } = React.useMemo(
|
|
61
|
+
() => getButtonConfig(variant, semantic, size, disabled, tokens),
|
|
62
|
+
[variant, semantic, size, disabled, tokens]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// Compute asymmetric padding (+8px on text side for optical balance)
|
|
66
|
+
const padding = React.useMemo(
|
|
67
|
+
() => computeButtonPadding(size, !!icon, !!children, iconPosition),
|
|
68
|
+
[size, icon, children, iconPosition]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Pressable disabled={disabled} {...pressableProps}>
|
|
73
|
+
{({ pressed }) => (
|
|
74
|
+
// Wrapper handles layout: direction, gap, alignment (padding via style)
|
|
75
|
+
<Wrapper
|
|
76
|
+
direction="horizontal"
|
|
77
|
+
align="center"
|
|
78
|
+
justify="center"
|
|
79
|
+
gap={sizeTokens.gap}
|
|
80
|
+
style={[
|
|
81
|
+
{
|
|
82
|
+
...padding, // Asymmetric horizontal padding for text optical balance
|
|
83
|
+
backgroundColor: pressed && !disabled ? variantColors.pressedBg : variantColors.bg,
|
|
84
|
+
borderRadius: sizeTokens.borderRadius,
|
|
85
|
+
borderWidth: variantColors.borderWidth, // Always 1 for consistent sizing
|
|
86
|
+
borderColor: variantColors.borderColor || 'transparent',
|
|
87
|
+
opacity: disabled ? 0.4 : 1,
|
|
88
|
+
},
|
|
89
|
+
...(Array.isArray(style) ? style : style ? [style] : []),
|
|
90
|
+
]}
|
|
91
|
+
>
|
|
92
|
+
{icon && iconPosition === 'left' && (
|
|
93
|
+
<Icon name={icon} size={sizeTokens.iconSize} color={variantColors.iconColor} />
|
|
94
|
+
)}
|
|
95
|
+
{children && (
|
|
96
|
+
// Text primitive with semantic props + color style override
|
|
97
|
+
<Text
|
|
98
|
+
size={sizeTokens.textSize}
|
|
99
|
+
weight="semibold"
|
|
100
|
+
style={[
|
|
101
|
+
{ color: variantColors.textColor },
|
|
102
|
+
...(Array.isArray(textStyle) ? textStyle : textStyle ? [textStyle] : []),
|
|
103
|
+
]}
|
|
104
|
+
>
|
|
105
|
+
{children}
|
|
106
|
+
</Text>
|
|
107
|
+
)}
|
|
108
|
+
{icon && iconPosition === 'right' && (
|
|
109
|
+
<Icon name={icon} size={sizeTokens.iconSize} color={variantColors.iconColor} />
|
|
110
|
+
)}
|
|
111
|
+
</Wrapper>
|
|
112
|
+
)}
|
|
113
|
+
</Pressable>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Visual
|
|
4
|
+
* Visual type for the Button component (describes visual weight)
|
|
5
5
|
*/
|
|
6
|
-
export type ButtonVariant = 'primary' | 'secondary' | '
|
|
6
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Semantic meaning for the Button component (describes color purpose)
|
|
10
|
+
*/
|
|
11
|
+
export type ButtonSemantic = 'neutral' | 'accent' | 'success' | 'error' | 'warning';
|
|
7
12
|
|
|
8
13
|
/**
|
|
9
14
|
* Size presets for the Button component
|
|
@@ -38,11 +43,17 @@ export interface ButtonProps extends Omit<PressableProps, 'children' | 'style'>
|
|
|
38
43
|
readonly iconPosition?: ButtonIconPosition;
|
|
39
44
|
|
|
40
45
|
/**
|
|
41
|
-
* Visual
|
|
46
|
+
* Visual type (describes visual weight: filled, outlined, ghost)
|
|
42
47
|
* @default 'primary'
|
|
43
48
|
*/
|
|
44
49
|
readonly variant?: ButtonVariant;
|
|
45
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Semantic meaning (describes color purpose: neutral, accent, success, error, warning)
|
|
53
|
+
* @default 'neutral'
|
|
54
|
+
*/
|
|
55
|
+
readonly semantic?: ButtonSemantic;
|
|
56
|
+
|
|
46
57
|
/**
|
|
47
58
|
* Size preset
|
|
48
59
|
* @default 'md'
|
|
@@ -2,11 +2,11 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { View, Text, Pressable, ScrollView } from 'react-native';
|
|
3
3
|
import type { SelectProps, SelectOption } from './Select.types';
|
|
4
4
|
import { isOptionGroup } from './Select.types';
|
|
5
|
-
import { useTokens } from '
|
|
5
|
+
import { useTokens } from '../../../tokens/useTokens';
|
|
6
6
|
import { getSelectStyles } from './Select.styles';
|
|
7
|
-
import { Icon } from '
|
|
8
|
-
import { Popover } from '
|
|
9
|
-
import { usePopover } from '
|
|
7
|
+
import { Icon } from '../../../primitives/Icon/Icon';
|
|
8
|
+
import { Popover } from '../../overlays/Popover/Popover';
|
|
9
|
+
import { usePopover } from '../../overlays/Popover/usePopover';
|
|
10
10
|
import { useSelect } from './useSelect';
|
|
11
11
|
import { SelectOptionRow } from './SelectOption';
|
|
12
12
|
import { srgbToHex } from 'newtone';
|